#ifndef IDIBUS_NEXTION_H_
#define IDIBUS_NEXTION_H_

#include "IdiBusSlave.h"				//	Common slave defines
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
enum IDIBUS_NEXTION_MODULE_DEVICES_LIST {	//	Describe devices on module
	IDIBUS_NEXTION_CNTRL_DEV = 0,			//	NEXTION device ID
	IDIBUS_NEXTION_DEVICES_NUMBER			//	Device count on module
	};

typedef struct {
	uint8_t RXlen;
	uint8_t RXbuf[255];
	uint8_t MMES_Error;		//	Last error
} IDIBUS_NEXTION_DATA_TYPE;

class IdiBus_NEXTION : public IdiBusSlave {									//	NEXTION module class
	public:																	//	Public methods 
 		IdiBus_NEXTION ( IdiBusSerialLine *SlaveLine, uint8_t SlaveAddress);		// Init object with specified bus line and addr
		IdiBus_NEXTION();															// init without specified line and addr (default value line=NULL,addr=1)
		 	
		uint8_t sendBuf(uint8_t *buf, uint8_t len);									// Sends MMES and gets Ch voltage (writes to CH structure and return error code)
		uint8_t getBuf();

		IDIBUS_NEXTION_DATA_TYPE getData(void);
	
	protected :																// 'Private' methods and structures
		IDIBUS_NEXTION_DATA_TYPE BRIDGE;
};

#endif /* IDIBUS_NEXTION_H_ */