board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Inria
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 
19 #ifndef BOARD_H
20 #define BOARD_H
21 
22 #include <stdint.h>
23 
24 #include "cpu.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 #define LED0_PIN GPIO_PIN(PORT_A, 5)
35 #define LED0_MASK (1 << 5)
36 
37 #define LED0_ON (GPIOA->BSRR = LED0_MASK)
38 #define LED0_OFF (GPIOA->BSRR = (LED0_MASK << 16))
39 #define LED0_TOGGLE (GPIOA->ODR ^= LED0_MASK)
40 
41 #define LED1_PIN GPIO_PIN(PORT_B, 13)
42 #define LED1_MASK (1 << 13)
43 
44 #define LED1_ON (GPIOB->BSRR = LED1_MASK)
45 #define LED1_OFF (GPIOB->BSRR = (LED1_MASK << 16))
46 #define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
47 
53 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
54 #define BTN0_MODE GPIO_IN_PD
56 #define BTN1_PIN GPIO_PIN(PORT_I, 9)
57 #define BTN1_MODE GPIO_IN_PD
59 #define BTN2_PIN GPIO_PIN(PORT_I, 10)
60 #define BTN2_MODE GPIO_IN_PD
62 #define BTN3_PIN GPIO_PIN(PORT_F, 11)
63 #define BTN3_MODE GPIO_IN_PD
65 #define BTN4_PIN GPIO_PIN(PORT_I, 8)
66 #define BTN4_MODE GPIO_IN_PD
72 void board_init(void);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* BOARD_H */
79