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