Hi Giovanni, hi Barthess
a few weeks ago i made for my use, a i2c (STM32) driver based on interrupt that currently works fine.
now i decided i'd make it available to avoid that Barthess do the same job i did.
(naturally, if he like it, can use this code freely in the most convenient mode)
http://www.megaupload.com/?d=VVRN9GUC(22-02-2011 i've correct one mistake on serial_lld.c and reupload an new file)It's close enough to the general driver specifications and the other drivers
for now it only works as master and only by interrupt, the master-receiver isr part meets the "method 2"
described in the reference manual, so it can be used with a lower interrupt priority instead of the highest.
It works asynchronously with events and callback and also with the bus lock (tested both)
optionally can also work in a synchronous mode (but it is really useful?)
Came with a easy, complete and tested configuration support .
An little issue is open about i2c_lld_wait_bus_free() wich now is blocking (for only about half sdc period in asynchronous mode)
exactly between the ack/nak (the last useful state of isr state machine) and the stop where the bus is fred.
i don't have already find an elegant solution for avoid this,
the exit could be triggered asynchronously by an exti on rising edge of sda? mhhh...
The protocol was verified in HW with a logic/protocol analyzer.
The 10-bit address has been implemented but not yet tested.
This driver was tested with two LM75 and one ADS1115 on the same bus with concurrent access.
Also i made a specific ADS1115 driver on top the I2C driver, but now is still under test.
as example, see ChibiOS_2.17\projects\i2c
In the attached file (an ChibiOS_2.17 minimal skeleton) there is also a USB serial driver
built on top of the usb ST libraries.
It's very easy to use, the driver came in the same manner of the other serial drivers
(some low level usb parts are merged in the serial_lld.c/h, instead serial.c/h is untouched)
It's temporaneous and should be used only while Giovanni still works on the official one.
as example, see ChibiOS_2.17\projects\vcom
it's a data exchange between SD2 and USBD1 and vice versa through events
Latest there is also a useful module for EXTI managing (only to make the life easy)
There isn't a driver now but i'm thinking of trying to make it.
as example, see ChibiOS_2.17\projects\Exti
Sorry for my poor english, i hope i was understood.
also i hope to be helpful to all the ChibiOS's friends
Alberto