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.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
inc/global.h
- Committer:
- jmarkel44
- Date:
- 2016-09-23
- Revision:
- 128:534bf29132f8
- Parent:
- 121:650205ffa656
- Child:
- 133:c871de2d2b90
File content as of revision 128:534bf29132f8:
/******************************************************************************
*
* File: global.h
* Desciption: global data
*
*****************************************************************************/
#ifndef GLOBAL_H
#define GLOBAL_H
#include "mbed.h"
#include "rtos.h"
#include "ntshell.h"
#include "mDot.h"
// file naming prefix conventions
#define CONTROL_SP_STR "control_sp_"
#define CONTROL_TM_STR "control_tm_"
#define CONTROL_MN_STR "control_mn_"
extern int sig_output_continue;
extern int sig_config_continue;
extern osThreadId mainThreadId;
typedef enum action_tag {
ACTION_CREATE,
ACTION_MODIFY,
ACTION_DESTROY,
ACTION_READ_FILE,
} Action_t;
typedef enum control_tag {
CONTROL_TIMER = 0,
CONTROL_PID = 1,
CONTROL_SETPOINT = 2,
CONTROL_COMPOSITE = 3,
CONTROL_MANUAL = 4
} Control_t;
// message data type
typedef struct message_tag {
Action_t action;
Control_t control;
char controlFile[64];
} Message_t;
typedef enum {
OFF = 0,
ON = 1
} State;
typedef enum output_action {
ACTION_NEW,
ACTION_CONTROL_ON,
ACTION_CONTROL_OFF,
ACTION_CONTROL_REGISTER,
ACTION_CONTROL_UNREGISTER
} OutputAction;
// output control request message
typedef struct output_control_req_t {
OutputAction action;
Control_t controlType;
char controlFile[32];
char input_tag[32];
char output_tag[32];
char id[32];
unsigned int priority;
} OutputControlMsg_t;
// analytics logger request message
typedef struct analytics_logger_req_t {
char timestamp[32];
char log_entry[96];
} AnalyticsLoggerReq_t;
extern Mail<Message_t, 16> MailBox;
extern Mail<Message_t, 16> ModbusMasterMailBox;
extern Mail<OutputControlMsg_t, 16> OutputMasterMailBox;
extern Mail<AnalyticsLoggerReq_t, 16> AnalyticsLoggerMailBox;
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);
extern mDot *GLOBAL_mdot;
struct ModbusRegister {
std::string name;
std::string units;
double min;
double max;
int node;
int reg;
int rtype;
int type;
int size;
int order;
int rfreq;
bool input;
std::string fmt;
float float_value;
uint32_t uint32_value;
uint16_t uint16_value;
bool simulated;
};
struct SimulateInput {
float start_value;
float min;
float max;
float step;
};
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_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,SimulateInput> SimulateInputMap;
extern I2C* i2c;
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;
#endif
