fixed merge conflict

This commit is contained in:
Jake Goodwin 2023-01-14 13:43:34 -08:00
commit 1750a9b65d
4 changed files with 61 additions and 9 deletions

11
LICENSE Normal file
View File

@ -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.

View File

@ -1,14 +1,51 @@
# AVR ATMEGA328P USART # AVR_ATMEGA_USART
---
## Description: ## 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. 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: ## ISSUES:
It's required to set the fuses in the chip for 8Mhz, otherwise a baud rate 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. of 9600 will result in errors at a 7% rate.
Another is that I need to design a standard naming scheme.

View File

@ -7,7 +7,6 @@
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <avr/sleep.h> #include <avr/sleep.h>
#include <stdint.h>
#include <util/delay.h> #include <util/delay.h>
#include "avr_usart.h" #include "avr_usart.h"
@ -17,7 +16,7 @@
//############################# //#############################
int main() { int main() {
led_blink(); led_blink();
led_blink(); led_blink();
led_blink(); led_blink();
@ -44,6 +43,15 @@ int main() {
//data = rx_usart0(); //data = rx_usart0();
serial0_flush_rxbuf(); serial0_flush_rxbuf();
serial0_read_with_err_checking(data, 1); 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; return 0;

View File

@ -56,7 +56,3 @@ void serial0_flush_rxbuf(void);