Loading...
Searching...
No Matches
periph_conf.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
19#ifndef PERIPH_CONF_H
20#define PERIPH_CONF_H
21
22#include "periph_cpu.h"
23#include "periph_conf_common.h"
24
25#ifdef __cplusplus
26extern "C"
27{
28#endif
29
34static const spi_conf_t spi_config[] = {
35 {
36 .dev = SPI1,
37 .pin_miso = GPIO_PIN(PORT_A, 17),
38 .pin_mosi = GPIO_PIN(PORT_A, 16),
39 .pin_clk = GPIO_PIN(PORT_A, 18),
40 .pin_cs = {
41 GPIO_PIN(PORT_A, 19),
46 },
47 .pcr = GPIO_AF_2,
48 .simmask = SIM_SCGC6_SPI1_MASK
49 }
50};
51#define SPI_NUMOF ARRAY_SIZE(spi_config)
58static const adc_conf_t adc_config[] = {
59 /* dev, pin, channel */
60 /* internal: temperature sensor */
61 /* The temperature sensor has a very high output impedance, it must not be
62 * sampled using hardware averaging, or the sampled values will be garbage */
63 [ 0] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 26, .avg = ADC_AVG_NONE },
64 /* Note: the band gap buffer uses a bit of current and is turned off by default,
65 * Set PMC->REGSC |= PMC_REGSC_BGBE_MASK before reading or the input will be floating */
66 /* internal: band gap */
67 [ 1] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 27, .avg = ADC_AVG_MAX },
68 /* internal: DCDC divided battery level */
69 [ 2] = { .dev = ADC0, .pin = GPIO_UNDEF, .chan = 23, .avg = ADC_AVG_MAX },
70};
71#define ADC_NUMOF ARRAY_SIZE(adc_config)
72/*
73 * KW41Z ADC reference settings:
74 * 0: VREFH external pin or VREF_OUT 1.2 V signal (if VREF module is enabled)
75 * 1: VDDA (analog supply input voltage)
76 * 2-3: reserved
77 *
78 * VREF_OUT and VREFH shares the pin on KW41Z and is tied to VDDA on the
79 * USB-KW41Z board, so it does not matter which setting is chosen here for this
80 * board.
81 */
82#define ADC_REF_SETTING 1
85#ifdef __cplusplus
86}
87#endif
88
89#endif /* PERIPH_CONF_H */
@ PORT_A
port A
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:363
#define ADC_AVG_NONE
Disable hardware averaging.
Definition periph_cpu.h:370
#define ADC_AVG_MAX
Maximum hardware averaging (32 samples)
Definition periph_cpu.h:374
ADC device configuration.
Definition periph_cpu.h:379
ADC_TypeDef * dev
ADC device used.
Definition periph_cpu.h:380
SPI device configuration.
Definition periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition periph_cpu.h:338