Addded defines and logic for carriage returns and line feeds to be appending to serial0_wirte() function calls

This commit is contained in:
Jake Goodwin 2023-01-16 19:50:56 -08:00
parent 32586999d0
commit b2992459b3
2 changed files with 11 additions and 6 deletions

View File

@ -26,9 +26,6 @@ int main() {
//enable interrupts //enable interrupts
sei(); sei();
unsigned char linefeed = 0x0a;
unsigned char carrigereturn = 0x0d;
//unsigned char data[11] = "snd 11chars";
unsigned char data[8] = "AT+BAUD3"; unsigned char data[8] = "AT+BAUD3";
unsigned char data_cmd[2] = "AT"; unsigned char data_cmd[2] = "AT";
uint8_t data_len = 8; uint8_t data_len = 8;
@ -38,9 +35,6 @@ int main() {
led_blink(); led_blink();
serial0_write(data, data_len); serial0_write(data, data_len);
tx_usart0(carrigereturn);
tx_usart0(linefeed);
//_delay_ms(1000); //_delay_ms(1000);
_delay_ms(500); _delay_ms(500);
@ -148,6 +142,15 @@ void serial0_write(unsigned 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]);
} }
#if CARRIAGE_RETURN
tx_usart0(0x0d);
#endif
#if LINE_FEED
tx_usart0(0x0a);
#endif
} }
/* /*

View File

@ -44,6 +44,8 @@
#define CLOCK_POL 0 #define CLOCK_POL 0
#define PARITY_BITS 0 #define PARITY_BITS 0
#define PARITY_POS 0 #define PARITY_POS 0
#define CARRIAGE_RETURN 0
#define LINE_FEED 0