Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix pico irq example
  • Loading branch information
2bndy5 committed May 3, 2025
commit db98a4780119a75f67293f69867104e060c31758
12 changes: 9 additions & 3 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,12 @@ uint8_t RF24::flush_tx(void)

void RF24::printStatus(uint8_t flags)
{
printf_P(PSTR("STATUS\t\t= 0x%02x RX_DR=%x TX_DS=%x TX_DF=%x RX_PIPE=%x TX_FULL=%x\r\n"), flags, (flags & RF24_RX_DR) ? 1 : 0,
(flags & RF24_TX_DS) ? 1 : 0, (flags & RF24_TX_DF) ? 1 : 0, ((flags >> RX_P_NO) & 0x07), (flags & _BV(TX_FULL)) ? 1 : 0);
printf_P(PSTR("RX_DR=%x TX_DS=%x TX_DF=%x RX_PIPE=%x TX_FULL=%x\r\n"),
(flags & RF24_RX_DR) ? 1 : 0,
(flags & RF24_TX_DS) ? 1 : 0,
(flags & RF24_TX_DF) ? 1 : 0,
(flags >> RX_P_NO) & 0x07,
(flags & _BV(TX_FULL)) ? 1 : 0);
}

/****************************************************************************/
Expand Down Expand Up @@ -703,7 +707,9 @@ void RF24::printDetails(void)
printf("================ NRF Configuration ================\n");
#endif // defined(RF24_LINUX)

printStatus(update());
uint8_t status = update();
printf_P(PSTR("STATUS\t\t= 0x%02x "), status);
printStatus(status);

print_address_register(PSTR("RX_ADDR_P0-1"), RX_ADDR_P0, 2);
print_byte_register(PSTR("RX_ADDR_P2-5"), RX_ADDR_P2, 4);
Expand Down
3 changes: 2 additions & 1 deletion examples_pico/interruptConfigure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ bool setup()
printf("radioNumber = %d\n", (int)radioNumber);

// setup the IRQ_PIN
gpio_init(IRQ_PIN);
gpio_set_irq_enabled_with_callback(IRQ_PIN, GPIO_IRQ_EDGE_FALL, true, &interruptHandler);
// IMPORTANT: do not call radio.available() before calling
// radio.whatHappened() when the interruptHandler() is triggered by the
Expand Down Expand Up @@ -289,7 +290,7 @@ void loop()
*/
void interruptHandler(uint gpio, uint32_t events)
{
if (gpio != IRQ_PIN && !(events & GPIO_IRQ_EDGE_FALL)) {
if (gpio != IRQ_PIN && (events & GPIO_IRQ_EDGE_FALL) == 0) {
// the gpio pin and event does not match the configuration we specified
return;
}
Expand Down