periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2023 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 timer_conf_t timer_config[] = {
32  {
33  .dev = NRF_TIMER0_S,
34  .channels = 5,
35  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
36  .irqn = TIMER0_IRQn
37  },
38  {
39  .dev = NRF_TIMER1_S,
40  .channels = 5,
41  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
42  .irqn = TIMER1_IRQn
43  },
44 };
45 
46 #define TIMER_0_ISR isr_timer0
47 #define TIMER_1_ISR isr_timer1
49 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
56 static const uart_conf_t uart_config[] = {
57  {
58  .dev = NRF_UARTE0_S,
59  .rx_pin = GPIO_PIN(1, 0),
60  .tx_pin = GPIO_PIN(1, 1),
61 #ifdef MODULE_PERIPH_UART_HW_FC
62  .rts_pin = GPIO_UNDEF,
63  .cts_pin = GPIO_UNDEF,
64 #endif
65  .irqn = SERIAL0_IRQn,
66  },
67 };
68 
69 #define UART_NUMOF ARRAY_SIZE(uart_config)
76 #ifndef RTT_DEV
77 #define RTT_DEV (0)
78 #endif
79 
80 #define RTT_MAX_VALUE (0x00ffffff)
81 #define RTT_MAX_FREQUENCY (32768U)
82 #define RTT_MIN_FREQUENCY (8U)
83 #define RTT_CLOCK_FREQUENCY (32768U)
85 #ifndef RTT_FREQUENCY
86 #define RTT_FREQUENCY (1024U)
87 #endif
94 static const pwm_conf_t pwm_config[] = {
95  {
96  .dev = NRF_PWM0_S,
97  .pin = {
98  LED0_PIN,
99  LED1_PIN,
100  LED2_PIN,
101  LED3_PIN
102  }
103  },
104 };
105 
106 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
113 static const spi_conf_t spi_config[] = {
114  {
115  .dev = NRF_SPIM1_S,
116  .sclk = GPIO_PIN(0, 17),
117  .mosi = GPIO_PIN(0, 13),
118  .miso = GPIO_PIN(0, 14),
119  }
120 };
121 
122 #define SPI_NUMOF ARRAY_SIZE(spi_config)
129 static const i2c_conf_t i2c_config[] = {
130  {
131  .dev = NRF_TWIM2_S,
132  .scl = GPIO_PIN(1, 3),
133  .sda = GPIO_PIN(1, 2),
134  .speed = I2C_SPEED_NORMAL
135  }
136 };
137 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
140 #ifdef __cplusplus
141 }
142 #endif
143 
#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.