Posts: 1
Joined: Fri Mar 02, 2018 8:03 am

[solved] Disable/enable i2c touch on fly

Fri Mar 02, 2018 8:19 am

i have a raspberry pi3 with official 7"display.
Touch is connected to i2c bus.
Everything work properly.
For one application i must use also rtc, so i connect also a IS1307 that is a i2c RTC.
i install all stuff and rtc is reconized and connected.
my problem is that i can't read and write the rtc if touch is enabled.
To understant this i disable touch with command "disable_touchscreen=1" in config.txt, after reboot i can read and write RTC without problem.
So i think to make a script that
-disable touch
-connect the rtc
- read RTC
- remove connection to rtc
- enable touch

i write and test the part that connect and remove rtc, like so:

#!/bin/sh -e
sudo /bin/bash -c "echo is1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device"
sudo hwclock --systohc
sudo /bin/bash -c "echo 0x68 > /sys/class/i2c-adapter/i2c-1/delete_device"

i don't have idea about how disable and enable touch on fly, i mean without reboot


seems that system recognize touch on i2c-0 or i2c-1 on boot, so if touch is connect on port 0 i can use port 1 without problem and connect my rtc, after that i discover that if i use a script with command like the one that i write and call it from my application i can use both rtc and internal ram of rts ( i use a 1308 chip that mean that i have 64 byte of backuped ram that i can use as i whant)

Return to “Official Foundation Display”