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.
Diff: ICE-Application/inc/global.h
- Revision:
- 2:02cb20446785
- Parent:
- 1:b2e90cda7a5a
--- a/ICE-Application/inc/global.h Tue Jan 24 19:06:45 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-#ifndef GLOBAL_H
-#define GLOBAL_H
-
-#include <map>
-
-#define LOAD_PERSISTENT_CONFIGURATIONS
-#include "mbed.h"
-#include "ntshell.h"
-#include "rtos.h"
-#include "ConfigFs.h"
-
-extern int sig_output_continue;
-extern int sig_config_continue;
-extern int sig_control_continue;
-
-extern osThreadId mainThreadId;
-
-extern Thread *GLOBAL_analyticsLogger_thread;
-extern Thread *GLOBAL_modbusMaster_thread;
-extern Thread *GLOBAL_BLE_thread;
-extern Thread *GLOBAL_CDH_thread;
-extern Thread *GLOBAL_configHandler_thread;
-extern Thread *GLOBAL_controlTask_thread;
-extern Thread *GLOBAL_outputTask_thread;
-extern Thread *GLOBAL_dataHandler_thread;
-
-extern ConfigFs *GLOBAL_mdot;
-extern I2C i2c_instance;
-extern I2C* i2c;
-
-#define EXECUTE_SCRIPT
-
-// declare stack sizes
-#ifdef EXECUTE_SCRIPT
-#define MODBUS_MASTER_STACK_SIZE (1024 * 8)
-#else
-#define MODBUS_MASTER_STACK_SIZE (1024 * 4)
-#endif
-#define OUTPUT_TASK_STACK_SIZE ((1024 * 2) + 512)
-#define CONFIG_HANDLER_STACK_SIZE (1024 * 3)
-#define CONTROL_TASK_STACK_SIZE (1024 * 2)
-#ifdef MDOT_ICE
-#define BLE_DATA_HANDLER_STACK_SIZE (1024 * 3)
-#define CLOUD_DATA_HANDLER_STACK_SIZE (1024 * 4)
-#else
-#define DATA_HANDLER_STACK_SIZE (1024 * 4)
-#endif
-#define ANALYTICS_LOGGER_STACK_SIZE (1024 * 2)
-
-/* tiny shell specifics */
-extern ntshell_t ntshell;
-
-extern int func_read(char *buf, int cnt);
-extern int func_write(const char *buf, int cnt);
-extern int func_cb_ntshell(const char *text);
-extern void func_cb_ntopt(int argc, char **argv);
-
-#define MAX_FILE_SIZE 350
-
-/****************************************************************************
- * Mailbox messaging data structures
- ****************************************************************************/
-
-#define CONTROL_FILE_SIZE (64)
-#define MODBUS_MSG_SIZE (256)
-
-// Messages sent to the configuration handler -------------------------------
-
-typedef enum action_tag {
- ACTION_CREATE,
- ACTION_MODIFY,
- ACTION_DESTROY,
- ACTION_READ_FILE,
- ACTION_EXEC_CMD
-} Action_t;
-
-typedef enum control_tag {
- CONTROL_TIMER = 0,
- CONTROL_PID = 1,
- CONTROL_SETPOINT = 2,
- CONTROL_COMPOSITE = 3,
- CONTROL_MANUAL = 4,
- CONTROL_FAILSAFE = 5,
- CONTROL_SEQUENCE = 6,
- CONTROL_SENSOR_ERROR = 7,
- CONTROL_ALGORITHM = 8
-} Control_t;
-
-typedef struct message_tag {
- Action_t action;
- Control_t control;
- char controlFile[CONTROL_FILE_SIZE];
-} ConfigMessage_t;
-
-// Messages sent to the Modbus Master ---------------------------------------
-
-typedef enum thread_name_tag {
- ANALYTICS_LOGGER = 0,
- BLE_HANDLER = 1,
- CLOUD_DATA_HANDLER = 2,
- CONFIG_HANDLER = 3,
- CONTROL_TASK = 4,
- OUTPUT_TASK = 5,
-} ThreadName_t;
-
-typedef struct modbus_master_tag {
- Action_t action;
- Control_t control;
- ThreadName_t replyThread;
- char msg[MODBUS_MSG_SIZE];
-} ModbusMasterReq_t;
-
-// Messages sent to the Output Task ------------------------------------------
-
-typedef enum output_action {
- ACTION_NEW,
- ACTION_CONTROL_ON,
- ACTION_CONTROL_OFF,
- ACTION_CONTROL_REGISTER,
- ACTION_CONTROL_UNREGISTER
-} OutputAction;
-
-typedef struct output_control_req_t {
- OutputAction action;
- Control_t controlType;
- char controlFile[CONTROL_FILE_SIZE];
- char input_tag[32];
- char output_tag[32];
- char id[32];
- unsigned int priority;
-} OutputControlMsg_t;
-
-
-// Messages sent to the Analytics Logger ------------------------------------
-
-typedef struct analytics_logger_req_t {
- char timestamp[32];
- char log_entry[96];
-} AnalyticsLoggerReq_t;
-
-// BLE request message
-typedef struct ble_handler_req_t {
- char reply[500];
-} BLEHandlerReq_t;
-
-extern Mail<ConfigMessage_t, 16> ConfigHandlerMailBox;
-extern Mail<ModbusMasterReq_t, 2> ModbusMasterMailBox;
-extern Mail<OutputControlMsg_t, 16> OutputMasterMailBox;
-extern Mail<BLEHandlerReq_t, 1> BLEHandlerMailBox;
-
-/****************************************************************************
- * MODBUS
- * TODO! Move this to the proper location
- ****************************************************************************/
-
-#define NUM_SCRIPT_ARGS 4
-
-typedef enum register_type_tag {
- REG_TYPE_NONE,
- REG_TYPE_INPUT,
- REG_TYPE_OUTPUT,
- REG_TYPE_VINPUT,
- REG_TYPE_VOUTPUT,
-} RegisterType_t;
-
-#define MODBUS_READ_COIL 1
-#define MODBUS_READ_DISCRETE_INPUT 2
-#define MODBUS_READ_HOLDING 3
-#define MODBUS_READ_INPUT 4
-#define MODBUS_WRITE_SINGLE_COIL 5
-#define MODBUS_WRITE_SINGLE_HOLDING 6
-#define MODBUS_WRITE_MULTIPLE_COIL 15
-#define MODBUS_WRITE_MULTIPLE_HOLDING 16
-
-#define ARGT_INT 0
-#define ARGT_FLOAT 1
-#define ARGT_DOUBLE 2
-#define ARGT_STRING 3
-
-struct ModbusRegister {
- float min;
- float max;
- unsigned char node;
- unsigned char rtype;
- unsigned char type;
- unsigned char size;
- unsigned char order;
- unsigned char rfreq;
- unsigned char argc;
- uint32_t reg;
- RegisterType_t regType;
- std::string cmd;
- std::string argv[NUM_SCRIPT_ARGS];
- bool simulated;
-};
-
-struct ExecuteJavaScript {
- std::string script;
- std::string argv[NUM_SCRIPT_ARGS];
-};
-
-struct RegisterValue {
- double float_value;
- uint32_t errflag;
-};
-
-struct VirtualCommand {
- float Constant;
- std::string Operand;
- std::string Operator;
-};
-
-struct HoldingRegister {
- unsigned char node;
- unsigned char sreg;
- unsigned char nreg;
- unsigned char order;
-};
-
-struct SimulateInput {
- float start_value;
- float min;
- float max;
- float up_step;
- float down_step;
- bool moving_up;
- uint32_t errflag;
-};
-
-typedef enum byte_order {
- BigEndian = 0,
- LittleEndian = 1,
- BigEndianReverseWord = 2,
- LittleEndianReversWord = 3,
-} Byte_Order;
-
-typedef enum event_reason_tag {
- EVENT_REASON_AUTO,
- EVENT_REASON_MANUAL,
- EVENT_REASON_TIMER,
- EVENT_REASON_FLOW,
- EVENT_REASON_FAILSAFE,
- EVENT_REASON_NO_CONTROL
-} EventReason_t;
-
-typedef struct event_reason_struct_t {
- EventReason_t eventReason;
- char inputTag[32];
- char outputTag[32];
- float inputValue;
- float outputValue;
-} EventReasonStruct_t;
-
-extern std::map<std::string, ModbusRegister> ModbusRegisterMap;
-extern std::map<std::string, RegisterValue> RegisterValueMap;
-extern std::map<std::string, SimulateInput> SimulateInputMap;
-
-#endif