Hello!
I want to connect MLX90614 temperature sensors on NXT, but those sensors are using SMBus protocol, not exactly I2C, so integrated I2C function doesn't work.
First, I wanted to manually wrote I2C functions with SensorPort.SetSensorPin and Delay.usDelay functions, but then I realized that that delay functions are not accurate and that everything is too slow for proper communication.
I wanted to create following functions:
- I2Cinit(port, SCL_pin, SDA_pin); //Define SCL (PA23/PA28/PA29/PA30) and SDA (PA2/PA18/PA20/pin6) as output and set them to high level (1)
- I2Cstart(port); //pull SDA line to low level (0)
- bool I2Csendbyte(port, ubyte); //shift out one byte and return boolean variable if ACK/NACK was received
- ubyte I2Creceivebyte(port, ack_nack); //receive one byte and return ACK (0) or NACK (1)
- I2Cstop(port); //release SCL line to high-level (1) and then SDA
I don't think this is possible directly in Java (I'm low-level programmer, used programming in AVR C and Assembler), so I'm asking if is there any possibility to add this features to firmware or if anyone have already done SMBus communication in leJOS, please share the code with me.
I should mention that SMBus communication is working properly on AVRs with hardware (TWI) and software I2C.
Thank you for you help
Bojan
