mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
led drivers and controller move to uORB::Subscription
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -41,7 +41,7 @@ class RGBLED : public DriverFramework::DevObj
|
||||
{
|
||||
public:
|
||||
RGBLED(const char *name);
|
||||
virtual ~RGBLED();
|
||||
virtual ~RGBLED() = default;
|
||||
|
||||
int start();
|
||||
int stop();
|
||||
|
||||
Reference in New Issue
Block a user