Merge pull request #5045 from haukepetersen/opt_boards_leddefines
boards: unified LED macros
This commit is contained in:
commit
272f12dfb8
@ -23,9 +23,6 @@
|
|||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* setup led(s) for debugging */
|
|
||||||
NRF_GPIO->DIRSET = LED_RED_MASK;
|
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,24 +38,6 @@
|
|||||||
#define XTIMER_BACKOFF (40)
|
#define XTIMER_BACKOFF (40)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_PIN (GPIO_PIN(0, 16))
|
|
||||||
#define LED_RED_MASK (1 << 16)
|
|
||||||
|
|
||||||
#define LED_RED_ON (NRF_GPIO->OUTSET = LED_RED_MASK)
|
|
||||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = LED_RED_MASK)
|
|
||||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_MASK)
|
|
||||||
#define LED_GREEN_ON /* not available */
|
|
||||||
#define LED_GREEN_OFF /* not available */
|
|
||||||
#define LED_GREEN_TOGGLE /* not available */
|
|
||||||
#define LED_BLUE_ON /* not available */
|
|
||||||
#define LED_BLUE_OFF /* not available */
|
|
||||||
#define LED_BLUE_TOGGLE /* not available */
|
|
||||||
/* @} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -27,5 +27,5 @@ void board_init(void)
|
|||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
/* initialize the on-board Amber "L" LED @ pin PB27 */
|
/* initialize the on-board Amber "L" LED @ pin PB27 */
|
||||||
gpio_init(LED_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,26 +32,11 @@ extern "C" {
|
|||||||
* @name LED pin definitions
|
* @name LED pin definitions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT PIOB
|
#define LED0_PIN GPIO_PIN(PB, 27)
|
||||||
#define LED_BIT PIO_PB27
|
|
||||||
#define LED_PIN GPIO_PIN(PB, 27)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_ON (PIOB->PIO_SODR = PIO_PB27)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_OFF (PIOB->PIO_CODR = PIO_PB27)
|
||||||
* @{
|
#define LED0_TOGGLE (PIOB->PIO_ODSR ^= PIO_PB27)
|
||||||
*/
|
|
||||||
#define LED_ON (LED_PORT->PIO_SODR = LED_BIT)
|
|
||||||
#define LED_OFF (LED_PORT->PIO_CODR = LED_BIT)
|
|
||||||
#define LED_TOGGLE (LED_PORT->PIO_ODSR ^= LED_BIT)
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
|
||||||
#define LED_GREEN_ON LED_ON
|
|
||||||
#define LED_GREEN_OFF LED_OFF
|
|
||||||
#define LED_GREEN_TOGGLE LED_TOGGLE
|
|
||||||
#define LED_RED_ON /* not available */
|
|
||||||
#define LED_RED_OFF /* not available */
|
|
||||||
#define LED_RED_TOGGLE /* not available */
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -43,28 +43,13 @@ void board_init(void)
|
|||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the board LED (connected to pin PB7) */
|
||||||
led_init();
|
DDRB |= (1 << DDB7);
|
||||||
|
PORTB &= ~(1 << 7);
|
||||||
|
|
||||||
enableIRQ();
|
enableIRQ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LED (Amber LED "L")
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LED is soldered
|
|
||||||
* onto the board it is fixed to its CPU pins.
|
|
||||||
*
|
|
||||||
* The LED is connected to the following pin:
|
|
||||||
* - LED: PB27
|
|
||||||
*/
|
|
||||||
void led_init(void)
|
|
||||||
{
|
|
||||||
LED_ENABLE_PORT;
|
|
||||||
LED_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the System, initialize IO via UART_0
|
* @brief Initialize the System, initialize IO via UART_0
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -35,29 +35,16 @@ extern "C" {
|
|||||||
#define UART_STDIO_BAUDRATE (9600U)
|
#define UART_STDIO_BAUDRATE (9600U)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT PORTB
|
#define LED0_PIN GPIO_PIN(1, 7)
|
||||||
#define LED_PIN (1 << 7)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << DDB7)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_ENABLE_PORT DDRB |= (1 << DDB7)
|
|
||||||
#define LED_ON LED_PORT |= LED_PIN
|
|
||||||
#define LED_OFF LED_PORT &= ~LED_PIN
|
|
||||||
#define LED_TOGGLE LED_PORT ^= LED_PIN;
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
#define LED0_ON (PORTB |= LED0_MASK)
|
||||||
#define LED_GREEN_ON LED_ON
|
#define LED0_OFF (PORTB &= ~LED0_MASK)
|
||||||
#define LED_GREEN_OFF LED_OFF
|
#define LED0_TOGGLE (PORTB ^= LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE LED_TOGGLE
|
|
||||||
#define LED_RED_ON /* not available */
|
|
||||||
#define LED_RED_OFF /* not available */
|
|
||||||
#define LED_RED_TOGGLE /* not available */
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -32,19 +32,22 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Board LED defines
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PIN (BIT25)
|
#define LED0_PIN GPIO_PIN(2, 25)
|
||||||
#define LED_GREEN_PIN (BIT26)
|
#define LED1_PIN GPIO_PIN(2, 26)
|
||||||
|
|
||||||
#define LED_GREEN_OFF (FIO3SET = LED_GREEN_PIN)
|
#define LED0_MASK (BIT25)
|
||||||
#define LED_GREEN_ON (FIO3CLR = LED_GREEN_PIN)
|
#define LED1_MASK (BIT26)
|
||||||
#define LED_GREEN_TOGGLE (FIO3PIN ^= LED_GREEN_PIN)
|
|
||||||
|
|
||||||
#define LED_RED_OFF (FIO3SET = LED_RED_PIN)
|
#define LED0_OFF (FIO3SET = LED0_MASK)
|
||||||
#define LED_RED_ON (FIO3CLR = LED_RED_PIN)
|
#define LED0_ON (FIO3CLR = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE (FIO3PIN ^= LED_RED_PIN)
|
#define LED0_TOGGLE (FIO3PIN ^= LED0_MASK)
|
||||||
|
|
||||||
|
#define LED1_OFF (FIO3SET = LED1_MASK)
|
||||||
|
#define LED1_ON (FIO3CLR = LED1_MASK)
|
||||||
|
#define LED1_TOGGLE (FIO3PIN ^= LED1_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -29,17 +29,6 @@ static void led_init_helper(int gpio_num) {
|
|||||||
IOC_PXX_OVER[gpio_num] = IOC_OVERRIDE_OE;
|
IOC_PXX_OVER[gpio_num] = IOC_OVERRIDE_OE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the SmartRF06's on-board LEDs
|
|
||||||
*/
|
|
||||||
void led_init(void)
|
|
||||||
{
|
|
||||||
led_init_helper(LED_RED_GPIO);
|
|
||||||
led_init_helper(LED_GREEN_GPIO);
|
|
||||||
led_init_helper(LED_YELLOW_GPIO);
|
|
||||||
led_init_helper(LED_ORANGE_GPIO);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the SmartRF06 board
|
* @brief Initialize the SmartRF06 board
|
||||||
*/
|
*/
|
||||||
@ -49,7 +38,10 @@ void board_init(void)
|
|||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
led_init();
|
led_init_helper(LED0_GPIO);
|
||||||
|
led_init_helper(LED1_GPIO);
|
||||||
|
led_init_helper(LED2_GPIO);
|
||||||
|
led_init_helper(LED3_GPIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
@ -28,34 +28,34 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Macros for controlling the on-board LEDs.
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_GPIO GPIO_PC0 /**< Red LED GPIO pin */
|
#define LED0_PIN GPIO_PIN(2, 0)
|
||||||
#define LED_YELLOW_GPIO GPIO_PC1 /**< Yellow LED GPIO pin */
|
#define LED1_PIN GPIO_PIN(2, 1)
|
||||||
#define LED_GREEN_GPIO GPIO_PC2 /**< Green LED GPIO pin */
|
#define LED2_PIN GPIO_PIN(2, 2)
|
||||||
#define LED_ORANGE_GPIO GPIO_PC3 /**< Orange LED GPIO pin */
|
#define LED3_PIN GPIO_PIN(2, 3)
|
||||||
|
|
||||||
#define LED_RED_ON cc2538_gpio_set(LED_GREEN_GPIO)
|
#define LED0_GPIO GPIO_PC0 /**< red LED */
|
||||||
#define LED_RED_OFF cc2538_gpio_clear(LED_GREEN_GPIO)
|
#define LED1_GPIO GPIO_PC1 /**< yellow LED */
|
||||||
#define LED_RED_TOGGLE cc2538_gpio_toggle(LED_GREEN_GPIO)
|
#define LED2_GPIO GPIO_PC2 /**< green LED */
|
||||||
|
#define LED3_GPIO GPIO_PC3 /**< orange LED */
|
||||||
|
|
||||||
#define LED_YELLOW_ON cc2538_gpio_set(LED_YELLOW_GPIO)
|
#define LED0_ON cc2538_gpio_set(LED0_GPIO)
|
||||||
#define LED_YELLOW_OFF cc2538_gpio_clear(LED_YELLOW_GPIO)
|
#define LED0_OFF cc2538_gpio_clear(LED0_GPIO)
|
||||||
#define LED_YELLOW_TOGGLE cc2538_gpio_toggle(LED_YELLOW_GPIO)
|
#define LED0_TOGGLE cc2538_gpio_toggle(LED0_GPIO)
|
||||||
|
|
||||||
#define LED_GREEN_ON cc2538_gpio_set(LED_GREEN_GPIO)
|
#define LED1_ON cc2538_gpio_set(LED1_GPIO)
|
||||||
#define LED_GREEN_OFF cc2538_gpio_clear(LED_GREEN_GPIO)
|
#define LED1_OFF cc2538_gpio_clear(LED1_GPIO)
|
||||||
#define LED_GREEN_TOGGLE cc2538_gpio_toggle(LED_GREEN_GPIO)
|
#define LED1_TOGGLE cc2538_gpio_toggle(LED1_GPIO)
|
||||||
|
|
||||||
#define LED_ORANGE_ON cc2538_gpio_set(LED_ORANGE_GPIO)
|
#define LED2_ON cc2538_gpio_set(LED2_GPIO)
|
||||||
#define LED_ORANGE_OFF cc2538_gpio_clear(LED_ORANGE_GPIO)
|
#define LED2_OFF cc2538_gpio_clear(LED2_GPIO)
|
||||||
#define LED_ORANGE_TOGGLE cc2538_gpio_toggle(LED_ORANGE_GPIO)
|
#define LED2_TOGGLE cc2538_gpio_toggle(LED2_GPIO)
|
||||||
|
|
||||||
/* Default to red if the color is not specified: */
|
#define LED3_ON cc2538_gpio_set(LED3_GPIO)
|
||||||
#define LED_ON LED_RED_ON
|
#define LED3_OFF cc2538_gpio_clear(LED3_GPIO)
|
||||||
#define LED_OFF LED_RED_OFF
|
#define LED3_TOGGLE cc2538_gpio_toggle(LED3_GPIO)
|
||||||
#define LED_TOGGLE LED_RED_TOGGLE
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -27,7 +27,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* for correct inclusion of <msp430.h> */
|
/**
|
||||||
|
* @brief Define the CPU model for the <msp430.h>
|
||||||
|
*/
|
||||||
#ifndef __CC430F6137__
|
#ifndef __CC430F6137__
|
||||||
#define __CC430F6137__
|
#define __CC430F6137__
|
||||||
#endif
|
#endif
|
||||||
@ -53,18 +55,6 @@ extern "C" {
|
|||||||
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
|
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief LED defines for compatibility
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON /* not present */
|
|
||||||
#define LED_RED_OFF /* not present */
|
|
||||||
#define LED_RED_TOGGLE /* not present */
|
|
||||||
#define LED_GREEN_ON /* not present */
|
|
||||||
#define LED_GREEN_OFF /* not present */
|
|
||||||
#define LED_GREEN_TOGGLE /* not present */
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -30,24 +30,29 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Macros for controlling the on-board LEDs.
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_GREEN_PIN 0x08
|
#define LED0_PIN GPIO_PIN(5, 7)
|
||||||
#define LED_BLUE_PIN 0x04
|
#define LED1_PIN GPIO_PIN(5, 2)
|
||||||
#define LED_RED_PIN 0x02
|
#define LED2_PIN GPIO_PIN(5, 1)
|
||||||
|
|
||||||
#define LED_GREEN_ON GPIO_PORTF_DATA_R |= LED_GREEN_PIN
|
#define LED_PORT (GPIO_PORTF_DATA_R)
|
||||||
#define LED_GREEN_OFF GPIO_PORTF_DATA_R &= ~(LED_GREEN_PIN)
|
#define LED0_MASK (1 << 7)
|
||||||
#define LED_GREEN_TOGGLE /* not available */
|
#define LED1_MASK (1 << 2)
|
||||||
|
#define LED2_MASK (1 << 1)
|
||||||
|
|
||||||
#define LED_BLUE_ON GPIO_PORTF_DATA_R |= LED_BLUE_PIN
|
#define LED0_ON (LED_PORT |= LED0_MASK)
|
||||||
#define LED_BLUE_OFF GPIO_PORTF_DATA_R &= ~(LED_BLUE_PIN)
|
#define LED0_OFF (LED_PORT &= ~LED0_MASK)
|
||||||
#define LED_BLUE_TOGGLE /* not available */
|
#define LED0_TOGGLE (LED_PORT ^= LED0_MASK)
|
||||||
|
|
||||||
#define LED_RED_ON GPIO_PORTF_DATA_R |= LED_RED_PIN
|
#define LED1_ON (LED_PORT |= LED1_MASK)
|
||||||
#define LED_RED_OFF GPIO_PORTF_DATA_R &= ~(LED_RED_PIN)
|
#define LED1_OFF (LED_PORT &= ~LED1_MASK)
|
||||||
#define LED_RED_TOGGLE /* not available */
|
#define LED1_TOGGLE (LED_PORT ^= LED1_MASK)
|
||||||
|
|
||||||
|
#define LED2_ON (LED_PORT |= LED2_MASK)
|
||||||
|
#define LED2_OFF (LED_PORT &= ~LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (LED_PORT ^= LED2_MASK)
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,44 +20,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs, this is done first for debugging purposes */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs (LD4,LD5 and LD6)
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
|
||||||
* onto the board they are fixed to their CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pins:
|
|
||||||
* - LD4: PA 1
|
|
||||||
* - LD5: PA 3
|
|
||||||
* - LD6: PA 2
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOD */
|
|
||||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
|
||||||
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_PORT->MODER &= ~(0x000000FC);
|
|
||||||
LED_PORT->MODER |= 0x00000054;
|
|
||||||
/* set output speed high-speed */
|
|
||||||
LED_PORT->OSPEEDR |= 0x000000FC;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_PORT->OTYPER &= ~(0x000E);
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_PORT->PUPDR &= ~(0x000000FC);
|
|
||||||
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_PORT->BSRRL = 0x00E;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -30,40 +30,29 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(PORT_A, 1)
|
||||||
|
#define LED1_PIN GPIO_PIN(PORT_A, 3)
|
||||||
|
#define LED2_PIN GPIO_PIN(PORT_A, 2)
|
||||||
|
|
||||||
#define LED_PORT GPIOA
|
#define LED_PORT GPIOA
|
||||||
#define LD4_PIN (1 << 1)
|
#define LED0_MASK (1 << 1)
|
||||||
#define LD5_PIN (1 << 3)
|
#define LED1_MASK (1 << 3)
|
||||||
#define LD6_PIN (1 << 2)
|
#define LED2_MASK (1 << 2)
|
||||||
|
|
||||||
/** @} */
|
#define LED0_ON (LED_PORT->BSRRH = LED0_MASK)
|
||||||
|
#define LED0_OFF (LED_PORT->BSRRL = LED0_MASK)
|
||||||
|
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
|
||||||
|
|
||||||
/**
|
#define LED1_ON (LED_PORT->BSRRH = LED1_MASK)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_OFF (LED_PORT->BSRRL = LED1_MASK)
|
||||||
* @{
|
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
|
||||||
*/
|
|
||||||
#define LD4_ON (LED_PORT->BSRRH = LD4_PIN)
|
|
||||||
#define LD4_OFF (LED_PORT->BSRRL = LD4_PIN)
|
|
||||||
#define LD4_TOGGLE (LED_PORT->ODR ^= LD4_PIN)
|
|
||||||
#define LD5_ON (LED_PORT->BSRRH = LD5_PIN)
|
|
||||||
#define LD5_OFF (LED_PORT->BSRRL = LD5_PIN)
|
|
||||||
#define LD5_TOGGLE (LED_PORT->ODR ^= LD5_PIN)
|
|
||||||
#define LD6_ON (LED_PORT->BSRRH = LD6_PIN)
|
|
||||||
#define LD6_OFF (LED_PORT->BSRRL = LD6_PIN)
|
|
||||||
#define LD6_TOGGLE (LED_PORT->ODR ^= LD6_PIN)
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
#define LED2_ON (LED_PORT->BSRRH = LED2_MASK)
|
||||||
#define LED_GREEN_ON LD6_ON
|
#define LED2_OFF (LED_PORT->BSRRL = LED2_MASK)
|
||||||
#define LED_GREEN_OFF LD6_OFF
|
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
|
||||||
#define LED_GREEN_TOGGLE LD6_TOGGLE
|
|
||||||
#define LED_RED_ON LD5_ON
|
|
||||||
#define LED_RED_OFF LD5_OFF
|
|
||||||
#define LED_RED_TOGGLE LD5_TOGGLE
|
|
||||||
#define LED_ORANGE_ON LD4_ON
|
|
||||||
#define LED_ORANGE_OFF LD4_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE LD4_TOGGLE
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,34 +19,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs and turn them off */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
}
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_set(LED0_PIN);
|
||||||
/**
|
gpio_set(LED1_PIN);
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The LEDs initialization is hard-coded in this function. As the LED is soldered
|
|
||||||
* onto the board it is fixed to its CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pin:
|
|
||||||
* - Green: PB12
|
|
||||||
* - Red: PB10
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* green pin */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
|
|
||||||
LED_GREEN_PORT->CR[0] = (0x3 << ((LED_GREEN_PIN-8)*4));
|
|
||||||
/* red pin */;
|
|
||||||
LED_RED_PORT->CR[0] = (0x3 << ((LED_RED_PIN-8)*4));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,32 +81,22 @@ extern "C" {
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PORT (GPIOB)
|
#define LED0_PIN GPIO_PIN(PORT_B, 10)
|
||||||
#define LED_RED_PIN (10)
|
#define LED1_PIN GPIO_PIN(PORT_B, 12)
|
||||||
#define LED_RED_GPIO GPIO_PIN(PORT_B,10)
|
|
||||||
#define LED_GREEN_PORT (GPIOB)
|
|
||||||
#define LED_GREEN_PIN (12)
|
|
||||||
#define LED_GREEN_GPIO GPIO_PIN(PORT_B,12)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 10)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_MASK (1 << 12)
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON (LED_RED_PORT->ODR &= ~(1<<LED_RED_PIN))
|
|
||||||
#define LED_RED_OFF (LED_RED_PORT->ODR |= (1<<LED_RED_PIN))
|
|
||||||
#define LED_RED_TOGGLE (LED_RED_PORT->ODR ^= (1<<LED_RED_PIN))
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->ODR &= ~(1<<LED_GREEN_PIN))
|
#define LED0_ON (GPIOB->ODR &= ~LED0_MASK)
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->ODR |= (1<<LED_GREEN_PIN))
|
#define LED0_OFF (GPIOB->ODR |= LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
|
#define LED0_TOGGLE (GPIOB->ODR ^= LED0_MASK)
|
||||||
|
|
||||||
#define LED_ORANGE_ON
|
#define LED1_ON (GPIOB->ODR &= ~LED1_MASK)
|
||||||
#define LED_ORANGE_OFF
|
#define LED1_OFF (GPIOB->ODR |= LED1_MASK)
|
||||||
#define LED_ORANGE_TOGGLE
|
#define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,34 +20,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
leds_init();
|
/* initialize the CPU core */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/* initialize and turn off the on-board RGB-LED */
|
||||||
* @brief Initialize the boards on-board RGB-LED
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
*
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
*/
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
static void leds_init(void)
|
gpio_set(LED0_PIN);
|
||||||
{
|
gpio_set(LED1_PIN);
|
||||||
/* enable clock */
|
gpio_set(LED2_PIN);
|
||||||
LED_B_PORT_CLKEN();
|
|
||||||
LED_G_PORT_CLKEN();
|
|
||||||
LED_R_PORT_CLKEN();
|
|
||||||
/* configure pins as gpio */
|
|
||||||
LED_B_PORT->PCR[LED_B_PIN] = PORT_PCR_MUX(1);
|
|
||||||
LED_G_PORT->PCR[LED_G_PIN] = PORT_PCR_MUX(1);
|
|
||||||
LED_R_PORT->PCR[LED_R_PIN] = PORT_PCR_MUX(1);
|
|
||||||
LED_B_GPIO->PDDR |= (1 << LED_B_PIN);
|
|
||||||
LED_G_GPIO->PDDR |= (1 << LED_G_PIN);
|
|
||||||
LED_R_GPIO->PDDR |= (1 << LED_R_PIN);
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_B_GPIO->PSOR |= (1 << LED_B_PIN);
|
|
||||||
LED_G_GPIO->PSOR |= (1 << LED_G_PIN);
|
|
||||||
LED_R_GPIO->PSOR |= (1 << LED_R_PIN);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,44 +31,28 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_R_PORT_CLKEN() (PORTB_CLOCK_GATE = 1) /**< Clock Enable for PORTD*/
|
#define LED0_PIN GPIO_PIN(PORT_B, 22)
|
||||||
#define LED_G_PORT_CLKEN() (PORTE_CLOCK_GATE = 1) /**< Clock Enable for PORTE*/
|
#define LED1_PIN GPIO_PIN(PORT_E, 26)
|
||||||
#define LED_B_PORT_CLKEN() (PORTB_CLOCK_GATE = 1) /**< Clock Enable for PORTB*/
|
#define LED2_PIN GPIO_PIN(PORT_B, 21)
|
||||||
#define LED_R_PORT PORTB /**< PORT for Red LED*/
|
|
||||||
#define LED_R_GPIO GPIOB /**< GPIO-Device for Red LED*/
|
|
||||||
#define LED_G_PORT PORTE /**< PORT for Green LED*/
|
|
||||||
#define LED_G_GPIO GPIOE /**< GPIO-Device for Green LED*/
|
|
||||||
#define LED_B_PORT PORTB /**< PORT for Blue LED*/
|
|
||||||
#define LED_B_GPIO GPIOB /**< GPIO-Device for Blue LED*/
|
|
||||||
#define LED_R_PIN 22 /**< Red LED connected to PINx*/
|
|
||||||
#define LED_G_PIN 26 /**< Green LED connected to PINx*/
|
|
||||||
#define LED_B_PIN 21 /**< Blue LED connected to PINx*/
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 22)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_MASK (1 << 26)
|
||||||
* @{
|
#define LED2_MASK (1 << 21)
|
||||||
*/
|
|
||||||
#define LED_B_ON (LED_B_GPIO->PCOR = (1 << LED_B_PIN))
|
|
||||||
#define LED_B_OFF (LED_B_GPIO->PSOR = (1 << LED_B_PIN))
|
|
||||||
#define LED_B_TOGGLE (LED_B_GPIO->PTOR = (1 << LED_B_PIN))
|
|
||||||
#define LED_G_ON (LED_G_GPIO->PCOR = (1 << LED_G_PIN))
|
|
||||||
#define LED_G_OFF (LED_G_GPIO->PSOR = (1 << LED_G_PIN))
|
|
||||||
#define LED_G_TOGGLE (LED_G_GPIO->PTOR = (1 << LED_G_PIN))
|
|
||||||
#define LED_R_ON (LED_R_GPIO->PCOR = (1 << LED_R_PIN))
|
|
||||||
#define LED_R_OFF (LED_R_GPIO->PSOR = (1 << LED_R_PIN))
|
|
||||||
#define LED_R_TOGGLE (LED_R_GPIO->PTOR = (1 << LED_R_PIN))
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
#define LED0_ON (GPIOB->PCOR = LED0_MASK)
|
||||||
#define LED_GREEN_ON LED_G_ON
|
#define LED0_OFF (GPIOB->PSOR = LED0_MASK)
|
||||||
#define LED_GREEN_OFF LED_G_OFF
|
#define LED0_TOGGLE (GPIOB->PTOR = LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE LED_G_TOGGLE
|
|
||||||
#define LED_RED_ON LED_R_ON
|
#define LED1_ON (GPIOE->PCOR = LED1_MASK)
|
||||||
#define LED_RED_OFF LED_R_OFF
|
#define LED1_OFF (GPIOE->PSOR = LED1_MASK)
|
||||||
#define LED_RED_TOGGLE LED_R_TOGGLE
|
#define LED1_TOGGLE (GPIOE->PTOR = LED1_MASK)
|
||||||
|
|
||||||
|
#define LED2_ON (GPIOB->PCOR = LED2_MASK)
|
||||||
|
#define LED2_OFF (GPIOB->PSOR = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (GPIOB->PTOR = LED2_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,41 +19,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs and turn them off */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
}
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
/**
|
gpio_set(LED0_PIN);
|
||||||
* @brief Initialize the boards on-board LEDs
|
gpio_set(LED1_PIN);
|
||||||
*
|
gpio_set(LED2_PIN);
|
||||||
* The LEDs initialization is hard-coded in this function. As the LED is soldered
|
|
||||||
* onto the board it is fixed to its CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pin:
|
|
||||||
* - Green: PB5
|
|
||||||
* - Orange: PC10
|
|
||||||
* - Red: PD2
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* green pin */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
|
|
||||||
LED_GREEN_PORT->CR[0] = (0x3 << (LED_GREEN_PIN*4));
|
|
||||||
|
|
||||||
/* orange pin */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
|
|
||||||
LED_ORANGE_PORT->CR[1] = (0x3 << ((LED_ORANGE_PIN-8)*4));
|
|
||||||
|
|
||||||
/* red pin */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
|
|
||||||
LED_RED_PORT->CR[0] = (0x3 << (LED_RED_PIN*4));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,35 +108,28 @@ extern "C" {
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PORT (GPIOD)
|
#define LED0_PIN GPIO_PIN(PORT_D, 2)
|
||||||
#define LED_RED_PIN (2)
|
#define LED1_PIN GPIO_PIN(PORT_B, 5)
|
||||||
#define LED_RED_GPIO GPIO_PIN(PORT_D,2)
|
#define LED2_PIN GPIO_PIN(PORT_C, 10)
|
||||||
#define LED_GREEN_PORT (GPIOB)
|
|
||||||
#define LED_GREEN_PIN (5)
|
|
||||||
#define LED_GREEN_GPIO GPIO_PIN(PORT_B,5)
|
|
||||||
#define LED_ORANGE_PORT (GPIOC)
|
|
||||||
#define LED_ORANGE_PIN (10)
|
|
||||||
#define LED_ORANGE_GPIO GPIO_PIN(PORT_C,10)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 2)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_MASK (1 << 5)
|
||||||
* @{
|
#define LED2_MASK (1 << 10)
|
||||||
*/
|
|
||||||
#define LED_RED_ON (LED_RED_PORT->ODR &= ~(1<<LED_RED_PIN))
|
|
||||||
#define LED_RED_OFF (LED_RED_PORT->ODR |= (1<<LED_RED_PIN))
|
|
||||||
#define LED_RED_TOGGLE (LED_RED_PORT->ODR ^= (1<<LED_RED_PIN))
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->ODR &= ~(1<<LED_GREEN_PIN))
|
#define LED0_ON (GPIOD->ODR &= ~LED0_MASK)
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->ODR |= (1<<LED_GREEN_PIN))
|
#define LED0_OFF (GPIOD->ODR |= LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
|
#define LED0_TOGGLE (GPIOD->ODR ^= LED0_MASK)
|
||||||
|
|
||||||
#define LED_ORANGE_ON (LED_ORANGE_PORT->ODR &= ~(1<<LED_ORANGE_PIN))
|
#define LED1_ON (GPIOB->ODR &= ~LED1_MASK)
|
||||||
#define LED_ORANGE_OFF (LED_ORANGE_PORT->ODR |= (1<<LED_ORANGE_PIN))
|
#define LED1_OFF (GPIOB->ODR |= LED1_MASK)
|
||||||
#define LED_ORANGE_TOGGLE (LED_ORANGE_PORT->ODR ^= (1<<LED_ORANGE_PIN))
|
#define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
|
||||||
|
|
||||||
|
#define LED2_ON (GPIOC->ODR &= ~LED2_MASK)
|
||||||
|
#define LED2_OFF (GPIOC->ODR |= LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (GPIOC->ODR ^= LED2_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -33,19 +33,19 @@ static const saul_gpio_params_t saul_gpio_params[] =
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
.name = "LED(red)",
|
.name = "LED(red)",
|
||||||
.pin = LED_RED_GPIO,
|
.pin = LED0_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL,
|
.pull = GPIO_NOPULL,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "LED(green)",
|
.name = "LED(green)",
|
||||||
.pin = LED_GREEN_GPIO,
|
.pin = LED1_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL,
|
.pull = GPIO_NOPULL,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "LED(orange)",
|
.name = "LED(orange)",
|
||||||
.pin = LED_ORANGE_GPIO,
|
.pin = LED2_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL,
|
.pull = GPIO_NOPULL,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -19,40 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function.
|
|
||||||
* As the LED is soldered onto the board it is fixed to
|
|
||||||
* its CPU pins.
|
|
||||||
*
|
|
||||||
* The red LED is connected to pin PC3
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOC */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_RED_PORT->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR3;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_RED_PORT->OTYPER &= ~(GPIO_OTYPER_OT_3);
|
|
||||||
/* configure pin as general output */
|
|
||||||
LED_RED_PORT->MODER &= ~(GPIO_MODER_MODER3);
|
|
||||||
LED_RED_PORT->MODER |= GPIO_MODER_MODER3_0;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_RED_PORT->PUPDR &= ~(GPIO_PUPDR_PUPDR3);
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_RED_PORT->BRR = (1 << 3);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -31,27 +31,17 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PORT (GPIOC)
|
#define LED0_PIN GPIO_PIN(PORT_C, 3)
|
||||||
#define LED_RED_PIN (3)
|
|
||||||
#define LED_RED_GPIO GPIO_PIN(PORT_C,3)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_PORT (GPIOC)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_MASK (1 << 3)
|
||||||
* @{
|
|
||||||
*/
|
#define LED0_ON (LED0_PORT->BSRRL = LED0_MASK)
|
||||||
#define LED_GREEN_ON
|
#define LED0_OFF (LED0_PORT->BSRRH = LED0_MASK)
|
||||||
#define LED_GREEN_OFF
|
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE
|
|
||||||
#define LED_ORANGE_ON
|
|
||||||
#define LED_ORANGE_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE
|
|
||||||
#define LED_RED_ON (LED_RED_PORT->BSRRL = (1 << LED_RED_PIN))
|
|
||||||
#define LED_RED_OFF (LED_RED_PORT->BSRRH = (1 << LED_RED_PIN))
|
|
||||||
#define LED_RED_TOGGLE (LED_RED_PORT->ODR ^= (1 << LED_RED_PIN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -48,8 +48,8 @@ void board_init(void)
|
|||||||
static void leds_init(void)
|
static void leds_init(void)
|
||||||
{
|
{
|
||||||
/* configure LED pins as output */
|
/* configure LED pins as output */
|
||||||
LED_PORT->FIODIR |= (LED1_PIN | LED2_PIN | LED3_PIN | LED4_PIN);
|
LED_PORT->FIODIR |= (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
|
||||||
|
|
||||||
/* clear all LEDs */
|
/* clear all LEDs */
|
||||||
LED_PORT->FIOCLR = (LED1_PIN | LED2_PIN | LED3_PIN | LED4_PIN);
|
LED_PORT->FIOCLR = (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,40 +33,32 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT LPC_GPIO1
|
#define LED0_PIN GPIO_PIN(1, 18)
|
||||||
#define LED1_PIN BIT18
|
#define LED1_PIN GPIO_PIN(1, 20)
|
||||||
#define LED2_PIN BIT20
|
#define LED2_PIN GPIO_PIN(1, 21)
|
||||||
#define LED3_PIN BIT21
|
#define LED3_PIN GPIO_PIN(1, 23)
|
||||||
#define LED4_PIN BIT23
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED_PORT (LPC_GPIO1)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_MASK (BIT18)
|
||||||
* @{
|
#define LED1_MASK (BIT20)
|
||||||
*/
|
#define LED2_MASK (BIT21)
|
||||||
#define LED1_ON (LED_PORT->FIOSET = LED1_PIN)
|
#define LED3_MASK (BIT23)
|
||||||
#define LED1_OFF (LED_PORT->FIOCLR = LED1_PIN)
|
|
||||||
#define LED1_TOGGLE (LED_PORT->FIOPIN ^= LED1_PIN)
|
|
||||||
#define LED2_ON (LED_PORT->FIOSET = LED2_PIN)
|
|
||||||
#define LED2_OFF (LED_PORT->FIOCLR = LED2_PIN)
|
|
||||||
#define LED2_TOGGLE (LED_PORT->FIOPIN ^= LED2_PIN)
|
|
||||||
#define LED3_ON (LED_PORT->FIOSET = LED3_PIN)
|
|
||||||
#define LED3_OFF (LED_PORT->FIOCLR = LED3_PIN)
|
|
||||||
#define LED3_TOGGLE (LED_PORT->FIOPIN ^= LED3_PIN)
|
|
||||||
#define LED4_ON (LED_PORT->FIOSET = LED4_PIN)
|
|
||||||
#define LED4_OFF (LED_PORT->FIOCLR = LED4_PIN)
|
|
||||||
#define LED4_TOGGLE (LED_PORT->FIOPIN ^= LED4_PIN)
|
|
||||||
|
|
||||||
/* for compatibility to other boards */
|
#define LED0_ON (LED_PORT->FIOSET = LED0_MASK)
|
||||||
#define LED_GREEN_ON LED1_ON
|
#define LED0_OFF (LED_PORT->FIOCLR = LED0_MASK)
|
||||||
#define LED_GREEN_OFF LED1_OFF
|
#define LED0_TOGGLE (LED_PORT->FIOPIN ^= LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE LED1_TOGGLE
|
#define LED1_ON (LED_PORT->FIOSET = LED1_MASK)
|
||||||
#define LED_RED_ON LED4_ON
|
#define LED1_OFF (LED_PORT->FIOCLR = LED1_MASK)
|
||||||
#define LED_RED_OFF LED4_OFF
|
#define LED1_TOGGLE (LED_PORT->FIOPIN ^= LED1_MASK)
|
||||||
#define LED_RED_TOGGLE LED4_TOGGLE
|
#define LED2_ON (LED_PORT->FIOSET = LED2_MASK)
|
||||||
|
#define LED2_OFF (LED_PORT->FIOCLR = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (LED_PORT->FIOPIN ^= LED2_MASK)
|
||||||
|
#define LED3_ON (LED_PORT->FIOSET = LED3_MASK)
|
||||||
|
#define LED3_OFF (LED_PORT->FIOCLR = LED3_MASK)
|
||||||
|
#define LED3_TOGGLE (LED_PORT->FIOPIN ^= LED3_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "board-conf.h"
|
#include "board.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "flashrom.h"
|
#include "flashrom.h"
|
||||||
|
|
||||||
|
|||||||
@ -199,8 +199,6 @@ void board_init(void)
|
|||||||
msp430_cpu_init();
|
msp430_cpu_init();
|
||||||
msb_ports_init();
|
msb_ports_init();
|
||||||
|
|
||||||
LED_RED_ON;
|
|
||||||
|
|
||||||
msp430_set_cpu_speed(CLOCK_CORECLOCK);
|
msp430_set_cpu_speed(CLOCK_CORECLOCK);
|
||||||
|
|
||||||
/* finally initialize STDIO over UART */
|
/* finally initialize STDIO over UART */
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013 Freie Universität Berlin
|
|
||||||
*
|
|
||||||
* This file is subject to the terms and conditions of the GNU Lesser
|
|
||||||
* General Public License v2.1. See the file LICENSE in the top level
|
|
||||||
* directory for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup boards_msb430-common MSB-430 common
|
|
||||||
* @ingroup boards
|
|
||||||
* @brief Common files for all MSB-430 boards
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* @file
|
|
||||||
* @brief Common definitions for all msb-430 based boards
|
|
||||||
*
|
|
||||||
* @author unknown
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BOARD_CONF_H_
|
|
||||||
#define BOARD_CONF_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define INFOMEM (0x1000)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* BOARD-CONF_H */
|
|
||||||
/** @} */
|
|
||||||
66
boards/msb-430-common/include/board_common.h
Normal file
66
boards/msb-430-common/include/board_common.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013-2016 Freie Universität Berlin
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
* directory for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup boards_msb430-common MSB-430 common
|
||||||
|
* @ingroup boards
|
||||||
|
* @brief Common files for all MSB-430 boards
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Common definitions for all msb-430 based boards
|
||||||
|
*
|
||||||
|
* @author unknown
|
||||||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOARD_COMMON_H_
|
||||||
|
#define BOARD_COMMON_H_
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Address of the info memory
|
||||||
|
*/
|
||||||
|
#define INFOMEM (0x1000)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Xtimer configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define XTIMER (0)
|
||||||
|
#define XTIMER_CHAN (0)
|
||||||
|
#define XTIMER_MASK (0xffff0000)
|
||||||
|
#define XTIMER_SHIFT_ON_COMPARE (4)
|
||||||
|
#define XTIMER_BACKOFF (40)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LED pin definitions and handlers
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(4, 7)
|
||||||
|
|
||||||
|
#define LED_OUT_REG (P5OUT)
|
||||||
|
#define LED0_MASK (1 << 7)
|
||||||
|
|
||||||
|
#define LED0_ON (LED_OUT_REG &= ~LED0_MASK)
|
||||||
|
#define LED0_OFF (LED_OUT_REG |= LED0_MASK)
|
||||||
|
#define LED0_TOGGLE (LED_OUT_REG ^= LED0_MASK)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* BOARD-CONF_H */
|
||||||
|
/** @} */
|
||||||
@ -34,58 +34,35 @@
|
|||||||
#ifndef MSB_BOARD_H_
|
#ifndef MSB_BOARD_H_
|
||||||
#define MSB_BOARD_H_
|
#define MSB_BOARD_H_
|
||||||
|
|
||||||
#include "board-conf.h"
|
#include "board_common.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* for correct inclusion of <msp430.h> */
|
/**
|
||||||
|
* @brief Define the CPU model for the <msp430.h>
|
||||||
|
*/
|
||||||
#ifndef __MSP430F1612__
|
#ifndef __MSP430F1612__
|
||||||
#define __MSP430F1612__
|
#define __MSP430F1612__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Xtimer configuration
|
* @brief CPU core configuration
|
||||||
|
*
|
||||||
|
* @todo Move this to the periph_conf.h
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define XTIMER (0)
|
|
||||||
#define XTIMER_CHAN (0)
|
|
||||||
#define XTIMER_MASK (0xffff0000)
|
|
||||||
#define XTIMER_SHIFT_ON_COMPARE (4)
|
|
||||||
#define XTIMER_BACKOFF (40)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/* MSB430 core */
|
|
||||||
#define MSP430_INITIAL_CPU_SPEED 2457600uL
|
#define MSP430_INITIAL_CPU_SPEED 2457600uL
|
||||||
#define F_CPU MSP430_INITIAL_CPU_SPEED
|
#define F_CPU MSP430_INITIAL_CPU_SPEED
|
||||||
#define F_RC_OSCILLATOR 32768
|
#define F_RC_OSCILLATOR 32768
|
||||||
#define MSP430_HAS_DCOR 1
|
#define MSP430_HAS_DCOR 1
|
||||||
#define MSP430_HAS_EXTERNAL_CRYSTAL 0
|
#define MSP430_HAS_EXTERNAL_CRYSTAL 0
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief LED definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LEDS_PxDIR (P5DIR)
|
|
||||||
#define LEDS_PxOUT (P5OUT)
|
|
||||||
#define LEDS_CONF_RED (0x80)
|
|
||||||
#define LEDS_CONF_GREEN (0x00)
|
|
||||||
#define LEDS_CONF_YELLOW (0x00)
|
|
||||||
|
|
||||||
#define LED_RED_ON (LEDS_PxOUT &=~LEDS_CONF_RED)
|
|
||||||
#define LED_RED_OFF (LEDS_PxOUT |= LEDS_CONF_RED)
|
|
||||||
#define LED_RED_TOGGLE (LEDS_PxOUT ^= LEDS_CONF_RED)
|
|
||||||
#define LED_GREEN_ON /* not present */
|
|
||||||
#define LED_GREEN_OFF /* not present */
|
|
||||||
#define LED_GREEN_TOGGLE /* not present */
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "board-conf.h"
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif /* MSB_BOARD_H_ */
|
#endif /* MSB_BOARD_H_ */
|
||||||
|
|||||||
@ -22,56 +22,35 @@
|
|||||||
#ifndef MSB_BOARD_H_
|
#ifndef MSB_BOARD_H_
|
||||||
#define MSB_BOARD_H_
|
#define MSB_BOARD_H_
|
||||||
|
|
||||||
|
#include "board_common.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* for correct inclusion of <msp430.h> */
|
/**
|
||||||
|
* @brief Define the CPU model for the <msp430.h>
|
||||||
|
*/
|
||||||
#ifndef __MSP430F1612__
|
#ifndef __MSP430F1612__
|
||||||
#define __MSP430F1612__
|
#define __MSP430F1612__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Xtimer configuration
|
* @brief CPU core configuration
|
||||||
|
*
|
||||||
|
* @todo Move this to the periph_conf.h
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define XTIMER (0)
|
|
||||||
#define XTIMER_CHAN (0)
|
|
||||||
#define XTIMER_MASK (0xffff0000)
|
|
||||||
#define XTIMER_SHIFT_ON_COMPARE (4)
|
|
||||||
#define XTIMER_BACKOFF (40)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
//MSB430 core
|
|
||||||
#define MSP430_INITIAL_CPU_SPEED 7372800uL
|
#define MSP430_INITIAL_CPU_SPEED 7372800uL
|
||||||
#define F_CPU MSP430_INITIAL_CPU_SPEED
|
#define F_CPU MSP430_INITIAL_CPU_SPEED
|
||||||
#define F_RC_OSCILLATOR 32768
|
#define F_RC_OSCILLATOR 32768
|
||||||
#define MSP430_HAS_DCOR 1
|
#define MSP430_HAS_DCOR 1
|
||||||
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
|
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief LED definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LEDS_PxDIR (P5DIR)
|
|
||||||
#define LEDS_PxOUT (P5OUT)
|
|
||||||
#define LEDS_CONF_RED (0x80)
|
|
||||||
#define LEDS_CONF_GREEN (0x00)
|
|
||||||
#define LEDS_CONF_YELLOW (0x00)
|
|
||||||
|
|
||||||
#define LED_RED_ON (LEDS_PxOUT &=~LEDS_CONF_RED)
|
|
||||||
#define LED_RED_OFF (LEDS_PxOUT |= LEDS_CONF_RED)
|
|
||||||
#define LED_RED_TOGGLE (LEDS_PxOUT ^= LEDS_CONF_RED)
|
|
||||||
#define LED_GREEN_ON /* not present */
|
|
||||||
#define LED_GREEN_OFF /* not present */
|
|
||||||
#define LED_GREEN_TOGGLE /* not present */
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "board-conf.h"
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif /* MSB_BOARD_H_ */
|
#endif /* MSB_BOARD_H_ */
|
||||||
|
|||||||
@ -27,28 +27,6 @@
|
|||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
void loop_delay(void)
|
|
||||||
{
|
|
||||||
volatile uint16_t i, j;
|
|
||||||
|
|
||||||
for (i = 1; i < 30; i++) {
|
|
||||||
for (j = 1; j != 0; j++) {
|
|
||||||
asm volatile(" nop ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void bl_blink(void)
|
|
||||||
{
|
|
||||||
LED_RED_ON;
|
|
||||||
LED_GREEN_ON;
|
|
||||||
|
|
||||||
loop_delay();
|
|
||||||
|
|
||||||
LED_RED_OFF;
|
|
||||||
LED_GREEN_OFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
void bl_init_ports(void)
|
void bl_init_ports(void)
|
||||||
{
|
{
|
||||||
gpio_init_ports();
|
gpio_init_ports();
|
||||||
@ -58,13 +36,11 @@ void bl_init_ports(void)
|
|||||||
PINSEL0 &= ~(BIT5 + BIT7);
|
PINSEL0 &= ~(BIT5 + BIT7);
|
||||||
|
|
||||||
/* LEDS */
|
/* LEDS */
|
||||||
FIO3DIR |= LED_RED_PIN;
|
FIO3DIR |= LED0_MASK;
|
||||||
FIO3DIR |= LED_GREEN_PIN;
|
FIO3DIR |= LED1_MASK;
|
||||||
LED_RED_OFF;
|
|
||||||
LED_GREEN_OFF;
|
|
||||||
|
|
||||||
/* short blinking of both of the LEDs on startup */
|
LED0_OFF;
|
||||||
bl_blink();
|
LED0_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_clks1(void)
|
void init_clks1(void)
|
||||||
|
|||||||
@ -29,19 +29,22 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Board LED defines
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PIN (BIT25)
|
#define LED0_PIN GPIO_PIN(2, 25)
|
||||||
#define LED_GREEN_PIN (BIT26)
|
#define LED1_PIN GPIO_PIN(2, 26)
|
||||||
|
|
||||||
#define LED_GREEN_OFF (FIO3SET = LED_GREEN_PIN)
|
#define LED0_MASK (BIT25)
|
||||||
#define LED_GREEN_ON (FIO3CLR = LED_GREEN_PIN)
|
#define LED1_MASK (BIT26)
|
||||||
#define LED_GREEN_TOGGLE (FIO3PIN ^= LED_GREEN_PIN)
|
|
||||||
|
|
||||||
#define LED_RED_OFF (FIO3SET = LED_RED_PIN)
|
#define LED0_OFF (FIO3SET = LED0_MASK)
|
||||||
#define LED_RED_ON (FIO3CLR = LED_RED_PIN)
|
#define LED0_ON (FIO3CLR = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE (FIO3PIN ^= LED_RED_PIN)
|
#define LED0_TOGGLE (FIO3PIN ^= LED0_MASK)
|
||||||
|
|
||||||
|
#define LED1_OFF (FIO3SET = LED1_MASK)
|
||||||
|
#define LED1_ON (FIO3CLR = LED1_MASK)
|
||||||
|
#define LED1_TOGGLE (FIO3PIN ^= LED1_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -49,28 +49,29 @@ extern "C" {
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT GPIOB
|
#define LED0_PIN GPIO_PIN(1, 8)
|
||||||
#define LED_RED_PIN (1 << 8)
|
#define LED1_PIN GPIO_PIN(1, 14)
|
||||||
#define LED_YELLOW_PIN (1 << 14)
|
#define LED2_PIN GPIO_PIN(1, 15)
|
||||||
#define LED_GREEN_PIN (1 << 15)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED_PORT GPIOB
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_MASK (1 << 8)
|
||||||
* @{
|
#define LED1_MASK (1 << 14)
|
||||||
*/
|
#define LED2_MASK (1 << 15)
|
||||||
#define LED_RED_ON (LED_PORT->BSRRH = LED_RED_PIN)
|
|
||||||
#define LED_RED_OFF (LED_PORT->BSRRL = LED_RED_PIN)
|
#define LED0_ON (LED_PORT->BSRRH = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE (LED_PORT->ODR ^= LED_RED_PIN)
|
#define LED0_OFF (LED_PORT->BSRRL = LED0_MASK)
|
||||||
#define LED_YELLOW_ON (LED_PORT->BSRRH = LED_YELLOW_PIN)
|
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
|
||||||
#define LED_YELLOW_OFF (LED_PORT->BSRRL = LED_YELLOW_PIN)
|
|
||||||
#define LED_YELLOW_TOGGLE (LED_PORT->ODR ^= LED_YELLOW_PIN)
|
#define LED1_ON (LED_PORT->BSRRH = LED1_MASK)
|
||||||
#define LED_GREEN_ON (LED_PORT->BSRRH = LED_GREEN_PIN)
|
#define LED1_OFF (LED_PORT->BSRRL = LED1_MASK)
|
||||||
#define LED_GREEN_OFF (LED_PORT->BSRRL = LED_GREEN_PIN)
|
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
|
||||||
#define LED_GREEN_TOGGLE (LED_PORT->ODR ^= LED_GREEN_PIN)
|
|
||||||
|
#define LED2_ON (LED_PORT->BSRRH = LED2_MASK)
|
||||||
|
#define LED2_OFF (LED_PORT->BSRRL = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -38,15 +38,6 @@ static nvram_spi_params_t nvram_spi_params = {
|
|||||||
.address_count = MULLE_NVRAM_SPI_ADDRESS_COUNT,
|
.address_count = MULLE_NVRAM_SPI_ADDRESS_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The LEDs are initialized here in order to be able to use them in the early
|
|
||||||
* boot for diagnostics.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static inline void leds_init(void);
|
|
||||||
|
|
||||||
/** @brief Initialize the GPIO pins controlling the power switches. */
|
/** @brief Initialize the GPIO pins controlling the power switches. */
|
||||||
static inline void power_pins_init(void);
|
static inline void power_pins_init(void);
|
||||||
|
|
||||||
@ -67,8 +58,11 @@ static int mulle_nvram_init(void);
|
|||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
/* initialize the boards LEDs, this is done first for debugging purposes */
|
|
||||||
leds_init();
|
/* initialize the boards LEDs */
|
||||||
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* Initialize power control pins */
|
/* Initialize power control pins */
|
||||||
power_pins_init();
|
power_pins_init();
|
||||||
@ -85,8 +79,6 @@ void board_init(void)
|
|||||||
/* Turn on AVDD for reading voltages */
|
/* Turn on AVDD for reading voltages */
|
||||||
gpio_set(MULLE_POWER_AVDD);
|
gpio_set(MULLE_POWER_AVDD);
|
||||||
|
|
||||||
LED_RED_ON;
|
|
||||||
|
|
||||||
/* Initialize RTC oscillator as early as possible since we are using it as a
|
/* Initialize RTC oscillator as early as possible since we are using it as a
|
||||||
* base clock for the FLL.
|
* base clock for the FLL.
|
||||||
* It takes a while to stabilize the oscillator, therefore we do this as
|
* It takes a while to stabilize the oscillator, therefore we do this as
|
||||||
@ -119,8 +111,6 @@ void board_init(void)
|
|||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
LED_YELLOW_ON;
|
|
||||||
|
|
||||||
/* NVRAM requires xtimer for timing */
|
/* NVRAM requires xtimer for timing */
|
||||||
xtimer_init();
|
xtimer_init();
|
||||||
|
|
||||||
@ -130,23 +120,6 @@ void board_init(void)
|
|||||||
/* Increment boot counter */
|
/* Increment boot counter */
|
||||||
increase_boot_count();
|
increase_boot_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
LED_GREEN_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The LEDs are initialized here in order to be able to use them in the early
|
|
||||||
* boot for diagnostics.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static inline void leds_init(void)
|
|
||||||
{
|
|
||||||
/* The pin configuration can be found in board.h and periph_conf.h */
|
|
||||||
gpio_init(LED_RED_GPIO, GPIO_DIR_OUT, GPIO_NOPULL);
|
|
||||||
gpio_init(LED_YELLOW_GPIO, GPIO_DIR_OUT, GPIO_NOPULL);
|
|
||||||
gpio_init(LED_GREEN_GPIO, GPIO_DIR_OUT, GPIO_NOPULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void power_pins_init(void)
|
static inline void power_pins_init(void)
|
||||||
|
|||||||
@ -34,35 +34,29 @@
|
|||||||
#define DISABLE_WDOG 1
|
#define DISABLE_WDOG 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LEDs configuration
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#define LED_PORT PTC
|
||||||
|
#define LED0_BIT (15)
|
||||||
|
#define LED1_BIT (14)
|
||||||
|
#define LED2_BIT (13)
|
||||||
|
|
||||||
#define LED_RED_PORT PTC
|
#define LED0_PIN GPIO_PIN(PORT_C, LED0_BIT)
|
||||||
#define LED_RED_PIN 15
|
#define LED1_PIN GPIO_PIN(PORT_C, LED1_BIT)
|
||||||
#define LED_RED_GPIO GPIO_PIN(PORT_C, LED_RED_PIN)
|
#define LED2_PIN GPIO_PIN(PORT_C, LED2_BIT)
|
||||||
#define LED_YELLOW_PORT PTC
|
|
||||||
#define LED_YELLOW_PIN 14
|
|
||||||
#define LED_YELLOW_GPIO GPIO_PIN(PORT_C, LED_YELLOW_PIN)
|
|
||||||
#define LED_GREEN_PORT PTC
|
|
||||||
#define LED_GREEN_PIN 13
|
|
||||||
#define LED_GREEN_GPIO GPIO_PIN(PORT_C, LED_GREEN_PIN)
|
|
||||||
|
|
||||||
/** @} */
|
#define LED0_ON (BITBAND_REG32(LED_PORT->PSOR, LED0_BIT) = 1)
|
||||||
|
#define LED0_OFF (BITBAND_REG32(LED_PORT->PCOR, LED0_BIT) = 1)
|
||||||
|
#define LED0_TOGGLE (BITBAND_REG32(LED_PORT->PTOR, LED0_BIT) = 1)
|
||||||
|
|
||||||
/**
|
#define LED1_ON (BITBAND_REG32(LED_PORT->PSOR, LED1_BIT) = 1)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_OFF (BITBAND_REG32(LED_PORT->PCOR, LED1_BIT) = 1)
|
||||||
* @{
|
#define LED1_TOGGLE (BITBAND_REG32(LED_PORT->PTOR, LED1_BIT) = 1)
|
||||||
*/
|
|
||||||
#define LED_RED_ON (LED_RED_PORT->PSOR = (1 << LED_RED_PIN))
|
#define LED2_ON (BITBAND_REG32(LED_PORT->PSOR, LED2_BIT) = 1)
|
||||||
#define LED_RED_OFF (LED_RED_PORT->PCOR = (1 << LED_RED_PIN))
|
#define LED2_OFF (BITBAND_REG32(LED_PORT->PCOR, LED2_BIT) = 1)
|
||||||
#define LED_RED_TOGGLE (LED_RED_PORT->PTOR = (1 << LED_RED_PIN))
|
#define LED2_TOGGLE (BITBAND_REG32(LED_PORT->PTOR, LED2_BIT) = 1)
|
||||||
#define LED_YELLOW_ON (LED_YELLOW_PORT->PSOR = (1 << LED_YELLOW_PIN))
|
|
||||||
#define LED_YELLOW_OFF (LED_YELLOW_PORT->PCOR = (1 << LED_YELLOW_PIN))
|
|
||||||
#define LED_YELLOW_TOGGLE (LED_YELLOW_PORT->PTOR = (1 << LED_YELLOW_PIN))
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->PSOR = (1 << LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->PCOR = (1 << LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->PTOR = (1 << LED_GREEN_PIN))
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
LED_GREEN_OFF;
|
LED0_OFF;
|
||||||
LED_RED_ON;
|
LED1_ON;
|
||||||
puts("RIOT native board initialized.");
|
puts("RIOT native board initialized.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,18 +30,24 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LED handlers
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
void _native_LED_GREEN_OFF(void);
|
void _native_LED_GREEN_OFF(void);
|
||||||
#define LED_GREEN_OFF (_native_LED_GREEN_OFF())
|
|
||||||
void _native_LED_GREEN_ON(void);
|
void _native_LED_GREEN_ON(void);
|
||||||
#define LED_GREEN_ON (_native_LED_GREEN_ON())
|
|
||||||
void _native_LED_GREEN_TOGGLE(void);
|
void _native_LED_GREEN_TOGGLE(void);
|
||||||
#define LED_GREEN_TOGGLE (_native_LED_GREEN_TOGGLE())
|
|
||||||
void _native_LED_RED_OFF(void);
|
void _native_LED_RED_OFF(void);
|
||||||
#define LED_RED_OFF (_native_LED_RED_OFF())
|
|
||||||
void _native_LED_RED_ON(void);
|
void _native_LED_RED_ON(void);
|
||||||
#define LED_RED_ON (_native_LED_RED_ON())
|
|
||||||
void _native_LED_RED_TOGGLE(void);
|
void _native_LED_RED_TOGGLE(void);
|
||||||
#define LED_RED_TOGGLE (_native_LED_RED_TOGGLE())
|
|
||||||
|
#define LED0_ON (_native_LED_RED_ON())
|
||||||
|
#define LED0_OFF (_native_LED_RED_OFF())
|
||||||
|
#define LED0_TOGGLE (_native_LED_RED_TOGGLE())
|
||||||
|
#define LED1_ON (_native_LED_GREEN_ON())
|
||||||
|
#define LED1_OFF (_native_LED_GREEN_OFF())
|
||||||
|
#define LED1_TOGGLE (_native_LED_GREEN_TOGGLE())
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,14 +18,16 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cpu.h"
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs, set pins as output and turn LEDs off */
|
/* initialize the boards LEDs, set pins as output and turn LEDs off */
|
||||||
NRF_GPIO->DIRSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
NRF_GPIO->OUTSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,30 +40,28 @@ extern "C" {
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PIN (GPIO_PIN(0, 21))
|
#define LED0_PIN GPIO_PIN(0, 21)
|
||||||
#define LED_GREEN_PIN (GPIO_PIN(0, 22))
|
#define LED1_PIN GPIO_PIN(0, 22)
|
||||||
#define LED_BLUE_PIN (GPIO_PIN(0, 23))
|
#define LED2_PIN GPIO_PIN(0, 23)
|
||||||
#define LED_RED_MASK (1 << 21)
|
|
||||||
#define LED_GREEN_MASK (1 << 22)
|
|
||||||
#define LED_BLUE_MASK (1 << 23)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 21)
|
||||||
* @name Macros for controlling the on-board LEDs
|
#define LED1_MASK (1 << 22)
|
||||||
* @{
|
#define LED2_MASK (1 << 23)
|
||||||
*/
|
|
||||||
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_MASK)
|
#define LED0_ON (NRF_GPIO->OUTCLR = LED0_MASK)
|
||||||
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_MASK)
|
#define LED0_OFF (NRF_GPIO->OUTSET = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_MASK)
|
#define LED0_TOGGLE (NRF_GPIO->OUT ^= LED0_MASK)
|
||||||
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_MASK)
|
|
||||||
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_MASK)
|
#define LED1_ON (NRF_GPIO->OUTCLR = LED1_MASK)
|
||||||
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_MASK)
|
#define LED1_OFF (NRF_GPIO->OUTSET = LED1_MASK)
|
||||||
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_MASK)
|
#define LED1_TOGGLE (NRF_GPIO->OUT ^= LED1_MASK)
|
||||||
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_MASK)
|
|
||||||
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_MASK)
|
#define LED2_ON (NRF_GPIO->OUTCLR = LED2_MASK)
|
||||||
|
#define LED2_OFF (NRF_GPIO->OUTSET = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (NRF_GPIO->OUT ^= LED2_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -24,8 +24,9 @@
|
|||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
NRF_P0->DIRSET = (LED1_MASK | LED2_MASK | LED3_MASK | LED4_MASK);
|
NRF_P0->DIRSET = (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
|
||||||
NRF_P0->OUTSET = (LED1_MASK | LED2_MASK | LED3_MASK | LED4_MASK);
|
NRF_P0->OUTSET = (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
|
||||||
|
NRF_P0->OUTSET = (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|||||||
@ -31,29 +31,31 @@ extern "C" {
|
|||||||
* @brief LED pin configuration
|
* @brief LED pin configuration
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED1_PIN (GPIO_PIN(0, 17))
|
#define LED0_PIN GPIO_PIN(0, 17)
|
||||||
#define LED2_PIN (GPIO_PIN(0, 18))
|
#define LED1_PIN GPIO_PIN(0, 18)
|
||||||
#define LED3_PIN (GPIO_PIN(0, 19))
|
#define LED2_PIN GPIO_PIN(0, 19)
|
||||||
#define LED4_PIN (GPIO_PIN(0, 20))
|
#define LED3_PIN GPIO_PIN(0, 20)
|
||||||
#define LED1_MASK (1 << 17)
|
|
||||||
#define LED2_MASK (1 << 18)
|
|
||||||
#define LED3_MASK (1 << 19)
|
|
||||||
#define LED4_MASK (1 << 20)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 17)
|
||||||
* @brief RIOT LED macros for backwards compatibility
|
#define LED1_MASK (1 << 18)
|
||||||
* @{
|
#define LED2_MASK (1 << 19)
|
||||||
*/
|
#define LED3_MASK (1 << 20)
|
||||||
#define LED_RED_ON (NRF_P0->OUTSET = LED1_MASK)
|
|
||||||
#define LED_RED_OFF (NRF_P0->OUTCLR = LED1_MASK)
|
#define LED0_ON (NRF_P0->OUTCLR = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE (NRF_P0->OUT ^= LED1_MASK)
|
#define LED0_OFF (NRF_P0->OUTSET = LED0_MASK)
|
||||||
#define LED_GREEN_ON (NRF_P0->OUTSET = LED2_MASK)
|
#define LED0_TOGGLE (NRF_P0->OUT ^= LED0_MASK)
|
||||||
#define LED_GREEN_OFF (NRF_P0->OUTCLR = LED2_MASK)
|
|
||||||
#define LED_GREEN_TOGGLE (NRF_P0->OUT ^= LED2_MASK)
|
#define LED1_ON (NRF_P0->OUTCLR = LED1_MASK)
|
||||||
#define LED_ORANGE_ON (NRF_P0->OUTSET = LED3_MASK)
|
#define LED1_OFF (NRF_P0->OUTSET = LED1_MASK)
|
||||||
#define LED_ORANGE_OFF (NRF_P0->OUTCLR = LED3_MASK)
|
#define LED1_TOGGLE (NRF_P0->OUT ^= LED1_MASK)
|
||||||
#define LED_ORANGE_TOGGLE (NRF_P0->OUT ^= LED3_MASK)
|
|
||||||
|
#define LED2_ON (NRF_P0->OUTCLR = LED2_MASK)
|
||||||
|
#define LED2_OFF (NRF_P0->OUTSET = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (NRF_P0->OUT ^= LED2_MASK)
|
||||||
|
|
||||||
|
#define LED3_ON (NRF_P0->OUTCLR = LED3_MASK)
|
||||||
|
#define LED3_OFF (NRF_P0->OUTSET = LED3_MASK)
|
||||||
|
#define LED3_TOGGLE (NRF_P0->OUT ^= LED3_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -34,25 +34,25 @@ static const saul_gpio_params_t saul_gpio_params[] =
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
.name = "LED 1",
|
.name = "LED 1",
|
||||||
.pin = LED1_PIN,
|
.pin = LED0_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL
|
.pull = GPIO_NOPULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "LED 2",
|
.name = "LED 2",
|
||||||
.pin = LED2_PIN,
|
.pin = LED1_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL
|
.pull = GPIO_NOPULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "LED 3",
|
.name = "LED 3",
|
||||||
.pin = LED3_PIN,
|
.pin = LED2_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL
|
.pull = GPIO_NOPULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "LED 4",
|
.name = "LED 4",
|
||||||
.pin = LED4_PIN,
|
.pin = LED3_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL
|
.pull = GPIO_NOPULL
|
||||||
},
|
},
|
||||||
|
|||||||
@ -25,8 +25,9 @@
|
|||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* setup led(s) for debugging */
|
/* initialize and turn off on-board LEDs */
|
||||||
NRF_GPIO->DIRSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
NRF_GPIO->DIRSET = (LED0_MASK | LED1_MASK | LED2_MASK);
|
||||||
|
NRF_GPIO->OUTSET = (LED0_MASK | LED1_MASK | LED2_MASK);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|||||||
@ -30,30 +30,28 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PIN (GPIO_PIN(0, 8))
|
#define LED0_PIN GPIO_PIN(0, 8)
|
||||||
#define LED_GREEN_PIN (GPIO_PIN(0, 9))
|
#define LED1_PIN GPIO_PIN(0, 9)
|
||||||
#define LED_BLUE_PIN (GPIO_PIN(0, 10))
|
#define LED2_PIN GPIO_PIN(0, 10)
|
||||||
#define LED_RED_MASK (1 << 8)
|
|
||||||
#define LED_GREEN_MASK (1 << 9)
|
|
||||||
#define LED_BLUE_MASK (1 << 10)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 8)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_MASK (1 << 9)
|
||||||
* @{
|
#define LED2_MASK (1 << 10)
|
||||||
*/
|
|
||||||
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_MASK)
|
#define LED0_ON (NRF_GPIO->OUTCLR = LED0_MASK)
|
||||||
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_MASK)
|
#define LED0_OFF (NRF_GPIO->OUTSET = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_MASK)
|
#define LED0_TOGGLE (NRF_GPIO->OUT ^= LED0_MASK)
|
||||||
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_MASK)
|
|
||||||
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_MASK)
|
#define LED1_ON (NRF_GPIO->OUTCLR = LED1_MASK)
|
||||||
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_MASK)
|
#define LED1_OFF (NRF_GPIO->OUTSET = LED1_MASK)
|
||||||
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_MASK)
|
#define LED1_TOGGLE (NRF_GPIO->OUT ^= LED1_MASK)
|
||||||
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_MASK)
|
|
||||||
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_MASK)
|
#define LED2_ON (NRF_GPIO->OUTCLR = LED2_MASK)
|
||||||
|
#define LED2_OFF (NRF_GPIO->OUTSET = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (NRF_GPIO->OUT ^= LED2_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
3
boards/nucleo-common/Makefile
Normal file
3
boards/nucleo-common/Makefile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
MODULE = nucleo_common
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
12
boards/nucleo-common/Makefile.include
Normal file
12
boards/nucleo-common/Makefile.include
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# define the default port depending on the host OS
|
||||||
|
PORT_LINUX ?= /dev/ttyACM0
|
||||||
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
|
||||||
|
|
||||||
|
# setup serial terminal
|
||||||
|
include $(RIOTBOARD)/Makefile.include.serial
|
||||||
|
|
||||||
|
# this board uses openocd
|
||||||
|
include $(RIOTBOARD)/Makefile.include.openocd
|
||||||
|
|
||||||
|
# add the common header files to the include path
|
||||||
|
INCLUDES += -I$(RIOTBOARD)/nucleo-common/include
|
||||||
70
boards/nucleo-common/include/board_common.h
Normal file
70
boards/nucleo-common/include/board_common.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Freie Universität Berlin
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
* directory for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup boards_nucleo_common STM Nucleo Common
|
||||||
|
* @ingroup drivers_periph
|
||||||
|
* @brief Common files for STM Nucleo boards
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Common pin definitions and board configuration options
|
||||||
|
*
|
||||||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOARD_COMMON__H
|
||||||
|
#define BOARD_COMMON__H
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "periph_conf.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LED pin definitions and handlers
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(PORT_A, 5)
|
||||||
|
|
||||||
|
#define LED0_MASK (1 << 5)
|
||||||
|
|
||||||
|
#if defined(CPU_FAM_STM32F4)
|
||||||
|
#define LED_CREG BSRRH
|
||||||
|
#else
|
||||||
|
#define LED_CREG BRR
|
||||||
|
#endif
|
||||||
|
#if defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32L1)
|
||||||
|
#define LED_SREG BSRRL
|
||||||
|
#else
|
||||||
|
#define LED_SREG BSRR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LED0_ON (GPIOA->LED_SREG = LED0_MASK)
|
||||||
|
#define LED0_OFF (GPIOA->LED_CREG = LED0_MASK)
|
||||||
|
#define LED0_TOGGLE (GPIOA->ODR ^= LED0_MASK)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief User button
|
||||||
|
*/
|
||||||
|
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||||
|
*/
|
||||||
|
void board_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* BOARD_COMMON__H */
|
||||||
|
/** @} */
|
||||||
@ -2,12 +2,5 @@
|
|||||||
export CPU = stm32f0
|
export CPU = stm32f0
|
||||||
export CPU_MODEL = stm32f091rc
|
export CPU_MODEL = stm32f091rc
|
||||||
|
|
||||||
#define the default port depending on the host OS
|
# load the common Makefile.include for Nucleo boards
|
||||||
PORT_LINUX ?= /dev/ttyACM0
|
include $(RIOTBOARD)/nucleo-common/Makefile.include
|
||||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|
||||||
|
|
||||||
# setup serial terminal
|
|
||||||
include $(RIOTBOARD)/Makefile.include.serial
|
|
||||||
|
|
||||||
# this board uses openocd
|
|
||||||
include $(RIOTBOARD)/Makefile.include.openocd
|
|
||||||
|
|||||||
@ -19,40 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
|
||||||
leds_init();
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/* initialize the boards LEDs */
|
||||||
* @brief Initialize the boards on-board LEDs
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function.
|
|
||||||
* As the LED is soldered onto the board it is fixed to
|
|
||||||
* its CPU pins.
|
|
||||||
*
|
|
||||||
* The green LED is connected to pin PA5
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOA */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_GREEN_PORT->OSPEEDR |= 0x00000c00;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_GREEN_PORT->OTYPER &= ~(0x00000020);
|
|
||||||
/* configure pin as general output */
|
|
||||||
LED_GREEN_PORT->MODER &= ~(0x00000c00);
|
|
||||||
LED_GREEN_PORT->MODER |= 0x00000400;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_GREEN_PORT->PUPDR &= ~(0x00000c00);
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_GREEN_PORT->BRR = 0x00c0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,54 +22,15 @@
|
|||||||
#ifndef BOARD_H_
|
#ifndef BOARD_H_
|
||||||
#define BOARD_H_
|
#define BOARD_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "board_common.h"
|
||||||
|
|
||||||
#include "cpu.h"
|
|
||||||
#include "periph_conf.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_GREEN_PORT (GPIOA)
|
|
||||||
#define LED_GREEN_PIN (5)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON
|
|
||||||
#define LED_RED_OFF
|
|
||||||
#define LED_RED_TOGGLE
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->BSRR = (1 << LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRR = ((1 << LED_GREEN_PIN) << 16))
|
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1 << LED_GREEN_PIN))
|
|
||||||
|
|
||||||
#define LED_ORANGE_ON
|
|
||||||
#define LED_ORANGE_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief User button
|
|
||||||
*/
|
|
||||||
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
||||||
*/
|
|
||||||
void board_init(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* BOARD_H_ */
|
#endif /* BOARD_H_ */
|
||||||
/** @} */
|
/** @} */
|
||||||
/** @} */
|
|
||||||
|
|||||||
@ -2,12 +2,5 @@
|
|||||||
export CPU = stm32f1
|
export CPU = stm32f1
|
||||||
export CPU_MODEL = stm32f103rb
|
export CPU_MODEL = stm32f103rb
|
||||||
|
|
||||||
#define the default port depending on the host OS
|
# load the common Makefile.include for Nucleo boards
|
||||||
PORT_LINUX ?= /dev/ttyUSB0
|
include $(RIOTBOARD)/nucleo-common/Makefile.include
|
||||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|
||||||
|
|
||||||
# setup serial terminal
|
|
||||||
include $(RIOTBOARD)/Makefile.include.serial
|
|
||||||
|
|
||||||
# this board uses openocd
|
|
||||||
include $(RIOTBOARD)/Makefile.include.openocd
|
|
||||||
|
|||||||
@ -19,34 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* pin remapping: in order to use the MCU peripherals with the Arduino
|
|
||||||
* compatible connectors. Some peripherals need to be remapped here. */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN;
|
|
||||||
AFIO->MAPR |= AFIO_MAPR_I2C1_REMAP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The green LED is connected to pin PA5
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
|
|
||||||
GPIOA->CR[0] &= ~(0x0f << 20);
|
|
||||||
GPIOA->CR[0] |= (0x03 << 20);
|
|
||||||
GPIOA->BRR = (1 << 5);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,10 +21,7 @@
|
|||||||
#ifndef BOARD_H_
|
#ifndef BOARD_H_
|
||||||
#define BOARD_H_
|
#define BOARD_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "board_common.h"
|
||||||
|
|
||||||
#include "cpu.h"
|
|
||||||
#include "periph_conf.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -42,40 +39,6 @@ extern "C" {
|
|||||||
#define XTIMER_BACKOFF 5
|
#define XTIMER_BACKOFF 5
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_GREEN_GPIO GPIO_PIN(PORT_A, 5)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON
|
|
||||||
#define LED_RED_OFF
|
|
||||||
#define LED_RED_TOGGLE
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (GPIOA->BSRR = (1 << 5))
|
|
||||||
#define LED_GREEN_OFF (GPIOA->BRR = (1 << 5))
|
|
||||||
#define LED_GREEN_TOGGLE (GPIOA->ODR ^= (1 << 5))
|
|
||||||
|
|
||||||
#define LED_ORANGE_ON
|
|
||||||
#define LED_ORANGE_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief User button
|
|
||||||
*/
|
|
||||||
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
||||||
*/
|
|
||||||
void board_init(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,12 +2,5 @@
|
|||||||
export CPU = stm32f3
|
export CPU = stm32f3
|
||||||
export CPU_MODEL = stm32f303re
|
export CPU_MODEL = stm32f303re
|
||||||
|
|
||||||
#define the default port depending on the host OS
|
# load the common Makefile.include for Nucleo boards
|
||||||
PORT_LINUX ?= /dev/ttyUSB0
|
include $(RIOTBOARD)/nucleo-common/Makefile.include
|
||||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|
||||||
|
|
||||||
# setup serial terminal
|
|
||||||
include $(RIOTBOARD)/Makefile.include.serial
|
|
||||||
|
|
||||||
# this board uses openocd
|
|
||||||
include $(RIOTBOARD)/Makefile.include.openocd
|
|
||||||
|
|||||||
@ -19,40 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
|
||||||
leds_init();
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/* initialize the boards LEDs */
|
||||||
* @brief Initialize the boards on-board LEDs
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function.
|
|
||||||
* As the LED is soldered onto the board it is fixed to
|
|
||||||
* its CPU pins.
|
|
||||||
*
|
|
||||||
* The green LED is connected to pin PA5
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOA */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_GREEN_PORT->OSPEEDR |= 0x00000c00;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_GREEN_PORT->OTYPER &= ~(0x00000020);
|
|
||||||
/* configure pin as general output */
|
|
||||||
LED_GREEN_PORT->MODER &= ~(0x00000c00);
|
|
||||||
LED_GREEN_PORT->MODER |= 0x00000400;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_GREEN_PORT->PUPDR &= ~(0x00000c00);
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_GREEN_PORT->BRR = 0x00c0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,54 +23,15 @@
|
|||||||
#ifndef BOARD_H_
|
#ifndef BOARD_H_
|
||||||
#define BOARD_H_
|
#define BOARD_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "board_common.h"
|
||||||
|
|
||||||
#include "cpu.h"
|
|
||||||
#include "periph_conf.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_GREEN_PORT (GPIOA)
|
|
||||||
#define LED_GREEN_PIN (5)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON
|
|
||||||
#define LED_RED_OFF
|
|
||||||
#define LED_RED_TOGGLE
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->BSRRL = (1 << LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRRH = (1 << LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1 << LED_GREEN_PIN))
|
|
||||||
|
|
||||||
#define LED_ORANGE_ON
|
|
||||||
#define LED_ORANGE_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief User button
|
|
||||||
*/
|
|
||||||
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
||||||
*/
|
|
||||||
void board_init(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* BOARD_H_ */
|
#endif /* BOARD_H_ */
|
||||||
/** @} */
|
/** @} */
|
||||||
/** @} */
|
|
||||||
|
|||||||
@ -2,12 +2,5 @@
|
|||||||
export CPU = stm32f3
|
export CPU = stm32f3
|
||||||
export CPU_MODEL = stm32f334r8
|
export CPU_MODEL = stm32f334r8
|
||||||
|
|
||||||
#define the default port depending on the host OS
|
# load the common Makefile.include for Nucleo boards
|
||||||
PORT_LINUX ?= /dev/ttyACM0
|
include $(RIOTBOARD)/nucleo-common/Makefile.include
|
||||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|
||||||
|
|
||||||
# setup serial terminal
|
|
||||||
include $(RIOTBOARD)/Makefile.include.serial
|
|
||||||
|
|
||||||
# this board uses openocd
|
|
||||||
include $(RIOTBOARD)/Makefile.include.openocd
|
|
||||||
|
|||||||
@ -19,40 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
/* initialize the boards LEDs */
|
|
||||||
leds_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/* initialize the boards LEDs */
|
||||||
* @brief Initialize the boards on-board LEDs
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function.
|
|
||||||
* As the LED is soldered onto the board it is fixed to
|
|
||||||
* its CPU pins.
|
|
||||||
*
|
|
||||||
* The green LED is connected to pin PA5
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOE */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_GREEN_PORT->OSPEEDR |= 0x00000c00;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_GREEN_PORT->OTYPER &= ~(0x00000020);
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_GREEN_PORT->MODER &= ~(0x00000c00);
|
|
||||||
LED_GREEN_PORT->MODER |= 0x00000400;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_GREEN_PORT->PUPDR &= ~(0x00000c00);
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_GREEN_PORT->BRR = 0x00c0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,45 +21,12 @@
|
|||||||
#ifndef BOARD_H_
|
#ifndef BOARD_H_
|
||||||
#define BOARD_H_
|
#define BOARD_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "board_common.h"
|
||||||
|
|
||||||
#include "cpu.h"
|
|
||||||
#include "periph_conf.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_GREEN_PORT (GPIOA)
|
|
||||||
#define LED_GREEN_PIN (5)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON
|
|
||||||
#define LED_RED_OFF
|
|
||||||
#define LED_RED_TOGGLE
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->BSRRL = (1<<LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRRH = (1<<LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
|
|
||||||
|
|
||||||
#define LED_ORANGE_ON
|
|
||||||
#define LED_ORANGE_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief User button
|
|
||||||
*/
|
|
||||||
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name xtimer tuning values
|
* @name xtimer tuning values
|
||||||
* @{
|
* @{
|
||||||
@ -68,15 +35,9 @@ extern "C" {
|
|||||||
#define XTIMER_SHOOT_EARLY 2
|
#define XTIMER_SHOOT_EARLY 2
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
||||||
*/
|
|
||||||
void board_init(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* BOARD_H_ */
|
#endif /* BOARD_H_ */
|
||||||
/** @} */
|
/** @} */
|
||||||
/** @} */
|
|
||||||
|
|||||||
@ -2,12 +2,5 @@
|
|||||||
export CPU = stm32f4
|
export CPU = stm32f4
|
||||||
export CPU_MODEL = stm32f401re
|
export CPU_MODEL = stm32f401re
|
||||||
|
|
||||||
# define the default port depending on the host OS
|
# load the common Makefile.include for Nucleo boards
|
||||||
PORT_LINUX ?= /dev/ttyACM0
|
include $(RIOTBOARD)/nucleo-common/Makefile.include
|
||||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|
||||||
|
|
||||||
# setup serial terminal
|
|
||||||
include $(RIOTBOARD)/Makefile.include.serial
|
|
||||||
|
|
||||||
# this board uses openocd
|
|
||||||
include $(RIOTBOARD)/Makefile.include.openocd
|
|
||||||
|
|||||||
@ -19,40 +19,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LED
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LED is
|
|
||||||
* soldered onto the board it is fixed to its CPU pins.
|
|
||||||
*
|
|
||||||
* The green LED is connected to pin PA5
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOA */
|
|
||||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_GREEN_PORT->OSPEEDR |= (0x3 << LED_GREEN_PIN * 2);
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_GREEN_PORT->OTYPER &= ~(1 << LED_GREEN_PIN);
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_GREEN_PORT->MODER &= ~(0x3 << LED_GREEN_PIN * 2);
|
|
||||||
LED_GREEN_PORT->MODER |= (0x1 << LED_GREEN_PIN * 2);
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_GREEN_PORT->PUPDR &= ~(0x3 << LED_GREEN_PIN * 2);
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_GREEN_PORT->BSRRL &= (1 << LED_GREEN_PIN);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,8 +21,7 @@
|
|||||||
#ifndef BOARD_H_
|
#ifndef BOARD_H_
|
||||||
#define BOARD_H_
|
#define BOARD_H_
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "board_common.h"
|
||||||
#include "periph_conf.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -38,42 +37,6 @@ extern "C" {
|
|||||||
#define XTIMER_BACKOFF (5)
|
#define XTIMER_BACKOFF (5)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_GREEN_PORT (GPIOA)
|
|
||||||
#define LED_GREEN_PIN (5)
|
|
||||||
#define LED_GREEN_GPIO GPIO_PIN(PORT_A,5)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON
|
|
||||||
#define LED_RED_OFF
|
|
||||||
#define LED_RED_TOGGLE
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->BSRRL = (1<<LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->BSRRH = (1<<LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
|
|
||||||
|
|
||||||
#define LED_ORANGE_ON
|
|
||||||
#define LED_ORANGE_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief User button
|
|
||||||
*/
|
|
||||||
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
||||||
*/
|
|
||||||
void board_init(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2,12 +2,5 @@
|
|||||||
export CPU = stm32l1
|
export CPU = stm32l1
|
||||||
export CPU_MODEL = stm32l152ret6
|
export CPU_MODEL = stm32l152ret6
|
||||||
|
|
||||||
# define the default port depending on the host OS
|
# load the common Makefile.include for Nucleo boards
|
||||||
PORT_LINUX ?= /dev/ttyACM0
|
include $(RIOTBOARD)/nucleo-common/Makefile.include
|
||||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))
|
|
||||||
|
|
||||||
# setup serial terminal
|
|
||||||
include $(RIOTBOARD)/Makefile.include.serial
|
|
||||||
|
|
||||||
# this board uses openocd
|
|
||||||
include $(RIOTBOARD)/Makefile.include.openocd
|
|
||||||
|
|||||||
@ -19,9 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
@ -29,32 +27,5 @@ void board_init(void)
|
|||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LED is soldered
|
|
||||||
* onto the board it is fixed to its CPU pins.
|
|
||||||
*
|
|
||||||
* The green LED is connected to pin PA5
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOE */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
|
|
||||||
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_GREEN_PORT->OSPEEDR |= 0x00000c00;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_GREEN_PORT->OTYPER &= ~(0x00000020);
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_GREEN_PORT->MODER &= ~(0x00000c00);
|
|
||||||
LED_GREEN_PORT->MODER |= 0x00000400;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_GREEN_PORT->PUPDR &= ~(0x00000c00);
|
|
||||||
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_GREEN_PORT->BRR = 0x00c0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,10 +21,7 @@
|
|||||||
#ifndef BOARD_H_
|
#ifndef BOARD_H_
|
||||||
#define BOARD_H_
|
#define BOARD_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "board_common.h"
|
||||||
|
|
||||||
#include "cpu.h"
|
|
||||||
#include "periph_conf.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -40,45 +37,9 @@ extern "C" {
|
|||||||
#define XTIMER_BACKOFF (3)
|
#define XTIMER_BACKOFF (3)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_GREEN_PORT (GPIOA)
|
|
||||||
#define LED_GREEN_PIN (5)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_ON
|
|
||||||
#define LED_RED_OFF
|
|
||||||
#define LED_RED_TOGGLE
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_GREEN_PORT->ODR &= ~(1<<LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_OFF (LED_GREEN_PORT->ODR |= (1<<LED_GREEN_PIN))
|
|
||||||
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
|
|
||||||
|
|
||||||
#define LED_ORANGE_ON
|
|
||||||
#define LED_ORANGE_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief User button
|
|
||||||
*/
|
|
||||||
#define BTN_B1_PIN GPIO_PIN(PORT_C, 13)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
|
||||||
*/
|
|
||||||
void board_init(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* BOARD_H_ */
|
#endif /* BOARD_H_ */
|
||||||
/** @} */
|
/** @} */
|
||||||
/** @} */
|
|
||||||
|
|||||||
@ -19,41 +19,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static inline void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED3_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs (LD3 and LD4)
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
|
||||||
* onto the board they are fixed to their CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pins:
|
|
||||||
* - LED1: PC4 (red)
|
|
||||||
* - LED2: PC5 (orange)
|
|
||||||
* - LED3: PC6 (yellow)
|
|
||||||
* - LED4: PC7 (green)
|
|
||||||
*/
|
|
||||||
static inline void leds_init(void)
|
|
||||||
{
|
|
||||||
/* set pins to be controlled by software */
|
|
||||||
LED_PORT->AFSEL &= ~((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN) |
|
|
||||||
(1 << LED_YELLOW_PIN) | (1 << LED_ORANGE_PIN));
|
|
||||||
/* configure pins as output */
|
|
||||||
LED_PORT->DIR |= ((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN) |
|
|
||||||
(1 << LED_YELLOW_PIN) | (1 << LED_ORANGE_PIN));
|
|
||||||
/* configure io-mux for used pins */
|
|
||||||
IOC->PC_OVER[LED_RED_PIN] = IOC_OVERRIDE_OE;
|
|
||||||
IOC->PC_OVER[LED_GREEN_PIN] = IOC_OVERRIDE_OE;
|
|
||||||
IOC->PC_OVER[LED_YELLOW_PIN] = IOC_OVERRIDE_OE;
|
|
||||||
IOC->PC_OVER[LED_ORANGE_PIN] = IOC_OVERRIDE_OE;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -29,35 +29,35 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(2, 4)
|
||||||
|
#define LED1_PIN GPIO_PIN(2, 7)
|
||||||
|
#define LED2_PIN GPIO_PIN(2, 6)
|
||||||
|
#define LED3_PIN GPIO_PIN(2, 5)
|
||||||
|
|
||||||
#define LED_PORT GPIO_C
|
#define LED_PORT GPIO_C
|
||||||
#define LED_RED_PIN (4)
|
#define LED0_MASK (1 << 4)
|
||||||
#define LED_GREEN_PIN (7)
|
#define LED1_MASK (1 << 7)
|
||||||
#define LED_YELLOW_PIN (6)
|
#define LED2_MASK (1 << 6)
|
||||||
#define LED_ORANGE_PIN (5)
|
#define LED3_MASK (1 << 5)
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_ON (LED_PORT->DATA |= LED0_MASK)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_OFF (LED_PORT->DATA &= ~LED0_MASK)
|
||||||
* @{
|
#define LED0_TOGGLE (LED_PORT->DATA ^= LED0_MASK)
|
||||||
*/
|
|
||||||
#define LED_RED_ON (LED_PORT->DATA |= (1 << LED_RED_PIN))
|
|
||||||
#define LED_RED_OFF (LED_PORT->DATA &= ~(1 << LED_RED_PIN))
|
|
||||||
#define LED_RED_TOGGLE (LED_PORT->DATA ^= (1 << LED_RED_PIN))
|
|
||||||
|
|
||||||
#define LED_GREEN_ON (LED_PORT->DATA |= (1 << LED_GREEN_PIN))
|
#define LED1_ON (LED_PORT->DATA |= LED1_MASK)
|
||||||
#define LED_GREEN_OFF (LED_PORT->DATA &= ~(1 << LED_GREEN_PIN))
|
#define LED1_OFF (LED_PORT->DATA &= ~LED1_MASK)
|
||||||
#define LED_GREEN_TOGGLE (LED_PORT->DATA ^= (1 << LED_GREEN_PIN))
|
#define LED1_TOGGLE (LED_PORT->DATA ^= LED1_MASK)
|
||||||
|
|
||||||
#define LED_YELLOW_ON (LED_PORT->DATA |= (1 << LED_YELLOW_PIN))
|
#define LED2_ON (LED_PORT->DATA |= LED2_MASK)
|
||||||
#define LED_YELLOW_OFF (LED_PORT->DATA &= ~(1 << LED_YELLOW_PIN))
|
#define LED2_OFF (LED_PORT->DATA &= ~LED2_MASK)
|
||||||
#define LED_YELLOW_TOGGLE (LED_PORT->DATA ^= (1 << LED_YELLOW_PIN))
|
#define LED2_TOGGLE (LED_PORT->DATA ^= LED2_MASK)
|
||||||
|
|
||||||
#define LED_ORANGE_ON (LED_PORT->DATA |= (1 << LED_ORANGE_PIN))
|
#define LED3_ON (LED_PORT->DATA |= LED3_MASK)
|
||||||
#define LED_ORANGE_OFF (LED_PORT->DATA &= ~(1 << LED_ORANGE_PIN))
|
#define LED3_OFF (LED_PORT->DATA &= ~LED3_MASK)
|
||||||
#define LED_ORANGE_TOGGLE (LED_PORT->DATA ^= (1 << LED_ORANGE_PIN))
|
#define LED3_TOGGLE (LED_PORT->DATA ^= LED3_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -21,34 +21,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
leds_init();
|
/* initialize the on-board LEDs */
|
||||||
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
|
/* initialize the CPU core */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board RGB-LED
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock */
|
|
||||||
LED_B_PORT_CLKEN();
|
|
||||||
LED_G_PORT_CLKEN();
|
|
||||||
LED_R_PORT_CLKEN();
|
|
||||||
/* configure pins as gpio */
|
|
||||||
LED_B_PORT_BASE->PCR[LED_B_PIN] = PORT_PCR_MUX(1);
|
|
||||||
LED_G_PORT_BASE->PCR[LED_G_PIN] = PORT_PCR_MUX(1);
|
|
||||||
LED_R_PORT_BASE->PCR[LED_R_PIN] = PORT_PCR_MUX(1);
|
|
||||||
LED_B_GPIO_BASE->PDDR |= (1 << LED_B_PIN);
|
|
||||||
LED_G_GPIO_BASE->PDDR |= (1 << LED_G_PIN);
|
|
||||||
LED_R_GPIO_BASE->PDDR |= (1 << LED_R_PIN);
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_B_GPIO_BASE->PSOR |= (1 << LED_B_PIN);
|
|
||||||
LED_G_GPIO_BASE->PSOR |= (1 << LED_G_PIN);
|
|
||||||
LED_R_GPIO_BASE->PSOR |= (1 << LED_R_PIN);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -31,47 +31,28 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_R_PORT_CLKEN() (SIM->SCGC5 |= (SIM_SCGC5_PORTD_MASK)) /**< Clock Enable for PORTD*/
|
#define LED2_PIN GPIO_PIN(PORT_D, 6)
|
||||||
#define LED_G_PORT_CLKEN() (SIM->SCGC5 |= (SIM_SCGC5_PORTD_MASK)) /**< Clock Enable for PORTD*/
|
#define LED1_PIN GPIO_PIN(PORT_D, 4)
|
||||||
#define LED_B_PORT_CLKEN() (SIM->SCGC5 |= (SIM_SCGC5_PORTA_MASK)) /**< Clock Enable for PORTA*/
|
#define LED0_PIN GPIO_PIN(PORT_A, 4)
|
||||||
#define LED_R_PORT_BASE PORTD /**< PORT base for the Red LED */
|
|
||||||
#define LED_G_PORT_BASE PORTD /**< PORT base for the Green LED */
|
|
||||||
#define LED_B_PORT_BASE PORTA /**< PORT base for the Blue LED */
|
|
||||||
#define LED_R_GPIO_BASE GPIOD /**< GPIO base for Red LED */
|
|
||||||
#define LED_G_GPIO_BASE GPIOD /**< GPIO base for Green LED */
|
|
||||||
#define LED_B_GPIO_BASE GPIOA /**< GPIO base for Blue LED */
|
|
||||||
#define LED_R_PIN 6 /**< Red LED connected to PINx*/
|
|
||||||
#define LED_G_PIN 4 /**< Green LED connected to PINx*/
|
|
||||||
#define LED_B_PIN 4 /**< Blue LED connected to PINx*/
|
|
||||||
#define LED_R_GPIO GPIO_PIN(PORT_D, LED_R_PIN) /**< GPIO-Device for Red LED */
|
|
||||||
#define LED_G_GPIO GPIO_PIN(PORT_D, LED_G_PIN) /**< GPIO-Device for Green LED */
|
|
||||||
#define LED_B_GPIO GPIO_PIN(PORT_A, LED_B_PIN) /**< GPIO-Device for Blue LED */
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 6)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_MASK (1 << 4)
|
||||||
* @{
|
#define LED2_MASK (1 << 4)
|
||||||
*/
|
|
||||||
#define LED_B_ON (LED_B_GPIO_BASE->PCOR = (1 << LED_B_PIN))
|
|
||||||
#define LED_B_OFF (LED_B_GPIO_BASE->PSOR = (1 << LED_B_PIN))
|
|
||||||
#define LED_B_TOGGLE (LED_B_GPIO_BASE->PTOR = (1 << LED_B_PIN))
|
|
||||||
#define LED_G_ON (LED_G_GPIO_BASE->PCOR = (1 << LED_G_PIN))
|
|
||||||
#define LED_G_OFF (LED_G_GPIO_BASE->PSOR = (1 << LED_G_PIN))
|
|
||||||
#define LED_G_TOGGLE (LED_G_GPIO_BASE->PTOR = (1 << LED_G_PIN))
|
|
||||||
#define LED_R_ON (LED_R_GPIO_BASE->PCOR = (1 << LED_R_PIN))
|
|
||||||
#define LED_R_OFF (LED_R_GPIO_BASE->PSOR = (1 << LED_R_PIN))
|
|
||||||
#define LED_R_TOGGLE (LED_R_GPIO_BASE->PTOR = (1 << LED_R_PIN))
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
#define LED0_ON (GPIOD->PCOR = LED0_MASK)
|
||||||
#define LED_GREEN_ON LED_G_ON
|
#define LED0_OFF (GPIOD->PSOR = LED0_MASK)
|
||||||
#define LED_GREEN_OFF LED_G_OFF
|
#define LED0_TOGGLE (GPIOD->PTOR = LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE LED_G_TOGGLE
|
|
||||||
#define LED_RED_ON LED_R_ON
|
#define LED1_ON (GPIOD->PCOR = LED1_MASK)
|
||||||
#define LED_RED_OFF LED_R_OFF
|
#define LED1_OFF (GPIOD->PSOR = LED1_MASK)
|
||||||
#define LED_RED_TOGGLE LED_R_TOGGLE
|
#define LED1_TOGGLE (GPIOD->PTOR = LED1_MASK)
|
||||||
|
|
||||||
|
#define LED2_ON (GPIOA->PCOR = LED2_MASK)
|
||||||
|
#define LED2_OFF (GPIOA->PSOR = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (GPIOA->PTOR = LED2_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -25,8 +25,9 @@
|
|||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs: set pins to output and turn LEDs off */
|
/* initialize the boards LEDs: set pins to output and turn LEDs off */
|
||||||
NRF_GPIO->DIRSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
NRF_GPIO->DIRSET = (LED0_MASK | LED1_MASK | LED2_MASK);
|
||||||
NRF_GPIO->OUTSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
NRF_GPIO->OUTSET = (LED0_MASK | LED1_MASK | LED2_MASK);
|
||||||
|
|
||||||
/* trigger the CPU initialization code */
|
/* trigger the CPU initialization code */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,30 +40,28 @@ extern "C" {
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_RED_PIN (GPIO_PIN(0, 21))
|
#define LED0_PIN GPIO_PIN(0, 21)
|
||||||
#define LED_GREEN_PIN (GPIO_PIN(0, 22))
|
#define LED1_PIN GPIO_PIN(0, 22)
|
||||||
#define LED_BLUE_PIN (GPIO_PIN(0, 23))
|
#define LED2_PIN GPIO_PIN(0, 23)
|
||||||
#define LED_RED_MASK (1 << 21)
|
|
||||||
#define LED_GREEN_MASK (1 << 22)
|
|
||||||
#define LED_BLUE_MASK (1 << 23)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_MASK (1 << 21)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED1_MASK (1 << 22)
|
||||||
* @{
|
#define LED2_MASK (1 << 23)
|
||||||
*/
|
|
||||||
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_MASK)
|
#define LED0_ON (NRF_GPIO->OUTCLR = LED0_MASK)
|
||||||
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_MASK)
|
#define LED0_OFF (NRF_GPIO->OUTSET = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_MASK)
|
#define LED0_TOGGLE (NRF_GPIO->OUT ^= LED0_MASK)
|
||||||
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_MASK)
|
|
||||||
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_MASK)
|
#define LED1_ON (NRF_GPIO->OUTCLR = LED1_MASK)
|
||||||
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_MASK)
|
#define LED1_OFF (NRF_GPIO->OUTSET = LED1_MASK)
|
||||||
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_MASK)
|
#define LED1_TOGGLE (NRF_GPIO->OUT ^= LED1_MASK)
|
||||||
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_MASK)
|
|
||||||
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_MASK)
|
#define LED2_ON (NRF_GPIO->OUTCLR = LED2_MASK)
|
||||||
|
#define LED2_OFF (NRF_GPIO->OUTSET = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (NRF_GPIO->OUT ^= LED2_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -25,9 +25,6 @@
|
|||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* setup led(s) for debugging */
|
|
||||||
NRF_GPIO->DIRSET = (LED_RED_MASK);
|
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,24 +39,6 @@ extern "C" {
|
|||||||
#define XTIMER_BACKOFF (40)
|
#define XTIMER_BACKOFF (40)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_RED_PIN (GPIO_PIN(0, 1))
|
|
||||||
#define LED_RED_MASK (1 << 1)
|
|
||||||
|
|
||||||
#define LED_RED_ON (NRF_GPIO->OUTSET = (1 << LED_RED_MASK))
|
|
||||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = (1 << LED_RED_MASK))
|
|
||||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= (1 << LED_RED_MASK))
|
|
||||||
#define LED_GREEN_ON /* not available */
|
|
||||||
#define LED_GREEN_OFF /* not available */
|
|
||||||
#define LED_GREEN_TOGGLE /* not available */
|
|
||||||
#define LED_BLUE_ON /* not available */
|
|
||||||
#define LED_BLUE_OFF /* not available */
|
|
||||||
#define LED_BLUE_TOGGLE /* not available */
|
|
||||||
/* @} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -50,18 +50,6 @@ void init_clks2(void);
|
|||||||
*/
|
*/
|
||||||
void bl_init_clks(void);
|
void bl_init_clks(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* @name dummy-defines for LEDs
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_GREEN_ON /* not available */
|
|
||||||
#define LED_GREEN_OFF /* not available */
|
|
||||||
#define LED_GREEN_TOGGLE /* not available */
|
|
||||||
#define LED_RED_ON /* not available */
|
|
||||||
#define LED_RED_OFF /* not available */
|
|
||||||
#define LED_RED_TOGGLE /* not available */
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -25,12 +25,13 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Serial port configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
#define UART_PORT (COM1_PORT) /* IO port to use for UART */
|
#define UART_PORT (COM1_PORT) /* IO port to use for UART */
|
||||||
#define UART_IRQ (COM1_IRQ) /* IRQ line to use for UART */
|
#define UART_IRQ (COM1_IRQ) /* IRQ line to use for UART */
|
||||||
|
/** @} */
|
||||||
#define LED_RED_ON /* not available */
|
|
||||||
#define LED_RED_OFF /* not available */
|
|
||||||
#define LED_RED_TOGGLE /* not available */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
33
boards/qemu-i386/include/periph_conf.h
Normal file
33
boards/qemu-i386/include/periph_conf.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Freie Universität Berlin
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
* directory for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup boards_qemu-i386
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Peripheral configuration for the qemu-i386
|
||||||
|
*
|
||||||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PERIPH_CONF_H
|
||||||
|
#define PERIPH_CONF_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* nothing to define here, yet */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PERIPH_CONF_H */
|
||||||
|
/** @} */
|
||||||
@ -23,49 +23,20 @@
|
|||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
static inline void leds_init(void);
|
|
||||||
static inline void rf_switch_init(void);
|
static inline void rf_switch_init(void);
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
/* initialize the 2.4GHz RF switch */
|
/* initialize the 2.4GHz RF switch */
|
||||||
rf_switch_init();
|
rf_switch_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs (LD3 and LD4)
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LED (RGB) are
|
|
||||||
* soldered onto the board they are fixed to their CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pins:
|
|
||||||
* - LED1: PD2 (red)
|
|
||||||
* - LED2: PC3 (blue)
|
|
||||||
* - LED3: PD5 (green)
|
|
||||||
*/
|
|
||||||
static inline void leds_init(void)
|
|
||||||
{
|
|
||||||
/* set pins to be controlled by software */
|
|
||||||
LED_PORT_C->AFSEL &= ~(1 << LED_BLUE_PIN);
|
|
||||||
LED_PORT_D->AFSEL &= ~((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN));
|
|
||||||
|
|
||||||
/* configure pins as output */
|
|
||||||
LED_PORT_C->DIR |= (1 << LED_BLUE_PIN);
|
|
||||||
LED_PORT_D->DIR |= ((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN));
|
|
||||||
|
|
||||||
/* configure io-mux for used pins */
|
|
||||||
IOC->PC_OVER[LED_BLUE_PIN] = IOC_OVERRIDE_OE;
|
|
||||||
IOC->PD_OVER[LED_GREEN_PIN] = IOC_OVERRIDE_OE;
|
|
||||||
IOC->PD_OVER[LED_RED_PIN] = IOC_OVERRIDE_OE;
|
|
||||||
|
|
||||||
/* Shoot rainbows */
|
|
||||||
LED_RAINBOW();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the 2.4GHz Radio Frequency SW-controlled Switch
|
* @brief Initialize the 2.4GHz Radio Frequency SW-controlled Switch
|
||||||
*
|
*
|
||||||
|
|||||||
@ -31,75 +31,30 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT_C GPIO_C
|
#define LED0_PIN GPIO_PIN(3, 2)
|
||||||
#define LED_PORT_D GPIO_D
|
#define LED1_PIN GPIO_PIN(3, 5)
|
||||||
#define LED_RED_PIN (2)
|
#define LED2_PIN GPIO_PIN(2, 3)
|
||||||
#define LED_GREEN_PIN (5)
|
|
||||||
#define LED_BLUE_PIN (3)
|
#define LED0_MASK (1 << 2)
|
||||||
/** @} */
|
#define LED1_MASK (1 << 5)
|
||||||
/**
|
#define LED2_MASK (1 << 3)
|
||||||
* @name Macros for controlling the on-board LEDs
|
|
||||||
* @{
|
#define LED0_ON (GPIO_D->DATA &= ~LED0_MASK)
|
||||||
*/
|
#define LED0_OFF (GPIO_D->DATA |= LED0_MASK)
|
||||||
#define LED_RED_ON (LED_PORT_D->DATA &= ~(1 << LED_RED_PIN))
|
#define LED0_TOGGLE (GPIO_D->DATA ^= LED0_MASK)
|
||||||
#define LED_RED_OFF (LED_PORT_D->DATA |= (1 << LED_RED_PIN))
|
|
||||||
#define LED_RED_TOGGLE (LED_PORT_D->DATA ^= (1 << LED_RED_PIN))
|
#define LED1_ON (GPIO_D->DATA &= ~LED1_MASK)
|
||||||
#define LED_GREEN_ON (LED_PORT_D->DATA &= ~(1 << LED_GREEN_PIN))
|
#define LED1_OFF (GPIO_D->DATA |= LED1_MASK)
|
||||||
#define LED_GREEN_OFF (LED_PORT_D->DATA |= (1 << LED_GREEN_PIN))
|
#define LED1_TOGGLE (GPIO_D->DATA ^= LED1_MASK)
|
||||||
#define LED_GREEN_TOGGLE (LED_PORT_D->DATA ^= (1 << LED_GREEN_PIN))
|
|
||||||
#define LED_BLUE_ON (LED_PORT_C->DATA &= ~(1 << LED_BLUE_PIN))
|
#define LED2_ON (GPIO_C->DATA &= ~LED2_MASK)
|
||||||
#define LED_BLUE_OFF (LED_PORT_C->DATA |= (1 << LED_BLUE_PIN))
|
#define LED2_OFF (GPIO_C->DATA |= LED2_MASK)
|
||||||
#define LED_BLUE_TOGGLE (LED_PORT_C->DATA ^= (1 << LED_BLUE_PIN))
|
#define LED2_TOGGLE (GPIO_C->DATA ^= LED2_MASK)
|
||||||
#define LED_ALL_OFF LED_GREEN_OFF; \
|
|
||||||
LED_RED_OFF; \
|
|
||||||
LED_BLUE_OFF
|
|
||||||
/* Output is color white */
|
|
||||||
#define LED_ALL_ON LED_BLUE_ON; \
|
|
||||||
LED_RED_ON; \
|
|
||||||
LED_GREEN_ON
|
|
||||||
#define LED_YELLOW_ON LED_BLUE_OFF; \
|
|
||||||
LED_GREEN_ON; \
|
|
||||||
LED_RED_ON
|
|
||||||
#define LED_YELLOW_OFF LED_GREEN_OFF; \
|
|
||||||
LED_RED_OFF
|
|
||||||
#define LED_YELLOW_TOGGLE LED_GREEN_TOGGLE; \
|
|
||||||
LED_RED_TOGGLE
|
|
||||||
#define LED_PURPLE_ON LED_GREEN_OFF; \
|
|
||||||
LED_BLUE_ON; \
|
|
||||||
LED_RED_ON
|
|
||||||
#define LED_PURPLE_OFF LED_BLUE_OFF; \
|
|
||||||
LED_RED_OFF
|
|
||||||
#define LED_PURPLE_TOGGLE LED_BLUE_TOGGLE; \
|
|
||||||
LED_RED_TOGGLE
|
|
||||||
/* Take LED_COLOR as argument, i.e LED_RED */
|
|
||||||
#define LED_FADE(led) \
|
|
||||||
volatile int i; \
|
|
||||||
int k, j; \
|
|
||||||
LED_FADE_EXPAND(led)
|
|
||||||
#define LED_FADE_EXPAND(led) \
|
|
||||||
for(k = 0; k < 800; ++k) { \
|
|
||||||
j = k > 400 ? 800 - k : k; \
|
|
||||||
led##_ON; \
|
|
||||||
for(i = 0; i < j; ++i) { \
|
|
||||||
asm("nop"); \
|
|
||||||
} \
|
|
||||||
led##_OFF; \
|
|
||||||
for(i = 0; i < 400 - j; ++i) { \
|
|
||||||
asm("nop"); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
#define LED_RAINBOW() \
|
|
||||||
volatile int i; \
|
|
||||||
int k,j; \
|
|
||||||
LED_FADE_EXPAND(LED_YELLOW); \
|
|
||||||
LED_FADE_EXPAND(LED_RED); \
|
|
||||||
LED_FADE_EXPAND(LED_PURPLE); \
|
|
||||||
LED_FADE_EXPAND(LED_BLUE); \
|
|
||||||
LED_FADE_EXPAND(LED_GREEN); \
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Flash Customer Configuration Area (CCA) parameters
|
* @name Flash Customer Configuration Area (CCA) parameters
|
||||||
* @{
|
* @{
|
||||||
|
|||||||
@ -28,31 +28,17 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(1, 10)
|
||||||
|
|
||||||
#define LED_PORT PORT->Group[1]
|
#define LED_PORT PORT->Group[1]
|
||||||
#define LED_PIN (10)
|
#define LED0_MASK (1 << 10)
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
|
||||||
* @{
|
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
|
||||||
*/
|
|
||||||
#define LED_ON (LED_PORT.OUTCLR.reg = 1<<LED_PIN)
|
|
||||||
#define LED_OFF (LED_PORT.OUTSET.reg = 1<<LED_PIN)
|
|
||||||
#define LED_TOGGLE (LED_PORT.OUTTGL.reg = 1<<LED_PIN)
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
|
||||||
#define LED_GREEN_ON /* not available */
|
|
||||||
#define LED_GREEN_OFF /* not available */
|
|
||||||
#define LED_GREEN_TOGGLE /* not available */
|
|
||||||
#define LED_ORANGE_ON LED_ON
|
|
||||||
#define LED_ORANGE_OFF LED_OFF
|
|
||||||
#define LED_ORANGE_TOGGLE LED_TOGGLE
|
|
||||||
#define LED_RED_ON /* not available */
|
|
||||||
#define LED_RED_OFF /* not available */
|
|
||||||
#define LED_RED_TOGGLE /* not available */
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,17 +20,14 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
/* initialize the on-board LED */
|
||||||
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
/* initialize the boards LED at pin PA19 */
|
|
||||||
LED_PORT.DIRSET.reg = (1 << LED_PIN);
|
|
||||||
LED_PORT.OUTSET.reg = (1 << LED_PIN);
|
|
||||||
LED_PORT.PINCFG[LED_PIN].bit.PULLEN = false;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,10 +31,12 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign the hardware timer
|
* @brief xtimer configuration
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
#define XTIMER TIMER_1
|
#define XTIMER TIMER_1
|
||||||
#define XTIMER_CHAN (0)
|
#define XTIMER_CHAN (0)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name AT86RF233 configuration
|
* @name AT86RF233 configuration
|
||||||
@ -49,32 +51,17 @@ extern "C" {
|
|||||||
.reset_pin = GPIO_PIN(PB, 15)}
|
.reset_pin = GPIO_PIN(PB, 15)}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(0, 19)
|
||||||
|
|
||||||
#define LED_PORT PORT->Group[0]
|
#define LED_PORT PORT->Group[0]
|
||||||
#define LED_PIN (19)
|
#define LED0_MASK (1 << 19)
|
||||||
#define LED_GPIO GPIO_PIN(0, 19)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
|
||||||
* @{
|
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
|
||||||
*/
|
|
||||||
#define LED_ON (LED_PORT.OUTCLR.reg = (1 << LED_PIN))
|
|
||||||
#define LED_OFF (LED_PORT.OUTSET.reg = (1 << LED_PIN))
|
|
||||||
#define LED_TOGGLE (LED_PORT.OUTTGL.reg = (1 << LED_PIN))
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
|
||||||
#define LED_GREEN_ON /* not available */
|
|
||||||
#define LED_GREEN_OFF /* not available */
|
|
||||||
#define LED_GREEN_TOGGLE /* not available */
|
|
||||||
#define LED_ORANGE_ON /* not available */
|
|
||||||
#define LED_ORANGE_OFF /* not available */
|
|
||||||
#define LED_ORANGE_TOGGLE /* not available */
|
|
||||||
#define LED_RED_ON LED_ON
|
|
||||||
#define LED_RED_OFF LED_OFF
|
|
||||||
#define LED_RED_TOGGLE LED_TOGGLE
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -35,7 +35,7 @@ static const saul_gpio_params_t saul_gpio_params[] =
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
.name = "LED(orange)",
|
.name = "LED(orange)",
|
||||||
.pin = LED_GPIO,
|
.pin = LED0_PIN,
|
||||||
.dir = GPIO_DIR_OUT,
|
.dir = GPIO_DIR_OUT,
|
||||||
.pull = GPIO_NOPULL,
|
.pull = GPIO_NOPULL,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -58,34 +58,19 @@ extern "C" {
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LED pin definitions
|
* @brief LED pin definitions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED0_PIN GPIO_PIN(PF,6)
|
#define LED0_PIN GPIO_PIN(PF, 6)
|
||||||
#define LED1_PIN GPIO_PIN(PF,7)
|
#define LED1_PIN GPIO_PIN(PF, 7)
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Macros for controlling the on-board LEDs.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED0_ON gpio_set(LED0_PIN)
|
#define LED0_ON gpio_set(LED0_PIN)
|
||||||
#define LED0_OFF gpio_clear(LED0_PIN)
|
#define LED0_OFF gpio_clear(LED0_PIN)
|
||||||
#define LED0_TOGGLE gpio_toggle(LED0_PIN)
|
#define LED0_TOGGLE gpio_toggle(LED0_PIN)
|
||||||
|
|
||||||
#define LED1_ON gpio_set(LED1_PIN)
|
#define LED1_ON gpio_set(LED1_PIN)
|
||||||
#define LED1_OFF gpio_clear(LED1_PIN)
|
#define LED1_OFF gpio_clear(LED1_PIN)
|
||||||
#define LED1_TOGGLE gpio_toggle(LED1_PIN)
|
#define LED1_TOGGLE gpio_toggle(LED1_PIN)
|
||||||
|
|
||||||
/* for compatability to other boards */
|
|
||||||
#define LED_GREEN_ON LED1_ON
|
|
||||||
#define LED_GREEN_OFF LED1_OFF
|
|
||||||
#define LED_GREEN_TOGGLE LED1_TOGGLE
|
|
||||||
#define LED_ORANGE_ON /* not available */
|
|
||||||
#define LED_ORANGE_OFF /* not available */
|
|
||||||
#define LED_ORANGE_TOGGLE /* not available */
|
|
||||||
#define LED_RED_ON LED0_ON
|
|
||||||
#define LED_RED_OFF LED0_OFF
|
|
||||||
#define LED_RED_TOGGLE LED0_TOGGLE
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,16 +20,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
/* initialize the boards LEDs */
|
||||||
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED3_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_set(LED0_PIN);
|
||||||
|
gpio_set(LED1_PIN);
|
||||||
|
gpio_set(LED2_PIN);
|
||||||
|
gpio_set(LED3_PIN);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
/* initialize the boards LEDs */
|
|
||||||
leds_init();
|
|
||||||
/* disable systick interrupt, set by the spark bootloader */
|
/* disable systick interrupt, set by the spark bootloader */
|
||||||
SysTick->CTRL = 0;
|
SysTick->CTRL = 0;
|
||||||
/* signal to spark bootloader: do not enable IWDG! set Stop Mode Flag! */
|
/* signal to spark bootloader: do not enable IWDG! set Stop Mode Flag! */
|
||||||
@ -37,30 +43,3 @@ void board_init(void)
|
|||||||
/* configure the RIOT vector table location to internal flash + spark bootloader offset */
|
/* configure the RIOT vector table location to internal flash + spark bootloader offset */
|
||||||
SCB->VTOR = LOCATION_VTABLE;
|
SCB->VTOR = LOCATION_VTABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The LEDs initialization is hard-coded in this function. As the LED is soldered
|
|
||||||
* onto the board it is fixed to its CPU pins.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port A */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
|
|
||||||
|
|
||||||
/* reset pins */
|
|
||||||
LED_PORT->CR[1] &= ~(0xf << (4*(LED_RED_PIN - 8)) |
|
|
||||||
0xf << (4*(LED_GREEN_PIN - 8)) |
|
|
||||||
0xf << (4*(LED_BLUE_PIN - 8)) |
|
|
||||||
0xf << (4*(LED_WHITE_PIN - 8)));
|
|
||||||
|
|
||||||
/* set pins to out */
|
|
||||||
LED_PORT->CR[1] |= (0x3 << (4*(LED_RED_PIN - 8)) |
|
|
||||||
0x3 << (4*(LED_GREEN_PIN - 8)) |
|
|
||||||
0x3 << (4*(LED_BLUE_PIN - 8)) |
|
|
||||||
0x3 << (4*(LED_WHITE_PIN - 8)));
|
|
||||||
|
|
||||||
LED_PORT->BSRR = (1 << LED_RED_PIN) | (1 << LED_GREEN_PIN) | (1 << LED_BLUE_PIN) | (1 << LED_WHITE_PIN);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -41,32 +41,35 @@
|
|||||||
#define XTIMER_MASK (0xffff0000)
|
#define XTIMER_MASK (0xffff0000)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief Macros for controlling the on-board LEDs
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT (GPIOA)
|
#define LED0_PIN GPIO_PIN(PORT_A, 9)
|
||||||
#define LED_RED_PIN (9)
|
#define LED1_PIN GPIO_PIN(PORT_A, 10)
|
||||||
#define LED_GREEN_PIN (10)
|
#define LED2_PIN GPIO_PIN(PORT_A, 8)
|
||||||
#define LED_BLUE_PIN (8)
|
#define LED3_PIN GPIO_PIN(PORT_A, 13)
|
||||||
#define LED_WHITE_PIN (13)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED_PORT (GPIOA)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_MASK (1 << 9)
|
||||||
* @{
|
#define LED1_MASK (1 << 10)
|
||||||
*/
|
#define LED2_MASK (1 << 8)
|
||||||
#define LED_RED_ON (LED_PORT->BRR = (1<<LED_RED_PIN))
|
#define LED3_MASK (1 << 13)
|
||||||
#define LED_RED_OFF (LED_PORT->BSRR = (1<<LED_RED_PIN))
|
|
||||||
#define LED_RED_TOGGLE (LED_PORT->ODR ^= (1<<LED_RED_PIN))
|
#define LED0_ON (LED_PORT->BRR = LED0_MASK)
|
||||||
#define LED_GREEN_ON (LED_PORT->BRR = (1<<LED_GREEN_PIN))
|
#define LED0_OFF (LED_PORT->BSRR = LED0_MASK)
|
||||||
#define LED_GREEN_OFF (LED_PORT->BSRR = (1<<LED_GREEN_PIN))
|
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE (LED_PORT->ODR ^= (1<<LED_GREEN_PIN))
|
|
||||||
#define LED_BLUE_ON (LED_PORT->BRR = (1<<LED_BLUE_PIN))
|
#define LED1_ON (LED_PORT->BRR = LED1_MASK)
|
||||||
#define LED_BLUE_OFF (LED_PORT->BSRR = (1<<LED_BLUE_PIN))
|
#define LED1_OFF (LED_PORT->BSRR = LED1_MASK)
|
||||||
#define LED_BLUE_TOGGLE (LED_PORT->ODR ^= (1<<LED_BLUE_PIN))
|
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
|
||||||
#define LED_WHITE_ON (LED_PORT->BRR = (1<<LED_WHITE_PIN))
|
|
||||||
#define LED_WHITE_OFF (LED_PORT->BSRR = (1<<LED_WHITE_PIN))
|
#define LED2_ON (LED_PORT->BRR = LED2_MASK)
|
||||||
#define LED_WHITE_TOGGLE (LED_PORT->ODR ^= (1<<LED_WHITE_PIN))
|
#define LED2_OFF (LED_PORT->BSRR = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
|
||||||
|
|
||||||
|
#define LED3_ON (LED_PORT->BRR = LED3_MASK)
|
||||||
|
#define LED3_OFF (LED_PORT->BSRR = LED3_MASK)
|
||||||
|
#define LED3_TOGGLE (LED_PORT->ODR ^= LED3_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,45 +19,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "periph/uart.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs (LD3 and LD4)
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
|
||||||
* onto the board they are fixed to their CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pins:
|
|
||||||
* - LD3: PC8
|
|
||||||
* - LD4: PC9
|
|
||||||
*/
|
|
||||||
void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOC */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
|
|
||||||
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_PORT->OSPEEDR |= 0x000f0000;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_PORT->OTYPER &= ~(0x00000300);
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_PORT->MODER &= ~(0x000f0000);
|
|
||||||
LED_PORT->MODER |= 0x00050000;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_PORT->PUPDR &= ~(0x000f0000);
|
|
||||||
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_PORT->BRR = 0x0300;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -27,33 +27,24 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_PORT GPIOC
|
|
||||||
#define LD3_PIN (1 << 9)
|
|
||||||
#define LD4_PIN (1 << 8)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Macros for controlling the on-board LEDs.
|
* @name Macros for controlling the on-board LEDs.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LD3_ON (LED_PORT->BSRR = LD3_PIN)
|
#define LED0_PIN GPIO_PIN(PORT_C, 9)
|
||||||
#define LD3_OFF (LED_PORT->BSRR = (LD3_PIN << 16))
|
#define LED1_PIN GPIO_PIN(PORT_C, 8)
|
||||||
#define LD3_TOGGLE (LED_PORT->ODR ^= LD3_PIN)
|
|
||||||
#define LD4_ON (LED_PORT->BSRR = LD4_PIN)
|
|
||||||
#define LD4_OFF (LED_PORT->BSRR = (LD4_PIN << 16))
|
|
||||||
#define LD4_TOGGLE (LED_PORT->ODR ^= LD4_PIN)
|
|
||||||
|
|
||||||
/* for compatibility to other boards */
|
#define LED_PORT GPIOC
|
||||||
#define LED_GREEN_ON LD3_ON
|
#define LED0_MASK (1 << 9)
|
||||||
#define LED_GREEN_OFF LD3_OFF
|
#define LED1_MASK (1 << 8)
|
||||||
#define LED_GREEN_TOGGLE LD3_TOGGLE
|
|
||||||
#define LED_RED_ON LD4_ON
|
#define LED0_ON (LED_PORT->BSRR = LED0_MASK)
|
||||||
#define LED_RED_OFF LD4_OFF
|
#define LED0_OFF (LED_PORT->BRR = LED0_MASK)
|
||||||
#define LED_RED_TOGGLE LD4_TOGGLE
|
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
|
||||||
|
|
||||||
|
#define LED1_ON (LED_PORT->BSRR = LED1_MASK)
|
||||||
|
#define LED1_OFF (LED_PORT->BRR = LED1_MASK)
|
||||||
|
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,49 +19,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED3_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED4_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED5_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED6_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED7_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs (LD3 to LD10)
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
|
||||||
* onto the board they are fixed to their CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pins:
|
|
||||||
* - LD3: PE9
|
|
||||||
* - LD4: PE8
|
|
||||||
* - LD5: PE10
|
|
||||||
* - LD6: PE15
|
|
||||||
* - LD7: PE11
|
|
||||||
* - LD8: PE14
|
|
||||||
* - LD9: PE12
|
|
||||||
* - LD10: PE13
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOE */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOEEN;
|
|
||||||
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_PORT->OSPEEDR |= 0xffff0000;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_PORT->OTYPER &= ~(0x0000ff00);
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_PORT->MODER &= ~(0xffff0000);
|
|
||||||
LED_PORT->MODER |= 0x55550000;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_PORT->PUPDR &= ~(0xffff0000);
|
|
||||||
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_PORT->BRR = 0xff00;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -27,56 +27,60 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @name LED pin definitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define LED_PORT GPIOE
|
|
||||||
#define LD3_PIN (1 << 9)
|
|
||||||
#define LD4_PIN (1 << 8)
|
|
||||||
#define LD5_PIN (1 << 10)
|
|
||||||
#define LD6_PIN (1 << 15)
|
|
||||||
#define LD7_PIN (1 << 11)
|
|
||||||
#define LD8_PIN (1 << 14)
|
|
||||||
#define LD9_PIN (1 << 12)
|
|
||||||
#define LD10_PIN (1 << 13)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Macros for controlling the on-board LEDs.
|
* @name Macros for controlling the on-board LEDs.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LD3_ON (LED_PORT->BSRRL = LD3_PIN)
|
#define LED0_PIN GPIO_PIN(PORT_E, 9)
|
||||||
#define LD3_OFF (LED_PORT->BSRRH = LD3_PIN)
|
#define LED1_PIN GPIO_PIN(PORT_E, 8)
|
||||||
#define LD3_TOGGLE (LED_PORT->ODR ^= LD3_PIN)
|
#define LED2_PIN GPIO_PIN(PORT_E, 10)
|
||||||
#define LD4_ON (LED_PORT->BSRRL = LD4_PIN)
|
#define LED3_PIN GPIO_PIN(PORT_E, 15)
|
||||||
#define LD4_OFF (LED_PORT->BSRRH = LD4_PIN)
|
#define LED4_PIN GPIO_PIN(PORT_E, 11)
|
||||||
#define LD4_TOGGLE (LED_PORT->ODR ^= LD4_PIN)
|
#define LED5_PIN GPIO_PIN(PORT_E, 14)
|
||||||
#define LD5_ON (LED_PORT->BSRRL = LD5_PIN)
|
#define LED6_PIN GPIO_PIN(PORT_E, 12)
|
||||||
#define LD5_OFF (LED_PORT->BSRRH = LD5_PIN)
|
#define LED7_PIN GPIO_PIN(PORT_E, 13)
|
||||||
#define LD5_TOGGLE (LED_PORT->ODR ^= LD5_PIN)
|
|
||||||
#define LD6_ON (LED_PORT->BSRRL = LD6_PIN)
|
#define LED_PORT GPIOE
|
||||||
#define LD6_OFF (LED_PORT->BSRRH = LD6_PIN)
|
#define LED0_MASK (1 << 9)
|
||||||
#define LD6_TOGGLE (LED_PORT->ODR ^= LD6_PIN)
|
#define LED1_MASK (1 << 8)
|
||||||
#define LD7_ON (LED_PORT->BSRRL = LD7_PIN)
|
#define LED2_MASK (1 << 10)
|
||||||
#define LD7_OFF (LED_PORT->BSRRH = LD7_PIN)
|
#define LED3_MASK (1 << 15)
|
||||||
#define LD7_TOGGLE (LED_PORT->ODR ^= LD7_PIN)
|
#define LED4_MASK (1 << 11)
|
||||||
#define LD8_ON (LED_PORT->BSRRL = LD8_PIN)
|
#define LED5_MASK (1 << 14)
|
||||||
#define LD8_OFF (LED_PORT->BSRRH = LD8_PIN)
|
#define LED6_MASK (1 << 12)
|
||||||
#define LD8_TOGGLE (LED_PORT->ODR ^= LD8_PIN)
|
#define LED7_MASK (1 << 13)
|
||||||
#define LD9_ON (LED_PORT->BSRRL = LD9_PIN)
|
|
||||||
#define LD9_OFF (LED_PORT->BSRRH = LD9_PIN)
|
#define LED0_ON (LED_PORT->BSRRL = LED0_MASK)
|
||||||
#define LD9_TOGGLE (LED_PORT->ODR ^= LD9_PIN)
|
#define LED0_OFF (LED_PORT->BSRRH = LED0_MASK)
|
||||||
#define LD10_ON (LED_PORT->BSRRL = LD10_PIN)
|
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
|
||||||
#define LD10_OFF (LED_PORT->BSRRH = LD10_PIN)
|
|
||||||
#define LD10_TOGGLE (LED_PORT->ODR ^= LD10_PIN)
|
#define LED1_ON (LED_PORT->BSRRL = LED1_MASK)
|
||||||
/* for compatability to other boards */
|
#define LED1_OFF (LED_PORT->BSRRH = LED1_MASK)
|
||||||
#define LED_GREEN_ON LD4_ON
|
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
|
||||||
#define LED_GREEN_OFF LD4_OFF
|
|
||||||
#define LED_GREEN_TOGGLE LD4_TOGGLE
|
#define LED2_ON (LED_PORT->BSRRL = LED2_MASK)
|
||||||
#define LED_RED_ON LD5_ON
|
#define LED2_OFF (LED_PORT->BSRRH = LED2_MASK)
|
||||||
#define LED_RED_OFF LD5_OFF
|
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
|
||||||
#define LED_RED_TOGGLE LD5_TOGGLE
|
|
||||||
|
#define LED3_ON (LED_PORT->BSRRL = LED3_MASK)
|
||||||
|
#define LED3_OFF (LED_PORT->BSRRH = LED3_MASK)
|
||||||
|
#define LED3_TOGGLE (LED_PORT->ODR ^= LED3_MASK)
|
||||||
|
|
||||||
|
#define LED4_ON (LED_PORT->BSRRL = LED4_MASK)
|
||||||
|
#define LED4_OFF (LED_PORT->BSRRH = LED4_MASK)
|
||||||
|
#define LED4_TOGGLE (LED_PORT->ODR ^= LED4_MASK)
|
||||||
|
|
||||||
|
#define LED5_ON (LED_PORT->BSRRL = LED5_MASK)
|
||||||
|
#define LED5_OFF (LED_PORT->BSRRH = LED5_MASK)
|
||||||
|
#define LED5_TOGGLE (LED_PORT->ODR ^= LED5_MASK)
|
||||||
|
|
||||||
|
#define LED6_ON (LED_PORT->BSRRL = LED6_MASK)
|
||||||
|
#define LED6_OFF (LED_PORT->BSRRH = LED6_MASK)
|
||||||
|
#define LED6_TOGGLE (LED_PORT->ODR ^= LED6_MASK)
|
||||||
|
|
||||||
|
#define LED7_ON (LED_PORT->BSRRL = LED7_MASK)
|
||||||
|
#define LED7_OFF (LED_PORT->BSRRH = LED7_MASK)
|
||||||
|
#define LED7_TOGGLE (LED_PORT->ODR ^= LED7_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,45 +19,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the boards LEDs, this is done first for debugging purposes */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
gpio_init(LED3_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs (LD3 and LD4)
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
|
||||||
* onto the board they are fixed to their CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pins:
|
|
||||||
* - LD3: PD13
|
|
||||||
* - LD4: PD12
|
|
||||||
* - LD5: PD14
|
|
||||||
* - LD6: PD15
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOD */
|
|
||||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
|
|
||||||
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_PORT->MODER &= ~(0xff000000);
|
|
||||||
LED_PORT->MODER |= 0x55000000;
|
|
||||||
/* set output speed high-speed */
|
|
||||||
LED_PORT->OSPEEDR |= 0xff000000;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_PORT->OTYPER &= ~(0xf000);
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_PORT->PUPDR &= ~(0xff000000);
|
|
||||||
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_PORT->BSRRH = 0xf000;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -42,37 +42,38 @@ extern "C" {
|
|||||||
* @name LED pin definitions
|
* @name LED pin definitions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT GPIOD
|
|
||||||
#define LD3_PIN (1 << 13)
|
|
||||||
#define LD4_PIN (1 << 12)
|
|
||||||
#define LD5_PIN (1 << 14)
|
|
||||||
#define LD6_PIN (1 << 15)
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Macros for controlling the on-board LEDs.
|
* @name Macros for controlling the on-board LEDs.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LD3_ON (LED_PORT->BSRRL = LD3_PIN)
|
#define LED0_PIN GPIO_PIN(PORT_D, 13)
|
||||||
#define LD3_OFF (LED_PORT->BSRRH = LD3_PIN)
|
#define LED1_PIN GPIO_PIN(PORT_D, 12)
|
||||||
#define LD3_TOGGLE (LED_PORT->ODR ^= LD3_PIN)
|
#define LED2_PIN GPIO_PIN(PORT_D, 14)
|
||||||
#define LD4_ON (LED_PORT->BSRRL = LD4_PIN)
|
#define LED3_PIN GPIO_PIN(PORT_D, 15)
|
||||||
#define LD4_OFF (LED_PORT->BSRRH = LD4_PIN)
|
|
||||||
#define LD4_TOGGLE (LED_PORT->ODR ^= LD4_PIN)
|
|
||||||
#define LD5_ON (LED_PORT->BSRRL = LD5_PIN)
|
|
||||||
#define LD5_OFF (LED_PORT->BSRRH = LD5_PIN)
|
|
||||||
#define LD5_TOGGLE (LED_PORT->ODR ^= LD5_PIN)
|
|
||||||
#define LD6_ON (LED_PORT->BSRRL = LD6_PIN)
|
|
||||||
#define LD6_OFF (LED_PORT->BSRRH = LD6_PIN)
|
|
||||||
#define LD6_TOGGLE (LED_PORT->ODR ^= LD6_PIN)
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
#define LED_PORT GPIOD
|
||||||
#define LED_GREEN_ON LD4_ON
|
#define LED0_MASK (1 << 13)
|
||||||
#define LED_GREEN_OFF LD4_OFF
|
#define LED1_MASK (1 << 12)
|
||||||
#define LED_GREEN_TOGGLE LD4_TOGGLE
|
#define LED2_MASK (1 << 14)
|
||||||
#define LED_RED_ON LD5_ON
|
#define LED3_MASK (1 << 15)
|
||||||
#define LED_RED_OFF LD5_OFF
|
|
||||||
#define LED_RED_TOGGLE LD5_TOGGLE
|
#define LED0_ON (LED_PORT->BSRRL = LED0_MASK)
|
||||||
|
#define LED0_OFF (LED_PORT->BSRRH = LED0_MASK)
|
||||||
|
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
|
||||||
|
|
||||||
|
#define LED1_ON (LED_PORT->BSRRL = LED1_MASK)
|
||||||
|
#define LED1_OFF (LED_PORT->BSRRH = LED1_MASK)
|
||||||
|
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
|
||||||
|
|
||||||
|
#define LED2_ON (LED_PORT->BSRRL = LED2_MASK)
|
||||||
|
#define LED2_OFF (LED_PORT->BSRRH = LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
|
||||||
|
|
||||||
|
#define LED3_ON (LED_PORT->BSRRL = LED3_MASK)
|
||||||
|
#define LED3_OFF (LED_PORT->BSRRH = LED3_MASK)
|
||||||
|
#define LED3_TOGGLE (LED_PORT->ODR ^= LED3_MASK)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -28,11 +28,15 @@
|
|||||||
#ifndef TELOSB_BOARD_H_
|
#ifndef TELOSB_BOARD_H_
|
||||||
#define TELOSB_BOARD_H_
|
#define TELOSB_BOARD_H_
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* for correct inclusion of <msp430.h> */
|
/**
|
||||||
|
* @brief Define the CPU model for the <msp430.h>
|
||||||
|
*/
|
||||||
#ifndef __MSP430F1611__
|
#ifndef __MSP430F1611__
|
||||||
#define __MSP430F1611__
|
#define __MSP430F1611__
|
||||||
#endif
|
#endif
|
||||||
@ -48,37 +52,48 @@ extern "C" {
|
|||||||
#define XTIMER_BACKOFF (40)
|
#define XTIMER_BACKOFF (40)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/* TelosB core */
|
/**
|
||||||
|
* @brief CPU core configuration
|
||||||
|
*
|
||||||
|
* @todo Move this to the periph_conf.h
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
#define MSP430_INITIAL_CPU_SPEED 2457600uL
|
#define MSP430_INITIAL_CPU_SPEED 2457600uL
|
||||||
#define F_CPU MSP430_INITIAL_CPU_SPEED
|
#define F_CPU MSP430_INITIAL_CPU_SPEED
|
||||||
#define F_RC_OSCILLATOR 32768
|
#define F_RC_OSCILLATOR 32768
|
||||||
#define MSP430_HAS_DCOR 0
|
#define MSP430_HAS_DCOR 0
|
||||||
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
|
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/* LEDs ports MSB430 */
|
/**
|
||||||
#define LEDS_PxDIR P5DIR
|
* @brief LED pin definitions and handlers
|
||||||
#define LEDS_PxOUT P5OUT
|
* @{
|
||||||
#define LEDS_CONF_RED 0x10
|
*/
|
||||||
#define LEDS_CONF_GREEN 0x20
|
#define LED0_PIN GPIO_PIN(4, 0)
|
||||||
#define LEDS_CONF_BLUE 0x40
|
#define LED1_PIN GPIO_PIN(4, 1)
|
||||||
|
#define LED2_PIN GPIO_PIN(4, 2)
|
||||||
|
|
||||||
#define LED_RED_ON LEDS_PxOUT &=~LEDS_CONF_RED
|
#define LED_OUT_REG P5OUT
|
||||||
#define LED_RED_OFF LEDS_PxOUT |= LEDS_CONF_RED
|
#define LED0_MASK (0x10)
|
||||||
#define LED_RED_TOGGLE LEDS_PxOUT ^= LEDS_CONF_RED
|
#define LED1_MASK (0x20)
|
||||||
|
#define LED2_MASK (0x40)
|
||||||
|
|
||||||
#define LED_GREEN_ON LEDS_PxOUT &=~LEDS_CONF_GREEN
|
#define LED0_ON (LED_OUT_REG &=~LED0_MASK)
|
||||||
#define LED_GREEN_OFF LEDS_PxOUT |= LEDS_CONF_GREEN
|
#define LED0_OFF (LED_OUT_REG |= LED0_MASK)
|
||||||
#define LED_GREEN_TOGGLE LEDS_PxOUT ^= LEDS_CONF_GREEN
|
#define LED0_TOGGLE (LED_OUT_REG ^= LED0_MASK)
|
||||||
|
|
||||||
#define LED_BLUE_ON LEDS_PxOUT &=~LEDS_CONF_BLUE
|
#define LED1_ON (LED_OUT_REG &=~LED1_MASK)
|
||||||
#define LED_BLUE_OFF LEDS_PxOUT |= LEDS_CONF_BLUE
|
#define LED1_OFF (LED_OUT_REG |= LED1_MASK)
|
||||||
#define LED_BLUE_TOGGLE LEDS_PxOUT ^= LEDS_CONF_BLUE
|
#define LED1_TOGGLE (LED_OUT_REG ^= LED1_MASK)
|
||||||
|
|
||||||
|
#define LED2_ON (LED_OUT_REG &=~LED2_MASK)
|
||||||
|
#define LED2_OFF (LED_OUT_REG |= LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (LED_OUT_REG ^= LED2_MASK)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif /* TELOSB_BOARD_H_ */
|
#endif /* TELOSB_BOARD_H_ */
|
||||||
|
|||||||
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
/* initialize the on-board Amber "L" LED @ pin PB27 */
|
||||||
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
/* initialize the on-board Amber "L" LED @ pin PB27 */
|
|
||||||
gpio_init(LED_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,29 +29,17 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(PB, 27)
|
||||||
|
|
||||||
#define LED_PORT PIOB
|
#define LED_PORT PIOB
|
||||||
#define LED_BIT PIO_PB27
|
#define LED0_MASK PIO_PB27
|
||||||
#define LED_PIN GPIO_PIN(PB, 27)
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED_ON (LED_PORT->PIO_SODR = LED0_MASK)
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED_OFF (LED_PORT->PIO_CODR = LED0_MASK)
|
||||||
* @{
|
#define LED_TOGGLE (LED_PORT->PIO_ODSR ^= LED0_MASK)
|
||||||
*/
|
|
||||||
#define LED_ON (LED_PORT->PIO_SODR = LED_BIT)
|
|
||||||
#define LED_OFF (LED_PORT->PIO_CODR = LED_BIT)
|
|
||||||
#define LED_TOGGLE (LED_PORT->PIO_ODSR ^= LED_BIT)
|
|
||||||
|
|
||||||
/* for compatability to other boards */
|
|
||||||
#define LED_GREEN_ON LED_ON
|
|
||||||
#define LED_GREEN_OFF LED_OFF
|
|
||||||
#define LED_GREEN_TOGGLE LED_TOGGLE
|
|
||||||
#define LED_RED_ON /* not available */
|
|
||||||
#define LED_RED_OFF /* not available */
|
|
||||||
#define LED_RED_TOGGLE /* not available */
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -18,35 +18,15 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
extern void SystemInit(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
/* initialize and turn off the boards LEDs */
|
||||||
|
LED_PORT->DIR[1] = (LED0_MASK | LED1_MASK | LED2_MASK);
|
||||||
|
LED_PORT->SET[1] = (LED0_MASK | LED1_MASK | LED2_MASK);
|
||||||
|
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
/* initialize the boards LEDs */
|
|
||||||
leds_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs (LED1 to LED4)
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
|
||||||
* onto the board they are fixed to their CPU pins.
|
|
||||||
*
|
|
||||||
* The LEDs are connected to the following pins:
|
|
||||||
* - LED1: P1.13
|
|
||||||
* - LED2: P1.14
|
|
||||||
* - LED3: P1.15
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* configure LED pins as output */
|
|
||||||
LED_PORT->DIR[1] = (LED1_PIN | LED2_PIN | LED3_PIN);
|
|
||||||
|
|
||||||
/* clear all LEDs */
|
|
||||||
LED_PORT->SET[1] = (LED1_PIN | LED2_PIN | LED3_PIN);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,35 +31,29 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name LED pin definitions
|
* @brief LED pin definitions and handlers
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT LPC_GPIO
|
#define LED0_PIN GPIO_PIN(0, 13)
|
||||||
#define LED1_PIN BIT13
|
#define LED1_PIN GPIO_PIN(0, 14)
|
||||||
#define LED2_PIN BIT14
|
#define LED2_PIN GPIO_PIN(0, 15)
|
||||||
#define LED3_PIN BIT15
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
#define LED_PORT LPC_GPIO
|
||||||
* @name Macros for controlling the on-board LEDs.
|
#define LED0_MASK BIT13
|
||||||
* @{
|
#define LED1_MASK BIT14
|
||||||
*/
|
#define LED2_MASK BIT15
|
||||||
#define LED1_ON (LED_PORT->CLR[1] = LED1_PIN)
|
|
||||||
#define LED1_OFF (LED_PORT->SET[1] = LED1_PIN)
|
#define LED0_ON (LED_PORT->CLR[1] = LED0_MASK)
|
||||||
#define LED1_TOGGLE (LED_PORT->NOT[1] = LED1_PIN)
|
#define LED0_OFF (LED_PORT->SET[1] = LED0_MASK)
|
||||||
#define LED2_ON (LED_PORT->CLR[1] = LED2_PIN)
|
#define LED0_TOGGLE (LED_PORT->NOT[1] = LED0_MASK)
|
||||||
#define LED2_OFF (LED_PORT->SET[1] = LED2_PIN)
|
|
||||||
#define LED2_TOGGLE (LED_PORT->NOT[1] = LED2_PIN)
|
#define LED1_ON (LED_PORT->CLR[1] = LED1_MASK)
|
||||||
#define LED3_ON (LED_PORT->CLR[1] = LED3_PIN)
|
#define LED1_OFF (LED_PORT->SET[1] = LED1_MASK)
|
||||||
#define LED3_OFF (LED_PORT->SET[1] = LED3_PIN)
|
#define LED1_TOGGLE (LED_PORT->NOT[1] = LED1_MASK)
|
||||||
#define LED3_TOGGLE (LED_PORT->NOT[1] = LED3_PIN)
|
|
||||||
/* for compatibility to other boards */
|
#define LED2_ON (LED_PORT->CLR[1] = LED2_MASK)
|
||||||
#define LED_GREEN_ON LED2_ON
|
#define LED2_OFF (LED_PORT->SET[1] = LED2_MASK)
|
||||||
#define LED_GREEN_OFF LED2_OFF
|
#define LED2_TOGGLE (LED_PORT->NOT[1] = LED2_MASK)
|
||||||
#define LED_GREEN_TOGGLE LED2_TOGGLE
|
|
||||||
#define LED_RED_ON LED1_ON
|
|
||||||
#define LED_RED_OFF LED1_OFF
|
|
||||||
#define LED_RED_TOGGLE LED1_TOGGLE
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "board-conf.h"
|
#include "board.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "flashrom.h"
|
#include "flashrom.h"
|
||||||
|
|
||||||
|
|||||||
@ -107,8 +107,6 @@ void board_init(void)
|
|||||||
msp430_cpu_init();
|
msp430_cpu_init();
|
||||||
msb_ports_init();
|
msb_ports_init();
|
||||||
|
|
||||||
LED_RED_ON;
|
|
||||||
|
|
||||||
msp430_set_cpu_speed(MCLK_8MHZ_SCLK_8MHZ);
|
msp430_set_cpu_speed(MCLK_8MHZ_SCLK_8MHZ);
|
||||||
|
|
||||||
/* initialize STDIO over UART */
|
/* initialize STDIO over UART */
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013 Milan Babel <babel@inf.fu-berlin.de>
|
|
||||||
*
|
|
||||||
* This file is subject to the terms and conditions of the GNU Lesser
|
|
||||||
* General Public License v2.1. See the file LICENSE in the top level
|
|
||||||
* directory for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup boards_wsn430-common WSN430 common
|
|
||||||
* @ingroup boards
|
|
||||||
* @brief Common files for WSN430 based boards
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* @file
|
|
||||||
* @brief Common definitions for WSN430 based boards
|
|
||||||
*
|
|
||||||
* @author unknown
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BOARD_CONF_H_
|
|
||||||
#define BOARD_CONF_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define INFOMEM (0x1000)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @} */
|
|
||||||
#endif /* BOARD-CONF_H */
|
|
||||||
78
boards/wsn430-common/include/board_common.h
Normal file
78
boards/wsn430-common/include/board_common.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Milan Babel <babel@inf.fu-berlin.de>
|
||||||
|
* 2016 Freie Universität Berlin
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
* directory for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup boards_wsn430-common WSN430 common
|
||||||
|
* @ingroup boards
|
||||||
|
* @brief Common files for WSN430 based boards
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @brief Common definitions for WSN430 based boards
|
||||||
|
*
|
||||||
|
* @author Milan Babel <babel@inf.fu-berlin.de>
|
||||||
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOARD_COMMON_H_
|
||||||
|
#define BOARD_COMMON_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Address of the info memory
|
||||||
|
*/
|
||||||
|
#define INFOMEM (0x1000)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Xtimer configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define XTIMER (0)
|
||||||
|
#define XTIMER_CHAN (0)
|
||||||
|
#define XTIMER_MASK (0xffff0000)
|
||||||
|
#define XTIMER_SHIFT_ON_COMPARE (4)
|
||||||
|
#define XTIMER_BACKOFF (40)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LED pin definitions and handlers
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LED0_PIN GPIO_PIN(4, 4)
|
||||||
|
#define LED1_PIN GPIO_PIN(4, 5)
|
||||||
|
#define LED2_PIN GPIO_PIN(4, 6)
|
||||||
|
|
||||||
|
#define LED_DIR_REG P5DIR
|
||||||
|
#define LED0_MASK (1 << 4)
|
||||||
|
#define LED1_MASK (1 << 5)
|
||||||
|
#define LED2_MASK (1 << 6)
|
||||||
|
|
||||||
|
#define LED0_ON (LED_DIR_REG &=~LED0_MASK)
|
||||||
|
#define LED0_OFF (LED_DIR_REG |= LED0_MASK)
|
||||||
|
#define LED0_TOGGLE (LED_DIR_REG ^= LED0_MASK)
|
||||||
|
|
||||||
|
#define LED1_ON (LED_DIR_REG &=~LED1_MASK)
|
||||||
|
#define LED1_OFF (LED_DIR_REG |= LED1_MASK)
|
||||||
|
#define LED1_TOGGLE (LED_DIR_REG ^= LED1_MASK)
|
||||||
|
|
||||||
|
#define LED2_ON (LED_DIR_REG &=~LED2_MASK)
|
||||||
|
#define LED2_OFF (LED_DIR_REG |= LED2_MASK)
|
||||||
|
#define LED2_TOGGLE (LED_DIR_REG ^= LED2_MASK)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* BOARD_COMMON_H_ */
|
||||||
|
/** @} */
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user