Changeset - 4b7449ab32bd
[Not reviewed]
default
0 1 0
Ethan Zonca - 10 years ago 2014-08-18 23:08:23
ez@ethanzonca.com
Add toggling fun text. Things seem to be working nicely.
1 file changed with 9 insertions and 1 deletions:
main.c
9
1
0 comments (0 inline, 0 general)
main.c
Show inline comments
 
@@ -62,45 +62,53 @@ int main(void)
 
    Delay(100);
 
    GPIO_SetBits(LED_POWER);
 
    Delay(500);
 
    GPIO_ResetBits(LED_POWER);
 
 
    init_spi();
 
 
    ssd1306_Init();
 
    ssd1306_block_write();
 
    ssd1306_DrawString("Hello World!", 0, 10);
 
  //  ssd1306_block_write();
 
 
    uint8_t toggle = 0;
 
    while(1)
 
   {  
 
        //ssd1306_block_write();
 
 
        // Process sensor inputs [TODO: 5hz?]
 
        process();
 
 
        // Run state machine [TODO: 50hz?]
 
        machine(); 
 
        // probably just passed the actual port
 
 
        // TODO: Grab buttonpresses with interrupts
 
        uint8_t sw_btn = GPIO_ReadInputDataBit(SW_BTN);
 
        uint8_t sw_up = GPIO_ReadInputDataBit(SW_UP);
 
        uint8_t sw_down = GPIO_ReadInputDataBit(SW_DOWN);
 
        uint8_t sw_left = GPIO_ReadInputDataBit(SW_LEFT);
 
        uint8_t sw_right = GPIO_ReadInputDataBit(SW_RIGHT);
 
 
        if(!sw_btn) {
 
            GPIO_ToggleBits(LED_STAT);
 
            ssd1306_DrawString("Douche!", 2, 10);
 
            if(!toggle) {
 
                ssd1306_DrawString("I freaking work!", 2, 10);
 
                toggle = ! toggle;
 
            }
 
            else  {
 
                ssd1306_block_write();
 
                toggle = ! toggle;
 
            }    
 
        }
 
 
        GPIO_SetBits(LED_POWER);
 
        Delay(50);
 
        GPIO_ResetBits(LED_POWER);
 
        Delay(50);
 
    }
 
}
 
 
int32_t temp = 0;
 
int32_t setpoint = 0;
 
int32_t p = 1;
0 comments (0 inline, 0 general)