Skip to content

Commit

Permalink
increase event buffer size; only zero-out irqEventInfo once
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Mar 17, 2024
1 parent a066d0c commit bd48742
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions utility/RPi/interrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ void* poll_irq(void* arg)
IrqPinCache* pinCache = (IrqPinCache*)(arg);
unsigned int lastEventSeqNo = 0;
gpio_v2_line_event irqEventInfo;
memset(&irqEventInfo, 0, sizeof(irqEventInfo));

for (;;) {
memset(&irqEventInfo, 0, sizeof(irqEventInfo));
int ret = read(pinCache->fd, &irqEventInfo, sizeof(gpio_v2_line_event));
if (ret < 0) {
std::string msg = "[poll_irq] Could not read event info; ";
Expand Down Expand Up @@ -114,7 +114,7 @@ int attachInterrupt(rf24_gpio_pin_t pin, int mode, void (*function)(void))
strcpy(request.consumer, "RF24 IRQ");
request.num_lines = 1U;
request.offsets[0] = pin;
request.event_buffer_size = 16U;
request.event_buffer_size = sizeof(gpio_v2_line_event);

// set debounce for the pin
// request.config.attrs[0].mask = 1LL;
Expand Down
4 changes: 2 additions & 2 deletions utility/SPIDEV/interrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ void* poll_irq(void* arg)
IrqPinCache* pinCache = (IrqPinCache*)(arg);
unsigned int lastEventSeqNo = 0;
gpio_v2_line_event irqEventInfo;
memset(&irqEventInfo, 0, sizeof(irqEventInfo));

for (;;) {
memset(&irqEventInfo, 0, sizeof(irqEventInfo));
int ret = read(pinCache->fd, &irqEventInfo, sizeof(gpio_v2_line_event));
if (ret < 0) {
std::string msg = "[poll_irq] Could not read event info; ";
Expand Down Expand Up @@ -76,7 +76,7 @@ int attachInterrupt(rf24_gpio_pin_t pin, int mode, void (*function)(void))
strcpy(request.consumer, "RF24 IRQ");
request.num_lines = 1U;
request.offsets[0] = pin;
request.event_buffer_size = 16U;
request.event_buffer_size = sizeof(gpio_v2_line_event);

// set debounce for the pin
// request.config.attrs[0].mask = 1LL;
Expand Down

0 comments on commit bd48742

Please sign in to comment.