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 
9 #pragma once
10 
21 #include "cpu.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
31 #define LED0_PIN GPIO_PIN(0, 17)
32 #define LED1_PIN GPIO_PIN(0, 19)
33 
34 /* as a shortcut, we include the two CS pins into the LED_MASK, this will make
35  * sure both pins are initialized as output and set during board initialization.
36  * This is needed so that the BMX280 and LIS2DH12 device drivers do not
37  * interfere... */
38 #define CS_PIN_MASK ((1 << 3) | (1 << 8))
39 
40 #define LED_PORT NRF_P0
41 #define LED0_MASK (1 << 17)
42 #define LED1_MASK (1 << 19)
43 
44 /* mask used in the common board.c file to initialize and set the given pins */
45 #define LED_MASK (LED0_MASK | LED1_MASK | CS_PIN_MASK)
46 
47 #define LED0_ON (LED_PORT->OUTCLR = LED0_MASK)
48 #define LED0_OFF (LED_PORT->OUTSET = LED0_MASK)
49 #define LED0_TOGGLE (LED_PORT->OUT ^= LED0_MASK)
50 
51 #define LED1_ON (LED_PORT->OUTCLR = LED1_MASK)
52 #define LED1_OFF (LED_PORT->OUTSET = LED1_MASK)
53 #define LED1_TOGGLE (LED_PORT->OUT ^= LED1_MASK)
60 #define BTN0_PIN GPIO_PIN(0, 13)
61 #define BTN0_MODE GPIO_IN_PU
68 #define BMX280_PARAM_CS GPIO_PIN(0, 3)
75 #define LIS2DH12_PARAM_CS GPIO_PIN(0, 8)
76 #define LIS2DH12_PARAM_INT_PIN1 GPIO_PIN(0, 2)
77 #define LIS2DH12_PARAM_INT_PIN2 GPIO_PIN(0, 6)
80 #ifdef __cplusplus
81 }
82 #endif
83