stm32f4discovery/include/board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
22 #ifndef BOARD_H
23 #define BOARD_H
24 
25 #include "cpu.h"
26 #include "periph_conf.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
36 #define XTIMER_OVERHEAD (6)
37 #define XTIMER_BACKOFF (10)
38 
50 #define LED0_PIN GPIO_PIN(PORT_D, 13)
51 #define LED1_PIN GPIO_PIN(PORT_D, 12)
52 #define LED2_PIN GPIO_PIN(PORT_D, 14)
53 #define LED3_PIN GPIO_PIN(PORT_D, 15)
54 
55 #define LED_PORT GPIOD
56 #define LED0_MASK (1 << 13)
57 #define LED1_MASK (1 << 12)
58 #define LED2_MASK (1 << 14)
59 #define LED3_MASK (1 << 15)
60 
61 #define LED0_ON (LED_PORT->BSRR = LED0_MASK)
62 #define LED0_OFF (LED_PORT->BSRR = (LED0_MASK << 16))
63 #define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
64 
65 #define LED1_ON (LED_PORT->BSRR = LED1_MASK)
66 #define LED1_OFF (LED_PORT->BSRR = (LED1_MASK << 16))
67 #define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
68 
69 #define LED2_ON (LED_PORT->BSRR = LED2_MASK)
70 #define LED2_OFF (LED_PORT->BSRR = (LED2_MASK << 16))
71 #define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
72 
73 #define LED3_ON (LED_PORT->BSRR = LED3_MASK)
74 #define LED3_OFF (LED_PORT->BSRR = (LED3_MASK << 16))
75 #define LED3_TOGGLE (LED_PORT->ODR ^= LED3_MASK)
76 
82 #define BTN0_PIN GPIO_PIN(PORT_A, 0)
83 #define BTN0_MODE GPIO_IN
84 
90 void board_init(void);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif /* BOARD_H */
97 
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.