Skip to content

Commit

Permalink
Add ENABLE_PCAP def
Browse files Browse the repository at this point in the history
  • Loading branch information
pipe01 committed Oct 14, 2024
1 parent 88d85e0 commit bfe3fa9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/peripherals/nrf52832/radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ enum

NRF52_PERIPHERAL(RADIO, radio)

#if ENABLE_PCAP
void radio_set_pcap(RADIO_t *, pcap_t *pcap);
#endif
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
6 changes: 6 additions & 0 deletions src/peripherals/nrf52832/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

0 comments on commit bfe3fa9

Please sign in to comment.