nucleo144-common/include/board_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  * 2017 OTAKeys
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
24 #ifndef BOARD_COMMON_H
25 #define BOARD_COMMON_H
26 
27 #include "cpu.h"
28 #include "periph_conf.h"
29 #include "arduino_pinmap.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
39 #define LED0_PIN GPIO_PIN(PORT_B, 0)
40 #define LED0_MASK (1 << 0)
41 #define LED0_ON (GPIOB->BSRR = LED0_MASK)
42 #define LED0_OFF (GPIOB->BSRR = (LED0_MASK << 16))
43 #define LED0_TOGGLE (GPIOB->ODR ^= LED0_MASK)
44 
45 #define LED1_PIN GPIO_PIN(PORT_B, 7)
46 #define LED1_MASK (1 << 7)
47 #define LED1_ON (GPIOB->BSRR = LED1_MASK)
48 #define LED1_OFF (GPIOB->BSRR = (LED1_MASK << 16))
49 #define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
50 
51 #define LED2_PIN GPIO_PIN(PORT_B, 14)
52 #define LED2_MASK (1 << 14)
53 #define LED2_ON (GPIOB->BSRR = LED2_MASK)
54 #define LED2_OFF (GPIOB->BSRR = (LED2_MASK << 16))
55 #define LED2_TOGGLE (GPIOB->ODR ^= LED2_MASK)
56 
62 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
63 #define BTN0_MODE GPIO_IN_PD
64 
69 void board_init(void);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* BOARD_COMMON_H */
76 
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.
Mapping from MCU pins to Arduino pins.