nucleo-common/include/board_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
28 #ifndef BOARD_COMMON_H
29 #define BOARD_COMMON_H
30 
31 #include "cpu.h"
32 #include "periph_conf.h"
33 #include "arduino_pinmap.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
43 #ifdef CPU_MODEL_STM32F302R8
44 #define LED0_PORT GPIOB
45 #define LED0_PIN GPIO_PIN(PORT_B, 13)
46 #define LED0_MASK (1 << 13)
47 #else
48 #define LED0_PORT GPIOA
49 #define LED0_PIN GPIO_PIN(PORT_A, 5)
50 #define LED0_MASK (1 << 5)
51 #endif
52 
53 #define LED0_ON (LED0_PORT->BSRR = LED0_MASK)
54 #define LED0_OFF (LED0_PORT->BSRR = (LED0_MASK << 16))
55 #define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
56 
62 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
63 #define BTN0_MODE GPIO_IN_PU
64 
69 void board_init(void);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* BOARD_COMMON_H */
76 
Mapping from MCU pins to Arduino pins.
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.