Expert Comment Needed on a New I2C Library API

pito,

I provide the option of internal pull-ups because of this statement in the AVR datasheet.

Note that the internal pull-ups in the AVR pads can be enabled by setting the PORT bits corresponding to the SCL and SDA pins, as explained in the I/O Port section. The internal pull-ups can in some systems eliminate the need for external ones.

I have run some I2C chips, like a RTC, with only internal pull-ups in past projects with no problems.

I didn't use the Wire style API since I don't want an internal buffer and limited transfer sizes for I2C master. I am designing for maximum performance with RTOSs.

In my first tests at 100kHz with a DS1307, Wire takes 1084 microseconds to read the seven date time registers. This library, in a NilRTOS thread, takes 1008 microseconds but the thread sleeps while the ISR does the read and lower priority threads get about 850 microseconds of extra CPU time.

At 400 kHz, the read takes 324 microseconds and lower priority threads get an extra 180 microseconds of CPU time.

I may investigate a Wire style wrapper class with an internal buffer but I don't know if that would be valuable.