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