stm32f3discovery/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 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
35 #define LED0_PIN GPIO_PIN(PORT_E, 9)
36 #define LED1_PIN GPIO_PIN(PORT_E, 8)
37 #define LED2_PIN GPIO_PIN(PORT_E, 10)
38 #define LED3_PIN GPIO_PIN(PORT_E, 15)
39 #define LED4_PIN GPIO_PIN(PORT_E, 11)
40 #define LED5_PIN GPIO_PIN(PORT_E, 14)
41 #define LED6_PIN GPIO_PIN(PORT_E, 12)
42 #define LED7_PIN GPIO_PIN(PORT_E, 13)
43 
44 #define LED_PORT GPIOE
45 #define LED0_MASK (1 << 9)
46 #define LED1_MASK (1 << 8)
47 #define LED2_MASK (1 << 10)
48 #define LED3_MASK (1 << 15)
49 #define LED4_MASK (1 << 11)
50 #define LED5_MASK (1 << 14)
51 #define LED6_MASK (1 << 12)
52 #define LED7_MASK (1 << 13)
53 
54 #define LED0_ON (LED_PORT->BSRR = LED0_MASK)
55 #define LED0_OFF (LED_PORT->BSRR = (LED0_MASK << 16))
56 #define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
57 
58 #define LED1_ON (LED_PORT->BSRR = LED1_MASK)
59 #define LED1_OFF (LED_PORT->BSRR = (LED1_MASK << 16))
60 #define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
61 
62 #define LED2_ON (LED_PORT->BSRR = LED2_MASK)
63 #define LED2_OFF (LED_PORT->BSRR = (LED2_MASK << 16))
64 #define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
65 
66 #define LED3_ON (LED_PORT->BSRR = LED3_MASK)
67 #define LED3_OFF (LED_PORT->BSRR = (LED3_MASK << 16))
68 #define LED3_TOGGLE (LED_PORT->ODR ^= LED3_MASK)
69 
70 #define LED4_ON (LED_PORT->BSRR = LED4_MASK)
71 #define LED4_OFF (LED_PORT->BSRR = (LED4_MASK << 16))
72 #define LED4_TOGGLE (LED_PORT->ODR ^= LED4_MASK)
73 
74 #define LED5_ON (LED_PORT->BSRR = LED5_MASK)
75 #define LED5_OFF (LED_PORT->BSRR = (LED5_MASK << 16))
76 #define LED5_TOGGLE (LED_PORT->ODR ^= LED5_MASK)
77 
78 #define LED6_ON (LED_PORT->BSRR = LED6_MASK)
79 #define LED6_OFF (LED_PORT->BSRR = (LED6_MASK << 16))
80 #define LED6_TOGGLE (LED_PORT->ODR ^= LED6_MASK)
81 
82 #define LED7_ON (LED_PORT->BSRR = LED7_MASK)
83 #define LED7_OFF (LED_PORT->BSRR = (LED7_MASK << 16))
84 #define LED7_TOGGLE (LED_PORT->ODR ^= LED7_MASK)
85 
91 #define BTN0_PIN GPIO_PIN(PORT_A, 0)
92 #define BTN0_MODE GPIO_IN
93 
99 void board_init(void);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* BOARD_H */
106 
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.