127 lines
5.1 KiB
C
127 lines
5.1 KiB
C
/****************************************************************************
|
|
* configs/efm32-g8xx-stk/include/board.h
|
|
*
|
|
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in
|
|
* the documentation and/or other materials provided with the
|
|
* distribution.
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
* used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __CONFIGS_EFM32_G8XX_STK_INCLUDE_BOARD_H
|
|
#define __CONFIGS_EFM32_G8XX_STK_INCLUDE_BOARD_H
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
/****************************************************************************
|
|
* Pre-Processor Definitions
|
|
****************************************************************************/
|
|
/* Clocking *****************************************************************/
|
|
/* Clock Sources
|
|
* - 1-28 MHz High Frequency RC Oscillator (HFRCO)
|
|
* - 4-32 MHz High Frequency Crystal Oscillator (HFXO)
|
|
* - 32.768 kHz Low Frequency RC Oscillator (LFRCO)
|
|
* - 32.768 kHz Low Frequency Crystal Oscillator (LFXO)
|
|
*
|
|
* The device boots with 14 MHz HFRCO as the HFCLK source.
|
|
*/
|
|
|
|
#define BOARD_HFRCO_FREQUENCY 14000000 /* 14MHz on reset */
|
|
#define BOARD_HFXO_FREQUENCY 32000000 /* 32MHz crystal on board */
|
|
#define BOARD_LFRCO_FREQUENCY 32768 /* Low frequency oscillator */
|
|
#define BOARD_LFXO_FREQUENCY 32768 /* 32MHz crystal on board */
|
|
|
|
/* The EFM32 Gecko Starter Kit supports 4 yellow LEDs. One side is grounded
|
|
* so these LEDs are illuminated by outputting a high value.
|
|
*
|
|
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
|
* any way. The following definitions are used to access individual LEDs.
|
|
*/
|
|
|
|
/* LED index values for use with efm32_setled() */
|
|
|
|
#define BOARD_LED1 0
|
|
#define BOARD_LED2 1
|
|
#define BOARD_LED3 2
|
|
#define BOARD_LED4 3
|
|
#define BOARD_NLEDS 4
|
|
|
|
#define BOARD_LED_GREEN BOARD_LED1
|
|
#define BOARD_LED_ORANGE BOARD_LED2
|
|
#define BOARD_LED_RED BOARD_LED3
|
|
#define BOARD_LED_BLUE BOARD_LED4
|
|
|
|
/* LED bits for use with efm32_setleds() */
|
|
|
|
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
|
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
|
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
|
#define BOARD_LED4_BIT (1 << BOARD_LED4)
|
|
|
|
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 4 LEDs on
|
|
* board the EFM32 Gecko Starter Kit. The following definitions describe
|
|
* how NuttX controls the LEDs in this configuration:
|
|
*/
|
|
|
|
#define LED_STARTED 0 /* LED1 */
|
|
#define LED_HEAPALLOCATE 1 /* LED2 */
|
|
#define LED_IRQSENABLED 2 /* LED1 + LED2 */
|
|
#define LED_STACKCREATED 3 /* LED3 */
|
|
#define LED_INIRQ 4 /* LED1 + LED3 */
|
|
#define LED_SIGNAL 5 /* LED2 + LED3 */
|
|
#define LED_ASSERTION 6 /* LED1 + LED2 + LED3 */
|
|
#define LED_PANIC 7 /* N/C + N/C + N/C + LED4 */
|
|
|
|
/****************************************************************************
|
|
* Public Function Prototypes
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Name: efm32_ledinit, efm32_setled, and efm32_setleds
|
|
*
|
|
* Description:
|
|
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
|
|
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the following interfaces
|
|
* are available to control the LEDs from user applications.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef CONFIG_ARCH_LEDS
|
|
void efm32_ledinit(void);
|
|
void efm32_setled(int led, bool ledon);
|
|
void efm32_setleds(uint8_t ledset);
|
|
#endif
|
|
|
|
#endif /* __CONFIGS_EFM32_DK3650_INCLUDE_BOARD_H */
|