Browse Source

Notify: add support for handle_led_control

mission-4.1.18
Randy Mackay 10 years ago
parent
commit
35a3a52f29
  1. 8
      libraries/AP_Notify/AP_Notify.cpp
  2. 4
      libraries/AP_Notify/AP_Notify.h
  3. 5
      libraries/AP_Notify/NotifyDevice.h

8
libraries/AP_Notify/AP_Notify.cpp

@ -82,3 +82,11 @@ void AP_Notify::update(void) @@ -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);
}
}

4
libraries/AP_Notify/AP_Notify.h

@ -19,6 +19,7 @@ @@ -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: @@ -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];
};

5
libraries/AP_Notify/NotifyDevice.h

@ -1,6 +1,9 @@ @@ -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: @@ -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…
Cancel
Save