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