DiscreteRGBLed.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * AP_Notify Library.
  3. * based upon a prototype library by David "Buzz" Bussenschutt.
  4. */
  5. /*
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #include "RGBLed.h"
  19. class DiscreteRGBLed: public RGBLed {
  20. public:
  21. DiscreteRGBLed(uint16_t red, uint16_t green, uint16_t blue, bool polarity);
  22. protected:
  23. bool hw_init(void) override;
  24. bool hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) override;
  25. private:
  26. AP_HAL::DigitalSource *red_pin;
  27. AP_HAL::DigitalSource *green_pin;
  28. AP_HAL::DigitalSource *blue_pin;
  29. uint16_t red_pin_number, green_pin_number, blue_pin_number;
  30. };