コード例 #1
0
int32_t platform_set_led(int32_t led, BOOL on)
{
    switch (led) {
    case EXO_LED_1:
        (on)?BSP_LEDOn(BSP_LED_1):BSP_LEDOff(BSP_LED_1);
        break;
    case EXO_LED_2:
        (on)?BSP_LEDOn(BSP_LED_2):BSP_LEDOff(BSP_LED_2);
        break;

    default:
        return ERR_NOT_APPLICABLE;
    }

    return ERR_SUCCESS;
}
コード例 #2
0
ファイル: bsp.c プロジェクト: ozwin/erts-project
void BSP_LEDSet (Led_TypeDef Led, INT16U on)
{
	if(on != 0)
		BSP_LEDOn(Led);
	else
		BSP_LEDOff(Led);
}
コード例 #3
0
ファイル: UART_SM_app.c プロジェクト: Emmas09/openstrom
/**********************************************************
 * Application tasks routine. This function implements the
 * application state machine.
 ***********************************************************/
void APP_Tasks ( void )
{
    /* check the application state*/
    switch ( appData.state )
    {
        case USART_ENABLE:
           
            /* Enable the UART module*/
            PLIB_USART_Enable(USART_ID_2);

            appData.stringPointer = txPowerValuesBuff_1;
;

            appData.state =  USART_TRANSMIT_FIRST_STRING;

            break;

        case USART_TRANSMIT_FIRST_STRING:
            if(true == WriteString())
            {
                appData.state = USART_TRANSMIT_SECOND_STRING;
                appData.stringPointer = string2;
            }

            break;

        case USART_TRANSMIT_SECOND_STRING:
            if(true == WriteString())
            {
                appData.state = USART_RECEIVE_DONE;
            }
            break;

        case USART_RECEIVE_DONE:
              if (appData.InterruptFlag)
              {
                  if(true == PutCharacter(appData.data))
                  {
                    BSP_LEDOn(BSP_LED_3);
                    appData.InterruptFlag = false;        
                  }
              }
            break;

        default:
            SYS_DEBUG (SYS_ERROR_FATAL,"ERROR! Invalid state\r\n");
            while (1);

    }

} 
コード例 #4
0
ファイル: app.c プロジェクト: samuelsam93/Sam_ME433
void APP_USBDeviceEventHandler(USB_DEVICE_EVENT event, void * eventData, uintptr_t context)
{
    USB_DEVICE_EVENT_DATA_CONFIGURED * configurationValue;
    switch(event)
    {
        case USB_DEVICE_EVENT_SOF:
            /* This event is used for switch debounce. This flag is reset
             * by the switch process routine. */
            appData.sofEventHasOccurred = true;
            appData.setIdleTimer++;
            break;
        case USB_DEVICE_EVENT_RESET:
        case USB_DEVICE_EVENT_DECONFIGURED:
        
            /* Device got deconfigured */
            
            appData.isConfigured = false;
            appData.isMouseReportSendBusy = false;
            appData.state = APP_STATE_WAIT_FOR_CONFIGURATION;
            appData.emulateMouse = true;
            BSP_LEDOn ( APP_USB_LED_1 );
            BSP_LEDOn ( APP_USB_LED_2 );
            BSP_LEDOff ( APP_USB_LED_3 );

            break;

        case USB_DEVICE_EVENT_CONFIGURED:

            /* Device is configured */
            configurationValue = (USB_DEVICE_EVENT_DATA_CONFIGURED *)eventData;
            if(configurationValue->configurationValue == 1)
            {
                appData.isConfigured = true;
                
                BSP_LEDOff ( APP_USB_LED_1 );
                BSP_LEDOff ( APP_USB_LED_2 );
                BSP_LEDOn ( APP_USB_LED_3 );

                /* Register the Application HID Event Handler. */

                USB_DEVICE_HID_EventHandlerSet(appData.hidInstance,
                        APP_USBDeviceHIDEventHandler, (uintptr_t)&appData);
            }
            break;

        case USB_DEVICE_EVENT_POWER_DETECTED:

            /* VBUS was detected. We can attach the device */
            USB_DEVICE_Attach(appData.deviceHandle);
            break;

        case USB_DEVICE_EVENT_POWER_REMOVED:

            /* VBUS is not available any more. Detach the device. */
            USB_DEVICE_Detach(appData.deviceHandle);
            break;

        case USB_DEVICE_EVENT_SUSPENDED:
            BSP_LEDOff ( APP_USB_LED_1 );
            BSP_LEDOn ( APP_USB_LED_2 );
            BSP_LEDOn ( APP_USB_LED_3 );
            break;

        case USB_DEVICE_EVENT_RESUMED:
        case USB_DEVICE_EVENT_ERROR:
        default:
            break;

    } 
}
コード例 #5
0
ファイル: app.c プロジェクト: jtaseff/433_jnt606
void APP_Tasks ( void )
{
    static int8_t   vector = 0;
    static uint8_t  movement_length = 0;
    static bool     sent_dont_move = false;

    int8_t dir_table[] ={-4,-4,-4, 0, 4, 4, 4, 0};
	
    /* Check the application's current state. */
    switch ( appData.state )
    {
        /* Application's initial state. */
        case APP_STATE_INIT:
        {
            BSP_LEDOff ( APP_USB_LED_1 );
            BSP_LEDOn ( APP_USB_LED_2 );
            
		    /* Open the device layer */
            appData.deviceHandle = USB_DEVICE_Open( USB_DEVICE_INDEX_0,
                    DRV_IO_INTENT_READWRITE );

            if(appData.deviceHandle != USB_DEVICE_HANDLE_INVALID)
            {
                /* Register a callback with device layer to get event notification (for end point 0) */
                USB_DEVICE_EventHandlerSet(appData.deviceHandle,
                        APP_USBDeviceEventHandler, 0);

                appData.state = APP_STATE_WAIT_FOR_CONFIGURATION;
            }
            else
            {
                /* The Device Layer is not ready to be opened. We should try
                 * again later. */
            }
            break;
        }

        case APP_STATE_WAIT_FOR_CONFIGURATION:

            /* Check if the device is configured. The 
             * isConfigured flag is updated in the
             * Device Event Handler */

            if(appData.isConfigured)
            {
                appData.state = APP_STATE_MOUSE_EMULATE;
            }
            break;

        case APP_STATE_MOUSE_EMULATE:

            APP_ProcessSwitchPress();

            /* The following logic rotates the mouse icon when
             * a switch is pressed */

            if(appData.isSwitchPressed)
            {
                /* Toggle the mouse emulation with each switch press */
                appData.emulateMouse ^= 1;
                appData.isSwitchPressed = false;
            }

            if(appData.emulateMouse)
            {
                sent_dont_move = false;

                if(movement_length > 50)
                {
                    appData.mouseButton[0] = MOUSE_BUTTON_STATE_RELEASED;
                    appData.mouseButton[1] = MOUSE_BUTTON_STATE_RELEASED;
                    appData.xCoordinate =(int8_t)dir_table[vector & 0x07] ;
                    appData.yCoordinate =(int8_t)dir_table[(vector+2) & 0x07];
                    vector ++;
                    movement_length = 0;
                }
            }
            else
            { 
                appData.mouseButton[0] = MOUSE_BUTTON_STATE_RELEASED;
                appData.mouseButton[1] = MOUSE_BUTTON_STATE_RELEASED;
                appData.xCoordinate = 0;
                appData.yCoordinate = 0;
            }

            if(!appData.isMouseReportSendBusy)
            {
                if(((sent_dont_move == false) && (!appData.emulateMouse)) || (appData.emulateMouse))
                {

                    /* This means we can send the mouse report. The
                       isMouseReportBusy flag is updated in the HID Event Handler. */

                    appData.isMouseReportSendBusy = true;

                    /* Create the mouse report */

                    MOUSE_ReportCreate(appData.xCoordinate, appData.yCoordinate,
                            appData.mouseButton, &mouseReport);

                    if(memcmp((const void *)&mouseReportPrevious, (const void *)&mouseReport,
                            (size_t)sizeof(mouseReport)) == 0)
                    {
                        /* Reports are same as previous report. However mouse reports
                         * can be same as previous report as the co-ordinate positions are relative.
                         * In that case it needs to be send */
                        if((appData.xCoordinate == 0) && (appData.yCoordinate == 0))
                        {
                            /* If the coordinate positions are 0, that means there
                             * is no relative change */
                            if(appData.idleRate == 0)
                            {
                                appData.isMouseReportSendBusy = false;
                            }
                            else
                            {
                                /* Check the idle rate here. If idle rate time elapsed
                                 * then the data will be sent. Idle rate resolution is
                                 * 4 msec as per HID specification; possible range is
                                 * between 4msec >= idlerate <= 1020 msec.
                                 */
                                if(appData.setIdleTimer * APP_USB_CONVERT_TO_MILLISECOND
                                        >= appData.idleRate * 4)
                                {
                                    /* Send REPORT as idle time has elapsed */
                                    appData.isMouseReportSendBusy = true;
                                }
                                else
                                {
                                    /* Do not send REPORT as idle time has not elapsed */
                                    appData.isMouseReportSendBusy = false;
                                }
                            }
                        }

                    }
                    if(appData.isMouseReportSendBusy == true)
                    {
                        /* Copy the report sent to previous */
                        memcpy((void *)&mouseReportPrevious, (const void *)&mouseReport,
                                (size_t)sizeof(mouseReport));
                        
                        /* Send the mouse report. */
                        USB_DEVICE_HID_ReportSend(appData.hidInstance,
                            &appData.reportTransferHandle, (uint8_t*)&mouseReport,
                            sizeof(MOUSE_REPORT));
                        appData.setIdleTimer = 0;
                    }
                    movement_length ++;
                    sent_dont_move = true;
                }
            }

            break;

        case APP_STATE_ERROR:

            break;

        /* The default state should never be executed. */
        default:
        {
            /* TODO: Handle error in application's state machine. */
            break;
        }
    }
}
コード例 #6
0
ファイル: app.c プロジェクト: therrma2/me433
void APP_USBDeviceEventHandler ( USB_DEVICE_EVENT event, void * eventData, uintptr_t context)
{
    uint8_t configurationValue;
    switch ( event )
    {
        case USB_DEVICE_EVENT_RESET:
        case USB_DEVICE_EVENT_DECONFIGURED:

            /* USB device is reset or device is deconfigured.
             * This means that USB device layer is about to deininitialize
             * all function drivers. Update LEDs to indicate
             * reset/deconfigured state. */

            BSP_LEDOn ( APP_USB_LED_1 );
            BSP_LEDOn ( APP_USB_LED_2  );
            BSP_LEDOff( APP_USB_LED_3  );

            appData.isConfigured = false;

            break;

        case USB_DEVICE_EVENT_CONFIGURED:

            /* Check the configuration */
            configurationValue = ((USB_DEVICE_EVENT_DATA_CONFIGURED *)eventData)->configurationValue;
            if (configurationValue == 1)
            {
                /* The device is in configured state. Update LED indication */

                BSP_LEDOff( APP_USB_LED_1 );
                BSP_LEDOff( APP_USB_LED_2  );
                BSP_LEDOn( APP_USB_LED_3  );

                /* Register the CDC Device application event handler here.
                 * Note how the appData object pointer is passed as the
                 * user data */

                USB_DEVICE_CDC_EventHandlerSet(USB_DEVICE_CDC_INDEX_0,
                        APP_USBDeviceCDCEventHandler, (uintptr_t)&appData);

                /* mark that set configuration is complete */
                appData.isConfigured = true;

            }
            break;

        case USB_DEVICE_EVENT_SUSPENDED:

            /* Update LEDs */
            BSP_LEDOff ( APP_USB_LED_1 );
            BSP_LEDOn ( APP_USB_LED_2  );
            BSP_LEDOn( APP_USB_LED_3  );
            break;

        
        case USB_DEVICE_EVENT_POWER_DETECTED:

            /* VBUS was detected. Connect the device */
            USB_DEVICE_Attach (appData.deviceHandle);
            break;

        case USB_DEVICE_EVENT_POWER_REMOVED:
            
            /* VBUS was removed. Disconnect the device */
            USB_DEVICE_Detach(appData.deviceHandle);
            break;

        /* These events are not used in this demo */
        case USB_DEVICE_EVENT_RESUMED:
        case USB_DEVICE_EVENT_ERROR:
        default:
            break;
    }
}
コード例 #7
0
void BSP_LED_LightShow(BSP_LED_LIGHT_SHOW lightShow)
{
    static uint32_t ledTick = 0;
    static uint8_t count = 0;
    static uint8_t count2 = 0;
    static uint32_t connectionTimeout = 0;

    switch (lightShow)
    {
        case     BSP_LED_EASY_CONFIGURATION:
            if(SYS_TMR_TickCountGet() - ledTick >= 625)
            {
                ledTick = SYS_TMR_TickCountGet();
                BSP_LEDToggle(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
                BSP_LEDOff(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
                BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                BSP_LEDOff(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
            }
            break;

        case     BSP_LED_CONNECTING_TO_AP:
            if(SYS_TMR_TickCountGet() - connectionTimeout >= (1250 * 10))
            {
                connectionTimeout = SYS_TMR_TickCountGet();
                BSP_LED_LightShowSet(BSP_LED_CONNECTION_FAILED);
            }
            if (SYS_TMR_TickCountGet() - ledTick >= 150)
            {
                ledTick = SYS_TMR_TickCountGet();
                BSP_LEDOff(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
                BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
                switch (count)
                {
                    case (0):
                        BSP_LEDOn(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                        BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                        BSP_LEDOff(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                        BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
                        count++;
                        break;
                    case (1):
                        BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                        BSP_LEDOn(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                        BSP_LEDOff(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                        BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
                        count++;
                        break;
                    case (2):
                        BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                        BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                        BSP_LEDOff(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                        BSP_LEDOn(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
                        count++;
                        break;
                    case (3):
                        BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                        BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                        BSP_LEDOn(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                        BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
                        count = 0;
                        break;
                    default:
                        count = 0;
                        break;
                }

            }
            break;
            //Not implemented
        case     BSP_LED_CONNECTION_FAILED:
                BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                BSP_LEDOn(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                BSP_LEDOff(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
                BSP_LEDOn(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
                BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);

            if(SYS_TMR_TickCountGet() - connectionTimeout >= 4750)
            {
                connectionTimeout = SYS_TMR_TickCountGet();
                ledTick = SYS_TMR_TickCountGet();
                BSP_LED_LightShowSet(BSP_LED_CONNECTING_TO_AP);
            }
            break;
        case    BSP_LED_AP_CONNECTED:
                if(SYS_TMR_TickCountGet() - ledTick >= 625)
                {
                    count2++;
                    ledTick = SYS_TMR_TickCountGet();
                    BSP_LEDStateSet(BSP_LED_5_CHANNEL, BSP_LED_5_PORT, BSP_LEDStateGet(BSP_LED_6_CHANNEL, BSP_LED_6_PORT));
                    BSP_LEDToggle(BSP_LED_5_CHANNEL, BSP_LED_6_PORT);
                    BSP_LEDToggle(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
                    BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                    BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                    BSP_LEDOff(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                    BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
                }
            break;

        case    BSP_LED_SERVER_CONNECT_FAILED:
                BSP_LEDOn(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
                BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
                BSP_LEDOff(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
                BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
                BSP_LEDOn(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
                BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
            break;

        case    BSP_LED_ALL_GOOD:
                BSP_LEDOff(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
                BSP_LEDOff(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
                ledTick = SYS_TMR_TickCountGet();
            // Idle state
            break;
            
        case    BSP_LED_TX:
            BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
            if(SYS_TMR_TickCountGet() - ledTick >= 30)
                BSP_LED_LightShowSet(BSP_LED_ALL_GOOD);
            break;
            
        case    BSP_LED_RX:
            BSP_LEDOn(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
            if(SYS_TMR_TickCountGet() - ledTick >= 30)
                BSP_LED_LightShowSet(BSP_LED_ALL_GOOD);
            break; 

        case    BSP_LED_DNS_FAILED:
            BSP_LEDOn(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
            BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
            BSP_LEDOn(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
            BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
            BSP_LEDOn(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
            BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
        break;
        
        case    BSP_LED_TCPIP_STACK_INIT_FAILURE:
            BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
            BSP_LEDOn(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
            BSP_LEDOn(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
            BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
            BSP_LEDOn(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
            BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
        break;
        
        case BSP_LED_NVM_FAILED_MOUNT:
            BSP_LEDOff(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
            BSP_LEDOff(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
            BSP_LEDOn(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
            BSP_LEDOff(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
            BSP_LEDOn(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
            BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
        break;  
        
        case BSP_LED_INTIAL_CONNECT:
            BSP_LEDOn(BSP_LED_1_CHANNEL, BSP_LED_1_PORT);
            BSP_LEDOn(BSP_LED_2_CHANNEL, BSP_LED_2_PORT);
            BSP_LEDOn(BSP_LED_3_CHANNEL, BSP_LED_3_PORT);
            BSP_LEDOn(BSP_LED_4_CHANNEL, BSP_LED_4_PORT);
            BSP_LEDOn(BSP_LED_5_CHANNEL, BSP_LED_5_PORT);
            BSP_LEDOn(BSP_LED_6_CHANNEL, BSP_LED_6_PORT);
            
        default:
            break;
    }
}
コード例 #8
0
ファイル: app.c プロジェクト: neslerc/Homework2
void APP_USBDeviceEventHandler(USB_DEVICE_EVENT event, void * eventData, uintptr_t context)
{
    switch(event)
    {
        case USB_DEVICE_EVENT_RESET:
        case USB_DEVICE_EVENT_DECONFIGURED:

            /* Host has de configured the device or a bus reset has happened.
             * Device layer is going to de-initialize all function drivers.
             * Hence close handles to all function drivers (Only if they are
             * opened previously. */

            BSP_LEDOn  (APP_USB_LED_1);
            BSP_LEDOn  (APP_USB_LED_2);
            BSP_LEDOff (APP_USB_LED_3);
            appData.deviceConfigured = false;
            appData.state = APP_STATE_WAIT_FOR_CONFIGURATION;
            break;

        case USB_DEVICE_EVENT_CONFIGURED:
            /* Set the flag indicating device is configured. */
            appData.deviceConfigured = true;

            /* Save the other details for later use. */
            appData.configurationValue = ((USB_DEVICE_EVENT_DATA_CONFIGURED*)eventData)->configurationValue;

            /* Register application HID event handler */
            USB_DEVICE_HID_EventHandlerSet(USB_DEVICE_HID_INDEX_0, APP_USBDeviceHIDEventHandler, (uintptr_t)&appData);

            /* Update the LEDs */
            BSP_LEDOff (APP_USB_LED_1);
            BSP_LEDOff (APP_USB_LED_2);
            BSP_LEDOn  (APP_USB_LED_3);

            break;

        case USB_DEVICE_EVENT_SUSPENDED:

            /* Switch on green and orange, switch off red */
            BSP_LEDOff (APP_USB_LED_1);
            BSP_LEDOn  (APP_USB_LED_2);
            BSP_LEDOn  (APP_USB_LED_3);
            break;

        case USB_DEVICE_EVENT_POWER_DETECTED:

            /* VBUS was detected. We can attach the device */

            USB_DEVICE_Attach (appData.usbDevHandle);
            break;

        case USB_DEVICE_EVENT_POWER_REMOVED:

            /* VBUS is not available */
            USB_DEVICE_Detach(appData.usbDevHandle);
            break;

        /* These events are not used in this demo */
        case USB_DEVICE_EVENT_RESUMED:
        case USB_DEVICE_EVENT_ERROR:
        default:
            break;
    }
}
コード例 #9
0
ファイル: flir.c プロジェクト: MattAtHazmat/flirry
void FLIR_Tasks ( void )
{
    LEP_RESULT result;
    /* Check the application's current state. */
    switch ( flirData.state )
    {
        /* Application's initial state. */
        case FLIR_STATE_INIT:
        {
            bool appInitialized = true;
       
            if (flirData.handleTmrDrv == DRV_HANDLE_INVALID)
            {
                flirData.handleTmrDrv = DRV_TMR_Open(FLIR_TMR_DRV, DRV_IO_INTENT_EXCLUSIVE);
                appInitialized &= ( DRV_HANDLE_INVALID != flirData.handleTmrDrv );
            }
        
            if (appInitialized)
            {
                TimerSetup();
                BSP_LEDOn(BSP_LED_1);
                flirData.state = FLIR_OPEN_PORT;
            }
            break;
        }
        case FLIR_OPEN_PORT:
        {
            BSP_LEDOn(BSP_LED_2);
            result = LEP_OpenPort(0,
                                  LEP_CCI_TWI,
                                    #ifdef BB_ENABLED
                                        DRV_I2C_BIT_BANG_BAUD_RATE_IDX0
                                    #else
                                        DRV_I2C_BAUD_RATE_IDX0
                                    #endif
                                  /1000,&flirData.lepton.cameraPort);
            if(result != LEP_OK)
            {
                flirData.state = FLIR_ERROR;
            }
            else
            {
                BSP_LEDOff(BSP_LED_1);
                BSP_LEDOff(BSP_LED_2);
                BSP_LEDOff(BSP_LED_3);
                BSP_LEDOn(BSP_LED_4);
                flirData.state = FLIR_STATE_SERVICE_TASKS;
            }
            break;
        }
        case FLIR_STATE_SERVICE_TASKS:
        {
            LedTask();
        
            break;
        }

        /* TODO: implement your application state machine.*/
        

        case FLIR_ERROR:
        default:
        {
            BSP_LEDOn(BSP_LED_1);
            BSP_LEDOn(BSP_LED_2);
            BSP_LEDOn(BSP_LED_3);
            BSP_LEDOn(BSP_LED_4);
            break;
        }
    }
}