Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2017-03-24 03:10:44 +0300
committerKarl Palsson <karlp@tweak.net.au>2017-03-31 00:48:08 +0300
commitb40c72828df0aab74224df6fd18205ef9623a084 (patch)
tree8ab57b559efa4629586b5557b4b0960bda7182e9 /include/libopencm3/stm32/common/i2c_common_v2.h
parentfb3b5e08f3c21c2f5f80d274b916e7dd5e548e67 (diff)
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
Diffstat (limited to 'include/libopencm3/stm32/common/i2c_common_v2.h')
-rw-r--r--include/libopencm3/stm32/common/i2c_common_v2.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/libopencm3/stm32/common/i2c_common_v2.h b/include/libopencm3/stm32/common/i2c_common_v2.h
index 01ec643b..3012fd7f 100644
--- a/include/libopencm3/stm32/common/i2c_common_v2.h
+++ b/include/libopencm3/stm32/common/i2c_common_v2.h
@@ -31,6 +31,9 @@ specific memorymap.h header before including this header file.*/
#ifndef LIBOPENCM3_I2C_COMMON_V2_H
#define LIBOPENCM3_I2C_COMMON_V2_H
+#include <stddef.h>
+#include <stdint.h>
+
/* --- Convenience macros -------------------------------------------------- */
/* I2C register base addresses (for convenience) */
@@ -427,6 +430,7 @@ void i2c_enable_rxdma(uint32_t i2c);
void i2c_disable_rxdma(uint32_t i2c);
void i2c_enable_txdma(uint32_t i2c);
void i2c_disable_txdma(uint32_t i2c);
+void i2c_transfer7(uint32_t i2c, uint8_t addr, uint8_t *w, size_t wn, uint8_t *r, size_t rn);
END_DECLS