cc3000 websocket demo for cc3000

Dependencies:   NVIC_set_all_priorities WebSocketClient cc3000_hostdriver_mbedsocket mbed

Committer:
Kojto
Date:
Wed Oct 02 20:56:46 2013 +0200
Revision:
1:214d23448fa7
Parent:
0:7f1ab388e9c4
Child:
2:398f4fa8fb4a
Added Wifi DipCortex init, printf consolidation

- init for Wifi DipCortex
- all printf with \r\n
- removed tabs

Who changed what in which revision?

UserRevisionLine numberNew 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 1:214d23448fa7 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 1:214d23448fa7 36 NVIC_SetPriority(SSP1_IRQn, 0x0);
Kojto 1:214d23448fa7 37 NVIC_SetPriority(PIN_INT0_IRQn, 0x1);
Kojto 0:7f1ab388e9c4 38
Kojto 1:214d23448fa7 39 // SysTick set to lower priority than Wi-Fi SPI bus interrupt
Kojto 1:214d23448fa7 40 NVIC_SetPriority(SysTick_IRQn, 0x2);
Kojto 0:7f1ab388e9c4 41 }
Kojto 0:7f1ab388e9c4 42
Kojto 0:7f1ab388e9c4 43 #else
Kojto 0:7f1ab388e9c4 44
Kojto 0:7f1ab388e9c4 45 /**
Kojto 0:7f1ab388e9c4 46 * \brief Place here init routine for your board
Kojto 0:7f1ab388e9c4 47 * \param none
Kojto 0:7f1ab388e9c4 48 * \return none
Kojto 0:7f1ab388e9c4 49 */
Kojto 0:7f1ab388e9c4 50 void init() {
Kojto 0:7f1ab388e9c4 51
Kojto 0:7f1ab388e9c4 52 }
Kojto 0:7f1ab388e9c4 53
Kojto 0:7f1ab388e9c4 54 #endif