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