firmware/main.c File Reference

Firmware for the binary DCF-77 clock. More...

#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


Detailed Description

Firmware for the binary DCF-77 clock.

Author:
Ronald Schaten
Version:
Id
main.c,v 1.2 2007/01/03 12:38:55 rschaten Exp
License: See documentation.

Definition in file main.c.


Enumeration Type Documentation

enum modes

the display-modes

Enumerator:
timeasbinary  display hours, minutes and seconds, one byte per row
dateasbinary  display day of month, month, year and day of week, one byte per row
timeasbcdhorizontal  display hours, minutes and seconds, two BCDs per row
dateasbcdhorizontal  display day of month, month, year and day of week, two BCDs per row
timeasbcdvertical  display hours, minutes and seconds, one BCD per column
dateasbcdvertical  display day of month, month and year, one BCD per column
timestamp  display unix timestamp, one byte per row

Definition at line 23 of file main.c.


Function Documentation

int main ( void   ) 

Main-function.

Initializes the hardware and starts the main loop of the application.

Returns:
An integer. Whatever... :-)

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.

Parameters:
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().


Variable Documentation

uint8_t byte[4] = { 2, 3, 1, 0 }

the order of the connected output-LED-rows

Definition at line 18 of file main.c.

Referenced by setLeds().

uint8_t demomode = 0

demo mode active

Definition at line 36 of file main.c.

Referenced by timerInterrupt().

enum modes mode

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]

old content of the LEDs

Definition at line 20 of file main.c.

Referenced by setLeds().


Generated on Wed Jan 3 22:22:46 2007 for Binary DCF-77 Clock by  doxygen 1.5.1