cc3000 UDP server demo

Dependencies:   NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed

Committer:
Kojto
Date:
Tue Jun 03 09:20:16 2014 +0000
Revision:
3:62fc96bb91b5
Parent:
0:c338c4b7ca0a
update mbed lib to r84

Who changed what in which revision?

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