air_touch.lua 493 B

12345678910111213141516171819202122
  1. local air_touch = {}
  2. log.info("tp", "tp init")
  3. local function tp_callBack(tp_device, tp_data)
  4. log.info("TP", tp_data[1].x, tp_data[1].y, tp_data[1].event)
  5. sys.publish("TP", tp_device, tp_data)
  6. end
  7. function air_touch.init()
  8. log.info("tp", "tp init function start")
  9. local i2c_id = 1
  10. i2c.setup(i2c_id)
  11. tp_device = tp.init("gt911", {
  12. port = i2c_id,
  13. pin_int = gpio.WAKEUP0
  14. }, tp_callBack)
  15. log.info("tp", "tp init function end")
  16. end
  17. return air_touch