Notify: add support for handle_led_control

This commit is contained in:
Randy Mackay 2015-02-26 16:07:33 +09:00
parent 9159c7107d
commit 35a3a52f29
3 changed files with 17 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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];
};

View File

@ -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