diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2024-11-03 14:18:39 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2024-11-03 14:18:39 +0800 |
| commit | 72bab6c6808bf77660c891e87d88f48c8c5b99e7 (patch) | |
| tree | a00a8bdbac03bfa2e70acb124a7402e9dc3a2833 /door_lock | |
| parent | 0c1f7fef8447da32a94c7b6784edd9a6b3a12428 (diff) | |
| download | smart-home-72bab6c6808bf77660c891e87d88f48c8c5b99e7.tar.gz | |
Rename functions in serial.
Diffstat (limited to 'door_lock')
| -rw-r--r-- | door_lock/main.c | 4 | ||||
| -rw-r--r-- | door_lock/serial.c | 10 | ||||
| -rw-r--r-- | door_lock/serial.h | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/door_lock/main.c b/door_lock/main.c index 4ee0e64..178538c 100644 --- a/door_lock/main.c +++ b/door_lock/main.c @@ -15,13 +15,13 @@ int main(void) { serial_init(); for(;;) { - serial_write("hello, world!"); - OCR1A = 3999 + offset; _delay_ms(5000); OCR1A = 1999 - offset; _delay_ms(5000); + + serial_write_line("hello, world!"); } return 0; diff --git a/door_lock/serial.c b/door_lock/serial.c index 4dba0e5..8a6cde2 100644 --- a/door_lock/serial.c +++ b/door_lock/serial.c @@ -16,17 +16,17 @@ void serial_init(void) UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); } -static void serial_write_raw(unsigned char data) +static void serial_write(unsigned char data) { while (!(UCSR0A & (1 << UDRE0))) ; UDR0 = data; } -void serial_write(const char *s) +void serial_write_line(const char *s) { for (; *s; s++) - serial_write_raw(*s); - serial_write_raw('\r'); - serial_write_raw('\n'); + serial_write(*s); + serial_write('\r'); + serial_write('\n'); } diff --git a/door_lock/serial.h b/door_lock/serial.h index 8db8037..6128623 100644 --- a/door_lock/serial.h +++ b/door_lock/serial.h @@ -2,6 +2,6 @@ #define SA_SERIAL_H void serial_init(void); -void serial_write(const char *s); +void serial_write_line(const char *s); #endif /* SA_SERIAL_H */ |
