Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LG by
Diff: DeviceProtocol.h
- Revision:
- 77:8d582faecf6b
- Parent:
- 76:1c54a614564d
- Child:
- 78:0ea9d02b7b46
--- a/DeviceProtocol.h Mon Feb 29 02:43:14 2016 +0000
+++ b/DeviceProtocol.h Sat Mar 05 14:36:42 2016 +0000
@@ -77,13 +77,13 @@
int count; //byte count
} DeviceOutputBuffer;
+//Response state
typedef struct _DeviceResponse {
- uint8_t enabled; //
+ uint8_t enabled; //set enabled when response required
ResponseType type; //how send: immediately/delayed/periodic
- //ResponseData data; //what send: buffer/Delta_BINS/Delta_PS/Delta_SF/M_Rate
- uint16_t code; //Request code
- uint32_t counter; //time from: broadcast line request/latch pulse/last response; values in mks;
- uint32_t trigger; //counter value to response; values in mks;
+ uint16_t code; //request code
+ uint32_t counter; //time from: broadcast line request/broadcast pin request/latest periodic response; values in mks;
+ uint32_t trigger; //counter trigger value to response; values in mks;
uint32_t rate; //response baud rate
DeviceOutputBuffer buffer;
uint8_t ready;
@@ -96,31 +96,36 @@
int end; //write start position
} DeviceInputBuffer;
+//Requests queue state
typedef struct _DeviceRequest {
uint32_t rate; //response baud rate
DeviceInputBuffer buffer;
} DeviceRequest;
+//Requests decoding state
typedef struct _DeviceProtocolDecoder {
uint8_t error; //Decode error encountered
uint8_t count; //Decoded bytes count
uint8_t address; //Decoded request address
uint8_t version; //Decoded protocol version (currently only 0 version exist)
- uint16_t code; //Decoded command code
+ uint16_t code; //Decoded command code
uint16_t position;//Current decoder position in input buffer
uint16_t CRC; //Current/final CRC of decoded packet
} DeviceProtocolDecoder;
+//Response encoding state
typedef struct _DeviceProtocolEncoder {
- uint8_t error;
- uint8_t count;
- uint16_t position;
- uint16_t CRC;
+ uint8_t error; //Encode error encountered
+ uint8_t count; //Encoded bytes count
+ //uint16_t position;
+ uint16_t CRC; //Current/final CRC of encoded packet
} DeviceProtocolEncoder;
-void Decode(void);
-void Encode(void);
-void Transmit(void);
+void Receive(void); //Receive requests to receive buffer
+void LineDecode(void); //Decode requests from receive buffer
+void PinDecode(void); //Decode hardware pin request
+void Encode(void); //Encode response to transmit buffer
+void Transmit(void); //Transmit response from transmit buffer
uint8_t Decode8(void);
uint16_t Decode16(void);
@@ -128,6 +133,7 @@
void DecodeEnd(void);
void DecodeCancel(void);
void DecodeFail(void);
+
void DecodeAddress(void);
void DecodeCode(void);
void DecodeCode2(void);
@@ -165,6 +171,7 @@
void EncodeStart(void);
void EncodeEnd(void);
+void EncodeFail(void);
void EncodeAddress(void);
void EncodeCRC(void);
