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:
- 59:daf3a8ed255e
- Parent:
- 54:d94145ba23f4
- Child:
- 60:98eb64c0fda3
--- a/DeviceProtocol.h Sun Feb 14 10:26:37 2016 +0000
+++ b/DeviceProtocol.h Sun Feb 14 15:10:45 2016 +0000
@@ -4,6 +4,15 @@
#include "DeviceSettings.h"
#include "stdint.h"
+/*Move this to uart_m.h when protocol completed*/
+#define IOBufferSize 1024
+typedef struct _IOCyclicBuffer {
+ uint8_t buffer[IOBufferSize];
+ int start; //first byte position
+ int end; //last byte position
+} IOCyclicBuffer;
+
+/*
typedef struct {
uint8_t Offset;
uint8_t Mask;
@@ -20,51 +29,11 @@
uint8_t CheckPointCount;
DeviceMessageCheckPoint *CheckPointList;
} DeviceMessageCheck;
-
-
-
-typedef enum {
- CMD_B_DELTA_PS = 0xa000, //e. the code of the B_DeltaPS command //r. код команды B_DeltaPS
- CMD_B_DELTA_BINS = 0xb000, //e. the code of the B_DeltaBINS command //r. код команды B_DeltaBINS
- CMD_B_DELTA_SF = 0xb200, //e. the code of the B_DeltaSF command //r. код команды B_DeltaSF
- CMD_DEV_MODE = 0xA500, //e. the code of the Device_Mode command //r. код команды Device_Mode
- CMD_BIT_MODE = 0xA700, //e. the code of the B.I.T. command //r. код команды B.I.T.(встроенного тестирования)
- CMD_RATE = 0x0000, //e. the code of the Rate command //r. код команды Rate
- CMD_DELTA = 0x0f00, //e. the code of the Delta command //r. код команды Delta
- CMD_D_PERIOD_W = 0xf000, //e. the code of the D_Period_W command //r. код команды D_Period_W
- CMD_MAINT = 0x9999, //e. the code of the Maintenance mode command //r. код команды Maintenance mode
-} DeviceCommands;
-typedef enum {
- SUBCMD_M_STIMUL = 0x0a00, //e. the code of the Stimul command //r. код команды Stimul
- SUBCMD_M_RESET = 0x8000, //e. software device reset(restart) //r. программный сброс (рестарт) прибора
- SUBCMD_M_CLEAR = 0xda00, //e. reset of the register of errors of line 485 //r. очистка регистра ошибок линии 485
- SUBCMD_M_MIRR = 0xda01, //e. return previous contents of the receiver buffer //r. возврат предыдущего содержимого буфера приемника
- SUBCMD_M_LDPAR_F = 0xda02, //e. load GLD parameters from Flash-memory //r. загрузить параметры ГЛД из флэш-памяти
- SUBCMD_M_LDPAR_D = 0xda03, //e. set GLD parameters by procedure of initialization //r. установить параметры ГЛД процедурой инициализации
- SUBCMD_M_START = 0xda04, //e. switch on the GLD //r. включить ГЛД
- SUBCMD_M_STOP = 0xda40, //e. switch off the GLD //r. выключить ГЛД
- SUBCMD_M_PULSE = 0xda0a, //e. generation of the light-up pulse //r. генерация импульса поджига
-
- SUBCMD_M_CTL_R = 0xd900, //e. reading the control register of the device //r. чтение регистра управления устройства
- SUBCMD_M_CTL_M = 0xd800, //e. modification of bit of the control register //r. модификация бита регистра управления
- SUBCMD_M_RATE = 0xdd00, //e. delivery of a stack of parameters M_Rate (Rate2, Rate3) //r. выдача набора параметров M_Rate (Rate2, Rate3)
-
- SUBCMD_M_TMP_W = 0xe000, //e. writing to the AD7714 circuit (temperature sensors) //r. запись в схемы AD7714 (измерители температуры)
- SUBCMD_M_TMP_R = 0xe100, //e. reading from the AD7714 circuit (temperature sensors) //r. чтение из схем AD7714 (измерители температуры)
- SUBCMD_M_E5R_W = 0xe200, //e. writing to the register of a mode of the Elio5 card //r. запись в регистр режима платы Elio5
- SUBCMD_M_ADC_R = 0xe300, //e. reading data from the ADC of the Elio5 card //r. чтение данных из АЦП платы Elio5
- SUBCMD_M_VIB_W = 0xe400, //e. loading of the oscillation period of the dither drive //r. загрузка периода колебаний вибропривода
- SUBCMD_M_CNT_R = 0xe500, //e. reading data from the counters of the Elio5 card //r. чтение данных из счетчиков платы Elio5
- SUBCMD_M_GPH_W = 0xe600, //e. loading gain factors of photodetector channels //r. загрузка коэффициентов усиления каналов фотоприемника
- SUBCMD_M_FLG_R = 0xe700, //e. reading data from the register of input flags //r. чтение данных из регистра входных флагов
- SUBCMD_M_PARAM_W = 0xe800, //e. writing working parameter to the data memory //r. запись рабочего параметра в память данных
- SUBCMD_M_PARAM_R = 0xe900, //e. reading working parameter of the GLD from the data memory //r. чтение рабочего параметра GLD из памяти данных
- SUBCMD_M_E5RA_W = 0xea00, //e. writing in 1st additional (A) register of a mode of the Elio5 card //r. запись в 1-ый дополнительный (А) регистр режима платы Elio5
-} DeviceSubCommands;
+*/
//Command: DeviceMode
-DeviceMessageCheckPoint DeviceModeRequestCheck[] = {{0x00,0xff,0xcc},{0x02,0xff,0xcc},{0x03,0xf0,0x00}};
-DeviceMessageCheckPoint DeviceModeResponseCheck[] = {{0x00,0xff,0xcc},{0x02,0xff,0x00}};
+//DeviceMessageCheckPoint DeviceModeRequestCheck[] = {{0x00,0xff,0xcc},{0x02,0xff,0xcc},{0x03,0xf0,0x00}};
+//DeviceMessageCheckPoint DeviceModeResponseCheck[] = {{0x00,0xff,0xcc},{0x02,0xff,0x00}};
typedef enum
{
Reserved,
@@ -94,7 +63,7 @@
uint8_t ChecksumHi; //Checksum Hi byte
uint8_t ChecksumLo; //Checksum Lo byte
} DeviceModeResponse;
-
+/*
DeviceMessageCheck DeviceRequestChecks[] = {
{DMID_DeviceMode, 6, 3, DeviceModeRequestCheck}
};
@@ -102,7 +71,8 @@
DeviceMessageCheck DeviceResponseChecks[] = {
{DMID_DeviceMode, 8, 2, DeviceModeResponseCheck}
};
+*/
-int CheckRequest(char *s, int start, int end);
+int PullRequest(IOCyclicBuffer *b);
#endif /* __DEVICEPROTOCOL_H__ */
\ No newline at end of file
