parent
96a7b58091
commit
611b38c5e6
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
Loading…
Reference in new issue