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 
9 #pragma once
10 
22 #include "periph_cpu.h"
23 
24 #include "board.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 static const timer_conf_t timer_config[] = {
35  {
36  .dev = NRF_TIMER0_S,
37  .channels = 5,
38  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
39  .irqn = TIMER0_IRQn
40  },
41  {
42  .dev = NRF_TIMER1_S,
43  .channels = 5,
44  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
45  .irqn = TIMER1_IRQn
46  },
47 };
48 
49 #define TIMER_0_ISR isr_timer0
50 #define TIMER_1_ISR isr_timer1
52 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
59 static const uart_conf_t uart_config[] = {
60  {
61  .dev = NRF_UARTE0_S,
62  .rx_pin = GPIO_PIN(1, 0),
63  .tx_pin = GPIO_PIN(1, 1),
64 #ifdef MODULE_PERIPH_UART_HW_FC
65  .rts_pin = GPIO_UNDEF,
66  .cts_pin = GPIO_UNDEF,
67 #endif
68  .irqn = SERIAL0_IRQn,
69  },
70 };
71 
72 #define UART_NUMOF ARRAY_SIZE(uart_config)
79 #ifndef RTT_DEV
80 #define RTT_DEV (0)
81 #endif
82 
83 #define RTT_MAX_VALUE (0x00ffffff)
84 #define RTT_MAX_FREQUENCY (32768U)
85 #define RTT_MIN_FREQUENCY (8U)
86 #define RTT_CLOCK_FREQUENCY (32768U)
88 #ifndef RTT_FREQUENCY
89 #define RTT_FREQUENCY (1024U)
90 #endif
97 static const pwm_conf_t pwm_config[] = {
98  {
99  .dev = NRF_PWM0_S,
100  .pin = {
101  LED0_PIN,
102  LED1_PIN,
103  LED2_PIN,
104  LED3_PIN
105  }
106  },
107 };
108 
109 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
116 static const spi_conf_t spi_config[] = {
117  {
118  .dev = NRF_SPIM1_S,
119  .sclk = GPIO_PIN(0, 17),
120  .mosi = GPIO_PIN(0, 13),
121  .miso = GPIO_PIN(0, 14),
122  }
123 };
124 
125 #define SPI_NUMOF ARRAY_SIZE(spi_config)
132 static const i2c_conf_t i2c_config[] = {
133  {
134  .dev = NRF_TWIM2_S,
135  .scl = GPIO_PIN(1, 3),
136  .sda = GPIO_PIN(1, 2),
137  .speed = I2C_SPEED_NORMAL
138  }
139 };
140 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
143 #ifdef __cplusplus
144 }
145 #endif
146 
#define LED2_PIN
RX LED yellow.
Definition: board.h:35
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:45
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:38
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:96
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:68
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:39
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
Definition: periph_conf.h:221
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:277
I2C configuration structure.
Definition: periph_cpu.h:298
TWI_t * dev
Pointer to hardware module registers.
Definition: periph_cpu.h:299
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition: periph_cpu.h:336
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:337
Timer device configuration.
Definition: periph_cpu.h:263
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:264
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218
Board specific definitions for the Zigduino board.