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_PIN GPIO_PIN(PORT_B, 13)
45 #define LED0_MASK (1 << 13)
46 #else
47 #define LED0_PIN GPIO_PIN(PORT_A, 5)
48 #define LED0_MASK (1 << 5)
49 #endif
50 
51 #define LED0_ON (GPIOA->BSRR = LED0_MASK)
52 #define LED0_OFF (GPIOA->BSRR = (LED0_MASK << 16))
53 #define LED0_TOGGLE (GPIOA->ODR ^= LED0_MASK)
54 
60 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
61 #define BTN0_MODE GPIO_IN_PU
62 
67 void board_init(void);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif /* BOARD_COMMON_H */
74 
Mapping from MCU pins to Arduino pins.
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.