Browse Source

Merge pull request #5045 from haukepetersen/opt_boards_leddefines

boards: unified LED macros
pr/gpio
Hauke Petersen 7 years ago
parent
commit
272f12dfb8
  1. 3
      boards/airfy-beacon/board.c
  2. 18
      boards/airfy-beacon/include/board.h
  3. 2
      boards/arduino-due/board.c
  4. 23
      boards/arduino-due/include/board.h
  5. 21
      boards/arduino-mega2560/board.c
  6. 25
      boards/arduino-mega2560/include/board.h
  7. 21
      boards/avsextrem/include/board.h
  8. 16
      boards/cc2538dk/board.c
  9. 52
      boards/cc2538dk/include/board.h
  10. 16
      boards/chronos/include/board.h
  11. 31
      boards/ek-lm4f120xl/include/board.h
  12. 39
      boards/f4vi1/board.c
  13. 45
      boards/f4vi1/include/board.h
  14. 29
      boards/fox/board.c
  15. 32
      boards/fox/include/board.h
  16. 34
      boards/frdm-k64f/board.c
  17. 52
      boards/frdm-k64f/include/board.h
  18. 39
      boards/iotlab-m3/board.c
  19. 41
      boards/iotlab-m3/include/board.h
  20. 6
      boards/iotlab-m3/include/gpio_params.h
  21. 31
      boards/limifrog-v1/board.c
  22. 26
      boards/limifrog-v1/include/board.h
  23. 4
      boards/mbed_lpc1768/board.c
  24. 52
      boards/mbed_lpc1768/include/board.h
  25. 2
      boards/msb-430-common/board_config.c
  26. 2
      boards/msb-430-common/board_init.c
  27. 37
      boards/msb-430-common/include/board-conf.h
  28. 66
      boards/msb-430-common/include/board_common.h
  29. 37
      boards/msb-430/include/board.h
  30. 37
      boards/msb-430h/include/board.h
  31. 32
      boards/msba2/board_init.c
  32. 21
      boards/msba2/include/board.h
  33. 37
      boards/msbiot/include/board.h
  34. 37
      boards/mulle/board.c
  35. 48
      boards/mulle/include/board.h
  36. 4
      boards/native/board_init.c
  37. 18
      boards/native/include/board.h
  38. 8
      boards/nrf51dongle/board.c
  39. 40
      boards/nrf51dongle/include/board.h
  40. 5
      boards/nrf52dk/board.c
  41. 46
      boards/nrf52dk/include/board.h
  42. 8
      boards/nrf52dk/include/gpio_params.h
  43. 5
      boards/nrf6310/board.c
  44. 40
      boards/nrf6310/include/board.h
  45. 3
      boards/nucleo-common/Makefile
  46. 12
      boards/nucleo-common/Makefile.include
  47. 70
      boards/nucleo-common/include/board_common.h
  48. 11
      boards/nucleo-f091/Makefile.include
  49. 33
      boards/nucleo-f091/board.c
  50. 41
      boards/nucleo-f091/include/board.h
  51. 11
      boards/nucleo-f103/Makefile.include
  52. 23
      boards/nucleo-f103/board.c
  53. 39
      boards/nucleo-f103/include/board.h
  54. 11
      boards/nucleo-f303/Makefile.include
  55. 33
      boards/nucleo-f303/board.c
  56. 41
      boards/nucleo-f303/include/board.h
  57. 11
      boards/nucleo-f334/Makefile.include
  58. 33
      boards/nucleo-f334/board.c
  59. 41
      boards/nucleo-f334/include/board.h
  60. 11
      boards/nucleo-f401/Makefile.include
  61. 33
      boards/nucleo-f401/board.c
  62. 39
      boards/nucleo-f401/include/board.h
  63. 11
      boards/nucleo-l1/Makefile.include
  64. 33
      boards/nucleo-l1/board.c
  65. 41
      boards/nucleo-l1/include/board.h
  66. 37
      boards/openmote-cc2538/board.c
  67. 44
      boards/openmote-cc2538/include/board.h
  68. 33
      boards/pba-d-01-kw2x/board.c
  69. 57
      boards/pba-d-01-kw2x/include/board.h
  70. 5
      boards/pca10000/board.c
  71. 40
      boards/pca10000/include/board.h
  72. 3
      boards/pca10005/board.c
  73. 18
      boards/pca10005/include/board.h
  74. 12
      boards/pttu/include/board.h
  75. 9
      boards/qemu-i386/include/board.h
  76. 33
      boards/qemu-i386/include/periph_conf.h
  77. 35
      boards/remote/board.c
  78. 87
      boards/remote/include/board.h
  79. 28
      boards/saml21-xpro/include/board.h
  80. 11
      boards/samr21-xpro/board.c
  81. 33
      boards/samr21-xpro/include/board.h
  82. 2
      boards/samr21-xpro/include/gpio_params.h
  83. 23
      boards/slwstk6220a/include/board.h
  84. 43
      boards/spark-core/board.c
  85. 47
      boards/spark-core/include/board.h
  86. 37
      boards/stm32f0discovery/board.c
  87. 33
      boards/stm32f0discovery/include/board.h
  88. 47
      boards/stm32f3discovery/board.c
  89. 94
      boards/stm32f3discovery/include/board.h
  90. 41
      boards/stm32f4discovery/board.c
  91. 51
      boards/stm32f4discovery/include/board.h
  92. 53
      boards/telosb/include/board.h
  93. 4
      boards/udoo/board.c
  94. 26
      boards/udoo/include/board.h
  95. 30
      boards/weio/board.c
  96. 44
      boards/weio/include/board.h
  97. 2
      boards/wsn430-common/board_config.c
  98. 2
      boards/wsn430-common/board_init.c
  99. 37
      boards/wsn430-common/include/board-conf.h
  100. 78
      boards/wsn430-common/include/board_common.h
  101. Some files were not shown because too many files have changed in this diff Show More

3
boards/airfy-beacon/board.c

@ -23,9 +23,6 @@
void board_init(void)
{
/* setup led(s) for debugging */
NRF_GPIO->DIRSET = LED_RED_MASK;
/* initialize the CPU */
cpu_init();
}

18
boards/airfy-beacon/include/board.h

@ -38,24 +38,6 @@
#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
*/

2
boards/arduino-due/board.c

@ -27,5 +27,5 @@ void board_init(void)
/* initialize the CPU */
cpu_init();
/* 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);
}

23
boards/arduino-due/include/board.h

@ -32,26 +32,11 @@ extern "C" {
* @name LED pin definitions
* @{
*/
#define LED_PORT PIOB
#define LED_BIT PIO_PB27
#define LED_PIN GPIO_PIN(PB, 27)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#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)
#define LED0_PIN GPIO_PIN(PB, 27)
/* 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 */
#define LED0_ON (PIOB->PIO_SODR = PIO_PB27)
#define LED0_OFF (PIOB->PIO_CODR = PIO_PB27)
#define LED0_TOGGLE (PIOB->PIO_ODSR ^= PIO_PB27)
/** @} */
/**

21
boards/arduino-mega2560/board.c

@ -43,28 +43,13 @@ void board_init(void)
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
led_init();
/* initialize the board LED (connected to pin PB7) */
DDRB |= (1 << DDB7);
PORTB &= ~(1 << 7);
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
*/

25
boards/arduino-mega2560/include/board.h

@ -35,29 +35,16 @@ extern "C" {
#define UART_STDIO_BAUDRATE (9600U)
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_PORT PORTB
#define LED_PIN (1 << 7)
/** @} */
#define LED0_PIN GPIO_PIN(1, 7)
/**
* @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;
#define LED0_MASK (1 << DDB7)
/* 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 */
#define LED0_ON (PORTB |= LED0_MASK)
#define LED0_OFF (PORTB &= ~LED0_MASK)
#define LED0_TOGGLE (PORTB ^= LED0_MASK)
/** @} */
/**

21
boards/avsextrem/include/board.h

@ -32,19 +32,22 @@ extern "C" {
#endif
/**
* @brief Board LED defines
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PIN (BIT25)
#define LED_GREEN_PIN (BIT26)
#define LED0_PIN GPIO_PIN(2, 25)
#define LED1_PIN GPIO_PIN(2, 26)
#define LED_GREEN_OFF (FIO3SET = LED_GREEN_PIN)
#define LED_GREEN_ON (FIO3CLR = LED_GREEN_PIN)
#define LED_GREEN_TOGGLE (FIO3PIN ^= LED_GREEN_PIN)
#define LED0_MASK (BIT25)
#define LED1_MASK (BIT26)
#define LED_RED_OFF (FIO3SET = LED_RED_PIN)
#define LED_RED_ON (FIO3CLR = LED_RED_PIN)
#define LED_RED_TOGGLE (FIO3PIN ^= LED_RED_PIN)
#define LED0_OFF (FIO3SET = LED0_MASK)
#define LED0_ON (FIO3CLR = LED0_MASK)
#define LED0_TOGGLE (FIO3PIN ^= LED0_MASK)
#define LED1_OFF (FIO3SET = LED1_MASK)
#define LED1_ON (FIO3CLR = LED1_MASK)
#define LED1_TOGGLE (FIO3PIN ^= LED1_MASK)
/** @} */
/**

16
boards/cc2538dk/board.c

@ -29,17 +29,6 @@ static void led_init_helper(int gpio_num) {
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
*/
@ -49,7 +38,10 @@ void board_init(void)
cpu_init();
/* 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);
}
/** @} */

52
boards/cc2538dk/include/board.h

@ -28,34 +28,34 @@ extern "C" {
#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 LED_YELLOW_GPIO GPIO_PC1 /**< Yellow LED GPIO pin */
#define LED_GREEN_GPIO GPIO_PC2 /**< Green LED GPIO pin */
#define LED_ORANGE_GPIO GPIO_PC3 /**< Orange LED GPIO pin */
#define LED_RED_ON cc2538_gpio_set(LED_GREEN_GPIO)
#define LED_RED_OFF cc2538_gpio_clear(LED_GREEN_GPIO)
#define LED_RED_TOGGLE cc2538_gpio_toggle(LED_GREEN_GPIO)
#define LED_YELLOW_ON cc2538_gpio_set(LED_YELLOW_GPIO)
#define LED_YELLOW_OFF cc2538_gpio_clear(LED_YELLOW_GPIO)
#define LED_YELLOW_TOGGLE cc2538_gpio_toggle(LED_YELLOW_GPIO)
#define LED_GREEN_ON cc2538_gpio_set(LED_GREEN_GPIO)
#define LED_GREEN_OFF cc2538_gpio_clear(LED_GREEN_GPIO)
#define LED_GREEN_TOGGLE cc2538_gpio_toggle(LED_GREEN_GPIO)
#define LED_ORANGE_ON cc2538_gpio_set(LED_ORANGE_GPIO)
#define LED_ORANGE_OFF cc2538_gpio_clear(LED_ORANGE_GPIO)
#define LED_ORANGE_TOGGLE cc2538_gpio_toggle(LED_ORANGE_GPIO)
/* Default to red if the color is not specified: */
#define LED_ON LED_RED_ON
#define LED_OFF LED_RED_OFF
#define LED_TOGGLE LED_RED_TOGGLE
#define LED0_PIN GPIO_PIN(2, 0)
#define LED1_PIN GPIO_PIN(2, 1)
#define LED2_PIN GPIO_PIN(2, 2)
#define LED3_PIN GPIO_PIN(2, 3)
#define LED0_GPIO GPIO_PC0 /**< red LED */
#define LED1_GPIO GPIO_PC1 /**< yellow LED */
#define LED2_GPIO GPIO_PC2 /**< green LED */
#define LED3_GPIO GPIO_PC3 /**< orange LED */
#define LED0_ON cc2538_gpio_set(LED0_GPIO)
#define LED0_OFF cc2538_gpio_clear(LED0_GPIO)
#define LED0_TOGGLE cc2538_gpio_toggle(LED0_GPIO)
#define LED1_ON cc2538_gpio_set(LED1_GPIO)
#define LED1_OFF cc2538_gpio_clear(LED1_GPIO)
#define LED1_TOGGLE cc2538_gpio_toggle(LED1_GPIO)
#define LED2_ON cc2538_gpio_set(LED2_GPIO)
#define LED2_OFF cc2538_gpio_clear(LED2_GPIO)
#define LED2_TOGGLE cc2538_gpio_toggle(LED2_GPIO)
#define LED3_ON cc2538_gpio_set(LED3_GPIO)
#define LED3_OFF cc2538_gpio_clear(LED3_GPIO)
#define LED3_TOGGLE cc2538_gpio_toggle(LED3_GPIO)
/** @} */
/**

16
boards/chronos/include/board.h

@ -27,7 +27,9 @@
extern "C" {
#endif
/* for correct inclusion of <msp430.h> */
/**
* @brief Define the CPU model for the <msp430.h>
*/
#ifndef __CC430F6137__
#define __CC430F6137__
#endif
@ -53,18 +55,6 @@ extern "C" {
#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
}
#endif

31
boards/ek-lm4f120xl/include/board.h

@ -30,24 +30,29 @@ extern "C" {
#endif
/**
* @name Macros for controlling the on-board LEDs.
* @brief LED pin definitions and handlers
* @{
*/
#define LED_GREEN_PIN 0x08
#define LED_BLUE_PIN 0x04
#define LED_RED_PIN 0x02
#define LED0_PIN GPIO_PIN(5, 7)
#define LED1_PIN GPIO_PIN(5, 2)
#define LED2_PIN GPIO_PIN(5, 1)
#define LED_GREEN_ON GPIO_PORTF_DATA_R |= LED_GREEN_PIN
#define LED_GREEN_OFF GPIO_PORTF_DATA_R &= ~(LED_GREEN_PIN)
#define LED_GREEN_TOGGLE /* not available */
#define LED_PORT (GPIO_PORTF_DATA_R)
#define LED0_MASK (1 << 7)
#define LED1_MASK (1 << 2)
#define LED2_MASK (1 << 1)
#define LED_BLUE_ON GPIO_PORTF_DATA_R |= LED_BLUE_PIN
#define LED_BLUE_OFF GPIO_PORTF_DATA_R &= ~(LED_BLUE_PIN)
#define LED_BLUE_TOGGLE /* not available */
#define LED0_ON (LED_PORT |= LED0_MASK)
#define LED0_OFF (LED_PORT &= ~LED0_MASK)
#define LED0_TOGGLE (LED_PORT ^= LED0_MASK)
#define LED_RED_ON GPIO_PORTF_DATA_R |= LED_RED_PIN
#define LED_RED_OFF GPIO_PORTF_DATA_R &= ~(LED_RED_PIN)
#define LED_RED_TOGGLE /* not available */
#define LED1_ON (LED_PORT |= LED1_MASK)
#define LED1_OFF (LED_PORT &= ~LED1_MASK)
#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)
/* @} */
/**

39
boards/f4vi1/board.c

@ -20,44 +20,15 @@
*/
#include "board.h"
static void leds_init(void);
#include "periph/gpio.h"
void board_init(void)
{
/* 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 the CPU */
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;
}

45
boards/f4vi1/include/board.h

@ -30,40 +30,29 @@ extern "C" {
#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 LD4_PIN (1 << 1)
#define LD5_PIN (1 << 3)
#define LD6_PIN (1 << 2)
#define LED0_MASK (1 << 1)
#define LED1_MASK (1 << 3)
#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)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#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)
#define LED1_ON (LED_PORT->BSRRH = LED1_MASK)
#define LED1_OFF (LED_PORT->BSRRL = LED1_MASK)
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
/* for compatability to other boards */
#define LED_GREEN_ON LD6_ON
#define LED_GREEN_OFF LD6_OFF
#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
#define LED2_ON (LED_PORT->BSRRH = LED2_MASK)
#define LED2_OFF (LED_PORT->BSRRL = LED2_MASK)
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
/** @} */
/**

29
boards/fox/board.c

@ -19,34 +19,17 @@
*/
#include "board.h"
#include "cpu.h"
#include "periph/gpio.h"
static void leds_init(void);
void board_init(void)
{
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
leds_init();
}
/**
* @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));
/* initialize the boards LEDs and turn them off */
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);
}

32
boards/fox/include/board.h

@ -81,32 +81,22 @@ extern "C" {
/** @} */
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PORT (GPIOB)
#define LED_RED_PIN (10)
#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_PIN GPIO_PIN(PORT_B, 10)
#define LED1_PIN GPIO_PIN(PORT_B, 12)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#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 LED0_MASK (1 << 10)
#define LED1_MASK (1 << 12)
#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 LED0_ON (GPIOB->ODR &= ~LED0_MASK)
#define LED0_OFF (GPIOB->ODR |= LED0_MASK)
#define LED0_TOGGLE (GPIOB->ODR ^= LED0_MASK)
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
#define LED1_ON (GPIOB->ODR &= ~LED1_MASK)
#define LED1_OFF (GPIOB->ODR |= LED1_MASK)
#define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
/** @} */
/**

34
boards/frdm-k64f/board.c

@ -20,34 +20,18 @@
*/
#include "board.h"
static void leds_init(void);
#include "periph/gpio.h"
void board_init(void)
{
leds_init();
/* initialize the CPU core */
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->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);
/* initialize and turn off the 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);
gpio_set(LED0_PIN);
gpio_set(LED1_PIN);
gpio_set(LED2_PIN);
}

52
boards/frdm-k64f/include/board.h

@ -31,44 +31,28 @@ extern "C"
#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 LED_G_PORT_CLKEN() (PORTE_CLOCK_GATE = 1) /**< Clock Enable for PORTE*/
#define LED_B_PORT_CLKEN() (PORTB_CLOCK_GATE = 1) /**< Clock Enable for PORTB*/
#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_PIN GPIO_PIN(PORT_B, 22)
#define LED1_PIN GPIO_PIN(PORT_E, 26)
#define LED2_PIN GPIO_PIN(PORT_B, 21)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#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))
#define LED0_MASK (1 << 22)
#define LED1_MASK (1 << 26)
#define LED2_MASK (1 << 21)
#define LED0_ON (GPIOB->PCOR = LED0_MASK)
#define LED0_OFF (GPIOB->PSOR = LED0_MASK)
#define LED0_TOGGLE (GPIOB->PTOR = LED0_MASK)
#define LED1_ON (GPIOE->PCOR = LED1_MASK)
#define LED1_OFF (GPIOE->PSOR = LED1_MASK)
#define LED1_TOGGLE (GPIOE->PTOR = LED1_MASK)
/* for compatability to other boards */
#define LED_GREEN_ON LED_G_ON
#define LED_GREEN_OFF LED_G_OFF
#define LED_GREEN_TOGGLE LED_G_TOGGLE
#define LED_RED_ON LED_R_ON
#define LED_RED_OFF LED_R_OFF
#define LED_RED_TOGGLE LED_R_TOGGLE
#define LED2_ON (GPIOB->PCOR = LED2_MASK)
#define LED2_OFF (GPIOB->PSOR = LED2_MASK)
#define LED2_TOGGLE (GPIOB->PTOR = LED2_MASK)
/** @} */
/**

39
boards/iotlab-m3/board.c

@ -19,41 +19,18 @@
*/
#include "board.h"
#include "cpu.h"
static void leds_init(void);
#include "periph/gpio.h"
void board_init(void)
{
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
leds_init();
}
/**
* @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: 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));
/* initialize the boards LEDs and turn them off */
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);
gpio_set(LED1_PIN);
gpio_set(LED2_PIN);
}

41
boards/iotlab-m3/include/board.h

@ -108,35 +108,28 @@ extern "C" {
/** @} */
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PORT (GPIOD)
#define LED_RED_PIN (2)
#define LED_RED_GPIO GPIO_PIN(PORT_D,2)
#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_PIN GPIO_PIN(PORT_D, 2)
#define LED1_PIN GPIO_PIN(PORT_B, 5)
#define LED2_PIN GPIO_PIN(PORT_C, 10)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#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 LED0_MASK (1 << 2)
#define LED1_MASK (1 << 5)
#define LED2_MASK (1 << 10)
#define LED0_ON (GPIOD->ODR &= ~LED0_MASK)
#define LED0_OFF (GPIOD->ODR |= LED0_MASK)
#define LED0_TOGGLE (GPIOD->ODR ^= LED0_MASK)
#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 LED1_ON (GPIOB->ODR &= ~LED1_MASK)
#define LED1_OFF (GPIOB->ODR |= LED1_MASK)
#define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
#define LED_ORANGE_ON (LED_ORANGE_PORT->ODR &= ~(1<<LED_ORANGE_PIN))
#define LED_ORANGE_OFF (LED_ORANGE_PORT->ODR |= (1<<LED_ORANGE_PIN))
#define LED_ORANGE_TOGGLE (LED_ORANGE_PORT->ODR ^= (1<<LED_ORANGE_PIN))
#define LED2_ON (GPIOC->ODR &= ~LED2_MASK)
#define LED2_OFF (GPIOC->ODR |= LED2_MASK)
#define LED2_TOGGLE (GPIOC->ODR ^= LED2_MASK)
/** @} */
/**

6
boards/iotlab-m3/include/gpio_params.h

@ -33,19 +33,19 @@ static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED(red)",
.pin = LED_RED_GPIO,
.pin = LED0_PIN,
.dir = GPIO_DIR_OUT,
.pull = GPIO_NOPULL,
},
{
.name = "LED(green)",
.pin = LED_GREEN_GPIO,
.pin = LED1_PIN,
.dir = GPIO_DIR_OUT,
.pull = GPIO_NOPULL,
},
{
.name = "LED(orange)",
.pin = LED_ORANGE_GPIO,
.pin = LED2_PIN,
.dir = GPIO_DIR_OUT,
.pull = GPIO_NOPULL,
},

31
boards/limifrog-v1/board.c

@ -19,40 +19,13 @@
*/
#include "board.h"
#include "cpu.h"
#include "periph/gpio.h"
static void leds_init(void);
void board_init(void)
{
/* initialize the boards LEDs */
leds_init();
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
/* initialize the CPU */
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);
}

26
boards/limifrog-v1/include/board.h

@ -31,27 +31,17 @@ extern "C" {
#endif
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PORT (GPIOC)
#define LED_RED_PIN (3)
#define LED_RED_GPIO GPIO_PIN(PORT_C,3)
/** @} */
#define LED0_PIN GPIO_PIN(PORT_C, 3)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_GREEN_ON
#define LED_GREEN_OFF
#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))
#define LED0_PORT (GPIOC)
#define LED0_MASK (1 << 3)
#define LED0_ON (LED0_PORT->BSRRL = LED0_MASK)
#define LED0_OFF (LED0_PORT->BSRRH = LED0_MASK)
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
/** @} */
/**

4
boards/mbed_lpc1768/board.c

@ -48,8 +48,8 @@ void board_init(void)
static void leds_init(void)
{
/* 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 */
LED_PORT->FIOCLR = (LED1_PIN | LED2_PIN | LED3_PIN | LED4_PIN);
LED_PORT->FIOCLR = (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
}

52
boards/mbed_lpc1768/include/board.h

@ -33,40 +33,32 @@ extern "C" {
#endif
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_PORT LPC_GPIO1
#define LED1_PIN BIT18
#define LED2_PIN BIT20
#define LED3_PIN BIT21
#define LED4_PIN BIT23
/** @} */
#define LED0_PIN GPIO_PIN(1, 18)
#define LED1_PIN GPIO_PIN(1, 20)
#define LED2_PIN GPIO_PIN(1, 21)
#define LED3_PIN GPIO_PIN(1, 23)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED1_ON (LED_PORT->FIOSET = LED1_PIN)
#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)
#define LED_PORT (LPC_GPIO1)
#define LED0_MASK (BIT18)
#define LED1_MASK (BIT20)
#define LED2_MASK (BIT21)
#define LED3_MASK (BIT23)
/* for compatibility to other boards */
#define LED_GREEN_ON LED1_ON
#define LED_GREEN_OFF LED1_OFF
#define LED_GREEN_TOGGLE LED1_TOGGLE
#define LED_RED_ON LED4_ON
#define LED_RED_OFF LED4_OFF
#define LED_RED_TOGGLE LED4_TOGGLE
#define LED0_ON (LED_PORT->FIOSET = LED0_MASK)
#define LED0_OFF (LED_PORT->FIOCLR = LED0_MASK)
#define LED0_TOGGLE (LED_PORT->FIOPIN ^= LED0_MASK)
#define LED1_ON (LED_PORT->FIOSET = LED1_MASK)
#define LED1_OFF (LED_PORT->FIOCLR = LED1_MASK)
#define LED1_TOGGLE (LED_PORT->FIOPIN ^= LED1_MASK)
#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)
/** @} */
/**

2
boards/msb-430-common/board_config.c

@ -21,7 +21,7 @@
#include <stdint.h>
#include <string.h>
#include "board-conf.h"
#include "board.h"
#include "config.h"
#include "flashrom.h"

2
boards/msb-430-common/board_init.c

@ -199,8 +199,6 @@ void board_init(void)
msp430_cpu_init();
msb_ports_init();
LED_RED_ON;
msp430_set_cpu_speed(CLOCK_CORECLOCK);
/* finally initialize STDIO over UART */

37
boards/msb-430-common/include/board-conf.h

@ -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

@ -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 */
/** @} */

37
boards/msb-430/include/board.h

@ -34,58 +34,35 @@
#ifndef MSB_BOARD_H_
#define MSB_BOARD_H_
#include "board-conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* for correct inclusion of <msp430.h> */
/**
* @brief Define the CPU model for the <msp430.h>
*/
#ifndef __MSP430F1612__
#define __MSP430F1612__
#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 F_CPU MSP430_INITIAL_CPU_SPEED
#define F_RC_OSCILLATOR 32768
#define MSP430_HAS_DCOR 1
#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
}
#endif
#include "board-conf.h"
/** @} */
#endif /* MSB_BOARD_H_ */

37
boards/msb-430h/include/board.h

@ -22,56 +22,35 @@
#ifndef MSB_BOARD_H_
#define MSB_BOARD_H_
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* for correct inclusion of <msp430.h> */
/**
* @brief Define the CPU model for the <msp430.h>
*/
#ifndef __MSP430F1612__
#define __MSP430F1612__
#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 F_CPU MSP430_INITIAL_CPU_SPEED
#define F_RC_OSCILLATOR 32768
#define MSP430_HAS_DCOR 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
}
#endif
#include "board-conf.h"
/** @} */
#endif /* MSB_BOARD_H_ */

32
boards/msba2/board_init.c

@ -27,28 +27,6 @@
#include "board.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)
{
gpio_init_ports();
@ -58,13 +36,11 @@ void bl_init_ports(void)
PINSEL0 &= ~(BIT5 + BIT7);
/* LEDS */
FIO3DIR |= LED_RED_PIN;
FIO3DIR |= LED_GREEN_PIN;
LED_RED_OFF;
LED_GREEN_OFF;
FIO3DIR |= LED0_MASK;
FIO3DIR |= LED1_MASK;
/* short blinking of both of the LEDs on startup */
bl_blink();
LED0_OFF;
LED0_OFF;
}
void init_clks1(void)

21
boards/msba2/include/board.h

@ -29,19 +29,22 @@ extern "C" {
#endif
/**
* @brief Board LED defines
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PIN (BIT25)
#define LED_GREEN_PIN (BIT26)
#define LED0_PIN GPIO_PIN(2, 25)
#define LED1_PIN GPIO_PIN(2, 26)
#define LED_GREEN_OFF (FIO3SET = LED_GREEN_PIN)
#define LED_GREEN_ON (FIO3CLR = LED_GREEN_PIN)
#define LED_GREEN_TOGGLE (FIO3PIN ^= LED_GREEN_PIN)
#define LED0_MASK (BIT25)
#define LED1_MASK (BIT26)
#define LED_RED_OFF (FIO3SET = LED_RED_PIN)
#define LED_RED_ON (FIO3CLR = LED_RED_PIN)
#define LED_RED_TOGGLE (FIO3PIN ^= LED_RED_PIN)
#define LED0_OFF (FIO3SET = LED0_MASK)
#define LED0_ON (FIO3CLR = LED0_MASK)
#define LED0_TOGGLE (FIO3PIN ^= LED0_MASK)
#define LED1_OFF (FIO3SET = LED1_MASK)
#define LED1_ON (FIO3CLR = LED1_MASK)
#define LED1_TOGGLE (FIO3PIN ^= LED1_MASK)
/** @} */
/**

37
boards/msbiot/include/board.h

@ -49,28 +49,29 @@ extern "C" {
/** @} */
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(1, 8)
#define LED1_PIN GPIO_PIN(1, 14)
#define LED2_PIN GPIO_PIN(1, 15)
#define LED_PORT GPIOB
#define LED_RED_PIN (1 << 8)
#define LED_YELLOW_PIN (1 << 14)
#define LED_GREEN_PIN (1 << 15)
/** @} */
#define LED0_MASK (1 << 8)
#define LED1_MASK (1 << 14)
#define LED2_MASK (1 << 15)
/**