Xively demo for cc3000

Dependencies:   NVIC_set_all_priorities cc3000_hostdriver_mbedsocket libxively mbed

Committer:
Kojto
Date:
Tue Jun 03 09:36:03 2014 +0000
Revision:
5:edcc0603078d
Parent:
4:cea07f0d1eeb
update mbed lib to r84

Who changed what in which revision?

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