/****************************************************************************
 CC3000 SPI Protocol API
 ****************************************************************************/
void SpiOpen(gcSpiHandleRx pfRxHandler)
{

	sSpiInformation.ulSpiState = eSPI_STATE_POWERUP;

	sSpiInformation.SPIRxHandler = pfRxHandler;
	sSpiInformation.pRxPacket = wlan_rx_buffer;
	sSpiInformation.usRxPacketLength = 0;
	sSpiInformation.pTxPacket = NULL;
	sSpiInformation.usTxPacketLength = 0;

	/* Enable Interrupt */
        tSLInformation.WriteWlanPin( WLAN_DISABLE );
        Delay_Microsecond(MS2u(300));
 	tSLInformation.WlanInterruptEnable();
        Delay_Microsecond(MS2u(1));
        tSLInformation.WriteWlanPin( WLAN_ENABLE );
        WaitFor(eSPI_STATE_INITIALIZED);

}
Exemplo n.º 2
0
void panic_(ePanicCode code, void* extraInfo, void (*HAL_Delay_Microseconds)(uint32_t))
{

#if HAL_PLATFORM_CORE_ENTER_PANIC_MODE
        HAL_Core_Enter_Panic_Mode(NULL);
#else
        HAL_disable_irq();
#endif // HAL_PLATFORM_CORE_ENTER_PANIC_MODE

        // Flush any serial message to help the poor bugger debug this;
        flash_codes_t pcd = flash_codes[code];
        LED_SetRGBColor(RGB_COLOR_RED);
        LED_SetBrightness(DEFAULT_LED_RGB_BRIGHTNESS);
        LED_Signaling_Stop();
        uint16_t c;
        int loops = 2;
        LOG_PRINT(TRACE, "!");
        LED_Off(LED_RGB);
        while(loops) {
                // preamble
            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(150));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(100));
            }

            HAL_Delay_Microseconds(MS2u(100));
            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(300));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(100));
            }
            HAL_Delay_Microseconds(MS2u(100));

            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(150));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(100));
            }

            // pause
            HAL_Delay_Microseconds(MS2u(900));
            // play code
            for (c = code; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(300));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(300));
            }
            // pause
            HAL_Delay_Microseconds(MS2u(800));
#if defined(RELEASE_BUILD) || PANIC_BUT_KEEP_CALM == 1
            if (--loops == 0) HAL_Core_System_Reset_Ex(RESET_REASON_PANIC, code, NULL);
#endif
        }

}
Exemplo n.º 3
0
void panic_(ePanicCode code)
{
        __disable_irq();
        flash_codes_t pcd = flash_codes[code];
        LED_SetRGBColor(RGB_COLOR_WHITE);
        LED_Off(LED_RGB);
        uint16_t c;
        while(1) {
                // preamble
            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                Delay_Microsecond(MS2u(150));
                LED_Off(LED_RGB);
                Delay_Microsecond(MS2u(100));
            }

            Delay_Microsecond(MS2u(100));
            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                Delay_Microsecond(MS2u(300));
                LED_Off(LED_RGB);
                Delay_Microsecond(MS2u(100));
            }
            Delay_Microsecond(MS2u(100));

            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                Delay_Microsecond(MS2u(150));
                LED_Off(LED_RGB);
                Delay_Microsecond(MS2u(100));
            }

                // pause
                Delay_Microsecond(MS2u(900));
                // play code
                for (c = code; c; c--) {
                    LED_SetRGBColor(pcd.led);
                    LED_On(LED_RGB);
                    Delay_Microsecond(MS2u(300));
                    LED_Off(LED_RGB);
                    Delay_Microsecond(MS2u(300));
                }
                // pause
                Delay_Microsecond(MS2u(800));
        }
}
Exemplo n.º 4
0
void panic_(ePanicCode code, void* extraInfo, void (*HAL_Delay_Microseconds)(uint32_t))
{
        HAL_disable_irq();
        // Flush any serial message to help the poor bugger debug this;
        flash_codes_t pcd = flash_codes[code];
        LED_SetRGBColor(RGB_COLOR_RED);
        LED_SetBrightness(DEFAULT_LED_RGB_BRIGHTNESS);
        LED_Signaling_Stop();
        uint16_t c;
        int loops = 2;
        log_direct_("!");
        LED_Off(LED_RGB);
        while(loops) {
                // preamble
            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(150));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(100));
            }

            HAL_Delay_Microseconds(MS2u(100));
            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(300));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(100));
            }
            HAL_Delay_Microseconds(MS2u(100));

            for (c = 3; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(150));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(100));
            }

            // pause
            HAL_Delay_Microseconds(MS2u(900));
            // play code
            for (c = code; c; c--) {
                LED_SetRGBColor(pcd.led);
                LED_On(LED_RGB);
                HAL_Delay_Microseconds(MS2u(300));
                LED_Off(LED_RGB);
                HAL_Delay_Microseconds(MS2u(300));
            }
            // pause
            HAL_Delay_Microseconds(MS2u(800));
#ifdef RELEASE_BUILD
            if (--loops == 0) HAL_Core_System_Reset();
#endif
        }

}