cc3000 websocket demo for cc3000

Dependencies:   NVIC_set_all_priorities WebSocketClient cc3000_hostdriver_mbedsocket mbed

Committer:
Kojto
Date:
Tue Jun 03 09:23:31 2014 +0000
Revision:
11:32afff984c83
Parent:
6:62b6aa700f85
update mbed lib to r84

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 6:62b6aa700f85 1 /* mbed Microcontroller Library
Kojto 6:62b6aa700f85 2 * Copyright (c) 2006-2013 ARM Limited
Kojto 6:62b6aa700f85 3 *
Kojto 6:62b6aa700f85 4 * Licensed under the Apache License, Version 2.0 (the "License");
Kojto 6:62b6aa700f85 5 * you may not use this file except in compliance with the License.
Kojto 6:62b6aa700f85 6 * You may obtain a copy of the License at
Kojto 6:62b6aa700f85 7 *
Kojto 6:62b6aa700f85 8 * http://www.apache.org/licenses/LICENSE-2.0
Kojto 6:62b6aa700f85 9 *
Kojto 6:62b6aa700f85 10 * Unless required by applicable law or agreed to in writing, software
Kojto 6:62b6aa700f85 11 * distributed under the License is distributed on an "AS IS" BASIS,
Kojto 6:62b6aa700f85 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Kojto 6:62b6aa700f85 13 * See the License for the specific language governing permissions and
Kojto 6:62b6aa700f85 14 * limitations under the License.
Kojto 6:62b6aa700f85 15 */
Kojto 6:62b6aa700f85 16 #include "main.h"
Kojto 6:62b6aa700f85 17 #include "mbed.h"
Kojto 6:62b6aa700f85 18
Kojto 6:62b6aa700f85 19 #if (MY_BOARD == WIGO)
Kojto 6:62b6aa700f85 20
Kojto 6:62b6aa700f85 21 #include "NVIC_set_all_priorities.h"
Kojto 6:62b6aa700f85 22
Kojto 6:62b6aa700f85 23 /**
Kojto 6:62b6aa700f85 24 * \brief Wi-Go initialization
Kojto 6:62b6aa700f85 25 * \param none
Kojto 6:62b6aa700f85 26 * \return none
Kojto 6:62b6aa700f85 27 */
Kojto 6:62b6aa700f85 28 void init() {
Kojto 6:62b6aa700f85 29 DigitalOut PWR_EN1(PTB2);
Kojto 6:62b6aa700f85 30 DigitalOut PWR_EN2(PTB3);
Kojto 6:62b6aa700f85 31
Kojto 6:62b6aa700f85 32 // Wi-Go set current to 500mA since we're turning on the Wi-Fi
Kojto 6:62b6aa700f85 33 PWR_EN1 = 0;
Kojto 6:62b6aa700f85 34 PWR_EN2 = 1;
Kojto 6:62b6aa700f85 35
Kojto 6:62b6aa700f85 36 NVIC_set_all_irq_priorities(3);
Kojto 6:62b6aa700f85 37 NVIC_SetPriority(SPI0_IRQn, 0x0); // Wi-Fi SPI interrupt must be higher priority than SysTick
Kojto 6:62b6aa700f85 38 NVIC_SetPriority(PORTA_IRQn, 0x1);
Kojto 6:62b6aa700f85 39 NVIC_SetPriority(SysTick_IRQn, 0x2); // SysTick set to lower priority than Wi-Fi SPI bus interrupt
Kojto 6:62b6aa700f85 40 PORTA->PCR[16] |=PORT_PCR_ISF_MASK;
Kojto 6:62b6aa700f85 41 PORTA->ISFR |= (1 << 16);
Kojto 6:62b6aa700f85 42 }
Kojto 6:62b6aa700f85 43
Kojto 6:62b6aa700f85 44 #elif (MY_BOARD == WIFI_DIPCORTEX)
Kojto 6:62b6aa700f85 45
Kojto 6:62b6aa700f85 46 /**
Kojto 6:62b6aa700f85 47 * \brief Wifi DipCortex initialization
Kojto 6:62b6aa700f85 48 * \param none
Kojto 6:62b6aa700f85 49 * \return none
Kojto 6:62b6aa700f85 50 */
Kojto 6:62b6aa700f85 51 void init() {
Kojto 6:62b6aa700f85 52 NVIC_SetPriority(SSP1_IRQn, 0x0);
Kojto 6:62b6aa700f85 53 NVIC_SetPriority(PIN_INT0_IRQn, 0x1);
Kojto 6:62b6aa700f85 54
Kojto 6:62b6aa700f85 55 // SysTick set to lower priority than Wi-Fi SPI bus interrupt
Kojto 6:62b6aa700f85 56 NVIC_SetPriority(SysTick_IRQn, 0x2);
Kojto 6:62b6aa700f85 57 }
Kojto 6:62b6aa700f85 58
Kojto 6:62b6aa700f85 59 #else
Kojto 6:62b6aa700f85 60
Kojto 6:62b6aa700f85 61 /**
Kojto 6:62b6aa700f85 62 * \brief Place here init routine for your board
Kojto 6:62b6aa700f85 63 * \param none
Kojto 6:62b6aa700f85 64 * \return none
Kojto 6:62b6aa700f85 65 */
Kojto 6:62b6aa700f85 66 void init() {
Kojto 6:62b6aa700f85 67
Kojto 6:62b6aa700f85 68 }
Kojto 6:62b6aa700f85 69
Kojto 6:62b6aa700f85 70 #endif