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