#ifndef _CONTROL_INFO_H #define _CONTROL_INFO_H #define MAX_STORAGE 10000 #define COMMAND_BASELEVEL_V 0.0 #define DEFAULT_COMMAND_V 5.0 #define DEFAULT_COMMAND_ms 1.0 #define DEFAULT_BASELINE_ms 50.0 #define DEFAULT_PROBE_ms 0.5 #define DEFAULT_TIMEOUT_ms 350.0 #define TRIGGER_LEVEL_V 1.0 #define DEFAULT_TRIGGERED_ATTENTION_ms 0 // 0 means detect without trigger #define DEFAULT_THRESHOLD_uV 10000 // 10mV #define POSITIVE 1 #define NEGATIVE (-1) #define DEFAULT_POLARITY NEGATIVE #define DEFAULT_STATE_DURATION_ms 1 // 0 means report threshold crossing, no check for duration #define ms_to_CYCLES(ms,limit) (int)((ms*CYCLES_per_ms>limit)?limit:(ms*CYCLES_per_ms)) // user-defined algorithm for detection and feedback inline void control_algorithm(double *in, double *out); // user-defined tools for control parameter adjustment int* adjust_params(); // console messages from real time kernel // for debugging only void print_string(char *str); // periodic reporting of event statistics #define REPORT_PERIOD_sec 30 #define REPORT_CYCLES ( REPORT_PERIOD_sec * 1000 * CYCLES_per_ms ) struct report_struct { int timestamp_sec; int threshold_events; int trigger_events; int reported_events; int upstate_ms; int resting_uV; }; #endif