Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Mesotic SAS
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include "periph_cpu.h"
20#include "kernel_defines.h"
21
22#include "board.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32static const i2c_conf_t i2c_config[] = {
33 {
34 .dev = NRF_TWIM3,
35 .scl = GPIO_PIN(0, 31),
36 .sda = GPIO_PIN(0, 30),
37 .speed = I2C_SPEED_NORMAL
38 }
39};
40#define I2C_NUMOF ARRAY_SIZE(i2c_config)
42
47static const spi_conf_t spi_config[] = {
48 {
49 .dev = NRF_SPIM2,
50 .sclk = GPIO_PIN(0, 13),
51 .mosi = GPIO_PIN(0, 11),
52 .miso = GPIO_PIN(0, 12),
53 }
54};
55
56#define SPI_NUMOF ARRAY_SIZE(spi_config)
58
63static const timer_conf_t timer_config[] = {
64 {
65 .dev = NRF_TIMER0,
66 /* using last channel for timer_read(), so only 5 of 6 channels available */
67 .channels = 5,
68 .bitmode = TIMER_BITMODE_BITMODE_32Bit,
69 .irqn = TIMER0_IRQn
70 },
71 {
72 .dev = NRF_TIMER1,
73 /* using last channel for timer_read(), so only 5 of 6 channels available */
74 .channels = 5,
75 .bitmode = TIMER_BITMODE_BITMODE_08Bit,
76 .irqn = TIMER1_IRQn
77 },
78};
79
80#define TIMER_0_ISR isr_timer0
81#define TIMER_1_ISR isr_timer1
82
84#define TIMER_0_MAX_VALUE 0xffffffff
86#define TIMER_1_MAX_VALUE 0xffffffff
87
88#define TIMER_NUMOF ARRAY_SIZE(timer_config)
90
95static const uart_conf_t uart_config[] = {
96 {
97 .dev = NRF_UARTE0,
98 .rx_pin = GPIO_PIN(0, 28),
99 .tx_pin = GPIO_PIN(0, 29),
100#ifdef MODULE_PERIPH_UART_HW_FC
101 .rts_pin = GPIO_UNDEF,
102 .cts_pin = GPIO_UNDEF,
103#endif
104 .irqn = UARTE0_SPIM0_SPIS0_TWIM0_TWIS0_IRQn,
105 },
106 {
107 .dev = NRF_UARTE1,
108 .rx_pin = GPIO_PIN(0, 0),
109 .tx_pin = GPIO_PIN(0, 1),
110#ifdef MODULE_PERIPH_UART_HW_FC
111 .rts_pin = GPIO_UNDEF,
112 .cts_pin = GPIO_UNDEF,
113#endif
114 .irqn = UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn,
115 },
116};
117
118#define UART_NUMOF ARRAY_SIZE(uart_config)
120
125#ifndef RTT_DEV
126#define RTT_DEV (0)
127#endif
128
129#define RTT_MAX_VALUE (0x00ffffff)
130#define RTT_MAX_FREQUENCY (32768U)
131#define RTT_MIN_FREQUENCY (8U)
132#define RTT_CLOCK_FREQUENCY (32768U)
133
134#ifndef RTT_FREQUENCY
135#define RTT_FREQUENCY (1024U)
136#endif
138
143static const pwm_conf_t pwm_config[] = {
144 {
145 .dev = NRF_PWM0,
146 .pin = {
147 LED0_PIN,
148 LED1_PIN,
149 LED2_PIN,
150 LED3_PIN
151 }
152 },
153};
154
155#define PWM_NUMOF ARRAY_SIZE(pwm_config)
157
158#ifdef __cplusplus
159}
160#endif
161
#define LED2_PIN
RX LED yellow.
Definition board.h:32
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
Common macros and compiler attributes/pragmas configuration.
#define NRF_TIMER0
Timer 0.
Definition periph_cpu.h:51
#define NRF_PWM0
PWM 0.
Definition periph_cpu.h:49
#define NRF_TWIM3
I2C master 3.
Definition periph_cpu.h:53
#define NRF_UARTE0
UART 0.
Definition periph_cpu.h:54
#define NRF_TIMER1
Timer 1.
Definition periph_cpu.h:52
#define NRF_UARTE1
UART 1.
Definition periph_cpu.h:55
#define NRF_SPIM2
SPI master 2.
Definition periph_cpu.h:50
Board configuration for the nrf9160dk board.
I2C configuration structure.
Definition periph_cpu.h:295
PWM device configuration.
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214