GPIO.h 787 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include "AP_HAL_Empty.h"
  3. class Empty::GPIO : public AP_HAL::GPIO {
  4. public:
  5. GPIO();
  6. void init() override;
  7. void pinMode(uint8_t pin, uint8_t output) override;
  8. uint8_t read(uint8_t pin) override;
  9. void write(uint8_t pin, uint8_t value) override;
  10. void toggle(uint8_t pin) override;
  11. /* Alternative interface: */
  12. AP_HAL::DigitalSource* channel(uint16_t n) override;
  13. /* return true if USB cable is connected */
  14. bool usb_connected(void) override;
  15. };
  16. class Empty::DigitalSource : public AP_HAL::DigitalSource {
  17. public:
  18. DigitalSource(uint8_t v);
  19. void mode(uint8_t output) override;
  20. uint8_t read() override;
  21. void write(uint8_t value) override;
  22. void toggle() override;
  23. private:
  24. uint8_t _v;
  25. };