cc3000 websocket demo for cc3000
Dependencies: NVIC_set_all_priorities WebSocketClient cc3000_hostdriver_mbedsocket mbed
init.cpp@0:7f1ab388e9c4, 2013-10-01 (annotated)
- Committer:
- Kojto
- Date:
- Tue Oct 01 15:42:21 2013 +0000
- Revision:
- 0:7f1ab388e9c4
- Child:
- 1:214d23448fa7
websocket demo initial version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 0:7f1ab388e9c4 | 1 | #include "main.h" |
Kojto | 0:7f1ab388e9c4 | 2 | |
Kojto | 0:7f1ab388e9c4 | 3 | #if (MY_BOARD == WIGO) |
Kojto | 0:7f1ab388e9c4 | 4 | |
Kojto | 0:7f1ab388e9c4 | 5 | #include "NVIC_set_all_priorities.h" |
Kojto | 0:7f1ab388e9c4 | 6 | |
Kojto | 0:7f1ab388e9c4 | 7 | /** |
Kojto | 0:7f1ab388e9c4 | 8 | * \brief Wi-Go initialization |
Kojto | 0:7f1ab388e9c4 | 9 | * \param none |
Kojto | 0:7f1ab388e9c4 | 10 | * \return none |
Kojto | 0:7f1ab388e9c4 | 11 | */ |
Kojto | 0:7f1ab388e9c4 | 12 | void init() { |
Kojto | 0:7f1ab388e9c4 | 13 | DigitalOut PWR_EN1(PTB2); |
Kojto | 0:7f1ab388e9c4 | 14 | DigitalOut PWR_EN2(PTB3); |
Kojto | 0:7f1ab388e9c4 | 15 | |
Kojto | 0:7f1ab388e9c4 | 16 | // Wi-Go set current to 500mA since we're turning on the Wi-Fi |
Kojto | 0:7f1ab388e9c4 | 17 | PWR_EN1 = 0; |
Kojto | 0:7f1ab388e9c4 | 18 | PWR_EN2 = 1; |
Kojto | 0:7f1ab388e9c4 | 19 | |
Kojto | 0:7f1ab388e9c4 | 20 | NVIC_set_all_irq_priorities(3); |
Kojto | 0:7f1ab388e9c4 | 21 | NVIC_SetPriority(SPI0_IRQn, 0x0); // Wi-Fi SPI interrupt must be higher priority than SysTick |
Kojto | 0:7f1ab388e9c4 | 22 | NVIC_SetPriority(PORTA_IRQn, 0x1); |
Kojto | 0:7f1ab388e9c4 | 23 | NVIC_SetPriority(SysTick_IRQn, 0x2); // SysTick set to lower priority than Wi-Fi SPI bus interrupt |
Kojto | 0:7f1ab388e9c4 | 24 | PORTA->PCR[16] |=PORT_PCR_ISF_MASK; |
Kojto | 0:7f1ab388e9c4 | 25 | PORTA->ISFR |= (1<<16); |
Kojto | 0:7f1ab388e9c4 | 26 | } |
Kojto | 0:7f1ab388e9c4 | 27 | |
Kojto | 0:7f1ab388e9c4 | 28 | #elif (MY_BOARD == WIFI_DIPCORTEX) |
Kojto | 0:7f1ab388e9c4 | 29 | |
Kojto | 0:7f1ab388e9c4 | 30 | /** |
Kojto | 0:7f1ab388e9c4 | 31 | * \brief Wifi DipCortex initialization |
Kojto | 0:7f1ab388e9c4 | 32 | * \param none |
Kojto | 0:7f1ab388e9c4 | 33 | * \return none |
Kojto | 0:7f1ab388e9c4 | 34 | */ |
Kojto | 0:7f1ab388e9c4 | 35 | void init() { |
Kojto | 0:7f1ab388e9c4 | 36 | |
Kojto | 0:7f1ab388e9c4 | 37 | } |
Kojto | 0:7f1ab388e9c4 | 38 | |
Kojto | 0:7f1ab388e9c4 | 39 | #else |
Kojto | 0:7f1ab388e9c4 | 40 | |
Kojto | 0:7f1ab388e9c4 | 41 | /** |
Kojto | 0:7f1ab388e9c4 | 42 | * \brief Place here init routine for your board |
Kojto | 0:7f1ab388e9c4 | 43 | * \param none |
Kojto | 0:7f1ab388e9c4 | 44 | * \return none |
Kojto | 0:7f1ab388e9c4 | 45 | */ |
Kojto | 0:7f1ab388e9c4 | 46 | void init() { |
Kojto | 0:7f1ab388e9c4 | 47 | |
Kojto | 0:7f1ab388e9c4 | 48 | } |
Kojto | 0:7f1ab388e9c4 | 49 | |
Kojto | 0:7f1ab388e9c4 | 50 | #endif |