diff options
Diffstat (limited to 'workspace/ts100/src/Main.c')
-rw-r--r-- | workspace/ts100/src/Main.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/workspace/ts100/src/Main.c b/workspace/ts100/src/Main.c index 7c3f3cf9..1762b02c 100644 --- a/workspace/ts100/src/Main.c +++ b/workspace/ts100/src/Main.c @@ -24,38 +24,39 @@ int main(void) {
RCC_Config(); //setup system clock
NVIC_Config(0x4000);
- Init_Timer2(); //init the timer
+ Init_Timer2(); //init the timers
Init_Timer3();
- GPIO_Config();
- USB_Port(DISABLE);
- Delay_Ms(200);
- USB_Port(ENABLE);
+ GPIO_Config();//setup all the GPIO pins
+
+ USB_Port(DISABLE);//disable the USB hardware
+ Delay_Ms(200);//pause to let hardware stabilize
+ USB_Port(ENABLE);//enable the USB hardware
USB_Init();
I2C_Configuration(); //init the i2c bus
Adc_Init(); //init adc and dma
if (Get_CtrlStatus() != CONFIG)
- StartUp_Accelerated();
+ StartUp_Accelerated();//start the accelerometer if not in config mode
- System_Init();
- Init_Oled();
- Clear_Screen();
- Init_Gtime();
- APP_Init();
+ System_Init();//load known safe values
+ Init_Oled();//init the OLED display
+ Clear_Screen();//clear the display buffer to black
+ Init_Gtime();//init the count down timers
+ APP_Init();//pick operating mode via input voltage
- Disk_BuffInit();
+ Disk_BuffInit();//fill the buffer for the virtual disk
Config_Analysis(); //read in config from virtual disk
Pid_Init(); //init the pid to starting values
- Set_gKey(NO_KEY); //reset keys
- Start_Watchdog(3000);
+ Set_gKey(NO_KEY); //reset keys to all off
+ Start_Watchdog(3000);//start the system watchdog as 3 seconds
while (1) {
Clear_Watchdog(); //reset the Watchdog
if (Get_CtrlStatus() != CONFIG && LEAVE_WAIT_TIMER== 0) {
Check_Accelerated(); //update readings from the accelerometer
- LEAVE_WAIT_TIMER = 50;
+ LEAVE_WAIT_TIMER = 50;//reset timer so we dont poll accelerometer for another 500ms
}
- OLed_Display(); //Draw in the Oled display
+ OLed_Display(); //Draw in the Oled display for this mode
Status_Tran(); //Handle user input and mode changing
}
}
|