Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <cs_config.h>
10
17// Set to 1 to define legacy driver configs, instead of the new NRFX ones.
18// This will overwrite some NRFX defines, via apply_old_config.h.
19#define CS_DEFINE_LEGACY_NRF_DRIVERS_CONFIGS 0
20
21// It is still the case that apply_old_config.h is applied...
22// The problem is described at
23// https://devzone.nordicsemi.com/f/nordic-q-a/60127/compare-sdk_config-files
24// As soon as an old macro like TWI_ENABLED is defined in app_config.h (or anywhere else) it will lead to the
25// NRFX_TWI_ENABLED macro to be disabled.
26// Note that it does not matter if it is defined as 0, even worse. The default app_config.h will define it such even
27// if it is not defined!
28
29#define APP_SCHEDULER_ENABLED 1
30#define APP_TIMER_ENABLED 1
31#define APP_TIMER_CONFIG_OP_QUEUE_SIZE 40
32#define APP_TIMER_CONFIG_USE_SCHEDULER 1
33
34// <i> NRF_SDH_DISPATCH_MODEL_INTERRUPT: SoftDevice events are passed to the application from the interrupt context.
35// <i> NRF_SDH_DISPATCH_MODEL_APPSH: SoftDevice events are scheduled using @ref app_scheduler.
36// <i> NRF_SDH_DISPATCH_MODEL_POLLING: SoftDevice events are to be fetched manually.
37// <0=> NRF_SDH_DISPATCH_MODEL_INTERRUPT
38// <1=> NRF_SDH_DISPATCH_MODEL_APPSH
39// <2=> NRF_SDH_DISPATCH_MODEL_POLLING
40#define NRF_SDH_DISPATCH_MODEL 1
41
42#define FDS_ENABLED 1
43#define FDS_VIRTUAL_PAGES CS_FDS_VIRTUAL_PAGES
44#define FDS_VIRTUAL_PAGE_SIZE CS_FDS_VIRTUAL_PAGE_SIZE
45#define FDS_VIRTUAL_PAGES_RESERVED CS_FDS_VIRTUAL_PAGES_RESERVED_AFTER
46#define FDS_OP_QUEUE_SIZE 4
47#define FDS_CRC_CHECK_ON_READ 1
48#define FDS_MAX_USERS 2
49
50#define NRF_FSTORAGE_ENABLED 1
51#define NRF_FSTORAGE_SD_QUEUE_SIZE 4
52
53#define HARDFAULT_HANDLER_ENABLED 1
54
55#define APP_SCHEDULER_WITH_PROFILER 1
56
57#if CS_SERIAL_NRF_LOG_ENABLED > 0
58#define NRF_LOG_ENABLED 1
59#else
60#define NRF_LOG_ENABLED 0
61#endif
62
64#define NRF_LOG_DEFERRED 1
65// <0=> Off
66// <1=> Error
67// <2=> Warning
68// <3=> Info
69// <4=> Debug
70#define NRF_LOG_DEFAULT_LEVEL 4
71#define NRF_SDH_SOC_LOG_LEVEL 4
72#define NRF_SDH_BLE_LOG_LEVEL 4
73#define NRF_SDH_LOG_LEVEL 4
74
75#define NRF_LOG_USES_COLORS 1
76#define NRF_LOG_WARNING_COLOR 4
77#define NRF_LOG_USES_TIMESTAMP 0
78#define NRF_FPRINTF_ENABLED 1
79#define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 1
80
81#if CS_SERIAL_NRF_LOG_ENABLED == 1
82#define NRF_LOG_BACKEND_RTT_ENABLED 1
83#else
84#define NRF_LOG_BACKEND_RTT_ENABLED 0
85#endif
86
87#if CS_SERIAL_NRF_LOG_ENABLED == 2
88#define NRF_LOG_BACKEND_UART_ENABLED 1
89#else
90#define NRF_LOG_BACKEND_UART_ENABLED 0
91#endif
92
93#define NRF_LOG_BACKEND_UART_TX_PIN CS_SERIAL_NRF_LOG_PIN_TX
94
95#if CS_SERIAL_NRF_LOG_ENABLED == 2
96// UARTE_ENABLED is overwritten by apply_old_config.h
97#define UARTE_ENABLED 1
98#define UART0_ENABLED 1
99#define UART_ENABLED 1
100// It wouldn't compile when using UARTE, so use normal UART instead.
101#define UART_LEGACY_SUPPORT 1
102#define UART_EASY_DMA_SUPPORT 0
103#define NRFX_UARTE_DEFAULT_CONFIG_HWFC 0
104#define NRFX_UARTE_DEFAULT_CONFIG_PARITY 0
105#endif
106
107// <323584=> 1200 baud
108// <643072=> 2400 baud
109// <1290240=> 4800 baud
110// <2576384=> 9600 baud
111// <3862528=> 14400 baud
112// <5152768=> 19200 baud
113// <7716864=> 28800 baud
114// <10289152=> 38400 baud
115// <15400960=> 57600 baud
116// <20615168=> 76800 baud
117// <30801920=> 115200 baud
118// <61865984=> 230400 baud
119// <67108864=> 250000 baud
120// <121634816=> 460800 baud
121// <251658240=> 921600 baud
122// <268435456=> 1000000 baud
123#define NRF_LOG_BACKEND_UART_BAUDRATE 61865984
124
125#define BLE_DB_DISCOVERY_ENABLED 1
126
127#define NRF_SDH_BLE_ENABLED 1
128#define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1
129#define NRF_SDH_BLE_CENTRAL_LINK_COUNT 1
130
131// Though we can have 1 outgoing (central), and 1 incoming (peripheral) connection, we can't have them both at the same
132// time, because we set the total link count to 1. This means we should stop connectable advertisements before
133// connecting to a peripheral.
134#define NRF_SDH_BLE_TOTAL_LINK_COUNT 1
135
136// Advised by mesh, see MESH_GATT_MTU_SIZE_MAX.
137#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 69
138#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE ATTR_TABLE_SIZE
139#define NRF_SDH_BLE_VS_UUID_COUNT MAX_NUM_VS_SERVICES
140
144#define NRF_SDH_BLE_SERVICE_CHANGED 1
145#define NRF_SDH_BLE_OBSERVER_PRIO_LEVELS 2
146#define NRF_SDH_ENABLED 1
147#define NRF_SDH_REQ_OBSERVER_PRIO_LEVELS 1
148#define NRF_SDH_STATE_OBSERVER_PRIO_LEVELS 1
149#define NRF_SDH_BLE_STACK_OBSERVER_PRIO 1
150#define NRF_SDH_SOC_ENABLED 1
151#define NRF_SDH_SOC_OBSERVER_PRIO_LEVELS 1
152
153// Required for FDS
154#define CRC16_ENABLED 1
155#define CRC32_ENABLED 1
156
157// Used by cs_Comp
158#define COMP_ENABLED 1
159
160#if CS_DEFINE_LEGACY_NRF_DRIVERS_CONFIGS == 0
161// NRFX_WDT_ENABLED is overwritten by apply_old_config.h
162#define WDT_ENABLED 1
163#endif
164
165#define NRFX_WDT_ENABLED 1
166
167// <1=> Run in SLEEP, Pause in HALT
168// <8=> Pause in SLEEP, Run in HALT
169// <9=> Run in SLEEP and HALT
170// <0=> Pause in SLEEP and HALT
171#ifdef DEBUG
172#define NRFX_WDT_CONFIG_BEHAVIOUR 1
173#else
174#define NRFX_WDT_CONFIG_BEHAVIOUR 9
175#endif
176
177// <0=> Include WDT IRQ handling
178// <1=> Remove WDT IRQ handling
179#define NRFX_WDT_CONFIG_NO_IRQ 1
180
181// Enable TWI
182// Still TWI0_ENABLED rather than NRFX_TWI0_ENABLED which won't work
183#ifdef BUILD_TWI
184#define NRFX_TWI_ENABLED 1
185#define NRFX_TWI0_ENABLED 1
186#endif
187
188#ifdef BUILD_GPIOTE
189#define NRFX_GPIOTE_ENABLED 1
190#endif
191
192//#define NRFX_SAADC_ENABLED 1
193
194//#define NRFX_RTC_ENABLED 1
195//#define NRFX_RTC0_ENABLED 1
196//#define NRFX_RTC1_ENABLED 1
197//#define NRFX_RTC2_ENABLED 1
198
199//#define NRFX_TIMER_ENABLED 1
200//#define NRFX_TIMER0_ENABLED 1
201//#define NRFX_TIMER1_ENABLED 1
202//#define NRFX_TIMER2_ENABLED 1
203//#define NRFX_TIMER3_ENABLED 1
204//#define NRFX_TIMER4_ENABLED 1
205
206//#define UART_ENABLED 1
207//#define UART_EASY_DMA_SUPPORT 0
208//#define UART0_ENABLED 1
209//#define UART0_CONFIG_USE_EASY_DMA 0
210
216// <o> NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings.
217// <i> Size of the buffer is a trade-off between RAM usage and processing.
218// <i> if buffer is smaller then strings will often be fragmented.
219// <i> It is recommended to use size which will fit typical log and only the
220// <i> longer one will be fragmented.
221#ifndef NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE
222#define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 64
223#endif
224
225// <o> NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS - Period before retrying writing to RTT
226#ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS
227#define NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS 1
228#endif
229
230// <o> NRF_LOG_BACKEND_RTT_TX_RETRY_CNT - Writing to RTT retries.
231// <i> If RTT fails to accept any new data after retries
232// <i> module assumes that host is not active and on next
233// <i> request it will perform only one write attempt.
234// <i> On successful writing, module assumes that host is active
235// <i> and scheme with retry is applied again.
236#ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_CNT
237#define NRF_LOG_BACKEND_RTT_TX_RETRY_CNT 3
238#endif
239
240// <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_UP - Size of upstream buffer.
241// <i> Note that either @ref NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE
242// <i> or this value is actually used. It depends on which one is bigger.
243#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP
244#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 4096
245#endif
246
247// <o> SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Maximum number of upstream buffers.
248#ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS
249#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
250#endif
251
252// <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of downstream buffer.
253#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN
254#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
255#endif
256
257// <o> SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Maximum number of downstream buffers.
258#ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS
259#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
260#endif
261
262// <o> SEGGER_RTT_CONFIG_DEFAULT_MODE - RTT behavior if the buffer is full.
263// <i> The following modes are supported:
264// <i> - SKIP - Do not block, output nothing.
265// <i> - TRIM - Do not block, output as much as fits.
266// <i> - BLOCK - Wait until there is space in the buffer.
267// <0=> SKIP
268// <1=> TRIM
269// <2=> BLOCK_IF_FIFO_FULL
270#ifndef SEGGER_RTT_CONFIG_DEFAULT_MODE
271#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0
272#endif
273
274// <o> NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE - Size of buffer for partially processed strings.
275// <i> Size of the buffer is a trade-off between RAM usage and processing.
276// <i> if buffer is smaller then strings will often be fragmented.
277// <i> It is recommended to use size which will fit typical log and only the
278// <i> longer one will be fragmented.
279#ifndef NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE
280#define NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE 64
281#endif
282
283#if NORDIC_SDK_VERSION > 15
284
285/*
286 * The BLE GATT Queue has been introduced in SDK16.
287 * See: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Fmigration.html
288 */
289#ifndef NRF_BLE_GQ_ENABLED
290#define NRF_BLE_GQ_ENABLED 1
291#endif
292
293#ifndef NRF_BALLOC_ENABLED
294#define NRF_BALLOC_ENABLED 1
295#endif
296
297#ifndef NRF_QUEUE_ENABLED
298#define NRF_QUEUE_ENABLED 1
299#endif
300
301#endif