Day19 - I2C Sensor Driver
Objective
- Implement a Linux I2C sensor driver
- Communicate with STM32 I2C slave
- Expose sensor data via sysfs
Step 1 - Build Driver
Step 2 - Load Module
sudo insmod myi2c_sensor.ko
Check:
Expected:
myi2c_sensor probe start
myi2c_sensor probed: addr=0x48 chip_id=0xa1
Step 3 - Load Device Tree Overlay
Step 4 - Verify Device
Expected:
Step 5 - Read Attributes
cat chip_id
cat temp_raw
cat temp_input
Step 6 - Trigger Update
Step 7 - Modify Configuration
echo 3 > config
cat config
Step 8 - Update Period
echo 1000 > update_period
cat update_period
Step 9 - Remove Driver