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.
interpret.h
00001 #include "mbed.h" 00002 00003 00004 //--------------------------------------- 00005 // Definitions 00006 //--------------------------------------- 00007 #define INT_BUF_DEVICEID 0 // UART buffer index of DeviceID 00008 #define INT_BUF_COMMAND 1 // UART buffer index of Command 00009 #define INT_BUF_NUM 2 // UART buffer index of number of Bytes 00010 #define INT_BUF_1DATA 3 // UART buffer index of first data byte if #Bytes > 0 00011 00012 00013 00014 //--------------------------------------- 00015 // Enums 00016 //--------------------------------------- 00017 typedef enum 00018 { 00019 INT_STATE_INIT, 00020 INT_STATE_IDLE, 00021 INT_STATE_CHECK, 00022 INT_STATE_INTERPRET, 00023 INT_STATE_ACK, 00024 //--------------- 00025 CNT_eINT_state 00026 }eINT_state; 00027 00028 00029 00030 typedef enum 00031 { 00032 INT_ID_BROADCAST = 0, 00033 INT_ID_MBED, 00034 INT_ID_PT100, 00035 INT_ID_DI, 00036 INT_ID_DO, 00037 //---------------------- 00038 CNT_eINT_deviceID 00039 00040 }eINT_deviceID; 00041 00042 00043 // Global commands 0 - 20, 00044 // Commands 21 - 127 are devined inside the individual HW-units 00045 typedef enum 00046 { 00047 INT_COM_NOP = 0, // 0: NOP 00048 INT_COM_RESET, // 1: Reset 00049 INT_COM_ACK, // 2: ACK 00050 INT_COM_DEV_NOTSUPP, // 3: DeviceID not supported 00051 INT_COM_COM_NOTSUPP, // 4: Command not supported 00052 INT_COM_VAL_NOTVALID, // 5: Value is not valid 00053 INT_COM_6, 00054 INT_COM_7, 00055 INT_COM_8, 00056 INT_COM_9, 00057 INT_COM_10, 00058 INT_COM_11, 00059 INT_COM_12, 00060 INT_COM_13, 00061 INT_COM_14, 00062 INT_COM_15, 00063 INT_COM_16, 00064 INT_COM_17, 00065 INT_COM_18, 00066 INT_COM_19, 00067 INT_COM_20, 00068 //---------------- 00069 CNT_eINT_command 00070 }eINT_command; 00071 00072 00073 //--------------------------------------- 00074 // Structures 00075 //--------------------------------------- 00076 typedef struct 00077 { 00078 eINT_state state; 00079 char receivedDeviceID; 00080 char receivedCommand; 00081 00082 }sINT_handler; 00083 00084 00085 00086 //--------------------------------------- 00087 // Global Variables 00088 //--------------------------------------- 00089 00090 00091 //--------------------------------------- 00092 // Global Functions 00093 //--------------------------------------- 00094 void INT_init( void ); 00095 void INT_poll( void ); 00096 void INT_generateACKFrame(char deviceID, char command);
Generated on Sat Jul 16 2022 03:23:51 by
