Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Eistec AB
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "periph_cpu.h"
19#include "periph_conf_common.h"
20
21#ifdef __cplusplus
22extern "C"
23{
24#endif
25
30static const spi_conf_t spi_config[] = {
31 {
32 .dev = SPI1,
33 .pin_miso = GPIO_PIN(PORT_A, 17),
34 .pin_mosi = GPIO_PIN(PORT_A, 16),
35 .pin_clk = GPIO_PIN(PORT_A, 18),
36 .pin_cs = {
37 GPIO_PIN(PORT_A, 19),
42 },
43 .pcr = GPIO_AF_2,
44 .simmask = SIM_SCGC6_SPI1_MASK
45 }
46};
47#define SPI_NUMOF ARRAY_SIZE(spi_config)
49
54static const adc_conf_t adc_config[] = {
55 /* dev, pin, channel */
56 /* internal: temperature sensor */
57 /* The temperature sensor has a very high output impedance, it must not be
58 * sampled using hardware averaging, or the sampled values will be garbage */
59 [ 0] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 26, .avg = ADC_AVG_NONE },
60 /* Note: the band gap buffer uses a bit of current and is turned off by default,
61 * Set PMC->REGSC |= PMC_REGSC_BGBE_MASK before reading or the input will be floating */
62 /* internal: band gap */
63 [ 1] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 27, .avg = ADC_AVG_MAX },
64 /* internal: DCDC divided battery level */
65 [ 2] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 23, .avg = ADC_AVG_MAX },
66};
67#define ADC_NUMOF ARRAY_SIZE(adc_config)
68/*
69 * KW41Z ADC reference settings:
70 * 0: VREFH external pin or VREF_OUT 1.2 V signal (if VREF module is enabled)
71 * 1: VDDA (analog supply input voltage)
72 * 2-3: reserved
73 *
74 * VREF_OUT and VREFH shares the pin on KW41Z and is tied to VDDA on the
75 * USB-KW41Z board, so it does not matter which setting is chosen here for this
76 * board.
77 */
78#define ADC_REF_SETTING 1
80
81#ifdef __cplusplus
82}
83#endif
84
@ PORT_A
port A
Definition periph_cpu.h:46
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:45
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:362
#define ADC_AVG_NONE
Disable hardware averaging.
Definition periph_cpu.h:369
#define ADC_AVG_MAX
Maximum hardware averaging (32 samples)
Definition periph_cpu.h:373
ADC device configuration.
Definition periph_cpu.h:377
SPI device configuration.
Definition periph_cpu.h:336