Addded defines and logic for carriage returns and line feeds to be appending to serial0_wirte() function calls
This commit is contained in:
parent
32586999d0
commit
b2992459b3
15
avr_usart.c
15
avr_usart.c
|
@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue