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 
22 #ifndef BOARD_COMMON_H
23 #define BOARD_COMMON_H
24 
25 #include "cpu.h"
26 #include "periph_conf.h"
27 #include "arduino_pinmap.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 #ifdef CPU_MODEL_STM32F302R8
38 #define LED0_PIN GPIO_PIN(PORT_B, 13)
39 #define LED0_MASK (1 << 13)
40 #else
41 #define LED0_PIN GPIO_PIN(PORT_A, 5)
42 #define LED0_MASK (1 << 5)
43 #endif
44 
45 #define LED0_ON (GPIOA->BSRR = LED0_MASK)
46 #define LED0_OFF (GPIOA->BSRR = (LED0_MASK << 16))
47 #define LED0_TOGGLE (GPIOA->ODR ^= LED0_MASK)
48 
54 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
55 #define BTN0_MODE GPIO_IN_PU
56 
61 void board_init(void);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif /* BOARD_COMMON_H */
68 
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.
Mapping from MCU pins to Arduino pins.