main.c File Reference

#include <main.h>

Functions

void interrupt_init (void)
void init_ports (void)
void call_inits (void)
void bk_LED (int8_t value)
 Function to connect to property "Backlight brightness".
int main (void)

Function Documentation

void bk_LED int8_t  value  ) 
 

Function to connect to property "Backlight brightness".

Form defined through the first function-pointer in struct menue_prop_struct in menu.h.

00086 {
00087     if(value >= 1 && value <= 11) OCR2 = (value-1) * 12;    //10*12 = 120
00088 }

void call_inits void   ) 
 

00042 {
00043     init_ports();
00044     menu_init();
00045     control_init();
00046     input_init();
00047     adc_init(0);
00048     disp_init();
00049     usart_init();
00050     interrupt_init();
00051 }

void init_ports void   ) 
 

00029 {
00030     DDRA=255;   //OUTPUT
00031     PORTA=255;  //on
00032 
00033     DDRC = 0;       //Input
00034     PORTC = 255;    //pull ups
00035     DDRD = (1<<PD3);    //PD3 Output
00036     PORTD = 255;
00037     DDRE = 0;   //input
00038     PORTE = 255;
00039 }

void interrupt_init void   ) 
 

Enables Timer2 for Backlight. Enables Timer3 for micro-second measurement. Enables interrupts globally.

00066 {
00067     //timer 2 in fast PWM for backlight
00068     PORTB &= ~(1<<PB7);
00069     DDRB |= (1<<PB7);   //OC2 pin is output
00070     TCCR2 = (1<<WGM21) | (1<<WGM20) | (1<<COM21) | (1<<CS20); //no prescaler
00071     TCNT2 = 0;
00072     OCR2 = 108; //max 120
00073 
00074     //timer 3 for us_timer
00075     us_timer_init();
00076 
00077     // enable interrupts
00078     sei();      
00079 }

int main void   ) 
 

Main, with test-code.

00097 {
00098     //#define cnt  1
00099     DDRE = (1<<PE2); //sets data direction for xck0 to output
00100 
00101     call_inits();
00102     #ifdef DISP_SPLASH
00103         for(uint32_t x=0; x < 5000000; x++) asm("nop");
00104     #endif
00105 
00106     while(1==1){
00107         //uart_empfang();
00108         control_refresh();
00109         disp_refresh();
00110         input_refresh();
00111     }
00112 }


Generated on Fri Aug 11 21:47:32 2006 for OpenOsci by  doxygen 1.4.6