ATBUpdateTool/include/tslib.h

91 lines
3.1 KiB
C
Raw Normal View History

#ifndef TSLIB_H
#define TSLIB_H
#include <stdint.h>
#include <QByteArray>
#define LOWBYTE false
#define HIGHBYTE true
uint16_t uchar2uint(char Highbyte, char Lowbyte);
uint16_t uchar2uint(uint8_t Highbyte, uint8_t Lowbyte);
uint32_t uchar2ulong(uint8_t Highbyte, uint8_t MHbyte, uint8_t MLbyte, uint8_t Lowbyte);
uint8_t uint2uchar(uint16_t uival, bool getHighB);
Squashed 'DCPlugin/' changes from 3e3e1ef..652ad9b 652ad9b Included changes of TS for version 3.5. c85b090 Added ulong2uchar (version 3.5). 87a6ed0 Include changes of Thomas for version 3.5. 99c88c7 Included changes of Thomas for version 3.5. prn_getPrintResult(), 712ea0f Included changes of Thomas for version 3.5 of library: datif_templatePrintFinished_OK(), datif_templatePrintFinished_Err(), datif_gotNewCoin(). 86311de Add use of shared memory. Add changes for version 3.4. of library. cb44127 Added check4freeFDshortCmd. a95e174 Included some changes of Thomas. c724b5b Shift several device controller related variables to shared memory. ef79321 Massive change: using shared memory containing most device controller realted variables. a7aa75a Massive change: using shared memory containing devcie controller variables. dc00c69 Added check4freeFDlongCmd. eeb3519 Adding shared memory containing all variables necessary to check device controller related variables. 30338e2 Changed struct T_moduleCondition. Changed struct T_dynamicCondition. Added struct T_extTime. Added log_chkIfVaultRecordAvailable(). Added sys_getDeviceConditions(). set version to 3.4. 58fdea4 Added m_sharedMem. Added cash_getAmountInVault. Added cash_getNrCoinsInVault. Added sys_getDynMachineConditions() with new interface. Added sys_getDeviceConditions() with new interface. Added log_chkIfVaultRecordAvailable(). df760f1 Added shared_mem_buffer.h/.cpp. git-subtree-dir: DCPlugin git-subtree-split: 652ad9b43d24bddbc3c2636c4ff4b5d74e081e46
2023-04-18 13:43:37 +02:00
uint8_t ulong2uchar(uint32_t ulval, uint8_t getBytNr);
// getBytNr: 0=LSB 3=MSB
void delay(uint16_t MilliSec);
#define MITSEK 1
#define OHNESEK 0
#define HourSys12h 1
#define HourSys24h 0
void GetTimeString(uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t System12h, uint8_t ShowSec, uint8_t *buf);
// generate time as ascii string from integers hours/minutes/seconds
// System12h=0: 24h system =1: 12h System
// ShowSec=0: String has 5 digits (hh:mm) =1: String has 8 digits (hh:mm:ss)
// return String in *buf // 12 byte für buf!
#define DateFormatDeutsch 0
#define DateFormatAmerica 1
#define UsePointSeperator 0
#define UseSlashSeperator 1
void GetDateString(uint8_t day, uint8_t month, uint8_t yearhigh, uint8_t yearlow, uint8_t format, uint8_t sep, uint8_t *buf);
// generate date as ascii string from integers day/month/year
// yearhigh in europe always 20 (not in arabia)
// format= 0: dd.mm.yyyy (deutsch)
// 1: mm.dd.yyyy (amerika)
// 2: yyyy.mm.dd (Iran, Dubai)
// 3: dd.yyyy.mm
// 4: mm.yyyy.dd
// 5: yyyy.dd.mm
// sep: 0: use . as seperator 1: use / as seperator
// return String in *buf // 11 byte für buf!
void GetShortDateString(uint8_t day, uint8_t month, uint8_t yearlow, uint8_t format, uint8_t sep, uint8_t *buf);
// generate date as ascii string from integers day/month/year
// format= 0: dd.mm.yy (deutsch)
// 1: mm.dd.yy (amerika)
// 2: yy.mm.dd (Iran, Dubai)
// 3: dd.yy.mm
// 4: mm.yy.dd
// 5: yy.dd.mm
// sep: 0: use . as seperator 1: use / as seperator
// return String in *buf // 11byte für buf!
uint16_t tslib_strlen(char *buf);
uint16_t tslib_strlen(uint8_t *buf);
void tslib_strclr(char *buf, char clrsign, uint16_t len);
void tslib_strclr(uint8_t *buf, char clrsign, uint16_t len);
void tslib_strcpy(char *srcbuf, char *destbuf, uint16_t len);
void tslib_strcpy(char *srcbuf, uint8_t *destbuf, uint16_t len);
void tslib_strcpy(uint8_t *srcbuf, uint8_t *destbuf, uint16_t len);
uint16_t tslib_calcCrcCcitt(uint16_t BufLength, uint8_t *buf);
bool tslib_isDecAsciiNumber(char sign);
bool tslib_isHexAsciiNumber(char sign);
int tslib_getMinimum(int val1, int val2);
void tslib_text2array(QByteArray text, char *aray, uint16_t maxArayLen);
// usage: tslib_text2array("my text", ctmp, 50);
void biox_CopyBlock(uint8_t *src, uint16_t srcPos, uint8_t *dest, uint16_t destPos, uint16_t len);
// both buffers starting from pos 0
#endif // TSLIB_H