1 #ifndef NRF5_SDK5_CONFIG_H
2 #define NRF5_SDK5_CONFIG_H
25 #if (!NRF5_SDK15_CONFIGURED)
26 # warning "NRF5 SDK15 is not configured, using defaults."
29 #if RUUVI_NRF5_SDK15_AES_ENABLED
30 # define NRF_CRYPTO_AES_ENABLED 1
31 # define NRF_CRYPTO_BACKEND_MBEDTLS_ENABLED 1
34 #ifndef RUUVI_NRF5_SDK15_BLE4_STACK_CONN_TAG
35 #define RUUVI_NRF5_SDK15_BLE4_STACK_CONN_TAG 1
39 #ifndef RUUVI_NRF5_SDK15_RADIO_IRQ_PRIORITY
40 #define RUUVI_NRF5_SDK15_RADIO_IRQ_PRIORITY 2
43 #ifndef NRF_SDH_ENABLED
45 #define NRF_SDH_ENABLED 1
48 #ifndef NRF_SDH_BLE_ENABLED
50 # define NRF_SDH_BLE_ENABLED NRF_SDH_ENABLED
53 #ifndef NRF_SDH_SOC_ENABLED
55 # define NRF_SDH_SOC_ENABLED NRF_SDH_ENABLED
58 #if RUUVI_NRF5_SDK15_ADV_ENABLED
60 # define NRF_QUEUE_ENABLED 1
62 # define NRF_BLE_SCAN_ENABLED 1
63 # define NRF_BLE_SCAN_SCAN_INTERVAL (1000U)
69 # define NRF_BLE_SCAN_SCAN_WINDOW (200U)
71 # define NRF_BLE_SCAN_SCAN_DURATION (3U * NRF_BLE_SCAN_SCAN_INTERVAL / 10U)
73 # define NRF_BLE_SCAN_SUPERVISION_TIMEOUT (4000U)
75 # define NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL (20U)
77 # define NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL (1000U)
79 # define NRF_BLE_SCAN_SLAVE_LATENCY 29
81 #ifndef RUUVI_NRF5_SDK15_ADV_QUEUE_LENGTH
82 # define RUUVI_NRF5_SDK15_ADV_QUEUE_LENGTH 3
84 #ifndef RUUVI_NRF5_SDK15_SCAN_QUEUE_LENGTH
85 # define RUUVI_NRF5_SDK15_SCAN_QUEUE_LENGTH 3
88 # define RUUVI_NRF5_SDK15_ADV_LENGTH RUUVI_COMM_BLE_ADV_MAX_LENGTH
89 # define RUUVI_NRF5_SDK15_SCAN_LENGTH RUUVI_COMM_BLE_ADV_SCAN_LENGTH
90 #if (RUUVI_NRF5_SDK15_ADV_EXTENDED_ENABLED)
91 #define NRF_BLE_SCAN_BUFFER \
92 ((RUUVI_COMM_BLE_ADV_SCAN_BUFFER >= BLE_GAP_SCAN_BUFFER_EXTENDED_MIN) \
93 ? RUUVI_COMM_BLE_ADV_SCAN_BUFFER \
94 : BLE_GAP_SCAN_BUFFER_EXTENDED_MIN)
96 # define NRF_BLE_SCAN_BUFFER RUUVI_COMM_BLE_ADV_SCAN_BUFFER
100 #if RUUVI_NRF5_SDK15_GATT_ENABLED
101 # define NRF_BLE_GATT_ENABLED (1U)
102 # define NRF_BLE_QWR_ENABLED (1U)
103 # define NRF_BLE_CONN_PARAMS_ENABLED (1U)
104 # define PEER_MANAGER_ENABLED (1U)
105 # define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT (1U)
106 # define NRF_BLE_CONN_PARAMS_MAX_SLAVE_LATENCY_DEVIATION (1U)
107 # define NRF_BLE_CONN_PARAMS_MAX_SUPERVISION_TIMEOUT_DEVIATION (100U)
108 # define BLE_DFU_ENABLED (1U)
109 # define BLE_DIS_ENABLED (1U)
110 # define BLE_NUS_ENABLED (1U)
111 # define NRF_SDH_BLE_VS_UUID_COUNT (BLE_DFU_ENABLED\
114 #define NRF_SDH_BLE_SERVICE_CHANGED (1U)
117 #if RUUVI_NRF5_SDK15_GPIO_ENABLED
118 # define GPIOTE_ENABLED 1
119 # define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS RT_GPIO_INT_TABLE_SIZE
122 #if RUUVI_NRF5_SDK15_ADC_ENABLED
123 # define SAADC_ENABLED 1
124 # define SAADC_CONFIG_RESOLUTION 1
125 # define SAADC_CONFIG_OVERSAMPLE 0
126 # define SAADC_CONFIG_LP_MODE 0
127 # define SAADC_CONFIG_IRQ_PRIORITY 7
130 #if RUUVI_NRF5_SDK15_GPIO_PWM_ENABLED
131 #define PWM_ENABLED 1
132 #define PWM0_ENABLED 1
133 #define PWM1_ENABLED 0
134 #define PWM2_ENABLED 0
135 #define PWM_DEFAULT_CONFIG_OUT0_PIN 255
136 #define PWM_DEFAULT_CONFIG_OUT1_PIN 255
137 #define PWM_DEFAULT_CONFIG_OUT2_PIN 255
138 #define PWM_DEFAULT_CONFIG_OUT3_PIN 255
139 #define PWM_DEFAULT_CONFIG_IRQ_PRIORITY 6
140 #define PWM_DEFAULT_CONFIG_BASE_CLOCK 0
141 #define PWM_DEFAULT_CONFIG_COUNT_MODE 0
142 #define PWM_DEFAULT_CONFIG_TOP_VALUE 1000
143 #define PWM_DEFAULT_CONFIG_LOAD_MODE 2
144 #define PWM_DEFAULT_CONFIG_STEP_MODE 0
147 #if RUUVI_NRF5_SDK15_FLASH_ENABLED
148 # define FDS_ENABLED 1
149 # define NRF_FSTORAGE_ENABLED 1
150 # define FDS_VIRTUAL_PAGES (RI_FLASH_PAGES + 1U)
153 #if RUUVI_NRF5_SDK15_I2C_ENABLED
154 # if defined (NRF52832_XXAA) || defined (NRF52840_XXAA)
155 # define TWI_ENABLED 1
156 # define TWI1_ENABLED 1
157 # define TWI1_USE_EASYDMA 0
158 # define I2C_INSTANCE 1
159 # elif(NRF52811_XXAA)
160 # define TWI_ENABLED 1
161 # define TWI0_ENABLED 1
162 # define TWI0_USE_EASYDMA 0
163 # define I2C_INSTANCE 0
167 #if RUUVI_NRF5_SDK15_SPI_ENABLED
168 # define SPI_ENABLED 1
169 # define SPI0_ENABLED 1
170 # define SPI0_USE_EASYDMA 1
171 # define SPI_INSTANCE 0
175 #define NRF_SPI_DRV_MISO_PULLUP_CFG 0
178 #if RUUVI_NRF5_SDK15_LOG_ENABLED
179 # define NRF_LOG_ENABLED 1
180 # define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0
181 # define NRF_LOG_DEFERRED 0
184 #if RUUVI_NRF5_SDK15_POWER_ENABLED
185 # define POWER_ENABLED 1
188 #if RUUVI_NRF5_SDK15_RTC_ENABLED
189 # if defined (NRF52832_XXAA) || defined (NRF52840_XXAA)
190 # define RTC_ENABLED 1
191 # define RTC2_ENABLED 1
192 # define NRF5_SDK15_RTC_INSTANCE 2
196 #if RUUVI_NRF5_SDK15_SCHEDULER_ENABLED
197 # define APP_SCHEDULER_ENABLED 1
200 #if RUUVI_NRF5_SDK15_TIMER_ENABLED
201 # define APP_TIMER_ENABLED 1
203 # define APP_TIMER_CONFIG_OP_QUEUE_SIZE (RI_TIMER_MAX_INSTANCES * 2U)
204 # define NRF_CLOCK_ENABLED 1
205 # define TIMER_ENABLED 1
206 # define TIMER1_ENABLED 1
209 #if RUUVI_NRF5_SDK15_NFC_ENABLED
210 # define NFC_NDEF_MSG_ENABLED 1
211 # define NFC_NDEF_RECORD_ENABLED 1
212 # define NFC_PLATFORM_ENABLED 1
213 # define NFC_NDEF_TEXT_RECORD_ENABLED 1
214 # define NFC_NDEF_URI_MSG_ENABLED 1
215 # define NFC_NDEF_URI_REC_ENABLED 1
216 # define NFC_NDEF_MSG_PARSER_ENABLED 1
217 # define NFC_NDEF_RECORD_PARSER_ENABLED 1
218 # define NRFX_NFCT_ENABLED 1
219 # define NFC_NDEF_MSG_TAG_TYPE 4
220 # if (!RUUVI_NRF5_SDK15_TIMER_ENABLED)
221 # error "NFC requires timer instance 4"
223 # define TIMER4_ENABLED 1
226 #if RUUVI_NRF5_SDK15_UART_ENABLED
227 # define NRF_SERIAL_ENABLED 1
228 # if defined (NRF52811_XXAA)
229 # define NRFX_UARTE_ENABLED 1
230 # define NRFX_UARTE0_ENABLED 1
231 # define NRFX_UART_ENABLED 1
232 # define NRFX_UART0_ENABLED 1
233 # define UART0_CONFIG_USE_EASY_DMA 1
234 # define NRFX_PRS_ENABLED 1
235 # define NRFX_PRS_BOX_2_ENABLED 1
237 # if defined (NRF52832_XXAA)
239 # define NRFX_UARTE_ENABLED 1
240 # define NRFX_UARTE0_ENABLED 1
241 # define NRFX_UART_ENABLED 1
242 # define NRFX_UART0_ENABLED 1
243 # define UART0_CONFIG_USE_EASY_DMA 1
245 # define NRFX_PRS_ENABLED 1
246 # define NRFX_PRS_BOX_4_ENABLED 1
248 # if defined (NRF52840_XXAA)
250 # define NRFX_UARTE_ENABLED 1
251 # define NRFX_UARTE0_ENABLED 1
252 # define NRFX_UART_ENABLED 1
253 # define NRFX_UART0_ENABLED 1
254 # define UART0_CONFIG_USE_EASY_DMA 1
256 # define NRFX_PRS_ENABLED 1
257 # define NRFX_PRS_BOX_4_ENABLED 1
259 # define UART_EASY_DMA_SUPPORT 1
260 # define UART_LEGACY_SUPPORT 1
261 # define UART0_ENABLED 1
264 # define NRF_DRV_UART_WITH_UART 1
267 #if RUUVI_NRF5_SDK15_YIELD_ENABLED
268 # define NRF_PWR_MGMT_ENABLED 1
271 #if RUUVI_NRF5_SDK15_WATCHDOG_ENABLED
272 # define WDT_ENABLED 1
Header to enable and disable module compilation.
Interface for controlling ADC onboard MCU.
Interface functions to persistent flash storage.
Interface for I2C operations.
Interface functions to scheduler.
Interface for SPI operations.
Interface functions to timer.