@@ -95,12 +95,8 @@ STATIC bool ble_started = false;
95
95
96
96
STATIC uint8_t workflow_state = WORKFLOW_UNSET ;
97
97
STATIC bool was_connected = false;
98
- #endif
99
98
100
99
STATIC void supervisor_bluetooth_start_advertising (void ) {
101
- #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
102
- return ;
103
- #else
104
100
if (workflow_state != WORKFLOW_ENABLED ) {
105
101
return ;
106
102
}
@@ -144,16 +140,15 @@ STATIC void supervisor_bluetooth_start_advertising(void) {
144
140
NULL );
145
141
// This may fail if we are already advertising.
146
142
advertising = status == NRF_SUCCESS ;
147
- #endif
148
143
}
149
144
145
+ #endif // CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
146
+
150
147
#define BLE_DISCOVERY_DATA_GUARD 0xbb0000bb
151
148
#define BLE_DISCOVERY_DATA_GUARD_MASK 0xff0000ff
152
149
153
150
void supervisor_bluetooth_init (void ) {
154
- #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
155
- return ;
156
- #endif
151
+ #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
157
152
uint32_t reset_state = port_get_saved_word ();
158
153
uint32_t ble_mode = 0 ;
159
154
if ((reset_state & BLE_DISCOVERY_DATA_GUARD_MASK ) == BLE_DISCOVERY_DATA_GUARD ) {
@@ -223,9 +218,11 @@ void supervisor_bluetooth_init(void) {
223
218
status_led_deinit ();
224
219
#endif
225
220
port_set_saved_word (reset_state );
221
+ #endif
226
222
}
227
223
228
224
void supervisor_bluetooth_background (void ) {
225
+ #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
229
226
if (!ble_started ) {
230
227
return ;
231
228
}
@@ -244,12 +241,11 @@ void supervisor_bluetooth_background(void) {
244
241
#if CIRCUITPY_BLE_FILE_SERVICE
245
242
supervisor_bluetooth_file_transfer_background ();
246
243
#endif
244
+ #endif
247
245
}
248
246
249
247
void supervisor_start_bluetooth (void ) {
250
- #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
251
- return ;
252
- #endif
248
+ #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
253
249
254
250
if (workflow_state != WORKFLOW_ENABLED ) {
255
251
return ;
@@ -270,12 +266,12 @@ void supervisor_start_bluetooth(void) {
270
266
271
267
// Kick off advertisements
272
268
supervisor_bluetooth_background ();
269
+
270
+ #endif
273
271
}
274
272
275
273
void supervisor_stop_bluetooth (void ) {
276
- #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
277
- return ;
278
- #endif
274
+ #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
279
275
280
276
if (!ble_started && workflow_state != WORKFLOW_ENABLED ) {
281
277
return ;
@@ -284,24 +280,22 @@ void supervisor_stop_bluetooth(void) {
284
280
#if CIRCUITPY_SERIAL_BLE
285
281
supervisor_stop_bluetooth_serial ();
286
282
#endif
287
- }
288
283
289
- void supervisor_bluetooth_enable_workflow (void ) {
290
- #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
291
- return ;
292
284
#endif
285
+ }
293
286
287
+ void supervisor_bluetooth_enable_workflow (void ) {
288
+ #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
294
289
if (workflow_state == WORKFLOW_DISABLED ) {
295
290
return ;
296
291
}
297
292
298
293
workflow_state = WORKFLOW_ENABLED ;
294
+ #endif
299
295
}
300
296
301
297
void supervisor_bluetooth_disable_workflow (void ) {
302
- #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE
303
- mp_raise_NotImplementedError ();
304
- #endif
305
-
298
+ #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE
306
299
workflow_state = WORKFLOW_DISABLED ;
300
+ #endif
307
301
}
0 commit comments