AP_HAL_Linux: attach_interrupt now takes a functor

AP_HAL_Linux: add type-safety for interrupt types
This commit is contained in:
Peter Barker 2018-07-05 14:12:26 +10:00 committed by Randy Mackay
parent 4767666a2d
commit 8d5a9ead48
6 changed files with 18 additions and 9 deletions

View File

@ -113,7 +113,9 @@ AP_HAL::DigitalSource* GPIO_BBB::channel(uint16_t n) {
}
/* Interrupt interface: */
bool GPIO_BBB::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p, uint8_t mode)
bool GPIO_BBB::attach_interrupt(uint8_t interrupt_num,
irq_handler_fn_t fn,
INTERRUPT_TRIGGER_TYPE mode)
{
return true;
}

View File

@ -130,8 +130,9 @@ public:
AP_HAL::DigitalSource* channel(uint16_t n);
/* Interrupt interface: */
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
uint8_t mode);
bool attach_interrupt(uint8_t interrupt_num,
irq_handler_fn_t fn,
INTERRUPT_TRIGGER_TYPE mode) override;
/* return true if USB cable is connected */
bool usb_connected(void);

View File

@ -122,7 +122,9 @@ AP_HAL::DigitalSource* GPIO_RPI::channel(uint16_t n)
}
/* Interrupt interface: */
bool GPIO_RPI::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p, uint8_t mode)
bool GPIO_RPI::attach_interrupt(uint8_t interrupt_num,
irq_handler_fn_t fn,
INTERRUPT_TRIGGER_TYPE mode)
{
return true;
}

View File

@ -57,8 +57,9 @@ public:
AP_HAL::DigitalSource* channel(uint16_t n);
/* Interrupt interface: */
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
uint8_t mode);
bool attach_interrupt(uint8_t interrupt_num,
irq_handler_fn_t fn,
INTERRUPT_TRIGGER_TYPE mode);
/* return true if USB cable is connected */
bool usb_connected(void);

View File

@ -188,8 +188,9 @@ AP_HAL::DigitalSource* GPIO_Sysfs::channel(uint16_t vpin)
return new DigitalSource_Sysfs(pin, value_fd);
}
bool GPIO_Sysfs::attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p,
uint8_t mode)
bool GPIO_Sysfs::attach_interrupt(uint8_t interrupt_num,
irq_handler_fn_t p,
INTERRUPT_TRIGGER_TYPE mode)
{
return false;
}

View File

@ -52,7 +52,9 @@ public:
/*
* Currently this function always returns false.
*/
bool attach_interrupt(uint8_t interrupt_num, AP_HAL::Proc p, uint8_t mode) override;
bool attach_interrupt(uint8_t interrupt_num,
irq_handler_fn_t p,
INTERRUPT_TRIGGER_TYPE mode) override;
/*
* Currently this function always returns false.