Changeset - c23168e6420f
[Not reviewed]
default
0 1 0
Ethan Zonca - 10 years ago 2014-07-17 23:18:06
ez@ethanzonca.com
Back to blinking, commented out USB initialization
1 file changed with 4 insertions and 8 deletions:
main.c
4
8
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
@@ -35,37 +35,32 @@ int main(void)
 
    SystemInit();
 
 
    init_gpio();
 
 
    Set_USBClock();
 
    USB_Interrupts_Config();
 
    USB_Init();
 
 
    GPIO_SetBits(LED_POWER);
 
    //USB_Init(); // freezes here... maybe clock issue?
 
 
    RCC_ClocksTypeDef RCC_Clocks;
 
 
    // SysTick end of count event each 1ms
 
    RCC_GetClocksFreq(&RCC_Clocks);
 
    SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
 
 
    GPIO_ResetBits(LED_STAT);
 
    Delay(100);
 
 
 
    //ssd1306_Init();
 
    //ssd1306_DrawPoint(3,3,1);
 
    //ssd1306_DrawPoint(5,5,0);
 
 
    GPIO_SetBits(LED_POWER);
 
    Delay(500);
 
    GPIO_ResetBits(LED_POWER);
 
 
 
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
 
 
    init_spi();
 
 
    while(1)
 
   {  
 
        // Process sensor inputs [TODO: 5hz?]
 
        process();
 
@@ -112,20 +107,21 @@ void process()
 
    uint8_t retval = SPI_I2S_ReceiveData(SPI2);
 
 
    // Deassert CS
 
    GPIO_SetBits(MAX_CS);
 
 
    if((!retval || (temp & 0x2) != 0))
 
        return; // Comms error
 
        return; // Comms error - this is happening right now
 
 
    if((temp & 0x4)!= 0)
 
        return; // Open thermocouple
 
 
 
    temp = (temp & 0x7FF8) >> 5;
 
 
 
    // TODO: Add calibration offset (linear)
 
 
 
    // Perform PID calculations
 
 
    // Write output to SSR
 
@@ -286,13 +282,13 @@ void machine()
 
            // N/A
 
 
 
        } break;
 
 
 
        // Something is terribly wrong
 
        deault:
 
        default:
 
        {
 
            state = STATE_IDLE;
 
 
        } break;
 
            
 
    }
0 comments (0 inline, 0 general)