board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  * 2017 OTAKeys
4  * 2018 Freie Universität Berlin
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
26 #ifndef BOARD_H
27 #define BOARD_H
28 
29 #include "board_nucleo.h"
30 #include "arduino_pinmap.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
40 #if defined(CPU_MODEL_STM32L496ZG) || defined(CPU_MODEL_STM32L4R5ZI) || \
41  defined(CPU_MODEL_STM32L552ZE)
42 #define LED0_PORT GPIOC
43 #define LED0_PIN GPIO_PIN(PORT_C, 7)
44 #define LED0_MASK (1 << 7)
45 #else
46 #define LED0_PORT GPIOB
47 #define LED0_PIN GPIO_PIN(PORT_B, 0)
48 #define LED0_MASK (1 << 0)
49 #endif
50 #define LED0_ON (LED0_PORT->BSRR = LED0_MASK)
51 #define LED0_OFF (LED0_PORT->BSRR = (LED0_MASK << 16))
52 #define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
53 
54 #define LED1_PIN GPIO_PIN(PORT_B, 7)
55 #define LED1_MASK (1 << 7)
56 #define LED1_ON (GPIOB->BSRR = LED1_MASK)
57 #define LED1_OFF (GPIOB->BSRR = (LED1_MASK << 16))
58 #define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
59 
60 #if defined(CPU_MODEL_STM32L552ZE)
61 #define LED2_PORT GPIOA
62 #define LED2_PIN GPIO_PIN(PORT_A, 9)
63 #define LED2_MASK (1 << 9)
64 #else
65 #define LED2_PORT GPIOB
66 #define LED2_PIN GPIO_PIN(PORT_B, 14)
67 #define LED2_MASK (1 << 14)
68 #endif
69 #define LED2_ON (LED2_PORT->BSRR = LED2_MASK)
70 #define LED2_OFF (LED2_PORT->BSRR = (LED2_MASK << 16))
71 #define LED2_TOGGLE (LED2_PORT->ODR ^= LED2_MASK)
72 
73 /* the Nucleo144 boards always use LED0, as there is no dual use of its pin */
74 #ifndef AUTO_INIT_LED0
75 #define AUTO_INIT_LED0
76 #endif
77 
83 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
84 #define BTN0_MODE GPIO_IN_PD
85 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif /* BOARD_H */
92 
arduino_pinmap.h
Mapping from MCU pins to Arduino pins.
board_nucleo.h
Global common Nucleo board configuration.