ADC skeleton
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "_tpl_internal.h"
|
||||
|
||||
/** Allocate data structure and set defaults */
|
||||
error_t TPL_preInit(Unit *unit)
|
||||
error_t UTPL_preInit(Unit *unit)
|
||||
{
|
||||
struct priv *priv = unit->data = calloc_ck(1, sizeof(struct priv));
|
||||
if (priv == NULL) return E_OUT_OF_MEM;
|
||||
@@ -20,7 +20,7 @@ error_t TPL_preInit(Unit *unit)
|
||||
}
|
||||
|
||||
/** Finalize unit set-up */
|
||||
error_t TPL_init(Unit *unit)
|
||||
error_t UTPL_init(Unit *unit)
|
||||
{
|
||||
bool suc = true;
|
||||
struct priv *priv = unit->data;
|
||||
@@ -32,7 +32,7 @@ error_t TPL_init(Unit *unit)
|
||||
|
||||
|
||||
/** Tear down the unit */
|
||||
void TPL_deInit(Unit *unit)
|
||||
void UTPL_deInit(Unit *unit)
|
||||
{
|
||||
struct priv *priv = unit->data;
|
||||
|
||||
|
||||
@@ -19,28 +19,28 @@ struct priv {
|
||||
};
|
||||
|
||||
/** Allocate data structure and set defaults */
|
||||
error_t TPL_preInit(Unit *unit);
|
||||
error_t UTPL_preInit(Unit *unit);
|
||||
|
||||
/** Load from a binary buffer stored in Flash */
|
||||
void TPL_loadBinary(Unit *unit, PayloadParser *pp);
|
||||
void UTPL_loadBinary(Unit *unit, PayloadParser *pp);
|
||||
|
||||
/** Write to a binary buffer for storing in Flash */
|
||||
void TPL_writeBinary(Unit *unit, PayloadBuilder *pb);
|
||||
void UTPL_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);
|
||||
error_t UTPL_loadIni(Unit *unit, const char *key, const char *value);
|
||||
|
||||
/** Generate INI file section for the unit */
|
||||
void TPL_writeIni(Unit *unit, IniWriter *iw);
|
||||
void UTPL_writeIni(Unit *unit, IniWriter *iw);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/** Finalize unit set-up */
|
||||
error_t TPL_init(Unit *unit);
|
||||
error_t UTPL_init(Unit *unit);
|
||||
|
||||
/** Tear down the unit */
|
||||
void TPL_deInit(Unit *unit);
|
||||
void UTPL_deInit(Unit *unit);
|
||||
|
||||
#endif //GEX_F072_TPL_INTERNAL_H
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "_tpl_internal.h"
|
||||
|
||||
/** Load from a binary buffer stored in Flash */
|
||||
void TPL_loadBinary(Unit *unit, PayloadParser *pp)
|
||||
void UTPL_loadBinary(Unit *unit, PayloadParser *pp)
|
||||
{
|
||||
struct priv *priv = unit->data;
|
||||
|
||||
@@ -20,7 +20,7 @@ void TPL_loadBinary(Unit *unit, PayloadParser *pp)
|
||||
}
|
||||
|
||||
/** Write to a binary buffer for storing in Flash */
|
||||
void TPL_writeBinary(Unit *unit, PayloadBuilder *pb)
|
||||
void UTPL_writeBinary(Unit *unit, PayloadBuilder *pb)
|
||||
{
|
||||
struct priv *priv = unit->data;
|
||||
|
||||
@@ -32,7 +32,7 @@ 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)
|
||||
error_t UTPL_loadIni(Unit *unit, const char *key, const char *value)
|
||||
{
|
||||
bool suc = true;
|
||||
struct priv *priv = unit->data;
|
||||
@@ -49,7 +49,7 @@ 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)
|
||||
void UTPL_writeIni(Unit *unit, IniWriter *iw)
|
||||
{
|
||||
struct priv *priv = unit->data;
|
||||
|
||||
|
||||
+12
-11
@@ -15,7 +15,8 @@ enum TplCmd_ {
|
||||
};
|
||||
|
||||
/** Handle a request message */
|
||||
static error_t TPL_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, PayloadParser *pp)
|
||||
static error_t UTPL_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command,
|
||||
PayloadParser *pp)
|
||||
{
|
||||
switch (command) {
|
||||
default:
|
||||
@@ -30,7 +31,7 @@ static error_t TPL_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, Pa
|
||||
*
|
||||
* @param unit
|
||||
*/
|
||||
static void TPL_updateTick(Unit *unit)
|
||||
static void UTPL_updateTick(Unit *unit)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -42,15 +43,15 @@ const UnitDriver UNIT_TPL = {
|
||||
.name = "TPL",
|
||||
.description = "Template unit",
|
||||
// Settings
|
||||
.preInit = TPL_preInit,
|
||||
.cfgLoadBinary = TPL_loadBinary,
|
||||
.cfgWriteBinary = TPL_writeBinary,
|
||||
.cfgLoadIni = TPL_loadIni,
|
||||
.cfgWriteIni = TPL_writeIni,
|
||||
.preInit = UTPL_preInit,
|
||||
.cfgLoadBinary = UTPL_loadBinary,
|
||||
.cfgWriteBinary = UTPL_writeBinary,
|
||||
.cfgLoadIni = UTPL_loadIni,
|
||||
.cfgWriteIni = UTPL_writeIni,
|
||||
// Init
|
||||
.init = TPL_init,
|
||||
.deInit = TPL_deInit,
|
||||
.init = UTPL_init,
|
||||
.deInit = UTPL_deInit,
|
||||
// Function
|
||||
.handleRequest = TPL_handleRequest,
|
||||
.updateTick = TPL_updateTick,
|
||||
.handleRequest = UTPL_handleRequest,
|
||||
.updateTick = UTPL_updateTick,
|
||||
};
|
||||
|
||||
@@ -4,39 +4,13 @@
|
||||
// Digital input unit; single or multiple pin read access on one port (A-F)
|
||||
//
|
||||
|
||||
#ifndef U_DIN_H
|
||||
#define U_DIN_H
|
||||
#ifndef U_TPL_H
|
||||
#define U_TPL_H
|
||||
|
||||
#include "unit.h"
|
||||
|
||||
extern const UnitDriver UNIT_DIN;
|
||||
extern const UnitDriver UNIT_TPL;
|
||||
|
||||
/**
|
||||
* Read pins
|
||||
*
|
||||
* @param unit - unit instance
|
||||
* @param packed - output; the packed (right aligned) bits representing the pins, highest to lowest, are written here.
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_DI_Read(Unit *unit, uint16_t *packed);
|
||||
// UU_ prototypes
|
||||
|
||||
/**
|
||||
* Arm pins for trigger generation
|
||||
*
|
||||
* @param unit - unit instance
|
||||
* @param arm_single_packed - packed bit map of pins to arm for single trigger
|
||||
* @param arm_auto_packed - packed bit map of pins to arm for auto trigger (repeated)
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_DI_Arm(Unit *unit, uint16_t arm_single_packed, uint16_t arm_auto_packed);
|
||||
|
||||
/**
|
||||
* Dis-arm pins to not generate events
|
||||
*
|
||||
* @param unit - unit instance
|
||||
* @param disarm_packed - packed bit map of pins to dis-arm
|
||||
* @return success
|
||||
*/
|
||||
error_t UU_DI_DisArm(Unit *unit, uint16_t disarm_packed);
|
||||
|
||||
#endif //U_DIN_H
|
||||
#endif //U_TPL_H
|
||||
|
||||
Reference in New Issue
Block a user