X2D lib first commit

X2D.h

Committer:
sev2000
Date:
2019-12-01
Revision:
13:345e4251cf25
Parent:
12:ce8ae07fd23b
Child:
15:2f74266340ac

File content as of revision 13:345e4251cf25:

#include "mbed.h" 

extern Serial pc;

#define __DEBUG__
#define Level 3
#define DBG(x, ...) if (Level>=3) pc.printf("[DBG]"x"\r\n", ##__VA_ARGS__); 
#define WARN(x, ...) if (Level>=2) pc.printf("[WARN]"x"\r\n", ##__VA_ARGS__); 
#define ERR(x, ...) if (Level>=1) pc.printf("[ERR]"x"\r\n", ##__VA_ARGS__); 

typedef enum {
    Moon   = 0,
    Conf1  = 1, // Confort -1
    Conf2  = 2, // Confort -2
    Sun    = 3,
    ABS     = 4,
    HG     = 7,
    OFF     = 8
}h_mode;  //Heater mode
// mode | 0x80 => OFF
// mode | 0x40 => Abs

typedef struct {
    long v;
    bool pin;
}pulse_t;

typedef struct {
    char zone;
    h_mode mode;
}info_t;

typedef struct {
    char data[8];
    int lenght;
}msg_t;

typedef struct {
    unsigned char zone;
    h_mode mode;
    bool fixed;
    unsigned char associated[3];
}zone_t;



void Init_X2D(void);
//void TASK_RcvMessages(info_t *message);
void SendCmd(int zone, h_mode prog);
void write_ctrl_reg(unsigned long write_data);
unsigned long read_ctrl_reg(void);