From 72bab6c6808bf77660c891e87d88f48c8c5b99e7 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sun, 3 Nov 2024 14:18:39 +0800 Subject: Rename functions in serial. --- door_lock/main.c | 4 ++-- door_lock/serial.c | 10 +++++----- 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 */ -- cgit v1.2.3