diff --git a/include/peripherals/nrf52832/radio.h b/include/peripherals/nrf52832/radio.h index a671ab2..70adcad 100644 --- a/include/peripherals/nrf52832/radio.h +++ b/include/peripherals/nrf52832/radio.h @@ -29,4 +29,6 @@ enum NRF52_PERIPHERAL(RADIO, radio) +#if ENABLE_PCAP void radio_set_pcap(RADIO_t *, pcap_t *pcap); +#endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 84443b8..7fbb51a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -116,7 +116,7 @@ if(EMSCRIPTEN) ) else() list(APPEND SRC_FILES ${SRC_NATIVE_FILES}) - add_compile_definitions(ENABLE_RUNLOG=1) + add_compile_definitions(ENABLE_RUNLOG=1 ENABLE_PCAP=1) add_executable(infiniemu-cli ${SRC_FILES}) add_library(infiniemu-lib STATIC ${SRC_FILES}) diff --git a/src/peripherals/nrf52832/radio.c b/src/peripherals/nrf52832/radio.c index 43201a5..4c7c3d7 100644 --- a/src/peripherals/nrf52832/radio.c +++ b/src/peripherals/nrf52832/radio.c @@ -140,7 +140,9 @@ struct RADIO_inst_t { ticker_t *ticker; dma_t *dma; +#if ENABLE_PCAP pcap_t *pcap; +#endif bool powered_on; radio_state_t state, next_state; @@ -326,6 +328,7 @@ PPI_TASK_HANDLER(radio_task_handler) switch (radio->state) { case STATE_TXIDLE: +#if ENABLE_PCAP if (radio->pcap) { uint8_t packet[256]; @@ -382,6 +385,7 @@ PPI_TASK_HANDLER(radio_task_handler) pcap_write_packet(radio->pcap, ll_packet, sizeof(ll_packet)); } +#endif // ENABLE_PCAP radio->next_state = STATE_TX; break; @@ -598,7 +602,9 @@ NRF52_PERIPHERAL_CONSTRUCTOR(RADIO, radio) return radio; } +#if ENABLE_PCAP void radio_set_pcap(RADIO_t *radio, pcap_t *pcap) { radio->pcap = pcap; } +#endif