This commit is contained in:
2018-02-03 11:54:22 +01:00
parent 96a7b58091
commit 611b38c5e6
39 changed files with 260 additions and 487 deletions
-1
View File
@@ -7,7 +7,6 @@
#define I2C_INTERNAL
#include "_i2c_internal.h"
#include "_i2c_init.h"
/** Allocate data structure and set defaults */
-24
View File
@@ -1,24 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_I2C_INIT_H
#define GEX_F072_I2C_INIT_H
#ifndef I2C_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t UI2C_preInit(Unit *unit);
/** Finalize unit set-up */
error_t UI2C_init(Unit *unit);
/** Tear down the unit */
void UI2C_deInit(Unit *unit);
#endif //GEX_F072_I2C_INIT_H
+27 -4
View File
@@ -19,10 +19,33 @@ struct priv {
uint8_t speed; //!< 0 - Standard, 1 - Fast, 2 - Fast+
I2C_TypeDef *periph;
// GPIO_TypeDef *port;
// uint32_t ll_pin_scl;
// uint32_t ll_pin_sda;
};
/** Load from a binary buffer stored in Flash */
void UI2C_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void UI2C_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t UI2C_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void UI2C_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Allocate data structure and set defaults */
error_t UI2C_preInit(Unit *unit);
/** Finalize unit set-up */
error_t UI2C_init(Unit *unit);
/** Tear down the unit */
void UI2C_deInit(Unit *unit);
// ------------------------------------------------------------------------
#endif //GEX_F072_I2C_INTERNAL_H
-28
View File
@@ -1,28 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_I2C_SETTINGS_H
#define GEX_F072_I2C_SETTINGS_H
#ifndef I2C_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Load from a binary buffer stored in Flash */
void UI2C_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void UI2C_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t UI2C_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void UI2C_writeIni(Unit *unit, IniWriter *iw);
#endif //GEX_F072_I2C_SETTINGS_H