I2c analog input communication



I’m writing a small C driver to use the raspberry pi zero, the explorer phat and the OS developed in my university. The only thing left is the control of the analog inputs. I saw on the python code it communicates using ioctl. My OS does not have file system so i can not use ioctl. How can i read the analog inputs?


You may either want to bitbang i2c, by writing a software-only driver to manipulate the pins, or drive the i2c hardware by directly manipulating the appropriate registers.

If you’re the learn by example type, this may help: http://www.susa.net/wordpress/2012/06/raspberry-pi-pcf8563-real-time-clock-rtc/


I want to use the bcm2835 library functions to communicate, i think, with the registers. I saw the I2C address of the phat is 0x48 but my question is what i need to do to communicate with the phat and read the values of the analog inputs. Thanks.


All of the devices on Explorer §HAT are listed here: https://github.com/pimoroni/explorer-hat/blob/master/documentation/Technical-reference.md

Should be easy to find the datasheet and, therein, all you need to know!