#include "main.h"
#include "stdlib.h"
#include "stdint.h"
#include "string.h"
#include "stdio.h"

#define DERE_High   HAL_GPIO_WritePin(DE_RE_GPIO_Port,DE_RE_Pin,GPIO_PIN_SET)
#define DERE_Low 		HAL_GPIO_WritePin(DE_RE_GPIO_Port,DE_RE_Pin,GPIO_PIN_RESET)
#define BufLen 250
#define SlaveReadCommand 0x03



typedef enum
{
	Temperature_Address=4100,  //temp*10 numaranin son 3 hanesi deec 018 hex 0x012
	Humidity_Address, //4101  humidity*10   numaranin son 3 hanesi +5
	Preasure_Address, //4102					numaranin son 3 hanesi +10
	Slope_Address,   //4103
	Depth_Address,	//4104
}MODBUSREG_MAP;



typedef struct
{
	float Temperature; 
	float Humidity;
	float Preasure;
	float Slope;
	float	Depth;
}Sensors;


typedef struct
{
	uint8_t MODBUS_Rx_Char;
	uint8_t MODBUS_Rx_BUF[BufLen];
	uint8_t MODBUS_Rx_Counter;
	uint8_t MODBUS_Tx_BUF[BufLen];
	uint8_t SlaveID;
	uint16_t StartAdress;
	uint16_t NumOfAdress;
	Sensors sv;
}Controller;

void ReadDataFromModbus(Controller*this);
