AVRly - AVR Development Resources
#include "digital_clock.h"
#include "hd44780_lcd.h"

Go to the source code of this file.

Macros

#define START_HOURS   21
 
#define START_MINS   59
 
#define START_SECS   02
 

Functions

void print_time (void)
 
int main ()
 

Variables

lcd_config_t lcd_config
 

Detailed Description

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
Jason Duffy
Date
2nd April 2022
See also

Definition in file main.c.

Macro Definition Documentation

◆ START_HOURS

#define START_HOURS   21

Definition at line 36 of file main.c.

◆ START_MINS

#define START_MINS   59

Definition at line 37 of file main.c.

◆ START_SECS

#define START_SECS   02

Definition at line 38 of file main.c.

Function Documentation

◆ print_time()

void print_time ( void  )

Definition at line 40 of file main.c.

41{
42 static char *time;
43 time = get_time();
44 lcd_set_cursor(0,0);
46 lcd_print_string(time);
48}
void lcd_print_string(const char *str)
Prints a string of characters to the display.
Definition: hd44780_lcd.c:205
void lcd_set_cursor(uint8_t column, uint8_t row)
Sets cursor location using x and y coordinates.
Definition: hd44780_lcd.c:247
char * get_time(void)
Getter function for time variables.

◆ main()

int main ( )

Definition at line 62 of file main.c.

63{
64 // Initialisation routines
65 init_lcd(&lcd_config);
66 set_time(START_HOURS, START_MINS, START_SECS);
68
69 while (1) // Loop forever
70 {
71 print_time();
72 }
73 return 0; // This line is never reached.
74}
void init_lcd(lcd_config_t *p_config)
Initialisation routine (run once at startup).
Definition: hd44780_lcd.c:105
void set_time(uint8_t hrs, uint8_t mins, uint8_t secs)
Setter function for time variables.
void init_timer_counter_0(void)
Initialisation routine for 8-bit timer 0.
Definition: digital_clock.c:99

Variable Documentation

◆ lcd_config

lcd_config_t lcd_config
Initial value:
=
{
.eight_bit_mode = false,
.two_line_display = true,
.five_by_ten_font = false,
.increment_counter = true,
.display_shift = false,
.cursor_enable = false,
.blink_enable = false,
}

Definition at line 50 of file main.c.