cc3000 udp client demo

Dependencies:   NVIC_set_all_priorities cc3000_hostdriver_mbedsocket mbed

Committer:
Kojto
Date:
Tue Jun 03 09:21:32 2014 +0000
Revision:
4:7bab74efae95
Parent:
0:ea82b2471444
update mbed lib to r84

Who changed what in which revision?

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