board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Eistec AB
3  * Copyright (C) 2018 HAW Hamburg
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
10 #pragma once
11 
23 #include "cpu.h"
24 #include "periph_conf.h"
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
31 /* Set the FOPT bit to disable NMI so that we can use it as a GPIO pin for
32  * the LED (PTB18) */
33 #define KINETIS_FOPT (0xff & ~(NV_FOPT_NMI_DIS_MASK))
34 
39 #define LED0_PIN GPIO_PIN(PORT_B, 3)
40 #define LED0_MASK (1 << 3)
41 #define LED0_ON (GPIOB->PCOR = LED0_MASK)
42 #define LED0_OFF (GPIOB->PSOR = LED0_MASK)
43 #define LED0_TOGGLE (GPIOB->PTOR = LED0_MASK)
44 
45 #define LED1_PIN GPIO_PIN(PORT_B, 1)
46 #define LED1_MASK (1 << 1)
47 #define LED1_ON (GPIOB->PCOR = LED1_MASK)
48 #define LED1_OFF (GPIOB->PSOR = LED1_MASK)
49 #define LED1_TOGGLE (GPIOB->PTOR = LED1_MASK)
50 
51 #define LED2_PIN GPIO_PIN(PORT_B, 0)
52 #define LED2_MASK (1 << 0)
53 #define LED2_ON (GPIOB->PCOR = LED2_MASK)
54 #define LED2_OFF (GPIOB->PSOR = LED2_MASK)
55 #define LED2_TOGGLE (GPIOB->PTOR = LED2_MASK)
56 
57 #define LED3_PIN GPIO_PIN(PORT_B, 18)
58 #define LED3_MASK (1 << 18)
59 #define LED3_ON (GPIOB->PCOR = LED3_MASK)
60 #define LED3_OFF (GPIOB->PSOR = LED3_MASK)
61 #define LED3_TOGGLE (GPIOB->PTOR = LED3_MASK)
68 /* Pressing SW1 will short this pin to ground but there are no external pull
69  * resistors, use internal pull-up on the pin */
70 /* BTN0 is mapped to SW1 */
71 #define BTN0_PIN GPIO_PIN(PORT_C, 5)
72 #define BTN0_MODE GPIO_IN_PU
79 #define V_PERIPH_PIN GPIO_PIN(PORT_C, 19)
80 #define V_PERIPH_MASK (1 << 19)
81 #define V_PERIPH_ON (GPIOC->PSOR = V_PERIPH_MASK)
82 #define V_PERIPH_OFF (GPIOC->PCOR = V_PERIPH_MASK)
89 #if IS_ACTIVE(KINETIS_XTIMER_SOURCE_PIT)
90 /* PIT xtimer configuration */
91 #define XTIMER_DEV (TIMER_PIT_DEV(0))
92 #define XTIMER_CHAN (0)
93 /* Default xtimer settings should work on the PIT */
94 #else
95 /* LPTMR xtimer configuration */
96 #define XTIMER_DEV (TIMER_LPTMR_DEV(0))
97 #define XTIMER_CHAN (0)
98 /* LPTMR is 16 bits wide and runs at 32768 Hz (clocked by the RTC) */
99 #define XTIMER_WIDTH (16)
100 #define XTIMER_BACKOFF (5)
101 #define XTIMER_ISR_BACKOFF (5)
102 #define XTIMER_HZ (32768ul)
103 #endif
110 #define CONFIG_ZTIMER_USEC_TYPE ZTIMER_TYPE_PERIPH_TIMER
111 #define CONFIG_ZTIMER_USEC_DEV (TIMER_PIT_DEV(0))
118 #define CCS811_PARAM_I2C_DEV (I2C_DEV(0))
119 #define CCS811_PARAM_I2C_ADDR (0x5A)
120 #define CCS811_PARAM_RESET_PIN (GPIO_UNDEF)
121 #define CCS811_PARAM_WAKE_PIN (GPIO_PIN(1, 2))
122 #define CCS811_PARAM_INT_PIN (GPIO_PIN(1, 3))
123 #define CCS811_PARAM_INT_MODE (CCS811_INT_NONE)
130 #define TCS37727_PARAM_I2C (I2C_DEV(0))
131 #define TCS37727_PARAM_ADDR (0x29)
138 #define MMA8X5X_PARAM_I2C (I2C_DEV(0))
139 #define MMA8X5X_PARAM_ADDR (0x1D)
142 #ifdef __cplusplus
143 }
144 #endif
145 
Peripheral MCU configuration for the Zigduino board.