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_DEV TIMER_DEV(0)
37 #define XTIMER_CHAN (0)
38 #define XTIMER_OVERHEAD (6)
39 #define XTIMER_BACKOFF (10)
40 
52 #define LED0_PIN GPIO_PIN(PORT_D, 13)
53 #define LED1_PIN GPIO_PIN(PORT_D, 12)
54 #define LED2_PIN GPIO_PIN(PORT_D, 14)
55 #define LED3_PIN GPIO_PIN(PORT_D, 15)
56 
57 #define LED_PORT GPIOD
58 #define LED0_MASK (1 << 13)
59 #define LED1_MASK (1 << 12)
60 #define LED2_MASK (1 << 14)
61 #define LED3_MASK (1 << 15)
62 
63 #define LED0_ON (LED_PORT->BSRR = LED0_MASK)
64 #define LED0_OFF (LED_PORT->BSRR = (LED0_MASK << 16))
65 #define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
66 
67 #define LED1_ON (LED_PORT->BSRR = LED1_MASK)
68 #define LED1_OFF (LED_PORT->BSRR = (LED1_MASK << 16))
69 #define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
70 
71 #define LED2_ON (LED_PORT->BSRR = LED2_MASK)
72 #define LED2_OFF (LED_PORT->BSRR = (LED2_MASK << 16))
73 #define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
74 
75 #define LED3_ON (LED_PORT->BSRR = LED3_MASK)
76 #define LED3_OFF (LED_PORT->BSRR = (LED3_MASK << 16))
77 #define LED3_TOGGLE (LED_PORT->ODR ^= LED3_MASK)
78 
84 #define BTN0_PIN GPIO_PIN(PORT_A, 0)
85 #define BTN0_MODE GPIO_IN
86 
92 void board_init(void);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* BOARD_H */
99 
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.