Skip to content

Commit 6b705c8

Browse files
paul-szczepanek-arm0xc0170
authored andcommitted
remove usage of gpio and leds from nordic cordio LL as it interferes with normal function
1 parent e43aa12 commit 6b705c8

File tree

2 files changed

+10
-63
lines changed
  • features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/stack/sources

2 files changed

+10
-63
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/stack/sources/pal_bb_ble.c

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -153,28 +153,6 @@ uint32_t USEC_TO_TICKS(uint32_t usec)
153153
#define BB_ENABLE_INLINE_DEC_RX FALSE
154154
#endif
155155

156-
#define PAL_LED0_MASK 0x00002000
157-
#define PAL_LED1_MASK 0x00004000
158-
#define PAL_LED2_MASK 0x00008000
159-
#define PAL_LED3_MASK 0x00010000
160-
161-
/* LED definitions */
162-
#ifndef BB_LED_ENA
163-
#define BB_LED_ENA 0
164-
#endif
165-
166-
#if (BB_LED_ENA == 1)
167-
#define BB_LED_1M_ON() PalLedOn(0)
168-
#define BB_LED_2M_ON() PalLedOn(2)
169-
#define BB_LED_CODED_ON() PalLedOnGroup(PAL_LED0_MASK | PAL_LED2_MASK)
170-
#define BB_LED_OFF() PalLedOffGroup(PAL_LED0_MASK | PAL_LED2_MASK)
171-
#else
172-
#define BB_LED_1M_ON()
173-
#define BB_LED_2M_ON()
174-
#define BB_LED_CODED_ON()
175-
#define BB_LED_OFF()
176-
#endif
177-
178156
/*! \brief convert little endian byte buffer to uint16_t. */
179157
#define BYTES_TO_UINT16(n, p) {n = ((uint16_t)(p)[0] + ((uint16_t)(p)[1] << 8));}
180158

@@ -367,16 +345,12 @@ uint16_t diagCancels = 0;
367345
#endif
368346
/////////////////////////////////////////////////////////////////////////////////
369347

370-
#if defined(BOARD_PCA10056)
371-
#define DIAG_USER_DEBUG_PINS_ENA 1
372-
#else
373-
#define DIAG_USER_DEBUG_PINS_ENA 0
374-
#endif
348+
#define DIAG_USER_DEBUG_PINS_ENA 0
375349

376-
/////////////////////////////////////////////////////////////////////////////////
377-
#if defined(BOARD_PCA10028)
350+
#define DIAG_PINS_ENA 0
378351

379-
#define DIAG_PINS_ENA 1
352+
#if DIAG_PINS_ENA
353+
#if defined(BOARD_PCA10028)
380354

381355
#define TX_PIN 12 /* P0.12 */
382356
#define RX_PIN 13 /* P0.13 */
@@ -390,8 +364,6 @@ uint16_t diagCancels = 0;
390364

391365
#elif defined(BOARD_PCA10040)
392366

393-
#define DIAG_PINS_ENA 1
394-
395367
#define TX_PIN 11 /* P0.11 */
396368
#define RX_PIN 12 /* P0.12 */
397369
#define RADIO_READY_TOGGLE_PIN 13 /* P0.13 */
@@ -403,31 +375,31 @@ uint16_t diagCancels = 0;
403375
#define DIAG_PIN_CLEAR(x) { nrf_gpio_pin_clear(x); }
404376
#elif defined(BOARD_PCA10056)
405377

406-
#define DIAG_PINS_ENA 1
407-
408378
#define TX_PIN 3 /* P0.03 */
409379
#define RX_PIN 4 /* P0.04 */
410380
#define RADIO_READY_TOGGLE_PIN 30 /* P0.30 */
411381
#define RADIO_END_TOGGLE_PIN 31 /* P0.31 */
412382
#define RADIO_INT_PIN 29 /* P0.29 */
413383
#define TIMER0_INT_PIN 28 /* P0.28 */
414384

415-
#if DIAG_USER_DEBUG_PINS_ENA
385+
#define DIAG_USER_DEBUG_PINS_ENA 1
416386
#define USER_DEBUG_0_PIN 35 /* P1.03 */
417387
#define USER_DEBUG_1_PIN 36 /* P1.04 */
418388
#define USER_DEBUG_2_PIN 37 /* P1.05 */
419389
#define USER_DEBUG_3_PIN 38 /* P1.06 */
420-
#endif
421390

422391
#define DIAG_PIN_SET(x) { nrf_gpio_pin_set(x); }
423392
#define DIAG_PIN_CLEAR(x) { nrf_gpio_pin_clear(x); }
424393
#else
394+
#error "Diagnostic pins not supported on board"
395+
#endif
425396

426-
#define DIAG_PINS_ENA 0
397+
#else // DIAG_PINS_ENA
427398

428399
#define DIAG_PIN_SET(x)
429400
#define DIAG_PIN_CLEAR(x)
430-
#endif
401+
#endif // DIAG_PINS_ENA
402+
431403
/////////////////////////////////////////////////////////////////////////////////
432404

433405
/*************************************************************************************************/
@@ -476,22 +448,6 @@ static inline void palBbSetRadioMode(uint8_t phy, uint8_t option)
476448
break;
477449
}
478450

479-
/* select LED according to client selection not actual PHY used */
480-
switch (bbRxPhy)
481-
{
482-
case BB_PHY_BLE_1M:
483-
BB_LED_1M_ON();
484-
break;
485-
case BB_PHY_BLE_2M:
486-
BB_LED_2M_ON();
487-
break;
488-
case BB_PHY_BLE_CODED:
489-
BB_LED_CODED_ON();
490-
break;
491-
default:
492-
break;
493-
}
494-
495451
#if defined(NRF52832_XXAA)
496452
*(volatile uint32_t*)0x40001777 = 0UL; /* Disable fault tolerant AA correlator. */
497453
#endif
@@ -1281,7 +1237,6 @@ void PalBbBleEnablePrbs15(bool_t enable)
12811237

12821238
/* update the driver state */
12831239
driverState = IDLE_STATE;
1284-
BB_LED_OFF();
12851240
}
12861241
}
12871242

@@ -2672,7 +2627,6 @@ void BbBleDrvRadioIRQHandler(void)
26722627
{
26732628
/* update driver state, *before* callback */
26742629
driverState = IDLE_STATE;
2675-
BB_LED_OFF();
26762630

26772631
/* run callback function */
26782632
palBbRestoreTrl();
@@ -2759,7 +2713,6 @@ void BbBleDrvRadioIRQHandler(void)
27592713
rssi = (int8_t)(-(NRF_RADIO->RSSISAMPLE & 0x7F)) - PalRadioGetRxRfPathComp();
27602714
/* update driver state, *before* callback */
27612715
driverState = IDLE_STATE;
2762-
BB_LED_OFF();
27632716

27642717
/* Follow Rx PHY options */
27652718
bbTxPhyOptions = bbRxPhyOptions;
@@ -2919,7 +2872,6 @@ static void palBbRadioHardStop(void)
29192872

29202873
/* update driver state */
29212874
driverState = IDLE_STATE;
2922-
BB_LED_OFF();
29232875

29242876
/* clear diagnostics pins */
29252877
DIAG_PIN_CLEAR( TX_PIN );

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/stack/sources/pal_sys.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ void PalSysInit(void)
140140
palSysBusyCount = 0;
141141

142142
PalRtcInit();
143-
PalLedInit();
144-
PalLedOff(PAL_LED_ID_ERROR);
145-
PalLedOn(PAL_LED_ID_CPU_ACTIVE);
146143

147144
#ifdef DEBUG
148145
/* Reset free memory. */
@@ -159,8 +156,6 @@ void PalSysInit(void)
159156
/*************************************************************************************************/
160157
void PalSysAssertTrap(void)
161158
{
162-
PalLedOn(PAL_LED_ID_ERROR);
163-
164159
palSysAssertCount++;
165160

166161
while (PalSysAssertTrapEnable);

0 commit comments

Comments
 (0)