|
1 | 1 | # Hardware initialization for Fri3d Camp 2026 Badge |
2 | 2 |
|
3 | | -# TODO: |
4 | | -# - touch screen / touch pad |
| 3 | +# Overview: |
| 4 | +# - Touch screen controller is cst816s |
5 | 5 | # - IMU (LSM6DSO) is different from fri3d_2024 (and address 0x6A instead of 0x6B) but the API seems the same, except different chip ID (0x6C iso 0x6A) |
6 | 6 | # - I2S audio (communicator) is the same |
7 | 7 | # - headphone jack audio? |
|
30 | 30 |
|
31 | 31 | import mpos.ui |
32 | 32 | import mpos.ui.focus_direction |
| 33 | +from mpos import InputManager |
33 | 34 |
|
34 | 35 | TFT_HOR_RES=320 |
35 | 36 | TFT_VER_RES=240 |
|
85 | 86 | # touch pad interrupt TP Int is on ESP.IO13 |
86 | 87 | i2c_bus = i2c.I2C.Bus(host=I2C_BUS, scl=TP_SCL, sda=TP_SDA, freq=I2C_FREQ, use_locks=False) |
87 | 88 | touch_dev = i2c.I2C.Device(bus=i2c_bus, dev_id=0x15, reg_bits=TP_REGBITS) |
88 | | -indev=cst816s.CST816S(touch_dev,startup_rotation=lv.DISPLAY_ROTATION._180) # button in top left, good |
| 89 | +tindev=cst816s.CST816S(touch_dev,startup_rotation=lv.DISPLAY_ROTATION._180) # button in top left, good |
| 90 | +InputManager.register_indev(tindev) |
89 | 91 |
|
90 | 92 | lv.init() |
91 | 93 | mpos.ui.main_display.set_rotation(lv.DISPLAY_ROTATION._270) # must be done after initializing display and creating the touch drivers, to ensure proper handling |
@@ -180,6 +182,7 @@ def keypad_read_cb(indev, data): |
180 | 182 | disp = lv.display_get_default() # NOQA |
181 | 183 | indev.set_display(disp) # different from display |
182 | 184 | indev.enable(True) # NOQA |
| 185 | +InputManager.register_indev(indev) |
183 | 186 |
|
184 | 187 | # Battery voltage ADC measuring: sits on PC0 of CH32X035GxUx |
185 | 188 | import mpos.battery_voltage |
|
0 commit comments