board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 
21 #ifndef BOARD_H
22 #define BOARD_H
23 
24 #include <stdint.h>
25 
26 #include "cpu.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
36 #define LED0_PIN GPIO_PIN(PORT_B, 2)
37 #define LED0_MASK (1 << 2)
38 
39 #define LED0_ON (GPIOB->BSRR = LED0_MASK)
40 #define LED0_OFF (GPIOB->BSRR = (LED0_MASK << 16))
41 #define LED0_TOGGLE (GPIOB->ODR ^= LED0_MASK)
42 
43 #define LED1_PIN GPIO_PIN(PORT_E, 8)
44 #define LED1_MASK (1 << 8)
45 
46 #define LED1_ON (GPIOE->BSRR = LED1_MASK)
47 #define LED1_OFF (GPIOE->BSRR = (LED1_MASK << 16))
48 #define LED1_TOGGLE (GPIOE->ODR ^= LED1_MASK)
49 
55 #define BTN0_PIN GPIO_PIN(PORT_A, 0)
56 #define BTN0_MODE GPIO_IN_PD
58 #define BTN1_PIN GPIO_PIN(PORT_A, 1)
59 #define BTN1_MODE GPIO_IN_PD
61 #define BTN2_PIN GPIO_PIN(PORT_A, 5)
62 #define BTN2_MODE GPIO_IN_PD
64 #define BTN3_PIN GPIO_PIN(PORT_A, 2)
65 #define BTN3_MODE GPIO_IN_PD
67 #define BTN4_PIN GPIO_PIN(PORT_A, 3)
68 #define BTN4_MODE GPIO_IN_PD
74 void board_init(void);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
80 #endif /* BOARD_H */
81