kaxori
09/23/2024, 2:14 PMWrites the $bytes to the device at the given $register.
The $register value must satisfy 0 <= $register < 256.
This is a convenience method and equivalent to prepending the $register byte to $bytes
and then calling $(write bytes).kaxori
09/23/2024, 2:25 PMfloitsch
09/23/2024, 2:26 PMfloitsch
09/23/2024, 2:28 PMfloitsch
09/23/2024, 2:30 PMkaxori
09/23/2024, 2:32 PMi2c-read-reg_ i2c address reg size:
#primitive.i2c.read-reg
may be the reg is meant to be only a byte wide. But the chip uses 16bit register addressesfloitsch
09/23/2024, 2:33 PMread-reg directly. But as the command explains, you should be able to do read-address #[your-address] sizefloitsch
09/23/2024, 2:33 PM#[your-address] consists of two bytes.kaxori
09/23/2024, 2:33 PMprint "registers_ : $(registers_.read-u8 0x00)"
print "registers_ : $(registers_.read-u8 0x0212)"kaxori
09/23/2024, 2:34 PMfloitsch
09/23/2024, 2:34 PMfloitsch
09/23/2024, 2:36 PMdevice := bus.device ..., then you get an i2c.Device back which has the method 'read-address` method.floitsch
09/23/2024, 2:36 PMfloitsch
09/23/2024, 2:36 PMread-uint16 ,...floitsch
09/23/2024, 2:37 PMfloitsch
09/23/2024, 2:38 PMfloitsch
09/23/2024, 2:38 PMread-address should.kaxori
09/23/2024, 3:38 PMread-register16 reg bytes -> ByteArray:
return device_.read-address #[reg>>8, reg] bytes
write-register16 reg bytes/ByteArray:
device_.write-address #[reg>>8, reg] bytes
Thank you - it works!