led drivers and controller move to uORB::Subscription

This commit is contained in:
Daniel Agar
2019-08-20 14:03:23 -04:00
committed by GitHub
parent 41dee3875e
commit 5ae408382b
7 changed files with 101 additions and 216 deletions

View File

@@ -55,13 +55,6 @@ RGBLED::RGBLED(const char *name)
{
};
RGBLED::~RGBLED()
{
if (_led_controller.led_control_subscription() >= 0) {
orb_unsubscribe(_led_controller.led_control_subscription());
}
};
int RGBLED::start()
{
int res = DevObj::init();
@@ -133,15 +126,14 @@ cleanup:
return res;
}
int RGBLED::stop()
int
RGBLED::stop()
{
int res;
_gpioR.unexportPin();
_gpioG.unexportPin();
_gpioB.unexportPin();
res = DevObj::stop();
int res = DevObj::stop();
if (res < 0) {
DF_LOG_ERR("could not stop DevObj");
@@ -152,13 +144,9 @@ int RGBLED::stop()
return 0;
}
void RGBLED::_measure()
void
RGBLED::_measure()
{
if (!_led_controller.is_init()) {
int led_control_sub = orb_subscribe(ORB_ID(led_control));
_led_controller.init(led_control_sub);
}
LedControlData led_control_data;
if (_led_controller.update(led_control_data) == 1) {

View File

@@ -41,7 +41,7 @@ class RGBLED : public DriverFramework::DevObj
{
public:
RGBLED(const char *name);
virtual ~RGBLED();
virtual ~RGBLED() = default;
int start();
int stop();