From 65301e5a0b382585887ea7b13e4eb9b0cb26c60f Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Tue, 21 Feb 2017 23:11:43 +0000 Subject: i2c-master: start progressing to extracting common i2c code --- tests/i2c-master/hw.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/i2c-master/hw.h (limited to 'tests/i2c-master/hw.h') diff --git a/tests/i2c-master/hw.h b/tests/i2c-master/hw.h new file mode 100644 index 0000000..7ce9c50 --- /dev/null +++ b/tests/i2c-master/hw.h @@ -0,0 +1,38 @@ +/* + * Feb 2017 Karl Palsson + */ + +#include +#include + +#pragma once + +struct hw_detail +{ + uint32_t periph; /* eg: I2C1 */ + uint32_t periph_rcc; /* eg: RCC_I2C1 */ + uint32_t periph_rst; /* eg: RST_I2C1 */ + uint32_t pins; /* eg: GPIO8 | GPIO9 */ /* ASSUMES SAME PORT*/ + uint32_t port; /* eg GPIOB */ + uint32_t port_rcc; /* eg RCC_GPIOB */ +}; + +extern struct hw_detail hw_details; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Expected to setup clocks, turn on all peripherals, and configure + * any gpios necessary. + * @param hw pointer to hw details necessary + */ + void hw_setup(struct hw_detail* hw); + + /* let devices have a status led */ + void hw_set_led(bool val); + +#ifdef __cplusplus +} +#endif -- cgit