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