Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
board.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018 Eistec AB
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser General
5
* Public License v2.1. See the file LICENSE in the top level directory for more
6
* details.
7
*/
8
9
#pragma once
10
21
#include "cpu.h"
22
#include "board_common.h"
23
#include "
periph_conf.h
"
24
25
#ifdef __cplusplus
26
extern
"C"
27
{
28
#endif
29
30
/* PTB18 is configured for non-maskable interrupt at power on reset, but it is
31
* also connected to the LED that is used by the JLink OpenSDA application as a
32
* status indicator, which causes the KW41Z to become stuck in the NMI handler
33
* at power on because the debugger interface is pulling the pin low to enable
34
* the LED to show that it is connected. */
35
/* Set the FOPT bit to disable NMI so that we can use it as a GPIO pin for the LED */
36
#define KINETIS_FOPT (0xff & ~(NV_FOPT_NMI_DIS_MASK))
41
/* The LED pins on this board are connected to both the KW41Z and to the OpenSDA
42
* K22F MCU, which may cause some issues between the two MCUs. The safest way to
43
* use these LEDs is to cut the intentional shorts SH5, SH6 between the K22F and
44
* the KW41Z. Cutting these traces will leave the KW41Z connected to the LEDs
45
* but the K22F will be cut off. */
46
/* The connected pin on the K22F (PTC6) is configured as an input when running
47
* the JLink OpenSDA application, so it should be reasonably safe to use this
48
* LED from the KW41Z */
49
#define LED0_PIN GPIO_PIN(PORT_B, 3)
50
#define LED0_MASK (1 << 3)
51
#define LED0_ON (GPIOB->PCOR = LED0_MASK)
52
#define LED0_OFF (GPIOB->PSOR = LED0_MASK)
53
#define LED0_TOGGLE (GPIOB->PTOR = LED0_MASK)
54
/* Enable this only if you have cut the intentional short SH6 which connects
55
* the debugger pin to the LED and KW41Z PTB18. Otherwise we may end up with one
56
* MCU driving the pin high and the other driving it low */
57
#if 0
/* user has cut SH6 */
58
/* The connected pin on the K22F (PTC7) is configured as a digital output with
59
* high drive strength enabled in the JLink OpenSDA application, so this should
60
* definitely not be configured as a digital output on the KW41Z unless the
61
* corresponding short SH6 has been cut.*/
62
#define LED1_PIN GPIO_PIN(PORT_B, 18)
63
#define LED1_MASK (1 << 18)
64
#define LED1_ON (GPIOB->PCOR = LED1_MASK)
65
#define LED1_OFF (GPIOB->PSOR = LED1_MASK)
66
#define LED1_TOGGLE (GPIOB->PTOR = LED1_MASK)
67
#endif
/* user has cut SH6 */
74
/* Pressing SW1 will short this pin to ground but there are no external pull
75
* resistors, use internal pull-up on the pin */
76
/* BTN0 is mapped to SW1 */
77
#define BTN0_PIN GPIO_PIN(PORT_B, 2)
78
#define BTN0_MODE GPIO_IN_PU
85
#if IS_ACTIVE(KINETIS_XTIMER_SOURCE_PIT)
86
/* PIT xtimer configuration */
87
#define XTIMER_DEV (TIMER_PIT_DEV(0))
88
#define XTIMER_CHAN (0)
89
/* Default xtimer settings should work on the PIT */
90
#else
91
/* LPTMR xtimer configuration */
92
#define XTIMER_DEV (TIMER_LPTMR_DEV(0))
93
#define XTIMER_CHAN (0)
94
/* LPTMR is 16 bits wide and runs at 32768 Hz (clocked by the RTC) */
95
#define XTIMER_WIDTH (16)
96
#define XTIMER_BACKOFF (5)
97
#define XTIMER_ISR_BACKOFF (5)
98
#define XTIMER_HZ (32768ul)
99
#endif
106
#define CONFIG_ZTIMER_USEC_TYPE ZTIMER_TYPE_PERIPH_TIMER
107
#define CONFIG_ZTIMER_USEC_DEV (TIMER_PIT_DEV(0))
108
#define CONFIG_ZTIMER_USEC_FREQ (1000000LU)
109
#define CONFIG_ZTIMER_USEC_WIDTH (32)
112
#ifdef __cplusplus
113
}
114
#endif
115
periph_conf.h
Peripheral MCU configuration for the Zigduino board.
Generated on Fri Jun 20 2025 21:02:35 by
1.9.1