sipo
Ondřej Hruška 7 years ago
parent 96a7b58091
commit 611b38c5e6
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 1
      units/1wire/_ow_api.c
  2. 36
      units/1wire/_ow_checksum.c
  3. 27
      units/1wire/_ow_checksum.h
  4. 25
      units/1wire/_ow_init.h
  5. 33
      units/1wire/_ow_internal.h
  6. 30
      units/1wire/_ow_low_level.c
  7. 13
      units/1wire/_ow_low_level.h
  8. 31
      units/1wire/_ow_settings.h
  9. 21
      units/digital_in/_din_exti.h
  10. 20
      units/digital_in/_din_init.h
  11. 34
      units/digital_in/_din_internal.h
  12. 31
      units/digital_in/_din_settings.h
  13. 20
      units/digital_out/_dout_init.h
  14. 25
      units/digital_out/_dout_internal.h
  15. 31
      units/digital_out/_dout_settings.h
  16. 6
      units/digital_out/unit_dout.c
  17. 1
      units/i2c/_i2c_init.c
  18. 24
      units/i2c/_i2c_init.h
  19. 31
      units/i2c/_i2c_internal.h
  20. 28
      units/i2c/_i2c_settings.h
  21. 1
      units/neopixel/_npx_init.c
  22. 20
      units/neopixel/_npx_init.h
  23. 27
      units/neopixel/_npx_internal.h
  24. 1
      units/neopixel/_npx_settings.c
  25. 31
      units/neopixel/_npx_settings.h
  26. 3
      units/neopixel/unit_neopixel.c
  27. 7
      units/spi/_spi_init.c
  28. 20
      units/spi/_spi_init.h
  29. 27
      units/spi/_spi_internal.h
  30. 9
      units/spi/_spi_settings.c
  31. 31
      units/spi/_spi_settings.h
  32. 16
      units/spi/unit_spi.c
  33. 1
      units/template/_tpl_init.c
  34. 20
      units/template/_tpl_init.h
  35. 25
      units/template/_tpl_internal.h
  36. 1
      units/template/_tpl_settings.c
  37. 31
      units/template/_tpl_settings.h
  38. 2
      units/template/unit_tpl.c
  39. 6
      units/usart/_usart_internal.h

@ -9,7 +9,6 @@
#define OW_INTERNAL
#include "_ow_internal.h"
#include "_ow_commands.h"
#include "_ow_checksum.h"
#include "_ow_low_level.h"
/* Check presence of any devices on the bus */

@ -1,36 +0,0 @@
//
// Created by MightyPork on 2018/02/01.
//
#include "platform.h"
#define OW_INTERNAL
#include "_ow_checksum.h"
static inline uint8_t crc8_bits(uint8_t data)
{
uint8_t crc = 0;
if(data & 1) crc ^= 0x5e;
if(data & 2) crc ^= 0xbc;
if(data & 4) crc ^= 0x61;
if(data & 8) crc ^= 0xc2;
if(data & 0x10) crc ^= 0x9d;
if(data & 0x20) crc ^= 0x23;
if(data & 0x40) crc ^= 0x46;
if(data & 0x80) crc ^= 0x8c;
return crc;
}
static uint8_t crc8_add(uint8_t cksum, uint8_t byte)
{
return crc8_bits(byte ^ cksum);
}
uint8_t ow_checksum(const uint8_t *buff, uint32_t len)
{
uint8_t cksum = 0;
for(uint32_t i = 0; i < len; i++) {
cksum = crc8_add(cksum, buff[i]);
}
return cksum;
}

@ -1,27 +0,0 @@
//
// Created by MightyPork on 2018/02/01.
//
#ifndef GEX_F072_OW_CHECKSUM_H
#define GEX_F072_OW_CHECKSUM_H
#ifndef OW_INTERNAL
#error bad include!
#endif
#include <stdint.h>
/**
* Compute a 1-wire type checksum.
* If the buffer includes the checksum, the result should be 0.
*
* (this function may be used externally, or you can delete the implementation
* from the c file if another implementation is already available)
*
* @param[in] buf - buffer of bytes to verify
* @param[in] len - buffer length
* @return checksum
*/
uint8_t ow_checksum(const uint8_t *buf, uint32_t len);
#endif //GEX_F072_OW_CHECKSUM_H

@ -1,25 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_OW_INIT_H
#define GEX_F072_OW_INIT_H
#ifndef OW_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t OW_preInit(Unit *unit);
/** Finalize unit set-up */
error_t OW_init(Unit *unit);
/** Tear down the unit */
void OW_deInit(Unit *unit);
extern void OW_TimerCb(TimerHandle_t xTimer);
#endif //GEX_F072_OW_INIT_H

@ -27,6 +27,37 @@ struct priv {
struct ow_search_state searchState;
};
// Prototypes
/** Allocate data structure and set defaults */
error_t OW_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void OW_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void OW_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t OW_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void OW_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Allocate data structure and set defaults */
error_t OW_preInit(Unit *unit);
/** Finalize unit set-up */
error_t OW_init(Unit *unit);
/** Tear down the unit */
void OW_deInit(Unit *unit);
/** Callback for the FreeRTOS timer used to wait for device ready */
void OW_TimerCb(TimerHandle_t xTimer);
// ------------------------------------------------------------------------
#endif //GEX_F072_OW_INTERNAL_H

@ -10,6 +10,36 @@
#include "_ow_internal.h"
#include "_ow_low_level.h"
static inline uint8_t crc8_bits(uint8_t data)
{
uint8_t crc = 0;
if(data & 1) crc ^= 0x5e;
if(data & 2) crc ^= 0xbc;
if(data & 4) crc ^= 0x61;
if(data & 8) crc ^= 0xc2;
if(data & 0x10) crc ^= 0x9d;
if(data & 0x20) crc ^= 0x23;
if(data & 0x40) crc ^= 0x46;
if(data & 0x80) crc ^= 0x8c;
return crc;
}
static uint8_t crc8_add(uint8_t cksum, uint8_t byte)
{
return crc8_bits(byte ^ cksum);
}
uint8_t ow_checksum(const uint8_t *buff, uint32_t len)
{
uint8_t cksum = 0;
for(uint32_t i = 0; i < len; i++) {
cksum = crc8_add(cksum, buff[i]);
}
return cksum;
}
// ----------------------------------------------
static inline void ow_pull_high(Unit *unit)
{
struct priv *priv = unit->data;

@ -13,6 +13,19 @@
#include "unit_base.h"
#include "_ow_low_level.h"
/**
* Compute a 1-wire type checksum.
* If the buffer includes the checksum, the result should be 0.
*
* (this function may be used externally, or you can delete the implementation
* from the c file if another implementation is already available)
*
* @param[in] buf - buffer of bytes to verify
* @param[in] len - buffer length
* @return checksum
*/
uint8_t ow_checksum(const uint8_t *buf, uint32_t len);
/**
* Reset the 1-wire bus
*/

@ -1,31 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_OW_SETTINGS_H
#define GEX_F072_OW_SETTINGS_H
#ifndef OW_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t OW_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void OW_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void OW_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t OW_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void OW_writeIni(Unit *unit, IniWriter *iw);
#endif //GEX_F072_OW_SETTINGS_H

@ -1,21 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_DIN_EXTI_H
#define GEX_F072_DIN_EXTI_H
#ifndef DIN_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/**
* EXTI callback for pin change interrupts
*
* @param arg - the unit is passed here
*/
void DIn_handleExti(void *arg);
#endif //GEX_F072_DIN_EXTI_H

@ -1,20 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_DIN_INIT_H
#define GEX_F072_DIN_INIT_H
#ifndef DIN_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Finalize unit set-up */
error_t DIn_init(Unit *unit);
/** Tear down the unit */
void DIn_deInit(Unit *unit);
#endif //GEX_F072_DIN_INIT_H

@ -28,4 +28,38 @@ struct priv {
GPIO_TypeDef *port;
};
/** Allocate data structure and set defaults */
error_t DIn_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void DIn_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void DIn_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t DIn_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void DIn_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Finalize unit set-up */
error_t DIn_init(Unit *unit);
/** Tear down the unit */
void DIn_deInit(Unit *unit);
// ------------------------------------------------------------------------
/**
* EXTI callback for pin change interrupts
*
* @param arg - the unit is passed here
*/
void DIn_handleExti(void *arg);
#endif //GEX_F072_DIN_INTERNAL_H

@ -1,31 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_DIN_SETTINGS_H
#define GEX_F072_DIN_SETTINGS_H
#ifndef DIN_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t DIn_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void DIn_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void DIn_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t DIn_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void DIn_writeIni(Unit *unit, IniWriter *iw);
#endif //GEX_F072_DIN_SETTINGS_H

@ -1,20 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_DOUT_INIT_H
#define GEX_F072_DOUT_INIT_H
#ifndef DOUT_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Finalize unit set-up */
error_t DOut_init(Unit *unit);
/** Tear down the unit */
void DOut_deInit(Unit *unit);
#endif //GEX_F072_DOUT_INIT_H

@ -21,4 +21,29 @@ struct priv {
GPIO_TypeDef *port;
};
/** Allocate data structure and set defaults */
error_t DOut_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void DOut_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void DOut_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t DOut_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void DOut_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Finalize unit set-up */
error_t DOut_init(Unit *unit);
/** Tear down the unit */
void DOut_deInit(Unit *unit);
#endif //GEX_F072_DOUT_INTERNAL_H

@ -1,31 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_DOUT_SETTINGS_H
#define GEX_F072_DOUT_SETTINGS_H
#ifndef DOUT_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t DOut_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void DOut_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void DOut_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t DOut_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void DOut_writeIni(Unit *unit, IniWriter *iw);
#endif //GEX_F072_DOUT_SETTINGS_H

@ -6,8 +6,7 @@
#include "unit_dout.h"
#define DOUT_INTERNAL
#include "_dout_settings.h"
#include "_dout_init.h"
#include "_dout_internal.h"
enum PinCmd_ {
CMD_TEST = 0,
@ -17,8 +16,7 @@ enum PinCmd_ {
};
/** Handle a request message */
static error_t DOut_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command,
PayloadParser *pp)
static error_t DOut_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, PayloadParser *pp)
{
uint16_t packed = pp_u16(pp);

@ -7,7 +7,6 @@
#define I2C_INTERNAL
#include "_i2c_internal.h"
#include "_i2c_init.h"
/** Allocate data structure and set defaults */

@ -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

@ -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

@ -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

@ -7,7 +7,6 @@
#define NPX_INTERNAL
#include "_npx_internal.h"
#include "_npx_init.h"
#include "ws2812.h"
/** Allocate data structure and set defaults */

@ -1,20 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_NPX_INIT_H
#define GEX_F072_NPX_INIT_H
#ifndef NPX_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Finalize unit set-up */
error_t Npx_init(Unit *unit);
/** Tear down the unit */
void Npx_deInit(Unit *unit);
#endif //GEX_F072_NPX_INIT_H

@ -21,4 +21,31 @@ struct priv {
GPIO_TypeDef *port;
};
// ------------------------------------------------------------------------
/** Allocate data structure and set defaults */
error_t Npx_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void Npx_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void Npx_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t Npx_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void Npx_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Finalize unit set-up */
error_t Npx_init(Unit *unit);
/** Tear down the unit */
void Npx_deInit(Unit *unit);
#endif //GEX_F072_NPX_INTERNAL_H

@ -7,7 +7,6 @@
#define NPX_INTERNAL
#include "_npx_internal.h"
#include "_npx_settings.h"
/** Load from a binary buffer stored in Flash */
void Npx_loadBinary(Unit *unit, PayloadParser *pp)

@ -1,31 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_NPX_SETTINGS_H
#define GEX_F072_NPX_SETTINGS_H
#ifndef NPX_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t Npx_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void Npx_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void Npx_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t Npx_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void Npx_writeIni(Unit *unit, IniWriter *iw);
#endif //GEX_F072_NPX_SETTINGS_H

@ -6,8 +6,7 @@
#include "unit_neopixel.h"
#define NPX_INTERNAL
#include "_npx_settings.h"
#include "_npx_init.h"
#include "_npx_internal.h"
enum PinCmd_ {
CMD_CLEAR = 0,

@ -7,10 +7,9 @@
#define SPI_INTERNAL
#include "_spi_internal.h"
#include "_spi_init.h"
/** Allocate data structure and set defaults */
error_t SPI_preInit(Unit *unit)
error_t USPI_preInit(Unit *unit)
{
struct priv *priv = unit->data = calloc_ck(1, sizeof(struct priv));
if (priv == NULL) return E_OUT_OF_MEM;
@ -32,7 +31,7 @@ error_t SPI_preInit(Unit *unit)
}
/** Finalize unit set-up */
error_t SPI_init(Unit *unit)
error_t USPI_init(Unit *unit)
{
bool suc = true;
struct priv *priv = unit->data;
@ -176,7 +175,7 @@ error_t SPI_init(Unit *unit)
}
/** Tear down the unit */
void SPI_deInit(Unit *unit)
void USPI_deInit(Unit *unit)
{
struct priv *priv = unit->data;

@ -1,20 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_SPI_INIT_H
#define GEX_F072_SPI_INIT_H
#ifndef SPI_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Finalize unit set-up */
error_t SPI_init(Unit *unit);
/** Tear down the unit */
void SPI_deInit(Unit *unit);
#endif //GEX_F072_SPI_INIT_H

@ -29,4 +29,31 @@ struct priv {
GPIO_TypeDef *ssn_port;
};
// ------------------------------------------------------------------------
/** Load from a binary buffer stored in Flash */
void USPI_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void USPI_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t USPI_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void USPI_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Allocate data structure and set defaults */
error_t USPI_preInit(Unit *unit);
/** Finalize unit set-up */
error_t USPI_init(Unit *unit);
/** Tear down the unit */
void USPI_deInit(Unit *unit);
#endif //GEX_F072_SPI_INTERNAL_H

@ -7,10 +7,9 @@
#define SPI_INTERNAL
#include "_spi_internal.h"
#include "_spi_settings.h"
/** Load from a binary buffer stored in Flash */
void SPI_loadBinary(Unit *unit, PayloadParser *pp)
void USPI_loadBinary(Unit *unit, PayloadParser *pp)
{
struct priv *priv = unit->data;
@ -31,7 +30,7 @@ void SPI_loadBinary(Unit *unit, PayloadParser *pp)
}
/** Write to a binary buffer for storing in Flash */
void SPI_writeBinary(Unit *unit, PayloadBuilder *pb)
void USPI_writeBinary(Unit *unit, PayloadBuilder *pb)
{
struct priv *priv = unit->data;
@ -53,7 +52,7 @@ void SPI_writeBinary(Unit *unit, PayloadBuilder *pb)
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t SPI_loadIni(Unit *unit, const char *key, const char *value)
error_t USPI_loadIni(Unit *unit, const char *key, const char *value)
{
bool suc = true;
struct priv *priv = unit->data;
@ -94,7 +93,7 @@ error_t SPI_loadIni(Unit *unit, const char *key, const char *value)
}
/** Generate INI file section for the unit */
void SPI_writeIni(Unit *unit, IniWriter *iw)
void USPI_writeIni(Unit *unit, IniWriter *iw)
{
struct priv *priv = unit->data;

@ -1,31 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_SPI_SETTINGS_H
#define GEX_F072_SPI_SETTINGS_H
#ifndef SPI_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t SPI_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void SPI_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void SPI_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t SPI_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void SPI_writeIni(Unit *unit, IniWriter *iw);
#endif //GEX_F072_SPI_SETTINGS_H

@ -11,8 +11,6 @@
#define SPI_INTERNAL
#include "_spi_internal.h"
#include "_spi_settings.h"
#include "_spi_init.h"
// SPI master
@ -73,14 +71,14 @@ const UnitDriver UNIT_SPI = {
.name = "SPI",
.description = "SPI master",
// Settings
.preInit = SPI_preInit,
.cfgLoadBinary = SPI_loadBinary,
.cfgWriteBinary = SPI_writeBinary,
.cfgLoadIni = SPI_loadIni,
.cfgWriteIni = SPI_writeIni,
.preInit = USPI_preInit,
.cfgLoadBinary = USPI_loadBinary,
.cfgWriteBinary = USPI_writeBinary,
.cfgLoadIni = USPI_loadIni,
.cfgWriteIni = USPI_writeIni,
// Init
.init = SPI_init,
.deInit = SPI_deInit,
.init = USPI_init,
.deInit = USPI_deInit,
// Function
.handleRequest = SPI_handleRequest,
};

@ -7,7 +7,6 @@
#define TPL_INTERNAL
#include "_tpl_internal.h"
#include "_tpl_init.h"
/** Allocate data structure and set defaults */
error_t TPL_preInit(Unit *unit)

@ -1,20 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_TPL_INIT_H
#define GEX_F072_TPL_INIT_H
#ifndef TPL_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Finalize unit set-up */
error_t TPL_init(Unit *unit);
/** Tear down the unit */
void TPL_deInit(Unit *unit);
#endif //GEX_F072_TPL_INIT_H

@ -18,4 +18,29 @@ struct priv {
// internal state
};
/** Allocate data structure and set defaults */
error_t TPL_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void TPL_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void TPL_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t TPL_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void TPL_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Finalize unit set-up */
error_t TPL_init(Unit *unit);
/** Tear down the unit */
void TPL_deInit(Unit *unit);
#endif //GEX_F072_TPL_INTERNAL_H

@ -7,7 +7,6 @@
#define TPL_INTERNAL
#include "_tpl_internal.h"
#include "_tpl_settings.h"
/** Load from a binary buffer stored in Flash */
void TPL_loadBinary(Unit *unit, PayloadParser *pp)

@ -1,31 +0,0 @@
//
// Created by MightyPork on 2018/02/03.
//
#ifndef GEX_F072_TPL_SETTINGS_H
#define GEX_F072_TPL_SETTINGS_H
#ifndef TPL_INTERNAL
#error bad include!
#endif
#include "unit_base.h"
/** Allocate data structure and set defaults */
error_t TPL_preInit(Unit *unit);
/** Load from a binary buffer stored in Flash */
void TPL_loadBinary(Unit *unit, PayloadParser *pp);
/** Write to a binary buffer for storing in Flash */
void TPL_writeBinary(Unit *unit, PayloadBuilder *pb);
// ------------------------------------------------------------------------
/** Parse a key-value pair from the INI file */
error_t TPL_loadIni(Unit *unit, const char *key, const char *value);
/** Generate INI file section for the unit */
void TPL_writeIni(Unit *unit, IniWriter *iw);
#endif //GEX_F072_TPL_SETTINGS_H

@ -7,8 +7,6 @@
#define TPL_INTERNAL
#include "_tpl_internal.h"
#include "_tpl_settings.h"
#include "_tpl_init.h"
// ------------------------------------------------------------------------

@ -63,9 +63,6 @@ struct priv {
volatile bool tx_dma_busy; //!< Flag that the Tx DMA request is ongoing
};
/** Allocate data structure and set defaults */
error_t UUSART_preInit(Unit *unit);
// ------------------------------------------------------------------------
/** Load from a binary buffer stored in Flash */
@ -84,6 +81,9 @@ void UUSART_writeIni(Unit *unit, IniWriter *iw);
// ------------------------------------------------------------------------
/** Allocate data structure and set defaults */
error_t UUSART_preInit(Unit *unit);
/** Tear down the unit */
void UUSART_deInit(Unit *unit);

Loading…
Cancel
Save