Cool project - any suggestions to get vcom value?
kimmobrunfeldt opened this issue · comments
Hi! I've been playing with the usb based controlling using https://sr.ht/~martijnbraam/it8951/ C code as the basis. I wasn't able to get the current vcom value using this code. Have you successfully queried the vcom value? The USB programming pdf sheet had an example command:
unsigned char get_vcom_cmd[16] = {
0xfe, // Customer command.
0x00,
0x00,
0x00,
0x00,
0x00,
0xa3, // PMIC (Power Management Integrated Circuits) command.
0x00,
0x00,
0x00, // Do Set VCom? (0 – no, 1 – yes)
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
};
but it didn't describe the return shape or length in bytes.
As a reference, Waveshare has a GPIO based C code example.
Hey @kimmobrunfeldt! 👋
I just made an experiment and could retreive the data with the command you've mentioned. The result you're receiving is a "word" (that is two bytes, or 16 bit).
The VCOM value of my display is -1.58
, which is represented as 1580
(decimal) or 062c
(hex). When I run the 0xa3
command I receive 062c
👍 - this is the code I've used:
let data = [
CUSTOMER_CMD, // 0xfe
0x00,
0x00,
0x00,
0x00,
0x00,
PMIC_CONTROL_CMD, // 0xa3
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
];
// https://github.com/adzialocha/it8951-video/blob/main/src/usb.rs#L47
let result: u16 = self
.connection
.read_command(&data, bincode::options().with_big_endian())?;
println!("{:x}", result); // 062c
@adzialocha ok awesome, thanks for testing!
Then it seems like my C code might have an issue with reading data.
Finally figured it out with the help of your example code. I didn't spot the "FROM" vs "TO" difference before, now with correct communication direction it works: kimmobrunfeldt/eink-weather-display@84b60bf
Super