board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 
19 #ifndef BOARD_H
20 #define BOARD_H
21 
22 #include "cpu.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define LED0_PIN GPIO_PIN(0, 17)
33 #define LED1_PIN GPIO_PIN(0, 19)
34 
35 /* as a shortcut, we include the two CS pins into the LED_MASK, this will make
36  * sure both pins are initialized as output and set during board initialization.
37  * This is needed so that the BMX280 and LIS2DH12 device drivers do not
38  * interfere... */
39 #define CS_PIN_MASK ((1 << 3) | (1 << 8))
40 
41 #define LED_PORT NRF_P0
42 #define LED0_MASK (1 << 17)
43 #define LED1_MASK (1 << 19)
44 
45 /* mask used in the common board.c file to initialize and set the given pins */
46 #define LED_MASK (LED0_MASK | LED1_MASK | CS_PIN_MASK)
47 
48 #define LED0_ON (LED_PORT->OUTCLR = LED0_MASK)
49 #define LED0_OFF (LED_PORT->OUTSET = LED0_MASK)
50 #define LED0_TOGGLE (LED_PORT->OUT ^= LED0_MASK)
51 
52 #define LED1_ON (LED_PORT->OUTCLR = LED1_MASK)
53 #define LED1_OFF (LED_PORT->OUTSET = LED1_MASK)
54 #define LED1_TOGGLE (LED_PORT->OUT ^= LED1_MASK)
55 
61 #define BTN0_PIN GPIO_PIN(0, 13)
62 #define BTN0_MODE GPIO_IN_PU
63 
69 #define BMX280_PARAM_CS GPIO_PIN(0, 3)
70 
76 #define LIS2DH12_PARAM_CS GPIO_PIN(0, 8)
77 #define LIS2DH12_PARAM_INT_PIN1 GPIO_PIN(0, 2)
78 #define LIS2DH12_PARAM_INT_PIN2 GPIO_PIN(0, 6)
79 
84 void board_init(void);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* BOARD_H */
91 
board_init
void board_init(void)
Board level initialization.