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