Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Mesotic SAS
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef PERIPH_CONF_H
21#define PERIPH_CONF_H
22
23#include "periph_cpu.h"
24
25#include "board.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
35static const i2c_conf_t i2c_config[] = {
36 {
37 .dev = NRF_TWIM3_S,
38 .scl = GPIO_PIN(0, 31),
39 .sda = GPIO_PIN(0, 30),
40 .speed = I2C_SPEED_NORMAL
41 }
42};
43#define I2C_NUMOF ARRAY_SIZE(i2c_config)
50static const spi_conf_t spi_config[] = {
51 {
52 .dev = NRF_SPIM2_S,
53 .sclk = GPIO_PIN(0, 13),
54 .mosi = GPIO_PIN(0, 11),
55 .miso = GPIO_PIN(0, 12),
56 }
57};
58
59#define SPI_NUMOF ARRAY_SIZE(spi_config)
66static const timer_conf_t timer_config[] = {
67 {
68 .dev = NRF_TIMER0_S,
69 /* using last channel for timer_read(), so only 5 of 6 channels available */
70 .channels = 5,
71 .bitmode = TIMER_BITMODE_BITMODE_32Bit,
72 .irqn = TIMER0_IRQn
73 },
74 {
75 .dev = NRF_TIMER1_S,
76 /* using last channel for timer_read(), so only 5 of 6 channels available */
77 .channels = 5,
78 .bitmode = TIMER_BITMODE_BITMODE_08Bit,
79 .irqn = TIMER1_IRQn
80 },
81};
82
83#define TIMER_0_ISR isr_timer0
84#define TIMER_1_ISR isr_timer1
87#define TIMER_0_MAX_VALUE 0xffffffff
89#define TIMER_1_MAX_VALUE 0xffffffff
90
91#define TIMER_NUMOF ARRAY_SIZE(timer_config)
98static const uart_conf_t uart_config[] = {
99 {
100 .dev = NRF_UARTE0_S,
101 .rx_pin = GPIO_PIN(0, 28),
102 .tx_pin = GPIO_PIN(0, 29),
103#ifdef MODULE_PERIPH_UART_HW_FC
104 .rts_pin = GPIO_UNDEF,
105 .cts_pin = GPIO_UNDEF,
106#endif
107 .irqn = UARTE0_SPIM0_SPIS0_TWIM0_TWIS0_IRQn,
108 },
109 {
110 .dev = NRF_UARTE1_S,
111 .rx_pin = GPIO_PIN(0, 0),
112 .tx_pin = GPIO_PIN(0, 1),
113#ifdef MODULE_PERIPH_UART_HW_FC
114 .rts_pin = GPIO_UNDEF,
115 .cts_pin = GPIO_UNDEF,
116#endif
117 .irqn = UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn,
118 },
119};
120
121#define UART_NUMOF ARRAY_SIZE(uart_config)
128#ifndef RTT_DEV
129#define RTT_DEV (0)
130#endif
131
132#define RTT_MAX_VALUE (0x00ffffff)
133#define RTT_MAX_FREQUENCY (32768U)
134#define RTT_MIN_FREQUENCY (8U)
135#define RTT_CLOCK_FREQUENCY (32768U)
137#ifndef RTT_FREQUENCY
138#define RTT_FREQUENCY (1024U)
139#endif
146static const pwm_conf_t pwm_config[] = {
147 {
148 .dev = NRF_PWM0_S,
149 .pin = {
150 LED0_PIN,
151 LED1_PIN,
152 LED2_PIN,
153 LED3_PIN
154 }
155 },
156};
157
158#define PWM_NUMOF ARRAY_SIZE(pwm_config)
161#ifdef __cplusplus
162}
163#endif
164
165#endif /* PERIPH_CONF_H */
#define LED1_PIN
TX LED yellow.
Definition board.h:35
#define LED2_PIN
RX LED yellow.
Definition board.h:36
#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.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
I2C configuration structure.
Definition periph_cpu.h:299
TWI_t * dev
Pointer to hardware module registers.
Definition periph_cpu.h:300
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition periph_cpu.h:338
Timer device configuration.
Definition periph_cpu.h:264
TC0_t * dev
Pointer to the used as Timer device.
Definition periph_cpu.h:265
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219
Board specific definitions for the Zigduino board.