removed unsigned from the chars, for gcc-avr they are the same

This commit is contained in:
Jake Goodwin 2023-03-07 01:58:10 -08:00
parent a702c52327
commit 200dd58c44
1 changed files with 6 additions and 10 deletions

View File

@ -4,10 +4,6 @@
* Description: Small library to handle Serial communication on AVR micros * Description: Small library to handle Serial communication on AVR micros
*/ */
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <util/delay.h>
#include "avr_usart.h" #include "avr_usart.h"
@ -25,8 +21,8 @@ int demo() {
//enable interrupts //enable interrupts
sei(); sei();
unsigned char data[8] = "AT+BAUD3"; char data[8] = "AT+BAUD3";
unsigned char data_cmd[2] = "AT"; char data_cmd[2] = "AT";
uint8_t data_len = 8; uint8_t data_len = 8;
uint8_t data_cmd_len = 2; uint8_t data_cmd_len = 2;
@ -86,7 +82,7 @@ void init_usart0(void) {
* Output: None * Output: None
* Description: Sends a char over usart0 * Description: Sends a char over usart0
*/ */
void tx_usart0(unsigned char data) { void tx_usart0(char data) {
//first wait for the transmit buffer to be empty //first wait for the transmit buffer to be empty
while(!(UCSR0A & (1<<UDRE0))) { while(!(UCSR0A & (1<<UDRE0))) {
;//Equiv of continue ;//Equiv of continue
@ -103,7 +99,7 @@ void tx_usart0(unsigned char data) {
* Output: a 8bit char * Output: a 8bit char
* Description: Recvs a char over usart0 * Description: Recvs a char over usart0
*/ */
unsigned char rx_usart0(void) { char rx_usart0(void) {
//first wait for the data to be received. //first wait for the data to be received.
while( !(UCSR0A & (1<<RXC0)) ) { while( !(UCSR0A & (1<<RXC0)) ) {
;//Equiv of continue ;//Equiv of continue
@ -136,7 +132,7 @@ void serial0_enable_timeouts(uint8_t ms) {
* Output: None * Output: None
* Description: * Description:
*/ */
void serial0_write(unsigned char* buffer, uint8_t write_length) { void serial0_write(char* buffer, uint8_t write_length) {
for(uint8_t i = 0; i < write_length; i++) { for(uint8_t i = 0; i < write_length; i++) {
tx_usart0(buffer[i]); tx_usart0(buffer[i]);
} }
@ -199,7 +195,7 @@ void serial0_set_stop_bits(uint8_t number) {
* Output: None * Output: None
* Description: Reads the serial data into a buffer of x length. * Description: Reads the serial data into a buffer of x length.
*/ */
void serial0_read(unsigned char* buffer, uint8_t buf_length) { void serial0_read(char* buffer, uint8_t buf_length) {
//clear buffer out? //clear buffer out?
//buffer = 0; //buffer = 0;
for(uint8_t i = 0; i < buf_length; i++) { for(uint8_t i = 0; i < buf_length; i++) {