File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 22import smbus2
33
44# Create a new SMBus instance on line 2
5- bus = smbus2 .SMBus (2 )
5+ bus = smbus2 .SMBus (1 )
66
77if __name__ == "__main__" :
88
99 if sys .argv [1 ] == "set_rtcm" :
1010 # Device i2c write address
11- device_address_write = 0xA2
12- device_address_read = 0xA3
11+ device_address = 0x51
1312
1413 # Register address
1514 register_address = 0x28
1615
1716 # First, we need to read the current value of the register
18- current_value = bus .read_byte_data (device_address_read , register_address )
17+ current_value = bus .read_byte_data (device_address , register_address )
1918
2019 # Then, we need to clear the fourth bit (fifth from the left, little endian starting at 0)
2120 # We can do this by creating a mask where all bits are 1, except for the fourth bit, which is 0.
2423 new_value = current_value & mask
2524
2625 # Write the new value back to the register
27- bus .write_byte_data (device_address_write , register_address , new_value )
26+ bus .write_byte_data (device_address , register_address , new_value )
2827
You can’t perform that action at this time.
0 commit comments