fixed merge conflict
This commit is contained in:
commit
1750a9b65d
|
@ -0,0 +1,11 @@
|
|||
Copyright (c) <year> <owner>.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
43
README.md
43
README.md
|
@ -1,14 +1,51 @@
|
|||
# AVR ATMEGA328P USART
|
||||
|
||||
# AVR_ATMEGA_USART
|
||||
---
|
||||
## Description:
|
||||
|
||||
This is a asynchronous serial program for the ATMEGA seris of mcu. The sotfware
|
||||
This is a asynchronous serial program for the ATMEGA seiries of mcu. The sotfware
|
||||
is tested and working.
|
||||
|
||||
Over time, I'm planning to add support for multiple AVR MCUs, however that
|
||||
may end up requiring more memory, so extensive of use of define macros will
|
||||
likely end up being the end result.
|
||||
|
||||
## Features:
|
||||
|
||||
- Multiple Baud Rates: 300, 600, 1200, 2400, 9600 ...
|
||||
- Asynchronous Receive and Transmit.
|
||||
- Optional Parity checking.
|
||||
- 7-8 data bits.
|
||||
- Hardware abstraction API
|
||||
- No Interrupt service routines required.
|
||||
- BSD-3 Licensing, aka you can use this for whatevery you want pretty much.
|
||||
|
||||
|
||||
|
||||
## Instructions
|
||||
|
||||
|
||||
### Example 1
|
||||
|
||||
```C
|
||||
#include "avr_usart.h"
|
||||
|
||||
void send_bt_cmd(char* cmd) {
|
||||
init_usart();
|
||||
unsigned char data[] = "AT+WAKE\0";
|
||||
uint8_t result = usart_send_str(data);
|
||||
|
||||
if(result) {
|
||||
raise_error();
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## ISSUES:
|
||||
|
||||
It's required to set the fuses in the chip for 8Mhz, otherwise a baud rate
|
||||
of 9600 will result in errors at a 7% rate.
|
||||
|
||||
Another is that I need to design a standard naming scheme.
|
||||
|
||||
|
|
10
avr_usart.c
10
avr_usart.c
|
@ -7,7 +7,6 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/sleep.h>
|
||||
#include <stdint.h>
|
||||
#include <util/delay.h>
|
||||
#include "avr_usart.h"
|
||||
|
||||
|
@ -44,6 +43,15 @@ int main() {
|
|||
//data = rx_usart0();
|
||||
serial0_flush_rxbuf();
|
||||
serial0_read_with_err_checking(data, 1);
|
||||
unsigned char data[] = "AT+WAKE";
|
||||
|
||||
while(1) {
|
||||
_delay_ms(1000);
|
||||
//led_blink();
|
||||
for(uint8_t i = 0; i < 7; i++) {
|
||||
tx_usart0(data[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -56,7 +56,3 @@ void serial0_flush_rxbuf(void);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue