periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 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
28 extern "C" {
29 #endif
30 
35 static const timer_conf_t timer_config[] = {
36  {
37  .dev = NRF_TIMER0_S,
38  .channels = 5,
39  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
40  .irqn = TIMER0_IRQn
41  },
42  {
43  .dev = NRF_TIMER1_S,
44  .channels = 5,
45  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
46  .irqn = TIMER1_IRQn
47  },
48 };
49 
50 #define TIMER_0_ISR isr_timer0
51 #define TIMER_1_ISR isr_timer1
53 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
60 static const uart_conf_t uart_config[] = {
61  {
62  .dev = NRF_UARTE0_S,
63  .rx_pin = GPIO_PIN(1, 0),
64  .tx_pin = GPIO_PIN(1, 1),
65 #ifdef MODULE_PERIPH_UART_HW_FC
66  .rts_pin = GPIO_UNDEF,
67  .cts_pin = GPIO_UNDEF,
68 #endif
69  .irqn = SERIAL0_IRQn,
70  },
71 };
72 
73 #define UART_NUMOF ARRAY_SIZE(uart_config)
80 #ifndef RTT_DEV
81 #define RTT_DEV (0)
82 #endif
83 
84 #define RTT_MAX_VALUE (0x00ffffff)
85 #define RTT_MAX_FREQUENCY (32768U)
86 #define RTT_MIN_FREQUENCY (8U)
87 #define RTT_CLOCK_FREQUENCY (32768U)
89 #ifndef RTT_FREQUENCY
90 #define RTT_FREQUENCY (1024U)
91 #endif
98 static const pwm_conf_t pwm_config[] = {
99  {
100  .dev = NRF_PWM0_S,
101  .pin = {
102  LED0_PIN,
103  LED1_PIN,
104  LED2_PIN,
105  LED3_PIN
106  }
107  },
108 };
109 
110 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
117 static const spi_conf_t spi_config[] = {
118  {
119  .dev = NRF_SPIM1_S,
120  .sclk = GPIO_PIN(0, 17),
121  .mosi = GPIO_PIN(0, 13),
122  .miso = GPIO_PIN(0, 14),
123  }
124 };
125 
126 #define SPI_NUMOF ARRAY_SIZE(spi_config)
133 static const i2c_conf_t i2c_config[] = {
134  {
135  .dev = NRF_TWIM2_S,
136  .scl = GPIO_PIN(1, 3),
137  .sda = GPIO_PIN(1, 2),
138  .speed = I2C_SPEED_NORMAL
139  }
140 };
141 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #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.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:39
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:97
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:69
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:40
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
Definition: periph_conf.h:222
@ 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.