Changeset - 7b13b1c2f3a1
[Not reviewed]
default
0 1 0
Ethan Zonca - 10 years ago 2014-09-25 21:56:47
ez@ethanzonca.com
Relocated USB init. Need to test with ext xtal
1 file changed with 5 insertions and 7 deletions:
main.c
5
7
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
@@ -71,58 +71,56 @@ void restore_settings();
 
void save_settings();
 
void save_setpoints();
 
 
int main(void)
 
{
 
 
    // Init clocks
 
    SystemInit();
 
 
    // Init GPIO
 
    init_gpio();
 
 
    // Init USB
 
    //Set_USBClock();
 
    //USB_Interrupts_Config();
 
    //USB_Init();
 
 
    // Turn on power LED
 
    GPIO_SetBits(LED_POWER);
 
 
    // TODO: Awesome pwm of power LED (TIM4_CH4 or TIM11_CH1)
 
 
    // Configure 1ms SysTick (change if more temporal resolution needed) 
 
    RCC_ClocksTypeDef RCC_Clocks;
 
    RCC_GetClocksFreq(&RCC_Clocks);
 
    SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
 
 
    // Init SPI busses
 
    init_spi();
 
 
    // Init OLED over SPI
 
    ssd1306_Init();
 
    ssd1306_clearscreen();
 
 
    // Check for problems on startup
 
    if(clock_fail) {
 
        ssd1306_DrawString("ERROR: Check Xtal", 3, 0);
 
        delay(2000);
 
    }
 
 
    // Init USB
 
//    Set_USBClock();
 
//    USB_Interrupts_Config();
 
//    USB_Init();
 
 
    // Startup screen 
 
    ssd1306_DrawString("therm v0.1", 1, 40);
 
    ssd1306_DrawString("protofusion.org/therm", 3, 0);
 
 
 
 
    delay(1500);
 
    ssd1306_clearscreen();
 
    
 
    restore_settings();
 
    if(boottobrew)
 
      state = STATE_PREHEAT_BREW; // Go to brew instead of idle if configured thusly
 
 
    GPIO_ResetBits(LED_STAT);
 
 
    // Main loop
 
    while(1)
 
    {
0 comments (0 inline, 0 general)