SmartLoong_KEY.c 623 B

123456789101112131415161718192021222324
  1. #include "../../../libraries/ls1c_delay.h"
  2. #include "../../../libraries/ls1c_gpio.h"
  3. #include "../../../libraries/ls1c_public.h"
  4. #include "PikaObj.h"
  5. void SmartLoong_KEY___init__(PikaObj* self) {
  6. obj_setInt(self, "io_number", 85);
  7. }
  8. void SmartLoong_KEY_enable(PikaObj* self) {
  9. int led_gpio = obj_getInt(self, "io_number");
  10. gpio_init(led_gpio, gpio_mode_input);
  11. }
  12. int SmartLoong_KEY_read(PikaObj* self) {
  13. int led_gpio = obj_getInt(self, "io_number");
  14. return gpio_get(led_gpio);
  15. }
  16. void SmartLoong_KEY_setId(PikaObj* self, int id) {
  17. if (1 == id) {
  18. obj_setInt(self, "io_number", 85);
  19. }
  20. }