18 #include "../hubolib.h"
19 #include "../hubocfg.h"
42 #define FAMILY_CODE (31)
43 #define TEMP_CONTROLLER_SOCKET (1)
44 #define REED_CONTACT_SOCKET (2)
52 #define TEMP_ON (27.0)
53 #define TEMP_OFF (29.0)
54 #define TEMP_SENSOR_AI_CHANNEL (0)
55 #define TEMP_CONTROLLER_RELAY (7)
61 bool GetDarkness (
int channel,
unsigned short& brightness);
62 #define LIGHT_OFF (2000)
63 #define LIGHT_ON (2500)
64 #define LIGHT_SENSOR_AI_CHANNEL (1)
65 #define LIGHT_CONTROLLER_RELAY (6)
68 int main(
int argc,
char *argv[])
73 printf (
"Failed to initialize. Are you running the program as sudoer?\n");
97 unsigned short darkness = 0;
115 printf (
"-> no change.\n");
120 unsigned long adcCount;
126 darkness = (
unsigned short) adcCount;
133 double temperature = 0.0;
137 printf (
"Temperature = %lf deg. C ", temperature);
144 printf (
"-> heating on.\n");
154 printf (
"-> heating off.\n");
161 printf (
"-> no change.\n");
168 unsigned long adcCount;
184 printf (
"Failed to save scheduling parameter. Are you running the program as sudoer?\n");
189 printf (
"Initializing GPIO.\n");
192 printf (
"GPIO not properly initialized. Are you running the program as sudoer?\n");
199 printf (
"Hubo hardware containing at least one cascaded slave could not be found.\n");
213 printf (
"Initializing Hubo hardware.\n");
226 printf (
"Waiting for MCP3x08 buffered values... ");
228 printf (
"received.\n");
230 printf (
"Waiting for MCP23017 buffered values... ");
232 printf (
"received.\n");
239 printf (
"Saving thread parameters.\n");
257 param.sched_priority = sched_get_priority_max(SCHED_FIFO);
258 int ret = pthread_setschedparam(
g_threadHandle, SCHED_FIFO, ¶m);
const char * m_sI2CDevice
int main(int argc, char *argv[])
bool Wait_For_MCP3x08_Buffered_Values()
Waits until the input buffer of the MCP3x08 are initialized from the hardware.
void Delay_MicroSeconds(unsigned long delay_micros)
delays the execution of the calling thread for the given number of micro seconds. ...
#define MAX_MCP3x08_CHANNELS
bool IsGPIOInitialized()
Returns the status of the initialisation of the GPIO part of the library.
bool InitializeApplication()
#define TEMP_CONTROLLER_RELAY
bool Set_DO_Channel(int channel, bool bValue)
Requests the background thread to set one of the digital outputs to the value specified.
bool Initialize()
Initializes the library.
#define TEMP_SENSOR_AI_CHANNEL
#define LIGHT_CONTROLLER_RELAY
bool GetTemperature(int channel, double &temperature)
bool Set_Cycle_Time(long cycleTime)
Sets the backgrounds threads polling interval in ms.
#define TEMP_CONTROLLER_SOCKET
#define LIGHT_SENSOR_AI_CHANNEL
void TemperatureControl()
bool SaveThreadPriority()
bool InitializeHuboHardware()
void RestoreThreadPriority()
void BoostThreadPriority()
CSC5262 rcSwitch(350, 17, true)
void Uninitialize()
Releases any resources bound to the library.
bool Wait_For_MCP23017_Buffered_Values()
Waits until input and output buffers of the MCP23017 master are initialized from the hardware...
double Get_MCP9701_Temperature(double volt)
Converts a voltage value of an MCP9701 temperature sensor into the equivalent temperature.
bool SwitchSocket(unsigned char SystemCode, unsigned char Receiver, bool bTurnOn, int repeatedSuccess, int totalTransmittion)
bool GetDarkness(int channel, unsigned short &brightness)