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 
19 #include "periph_cpu.h"
20 
21 #include "board.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
31 static const i2c_conf_t i2c_config[] = {
32  {
33  .dev = NRF_TWIM3_S,
34  .scl = GPIO_PIN(0, 31),
35  .sda = GPIO_PIN(0, 30),
36  .speed = I2C_SPEED_NORMAL
37  }
38 };
39 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
46 static const spi_conf_t spi_config[] = {
47  {
48  .dev = NRF_SPIM2_S,
49  .sclk = GPIO_PIN(0, 13),
50  .mosi = GPIO_PIN(0, 11),
51  .miso = GPIO_PIN(0, 12),
52  }
53 };
54 
55 #define SPI_NUMOF ARRAY_SIZE(spi_config)
62 static const timer_conf_t timer_config[] = {
63  {
64  .dev = NRF_TIMER0_S,
65  /* using last channel for timer_read(), so only 5 of 6 channels available */
66  .channels = 5,
67  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
68  .irqn = TIMER0_IRQn
69  },
70  {
71  .dev = NRF_TIMER1_S,
72  /* using last channel for timer_read(), so only 5 of 6 channels available */
73  .channels = 5,
74  .bitmode = TIMER_BITMODE_BITMODE_08Bit,
75  .irqn = TIMER1_IRQn
76  },
77 };
78 
79 #define TIMER_0_ISR isr_timer0
80 #define TIMER_1_ISR isr_timer1
83 #define TIMER_0_MAX_VALUE 0xffffffff
85 #define TIMER_1_MAX_VALUE 0xffffffff
86 
87 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
94 static const uart_conf_t uart_config[] = {
95  {
96  .dev = NRF_UARTE0_S,
97  .rx_pin = GPIO_PIN(0, 28),
98  .tx_pin = GPIO_PIN(0, 29),
99 #ifdef MODULE_PERIPH_UART_HW_FC
100  .rts_pin = GPIO_UNDEF,
101  .cts_pin = GPIO_UNDEF,
102 #endif
103  .irqn = UARTE0_SPIM0_SPIS0_TWIM0_TWIS0_IRQn,
104  },
105  {
106  .dev = NRF_UARTE1_S,
107  .rx_pin = GPIO_PIN(0, 0),
108  .tx_pin = GPIO_PIN(0, 1),
109 #ifdef MODULE_PERIPH_UART_HW_FC
110  .rts_pin = GPIO_UNDEF,
111  .cts_pin = GPIO_UNDEF,
112 #endif
113  .irqn = UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn,
114  },
115 };
116 
117 #define UART_NUMOF ARRAY_SIZE(uart_config)
124 #ifndef RTT_DEV
125 #define RTT_DEV (0)
126 #endif
127 
128 #define RTT_MAX_VALUE (0x00ffffff)
129 #define RTT_MAX_FREQUENCY (32768U)
130 #define RTT_MIN_FREQUENCY (8U)
131 #define RTT_CLOCK_FREQUENCY (32768U)
133 #ifndef RTT_FREQUENCY
134 #define RTT_FREQUENCY (1024U)
135 #endif
142 static const pwm_conf_t pwm_config[] = {
143  {
144  .dev = NRF_PWM0_S,
145  .pin = {
146  LED0_PIN,
147  LED1_PIN,
148  LED2_PIN,
149  LED3_PIN
150  }
151  },
152 };
153 
154 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
157 #ifdef __cplusplus
158 }
159 #endif
160 
#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.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:35
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:93
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:65
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:36
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
Definition: periph_conf.h:218
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:274
I2C configuration structure.
Definition: periph_cpu.h:295
TWI_t * dev
Pointer to hardware module registers.
Definition: periph_cpu.h:296
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition: periph_cpu.h:333
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:334
Timer device configuration.
Definition: periph_cpu.h:260
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:261
UART device configuration.
Definition: periph_cpu.h:214
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:215
Board specific definitions for the Zigduino board.