Koncentrator

Dependencies:   SX127x mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers application.h Source File

application.h

00001 #ifndef __APPLICATION_H__
00002 #define __APPLICATION_H__
00003 
00004 // Application
00005 #define APP                     "WIND Concentrator"
00006 #define SOURCE_ID               0
00007 #define DESTINATION_ID          0
00008 
00009 #define PC_INTERVAL             1
00010 #define FIBER_OPTIC_INTERVAL    1
00011 #define LORA_INTERVAL           1
00012 
00013 // Uart's
00014 #define PC_RX_BUFFER            500
00015 #define FIBER_OPTIC_RX_BUFFER   500
00016 #define LORA_RX_BUFFER          500
00017 
00018 // Uart's bauds
00019 #define PC_BAUD                 115200
00020 #define FIBER_OPTIC_BAUD        57600
00021 
00022 // Enable modules
00023 #define PC_ENABLE               1
00024 #define FIBER_OPTIC_ENABLE      0
00025 #define LORA_ENABLE             1
00026 
00027 // Protocol
00028 #define pSTX                    0x02
00029 #define pETX                    0x03
00030 #define pBEL                    0x07
00031 #define pACK                    0x06
00032 
00033 enum systemEnum{
00034     Clear   = 0,
00035     Set     = 0,
00036     SetLed  = 0,
00037     ClearLed= 1
00038 };
00039 
00040 enum communications {
00041     lora_com,fiberOptic_com,pc_com
00042 };
00043 
00044 // System settings structure
00045 typedef struct {
00046     unsigned char last_ppe_id[3];      // Last transmited PPE ID
00047     unsigned char last_ppe_id_fo;
00048     unsigned long TXCharCounter[3];    // Transmited chars -> PC,FIBER_OPTIC,LoRa 
00049     unsigned long RXCharCounter[3];    // Received chars -> PC,FIBER_OPTIC,LoRa 
00050     unsigned long errorCounter[3];  
00051     unsigned char fiberOpticEnable;
00052 }systemStructure;
00053 
00054 extern systemStructure sys;
00055 
00056 extern Timer txFiberOpticTmr;
00057 extern Timer rxFiberOpticTmr;
00058 extern Timer pcTmr;
00059 
00060 enum counters{
00061     PC,FO,LO,GS  
00062 };
00063 
00064 extern DigitalOut LEDG;          // Testni Led Green
00065 extern DigitalOut LEDR;          // Testni Led Red
00066 
00067 extern DigitalOut RX_LED;
00068 extern DigitalOut TX_LED;
00069 
00070 //extern DigitalOut FIBER_OPTIC_TX;
00071 extern DigitalOut FIBER_OPTIC_TX_PWR;
00072 extern DigitalOut FIBER_OPTIC_RX_PWR;
00073 
00074 // Turn On fiber optic
00075 extern DigitalIn OperationMode;
00076 
00077 extern RawSerial pc;            // USB serial port
00078 extern RawSerial fiberOptic;    // Fiber Optic serial port
00079 extern RawSerial lora;          // GSM serial port
00080 
00081 #endif