#ifndef IDIBUS_CO2_H_
#define IDIBUS_CO2_H_

#include "IdiBusSlave.h"				//	Common slave defines
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#define IDIBUS_CUSTDEF_ERCODE_CO2_CRC_ERROR						100U
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
enum IDIBUS_CO2_MODULE_DEVICES_LIST {	//	Describe devices on module
	IDIBUS_CO2_CNTRL_DEV = 0,			//	ADC device ID
	IDIBUS_CO2_DEVICES_NUMBER			//	Device count on module
	};

enum {									//	Describe channel configuration for device (CO2)
	IDIBUS_CO2_CH0_NUM = 0,			//	Name for 1st channel
	IDIBUS_CO2_CH_COUNT,				// Module channel count
	};

typedef struct {
	uint32_t Value;		//	Last voltage
	uint8_t MMES_Error;		//	Last error
} IDIBUS_CO2_DATA_TYPE;	//	Data structure for ADC channels

class IdiBus_CO2 : public IdiBusSlave {									//	ADC module class
	public:																	//	Public methods 
 		IdiBus_CO2 ( IdiBusSerialLine *SlaveLine, uint8_t SlaveAddress);		// Init object with specified bus line and addr
		IdiBus_CO2 ();															// init without specified line and addr (default value line=NULL,addr=1)
		 	
		uint8_t getCO2(uint8_t ChNum);									// Sends MMES and gets Ch voltage (writes to CH structure and return error code)
		//void    getAllChTemperature(void);											// Sends MMES and gets all Ch voltages (writes to CH structure)
			
		//void    initAllChs(void);												// Inits all adc channels on module
	
		IDIBUS_CO2_DATA_TYPE  getChData(uint8_t ChNum);						// Returns data structure for ADC channel
	
	protected :																// 'Private' methods and structures
		IDIBUS_CO2_DATA_TYPE  CH[IDIBUS_CO2_CH_COUNT];						// Data structure array
			
		void    setAllChErr(uint8_t ErrCode);									// Set error code for all channels
};

#endif /* IDIBUS_4CO2_H_ */