#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "saa1064.h"
#include "dcftime.h"
Include dependency graph for main.c:
Go to the source code of this file.
Enumerations | |
enum | modes { timeasbinary, dateasbinary, timeasbcdhorizontal, dateasbcdhorizontal, timeasbcdvertical, dateasbcdvertical, timestamp } |
the display-modes More... | |
Functions | |
void | setLeds (void) |
sends the current content of output[] to the LEDs if it has changed. | |
void | setOutput (dcf_datetime datetime) |
Takes the current time and converts it into different output-formats. | |
void | setWaiting (void) |
Sets the output to a running light. | |
void | timerInterrupt (void) |
Timer interrupt function. | |
int | main (void) |
Main-function. | |
Variables | |
uint8_t | byte [4] = { 2, 3, 1, 0 } |
the order of the connected output-LED-rows | |
uint8_t | output [4] |
current content of the LEDs | |
uint8_t | outputOld [4] |
old content of the LEDs | |
enum modes | mode |
the current display-mode | |
uint8_t | demomode = 0 |
demo mode active |
Definition in file main.c.
enum modes |
the display-modes
int main | ( | void | ) |
Main-function.
Initializes the hardware and starts the main loop of the application.
Definition at line 323 of file main.c.
References dcf_init(), led_init(), mode, set_led_brightness(), set_led_digit(), timeasbinary, and timerInterrupt().
void setLeds | ( | void | ) |
sends the current content of output[] to the LEDs if it has changed.
Definition at line 42 of file main.c.
References byte, output, outputOld, and set_led_digit().
Referenced by timerInterrupt().
void setOutput | ( | dcf_datetime | datetime | ) |
Takes the current time and converts it into different output-formats.
datetime | the current time |
Definition at line 56 of file main.c.
References dcf_datetime_struct::date, dateasbcdhorizontal, dateasbcdvertical, dateasbinary, dcf_date_struct::dayofmonth, dcf_date_struct::dayofweek, dcf_time_struct::hour, dcf_time_struct::minute, mode, dcf_date_struct::month, output, dcf_time_struct::second, dcf_datetime_struct::time, timeasbcdhorizontal, timeasbcdvertical, timeasbinary, timestamp, and dcf_date_struct::year.
Referenced by timerInterrupt().
void setWaiting | ( | void | ) |
Sets the output to a running light.
This is used when no valid time can be displayed.
Definition at line 191 of file main.c.
References output.
Referenced by timerInterrupt().
void timerInterrupt | ( | void | ) |
Timer interrupt function.
This is called on every timer-interrupt (which happens 488 times per second.
takes the current time and date
internal tick, is incremented with every timer-loop
used to defeat bouncing buttons
used to switch to demo mode
set when the mode has been switched, displays bars to indicate the new mode.
Definition at line 220 of file main.c.
References dcf_datetime_struct::date, dcf_date_struct::dayofmonth, dcf_date_struct::dayofweek, dcf_current_datetime(), dcf_signal(), demomode, False, dcf_time_struct::hour, dcf_datetime_struct::is_valid, dcf_time_struct::minute, mode, dcf_date_struct::month, output, dcf_time_struct::second, setLeds(), setOutput(), setWaiting(), dcf_datetime_struct::time, timeasbinary, timestamp, True, and dcf_date_struct::year.
Referenced by main().
uint8_t byte[4] = { 2, 3, 1, 0 } |
uint8_t demomode = 0 |
the current display-mode
Definition at line 33 of file main.c.
Referenced by main(), setOutput(), and timerInterrupt().
uint8_t output[4] |
current content of the LEDs
Definition at line 19 of file main.c.
Referenced by setLeds(), setOutput(), setWaiting(), and timerInterrupt().
uint8_t outputOld[4] |