Mario Bambagini / Mbed 2 deprecated watering_unit

Dependencies:   DHT11 mbed-rtos mbed ssWi

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config.hpp Source File

config.hpp

00001 #ifndef __WATERING_CONFIG__
00002 #define __WATERING_CONFIG__
00003 
00004 // Hardware pins
00005 #define HW_PIN_MOISTURE             p20
00006 #define HW_PIN_TEMPERATURE          p17
00007 #define HW_PIN_PUMP                 p25
00008 #define HW_PIN_LOW_WATER_LEVEL      p14
00009 
00010 // internal signals/events to synchronize threads
00011 #define SIGNAL_START_ARRIVED        0x01
00012 #define SIGNAL_STOP_ARRIVED         0x02
00013 #define SIGNAL_WATERING_ARRIVED     0x03
00014 
00015 // number of samples to read when the system starts
00016 #define NUM_SAMPLES                 10
00017 
00018 // timeout to wait before starting
00019 #define TIMEOUT_CONF                10.0
00020 // timeout to finish the sampling process
00021 #define TIMEOUT_SAMPLING            60.0
00022 // timeout to read water quantity
00023 #define TIMEOUT_WATERING            30.0
00024 
00025 // time to wait between two consecutive samplings
00026 #define INTERVAL_SAMPLING           2500
00027 // time between two steps of the watering algorithm
00028 #define INTERVAL_WATERING           1000
00029 
00030 // COMM VALUES
00031 #define COMM_NO_VALUE               0x0000
00032 #define COMM_START_SAMPLING         0xAAAA
00033 #define COMM_STOP_SAMPLING          0x1111
00034 #define COMM_START_WATERING_OFFSET  0xFF00
00035 #define COMM_SHUTDOWN               0x00FF
00036 #define COMM_EXIT                   0x2244
00037 #define COMM_SAMPLING_KO            0x2222
00038 #define COMM_SAMPLING_OUT           0x5555
00039 #define COMM_SAMPLING_OK            0xBBBB
00040 #define COMM_WATERING_KO            0x3333
00041 #define COMM_WATERING_OK            0xCCCC
00042 #define COMM_LOW_WATER_LEVEL        0x7777
00043 
00044 // PORTS
00045 #define PORT_COMMANDS               0x00
00046 #define PORT_HUMIDITY_OFFSET        0x01
00047 #define PORT_TEMPERATURE_OFFSET     0x02
00048 #define PORT_MOISTURE_OFFSET        0x03
00049 #define PORT_WATER_OFFSET           0x04
00050 #define PORT_RESPONSE_OFFSET        0x05
00051 #define GET_MOISTURE_PORT(x)        (PORT_MOISTURE_OFFSET + (x.address * 5))
00052 #define GET_TEMPERATURE_PORT(x)     (PORT_TEMPERATURE_OFFSET + (x.address * 5))
00053 #define GET_HUMIDITY_PORT(x)        (PORT_HUMIDITY_OFFSET + (x.address * 5))
00054 #define GET_WATER_PORT(x)           (PORT_WATER_OFFSET + (x.address * 5))
00055 #define GET_RESPONSE_PORT(x)        (PORT_RESPONSE_OFFSET + (x.address * 5))
00056 #define GET_WATERING_COMMAND(x)     (COMM_START_WATERING_OFFSET + x.address)
00057 
00058 // NETWORK
00059 #define PAN_ID                      102
00060 #define CHANNEL_ID                  14
00061 #define XBEE_TX_PER_SECOND          3
00062 #define XBEE_RX_PER_SECOND          10
00063 #define XBEE_PIN_TX                 p9
00064 #define XBEE_PIN_RX                 p10
00065 
00066 struct watering_unit_config_t {
00067     int address;
00068     int moisture_port;
00069     int temperature_port;
00070     int humidity_port;
00071     int water_port;
00072     int response_port;
00073 };
00074 
00075 #endif //__WATERING_CONFIG__