mirror of https://github.com/ArduPilot/ardupilot
Notify: add support for handle_led_control
This commit is contained in:
parent
9159c7107d
commit
35a3a52f29
|
@ -82,3 +82,11 @@ void AP_Notify::update(void)
|
|||
//reset the events
|
||||
memset(&AP_Notify::events, 0, sizeof(AP_Notify::events));
|
||||
}
|
||||
|
||||
// handle a LED_CONTROL message
|
||||
void AP_Notify::handle_led_control(mavlink_message_t *msg)
|
||||
{
|
||||
for (int i = 0; i < CONFIG_NOTIFY_DEVICES_COUNT; i++) {
|
||||
_devices[i]->handle_led_control(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#define __AP_NOTIFY_H__
|
||||
|
||||
#include <AP_Common.h>
|
||||
#include <GCS_MAVLink.h>
|
||||
#include <AP_BoardLED.h>
|
||||
#include <ToshibaLED.h>
|
||||
#include <ToshibaLED_I2C.h>
|
||||
|
@ -96,6 +97,9 @@ public:
|
|||
/// update - allow updates of leds that cannot be updated during a timed interrupt
|
||||
void update(void);
|
||||
|
||||
// handle a LED_CONTROL message
|
||||
static void handle_led_control(mavlink_message_t* msg);
|
||||
|
||||
private:
|
||||
static NotifyDevice* _devices[CONFIG_NOTIFY_DEVICES_COUNT];
|
||||
};
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef __NOTIFYDEVICE_H__
|
||||
#define __NOTIFYDEVICE_H__
|
||||
|
||||
#include <AP_Common.h>
|
||||
#include <GCS_MAVLink.h>
|
||||
|
||||
class NotifyDevice {
|
||||
public:
|
||||
virtual ~NotifyDevice() {}
|
||||
|
@ -9,6 +12,8 @@ public:
|
|||
// update - updates device according to timed_updated. Should be
|
||||
// called at 50Hz
|
||||
virtual void update() = 0;
|
||||
// handle a LED_CONTROL message, by default device ignore message
|
||||
virtual void handle_led_control(mavlink_message_t *msg) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue