Using a TSL2591 instead of a TSL2561

I have been trying to figure out how to modify the code here: https://electricimp.com/docs/resources/i2c/ to work with a TSL2591 instead of the 2561. The only difference AFAIK is that the 2591 uses a fixed i2c address of 0x29. I’m not sure if any of the registers are different. I tried changing them to reflect the tsl2591’s Arduino library, which I know works.

The device code gets as far as the power check (and it returns 3). The next step is:

// Set command focus to the timing register
i2c.write(i2c_addr, TSL2561_REGISTER_TIMING);

and it just hangs there. It seems this must be an issue with the “TSL2561_REGISTER_TIMING”, which doesn’t seem to exist in the 2591 .h file. Maybe the 2591 handles timing differently than the 2561?

Any help greatly appreciated!

Also, I didn’t want to put this in documentation. If there’s any admin out there could you please move it to where you think is best, I’m guessing device code.

Done!