|
*/
|
|
#ifndef GLOBAL_H
|
|
#define GLOBAL_H
|
|
// USARTD1 Receiver buffer
|
|
|
|
#define EEPROM_VERSION 100 //Change EEPROM_VERSION only if EEP variables have changed//Modifier uniquement si les variables PEE ont chang?
|
|
#define VERSION_NR "Z1005.o27" //Version 00
|
|
//
|
|
#define VERSION_DAY 11
|
|
#define VERSION_Month 4
|
|
#define VERSION_YEAR 14
|
|
|
|
//#define _ATXMEGA_USART_ USARTE0
|
|
|
|
|
|
#define DEBUG 1
|
|
|
|
//EEPROM ADRESSEN
|
|
|
|
#define EEP_UI16_LAST_ADR 0x0010u //4x16Bit (->0x0017)
|
|
#define EEP_UI8_MAX_LINE 0x0018u //8Bit
|
|
#define EEP_UI8_MAX_ZONES 0x0019u //8Bit
|
|
#define EEP_UI16_MAX_LUMS_LINE 0x001Au //4x16Bit (->0x0021)
|
|
#define EEP_UI8_MAX_TESTGROUPS 0x0022u //8Bit
|
|
#define EEP_UI8_CPTBLY_DELAYS_ADR 0x0023u //1Byte
|
|
#define EEP_UI8_CPTBLY_DELAYS_POLLING 0x0024u //1Byte
|
|
#define EEP_UI8_CPTBLY_BYTE 0x0025u //1Byte
|
|
#define EEP_UI8_SW_VERSION 0x0026u //3Byte
|
|
// 6Byte free to use (->0x002F)
|
|
#define EEP_UI8_ADR 0x0030u //4*50Byte (->0x00F7)
|
|
// 8Byte free to use (->0x00FF)
|
|
#define EEP_UI8_GROUP_MEMBER 0x0100u //2x200Byte (->0x028F) each group locate in one nibble
|
|
#define EEP_UI8_EEPROM_VERSION 0x03FFu
|
|
|
|
#define EEP_UI8_LANGUAGE 0x0301u
|
|
#define EEP_UI8_OUTPUT 0x0302u
|
|
#define EEP_UI8_TIME 0x0303u
|
|
#define EEP_UI8_TEMPERATURE 0x0304u
|
|
#define EEP_UI16_CLOCK 0x0305u
|
|
#define EEP_UI16_NANOSECONDS 0x0307u
|
|
#define EEP_UI16_MICROSECONDS 0x0309u
|
|
#define EEP_UI16_MILLISECONDS 0x030Bu
|
|
#define EEP_UI8_SECONDS 0x030Du
|
|
#define EEP_UI8_MINUTES 0x030Eu
|
|
#define EEP_UI8_HOURS 0x030Fu
|
|
#define EEP_UI8_TIMESET 0x0310u
|
|
|
|
#define BUFFER_SIZE_USARTD1 28
|
|
#define BUFFER_SIZE_USARTE0 128
|
|
//#define _ALTERNATE_GETCHAR_
|
|
|
|
#define PENDING 0x80
|
|
|
|
#define CGL_DATA_SIZE 8
|
|
#define MAX_FIFO 10
|
|
|
|
#define FIFO_CARRY 0x01
|
|
#define FIFO_READY 0x10
|
|
#define FIFO_GROUP 0x20
|
|
#define FIFO_POLL_READY 0x40
|
|
|
|
#define EB_CGLINE_ALT 0x01
|
|
#define EB_CGLINE 0x11
|
|
#define EB_VL8 0x21
|
|
#define EB_LED_CGLINE 0x31
|
|
#define EB_CGLINE_OL3 0x41
|
|
#define EB_LED_CGLINE_E 0x51
|
|
#define GUIDELED_CGLINE 0x61
|
|
#define MASTERCGLINE_PLUS 0x08 //this bit indicate that the luminary belong to CGLine+ protocol
|
|
|
|
#define POLL_INACTIVE 0x80
|
|
#define POLL_IN_PROGRESS 0x01
|
|
#define POLL_STOP_REQUEST 0x02
|
|
#define POLL_STOP 0x04
|
|
#define POLL_START 0x08
|
|
|
|
//Switch-Settings
|
|
#define SWITCH_SETTING_CGLINE 0x00
|
|
#define SWITCH_SETTING_DALI 0x01
|
|
#define SWITCH_SETTING_CCB 0x03
|
|
|
|
//*********INIT.XML SETTINGS***********
|
|
//Temperature, Timestamp
|
|
#define SETTING_OFF 0x00
|
|
#define SETTING_ON 0x01
|
|
#define SETTING_UARTONLY 0x02
|
|
#define SETTING_SDCARDONLY 0x03
|
|
//Output
|
|
#define SETTING_UART 0x00
|
|
#define SETTING_SD 0x01
|
|
#define SETTING_UART_SD 0x02
|
|
//Language
|
|
#define SETTING_ENGLISH 0x00
|
|
#define SETTING_GERMAN 0x01
|
|
#define SETTING_FRANCE 0x02
|
|
|
|
//*************************************
|
|
|
|
//AD-Converter MUXCTRL
|
|
#define AD_5V (0x00<<3) /* Input pin 0 */
|
|
#define AD_REG (0x01<<3) /* Input pin 1 */
|
|
#define AD_BATT (0x02<<3) /* Input pin 2 */
|
|
#define Ext_Pin1 (0x04<<3) /* Input pin 4 */
|
|
#define Ext_Pin2 (0x05<<3) /* Input pin 5 */
|
|
#define NTC (0x06<<3) /* Input pin 6 */
|
|
#define DALI_OK_1 (0x07<<3) /* Input pin 7 */
|
|
#define DALI_OK_2 (0x08<<3) /* Input pin 8 */
|
|
#define VCC 0xFF
|
|
|
|
|
|
//SLEEP
|
|
#define ADC_SLEEP 0x01
|
|
#define USART_TX_SLEEP 0x02
|
|
#define USART_RX_SLEEP 0x04
|
|
#define CLOCK_SLEEP 0x08
|
|
|
|
typedef struct S_CGL_Status
|
|
{
|
|
uint8 Mode;
|
|
uint8 Failure;
|
|
uint8 State;
|
|
} CGL_Status_t;
|
|
|
|
typedef struct S_CGL_Data
|
|
{
|
|
uint8 Zone;
|
|
uint8 TestGroup;
|
|
uint8 Reserve;
|
|
uint16 Adr;
|
|
uint16 Inst;
|
|
uint8 Data[CGL_DATA_SIZE]; // 8 Byte
|
|
} CGL_Data_t; // 15 byte
|
|
|
|
typedef struct S_FIFO
|
|
{
|
|
uint8 FF_Pnt_In;
|
|
uint8 FF_Pnt_Out;
|
|
uint8 FF_Reg;
|
|
CGL_Data_t FiFo[MAX_FIFO];
|
|
} FIFO_t;
|
|
|
|
|
|
|
|
typedef struct S_SL_VALUE
|
|
{
|
|
uint8 ui8_SL_Cnt;
|
|
uint8 ui8_SL_Pnt;
|
|
uint8 ui8_SL_ID_H;
|
|
uint8 ui8_SL_ID_M;
|
|
uint8 ui8_SL_ID_L;
|
|
uint8 ui8_SL_Loops;
|
|
uint8 ui8_Repeat;
|
|
uint16 ui16_SL_NewAdress;
|
|
uint32 ui32_SL_Surge_ID;
|
|
uint32 ui32_SL_ID_Temp;
|
|
union S_SL_SURGE_ID
|
|
{
|
|
struct SID
|
|
{
|
|
uint8 ui8_Reserve;
|
|
uint8 ui8_H;
|
|
uint8 ui8_M;
|
|
uint8 ui8_L;
|
|
} s_SID;
|
|
uint32 ui32_SID;
|
|
};
|
|
} SL_Value_t;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
uint16 ui16_Time_nsec;
|
|
uint16 ui16_Time_usec;
|
|
uint16 ui16_Time_msec;
|
|
uint16 ui8_Time_sec;
|
|
uint8 ui8_Time_min;
|
|
uint8 ui8_Time_hrs;
|
|
} TimestampStruct;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
uint8 ui8_Address;
|
|
uint8 ui8_Ext_Address;
|
|
uint8 ui8_Command;
|
|
uint8 ui8_Answer;
|
|
uint8 ui8_Line_1or2;
|
|
TimestampStruct s_Timestamp;
|
|
bool b_Answer_Available;
|
|
bool b_Any_Answer;
|
|
} DaliMessageStruct;
|
|
|
|
|
|
extern uint8 eep_language;
|
|
extern uint8 eep_output;
|
|
extern uint8 eep_temperature;
|
|
extern uint8 eep_time;
|
|
extern uint16 eep_clock;
|
|
|
|
extern sint16 si16_Bat_Empty;
|
|
|
|
extern uint8 ui8_switch_state;
|
|
extern uint8 ui8_rot_state;
|
|
extern bool b_sdcard_on;
|
|
extern bool b_uart_on;
|
|
extern bool b_sdcard_active;
|
|
extern bool b_sdcard_ready;
|
|
extern uint8 ui8_LED_lock;
|
|
|
|
extern uint8 ui8_USB_SD_switch;
|
|
|
|
extern uint8 ui8_allow_sleep;
|
|
|
|
extern bool b_DALI_OK[2];
|
|
|
|
extern TimestampStruct s_Time;
|
|
|
|
extern uint8 ui8_DALI_OUT_Adr[2]; // The DALI address
|
|
extern uint8 ui8_DALI_OUT_Command[2]; // The DALI command
|
|
extern uint8 ui8_DALI_OUT_Tail_Bits[2]; // The additional address bits (> Adr 63)
|
|
|
|
extern uint8 DALI_OUT_answer[2]; // The DALI answer of outgoing DALI line
|
|
extern uint8 ui8_OUT_rec_bit[2]; // Number of received bits
|
|
|
|
|
|
extern uint8 ui8_Input_Content; // Reflect the value of the 3 Inputs (S1/S2, IO1, IO2)
|
|
extern uint16 ui16_Input_Cnt[4]; // Counter to debounce the input
|
|
extern uint16 ui16_Input_Select; //Counter to Select Input (DIP/ROTATION)
|
|
extern uint16 ui16_RX_TX_State; // give the info that rec is active or send_active
|
|
|
|
|
|
extern uint8 ui8_Byte_Position[2];
|
|
extern uint8 ui8_Parity_Counter[2];
|
|
|
|
extern uint8 rx_buffer_usarte0[BUFFER_SIZE_USARTE0]; // USARTE0 Receiver buffer
|
|
extern uint8 tx_buffer_usarte0[BUFFER_SIZE_USARTE0]; // USARTE0 Transmitter buffer
|
|
|
|
extern uint8 rx_wr_index_usarte0;
|
|
extern uint8 rx_rd_index_usarte0;
|
|
extern uint8 rx_counter_usarte0;
|
|
|
|
extern uint8 tx_wr_index_usarte0;
|
|
extern uint8 tx_rd_index_usarte0;
|
|
extern uint8 tx_counter_usarte0;
|
|
|
|
extern bit rx_buffer_overflow_usarte0;
|
|
extern uint8 adc_mode;
|
|
extern uint8 ui8_adc_counter;
|
|
|
|
extern uint8 ui8_TrueOrFalse[2];
|
|
|
|
extern uint16 max_Lums;
|
|
extern sint16 si16_NTC_TABLE[116][2];
|
|
|
|
#endif //GLOBAL_H
|