Wavebubble 2010 Firmware
Functions | Variables

main.c File Reference

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>
#include <ctype.h>
#include "serial.h"
#include "pll.h"
#include "main.h"

Go to the source code of this file.

Functions

void delay_ms (uint16_t ms)
 Milliseconds delay function.
void set_sawtooth_high (void)
 Set NE555 high frequency mode.
void set_sawtooth_low (void)
 Set NE555 low frequency mode.
void set_resistor (uint8_t rnum, uint8_t rval)
 Set digital potentiometer.
int main (void)
 The main function.
 ISR (TIMER0_COMPA_vect)
 Timer0 OCR interrupt service routine.

Variables

uint16_t EEMEM dummy = 0
 A dummy word is used at EEPROM address 0 to prevent corruption of data.
uint16_t EEMEM validity = 0
 Validity value to check for empty eeprom.
uint8_t EEMEM max_programs = 0
 Number of programs in eeprom.
uint8_t EEMEM curr_program = 0
 Number of actual program in use.
uint8_t EEMEM settings_ee
 Offset where we start to save out setting.
volatile uint16_t global_delay = 0
 milliseconds delay counter, decremented by ISR
volatile uint16_t led_delay = 0
 LED blink timer.
volatile uint16_t key_delay = 0
 Key press timer to debounce and detect short/long press.
volatile uint8_t lowbatt_timer = 0
 1s timer for low battery threshold

Detailed Description

Definition in file main.c.


Function Documentation

void delay_ms ( uint16_t  ms)

Milliseconds delay function.

Uses 1ms system tick from timer0

Parameters:
msNumber of milliseconds to delay

Definition at line 74 of file main.c.

ISR ( TIMER0_COMPA_vect  )

Timer0 OCR interrupt service routine.

System tick 1ms

Definition at line 699 of file main.c.

int main ( void  )

The main function.

Returns:
Zero

Definition at line 491 of file main.c.

void set_resistor ( uint8_t  rnum,
uint8_t  rval 
)

Set digital potentiometer.

Parameters:
rnumNumber of potentiometer, 0 or 1
rvalResistor value to set

Definition at line 130 of file main.c.

void set_sawtooth_high ( void  )

Set NE555 high frequency mode.

Enable 20KHz sawtooth

Definition at line 105 of file main.c.

void set_sawtooth_low ( void  )

Set NE555 low frequency mode.

Enable 100Hz sawtooth

Definition at line 117 of file main.c.


Variable Documentation

uint8_t EEMEM curr_program = 0

Number of actual program in use.

Definition at line 57 of file main.c.

uint16_t EEMEM dummy = 0

A dummy word is used at EEPROM address 0 to prevent corruption of data.

Definition at line 54 of file main.c.

volatile uint16_t global_delay = 0

milliseconds delay counter, decremented by ISR

Definition at line 61 of file main.c.

volatile uint16_t key_delay = 0

Key press timer to debounce and detect short/long press.

Definition at line 63 of file main.c.

volatile uint16_t led_delay = 0

LED blink timer.

Definition at line 62 of file main.c.

volatile uint8_t lowbatt_timer = 0

1s timer for low battery threshold

Definition at line 64 of file main.c.

uint8_t EEMEM max_programs = 0

Number of programs in eeprom.

Definition at line 56 of file main.c.

uint8_t EEMEM settings_ee

Offset where we start to save out setting.

Definition at line 59 of file main.c.

uint16_t EEMEM validity = 0

Validity value to check for empty eeprom.

Definition at line 55 of file main.c.