GPIO.cpp 700 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "GPIO.h"
  2. using namespace Empty;
  3. GPIO::GPIO()
  4. {}
  5. void GPIO::init()
  6. {}
  7. void GPIO::pinMode(uint8_t pin, uint8_t output)
  8. {}
  9. uint8_t GPIO::read(uint8_t pin) {
  10. return 0;
  11. }
  12. void GPIO::write(uint8_t pin, uint8_t value)
  13. {}
  14. void GPIO::toggle(uint8_t pin)
  15. {}
  16. /* Alternative interface: */
  17. AP_HAL::DigitalSource* GPIO::channel(uint16_t n) {
  18. return new DigitalSource(0);
  19. }
  20. bool GPIO::usb_connected(void)
  21. {
  22. return false;
  23. }
  24. DigitalSource::DigitalSource(uint8_t v) :
  25. _v(v)
  26. {}
  27. void DigitalSource::mode(uint8_t output)
  28. {}
  29. uint8_t DigitalSource::read() {
  30. return _v;
  31. }
  32. void DigitalSource::write(uint8_t value) {
  33. _v = value;
  34. }
  35. void DigitalSource::toggle() {
  36. _v = !_v;
  37. }