TemplateDevice_GPIO.c 1.1 KB

12345678910111213141516171819202122232425262728
  1. #include "TemplateDevice_GPIO.h"
  2. void TemplateDevice_GPIO_platformDisable(PikaObj* self) {}
  3. void TemplateDevice_GPIO_platformEnable(PikaObj* self) {}
  4. void TemplateDevice_GPIO_platformHigh(PikaObj* self) {}
  5. void TemplateDevice_GPIO_platformLow(PikaObj* self) {}
  6. void TemplateDevice_GPIO_platformRead(PikaObj* self) {}
  7. void TemplateDevice_GPIO_platformSetMode(PikaObj* self) {}
  8. const uint32_t GPIO_PA8_EVENT_ID = 0x08;
  9. void TemplateDevice_GPIO_platformGetEventId(PikaObj* self) {
  10. char* pin = obj_getStr(self, "pin");
  11. if (strEqu(pin, "PA8")) {
  12. obj_setInt(self, "eventId", GPIO_PA8_EVENT_ID);
  13. }
  14. }
  15. extern PikaEventListener* g_pika_device_event_listener;
  16. #define EVENT_SIGNAL_IO_RISING_EDGE 0x01
  17. #define EVENT_SIGNAL_IO_FALLING_EDGE 0x02
  18. #define GPIO_PA8_EVENT_ID 0x08
  19. void TemplateDevice_GPIO_eventTest(PikaObj* self) {
  20. pks_eventLisener_sendSignal(g_pika_device_event_listener, GPIO_PA8_EVENT_ID,
  21. EVENT_SIGNAL_IO_FALLING_EDGE);
  22. pks_eventLisener_sendSignal(g_pika_device_event_listener, GPIO_PA8_EVENT_ID,
  23. EVENT_SIGNAL_IO_RISING_EDGE);
  24. }