Commit Graph

5 Commits

Author SHA1 Message Date
Dima Barsky 08c5f2a1fb stm32: i2c-v1: Fixed a typo in i2c_read7_v1 and i2c_write7_v1
Replaced & with &&
Wait for all three bits to be set - SB, MSL, and BUSY.

Old code worked by chance, use booleans to correctly convey intent.
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-10-16 12:00:20 +00:00
Karl Palsson b4154f3ce6 doc: convert i2c to peripherals_api 2018-07-03 22:23:00 +00:00
Karl Palsson 6678da39bd stm32: i2c: Support auto speed configuration
For both v1 and v2, support automatic calculation of timing registers
for 100khz and 400khz i2c modes.

Based on work by Chuck in
https://github.com/libopencm3/libopencm3/pull/470 for v1
2017-06-08 23:01:45 +00:00
Karl Palsson b40c72828d stm32: i2c: provide "transfer" level helper routines
For both v1 and v2, provide routines to help do arbitrary length
write/read transfers.

Tested with multiple byte writes and reads, for both 100khz and 400khz,
with repeated starts and stop/starts.  However, only tested (presently)
with a single i2c target device, a Sensiron SHT21 sensor.  Extended
testing against eeproms and alternative devices would be useful
2017-03-30 21:48:08 +00:00
Sergey Matyukevich ef91856ac1 stm32: unify i2c implementations
The f1, f2, f4, l1 chip families have a similar "v1" i2c peripheral on board.
More recent f0, f3, l0, l3 chip families share another "v2" version  of i2c.

This patch unifies headers and implementation for two types of i2c peripherals:

- rename: i2c_common_all.[ch] to i2c_common_v1.[ch]
- remove i2c_common_f24.h: extra I2C blocks are defined in specific headers
- use f3 i2c code as a basis for common "v2" i2c implementation
- add f0 i2c support: use "v2" i2c implementation

Tests:
- tested on a custom f0 board
- compile-tested both libopencm3 and libopencm3-examples for all stm32

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
2017-03-30 21:48:07 +00:00