Style fixes and added some comments
This commit is contained in:
parent
f3676e9408
commit
04031523d4
@ -2,8 +2,8 @@
|
||||
#ifndef _HMI_MSG_H_
|
||||
#define _HMI_MSG_H_
|
||||
|
||||
#define PROG_VERSION "Version: %S built on: %S %S\n"
|
||||
#define LIBC_VERSION "avr-libc version: %S\n"
|
||||
#define PROG_VERSION "Version: %S built on: %S %S"
|
||||
#define LIBC_VERSION "avr-libc version: %S"
|
||||
#define STUD_NAME "Arti Zirk"
|
||||
#define GET_MONTH_MSG "Enter Month name first letter >"
|
||||
#define UPTIME_MSG "Uptime: %lu s"
|
||||
|
10
src/main.c
10
src/main.c
@ -52,9 +52,9 @@ static inline void init_hw (void)
|
||||
static inline void start_ui (void)
|
||||
{
|
||||
// Print program and libc versions
|
||||
fprintf_P(stderr, PSTR(PROG_VERSION),
|
||||
fprintf_P(stderr, PSTR(PROG_VERSION "\n"),
|
||||
PSTR(GIT_DESCR), PSTR(__DATE__), PSTR(__TIME__));
|
||||
fprintf_P(stderr, PSTR(LIBC_VERSION), PSTR(__AVR_LIBC_VERSION_STRING__));
|
||||
fprintf_P(stderr, PSTR(LIBC_VERSION "\n"), PSTR(__AVR_LIBC_VERSION_STRING__));
|
||||
|
||||
// print student name
|
||||
fprintf_P(stdout, PSTR(STUD_NAME));
|
||||
@ -89,11 +89,15 @@ static inline void search_month (void)
|
||||
}
|
||||
}
|
||||
|
||||
// this is fine because even when the hd44780 address counter goes over 0xf4
|
||||
// we still have quite a few addresses left until address counter overflow
|
||||
// and we also dont care about the data that is at the end of the ddram
|
||||
lcd_puts_P(PSTR(" ")); // Clear the end of the line
|
||||
fprintf_P(stdout, PSTR(GET_MONTH_MSG));
|
||||
}
|
||||
|
||||
static inline void heartbeat (void) {
|
||||
static inline void heartbeat (void)
|
||||
{
|
||||
static time_t time_prev;
|
||||
time_t time_cur = time(NULL);
|
||||
if (time_cur <= time_prev) {
|
||||
|
@ -17,6 +17,10 @@ int uart0_putc_wrap(char c, FILE *stream)
|
||||
int uart0_getc_wrap(FILE *stream)
|
||||
{
|
||||
(void) stream;
|
||||
// Probabbly should add some error checking in here but because
|
||||
// this function is only called out when there is at least one character
|
||||
// available in the input buffer (see main.c line 114) then error checking
|
||||
// is not currently necessary.
|
||||
return (char)uart0_getc();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef _UART_H_
|
||||
#define _UART_H_
|
||||
#ifndef _UART_WRAP_H_
|
||||
#define _UART_WRAP_H_
|
||||
|
||||
int uart0_putc_wrap(char c, FILE *stream);
|
||||
int uart0_getc_wrap(FILE *stream);
|
||||
@ -12,4 +12,4 @@ int uart3_putc_wrap(char c, FILE *stream);
|
||||
FILE uart0_io = FDEV_SETUP_STREAM(uart0_putc_wrap, uart0_getc_wrap, _FDEV_SETUP_RW);
|
||||
FILE uart3_out = FDEV_SETUP_STREAM(uart3_putc_wrap, NULL, _FDEV_SETUP_WRITE);
|
||||
|
||||
#endif /* _UART_H_ */
|
||||
#endif /* _UART_WRAP_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user