I want to have a go at bit banging my own I2C device...in particular the TSL2561 light sensor.
Now, I have read the datasheet and come up with a "plan" as such...does this sound like the actual way to read the 4 bytes from registers C->F?
Assume TSL2561 on Slave Address I2C - 0x29h = 0b101001 http://www.adafruit.com/datasheets/TSL2561.pdf
I have placed a comment in my code here where I am a bit unsure if I have done something right...the requesting the command register to somehow get me a block read of the 4 bytes (with ACK bits between...).
1. Start signal (CLK High -> SDA goes High to Low); 2. 7 bits for device address: 0b101001 one bit for WRITE 0b0; = 1 total byte to tell slave TSL2561 is to have a byte written to it. 3. Check for NACK bit (0b1) -> If present....throw an error. Else, continue. 4. Send to register address (Control register = 0h = 0b00000000) a byte to power up (03h) = 0b00000011. 5. Send stop signal (CLK HIGH -> SDA goes LOW->HIGH) 6. Now the unit is powered up...read the bytes in the data registers...(Figure 16 in data sheet) 7. Start signal (CLK High -> SDA goes High to Low); 8. 7bit slave address + 1 write bit (0b1010010) 9. Check for NACK and abort if present. 10. STUCK HERE? What do I want to to do to fetch the bytes from the data registers??? The command register instructions are a bit confusing :(... I am assuming this bit of text says you send the command code 9Bh and then things automatically happen and I end up with my 4 bytes from the register Ch to Fh? 11. Wait for the bytes and then send a STOP signal.