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 
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 i2c_conf_t i2c_config[] = {
35  {
36  .dev = NRF_TWIM3_S,
37  .scl = GPIO_PIN(0, 31),
38  .sda = GPIO_PIN(0, 30),
39  .speed = I2C_SPEED_NORMAL
40  }
41 };
42 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
49 static const spi_conf_t spi_config[] = {
50  {
51  .dev = NRF_SPIM2_S,
52  .sclk = GPIO_PIN(0, 13),
53  .mosi = GPIO_PIN(0, 11),
54  .miso = GPIO_PIN(0, 12),
55  }
56 };
57 
58 #define SPI_NUMOF ARRAY_SIZE(spi_config)
65 static const timer_conf_t timer_config[] = {
66  {
67  .dev = NRF_TIMER0_S,
68  /* using last channel for timer_read(), so only 5 of 6 channels available */
69  .channels = 5,
70  .bitmode = TIMER_BITMODE_BITMODE_32Bit,
71  .irqn = TIMER0_IRQn
72  },
73  {
74  .dev = NRF_TIMER1_S,
75  /* using last channel for timer_read(), so only 5 of 6 channels available */
76  .channels = 5,
77  .bitmode = TIMER_BITMODE_BITMODE_08Bit,
78  .irqn = TIMER1_IRQn
79  },
80 };
81 
82 #define TIMER_0_ISR isr_timer0
83 #define TIMER_1_ISR isr_timer1
86 #define TIMER_0_MAX_VALUE 0xffffffff
88 #define TIMER_1_MAX_VALUE 0xffffffff
89 
90 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
97 static const uart_conf_t uart_config[] = {
98  {
99  .dev = NRF_UARTE0_S,
100  .rx_pin = GPIO_PIN(0, 28),
101  .tx_pin = GPIO_PIN(0, 29),
102 #ifdef MODULE_PERIPH_UART_HW_FC
103  .rts_pin = GPIO_UNDEF,
104  .cts_pin = GPIO_UNDEF,
105 #endif
106  .irqn = UARTE0_SPIM0_SPIS0_TWIM0_TWIS0_IRQn,
107  },
108  {
109  .dev = NRF_UARTE1_S,
110  .rx_pin = GPIO_PIN(0, 0),
111  .tx_pin = GPIO_PIN(0, 1),
112 #ifdef MODULE_PERIPH_UART_HW_FC
113  .rts_pin = GPIO_UNDEF,
114  .cts_pin = GPIO_UNDEF,
115 #endif
116  .irqn = UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn,
117  },
118 };
119 
120 #define UART_NUMOF ARRAY_SIZE(uart_config)
127 #ifndef RTT_DEV
128 #define RTT_DEV (0)
129 #endif
130 
131 #define RTT_MAX_VALUE (0x00ffffff)
132 #define RTT_MAX_FREQUENCY (32768U)
133 #define RTT_MIN_FREQUENCY (8U)
134 #define RTT_CLOCK_FREQUENCY (32768U)
136 #ifndef RTT_FREQUENCY
137 #define RTT_FREQUENCY (1024U)
138 #endif
145 static const pwm_conf_t pwm_config[] = {
146  {
147  .dev = NRF_PWM0_S,
148  .pin = {
149  LED0_PIN,
150  LED1_PIN,
151  LED2_PIN,
152  LED3_PIN
153  }
154  },
155 };
156 
157 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
160 #ifdef __cplusplus
161 }
162 #endif
163 
#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.