//-----------MODBUS DEVICE DATA SETTING-------------
//--------------DEFINES FOR REGISTERS---------------
// DEFINES FOR ARRAYS
#define LOG_SIZE											500

#define R_SINE_LOG_ADDR 							0
#define R_SINE_LOG_QNT 								LOG_SIZE

#define R_PWM_LOG_ADDR 								500
#define R_PWM_LOG_QNT 								LOG_SIZE

#define R_CNT_LOG_ADDR 								1000
#define R_CNT_LOG_QNT 								LOG_SIZE

#define R_TIME_LOG_ADDR 							1500
#define R_TIME_LOG_QNT 								LOG_SIZE


#define R_SETTINGS_START_ADDR					20000

#define R_PWM_CTRL_ADDR								R_SETTINGS_START_ADDR
#define	R_PWM_CTRL_QNT 								8

#define R_LOG_CTRL_ADDR								(R_SETTINGS_START_ADDR+8)
#define	R_LOG_CTRL_QNT 								8

#define R_UART_CTRL_ADDR							R_SETTINGS_START_ADDR+16
#define	R_UART_CTRL_QNT 							8
 
// DEFINES FOR REGISTERS

#define R_PWM_CTRL_PWM_VALUE					0		// PWM value: sin freq OR pwm duty
#define R_PWM_CTRL_PWM_HZ							1		// frequency of PWM Timer
#define R_PWM_CTRL_MIN_PULSE_DUR 			2 	// duration of shortest pulse in sine PWM
#define R_PWM_CTRL_DEAD_TIME 					3 	// duration between between switches half waves (channels)
#define R_PWM_CTRL_SIN_TABLE_SIZE			4		// size of sinus table

#define R_LOG_CTRL_LOG_SIZE						0		// size of number elements in log
#define R_LOG_CTRL_LOG_PWM_NUMB				1		// number of PWM periods in log
#define R_LOG_CTRL_LOG_HZ						 	2		// frequency of log Timer

#define R_UART_CTRL_SPEED							0	// sin frequency

 
//----------------DEFINES FOR COILS-----------------
// DEFINES FOR ARRAYS
#define C_GPIOD_ADDR							0
#define C_GPIOD_QNT								16		// minimum 16

#define C_CTRL_COILS_ADDR					0x10
#define C_CTRL_COILS_QNT					160		// minimum 16


// DEFINES FOR COILS
#define COIL_GPIOD_LED1						12
#define COIL_GPIOD_LED2						13
#define COIL_GPIOD_LED3						14
#define COIL_GPIOD_LED4						15
#define COIL_GPIOD_LED1_GLOBAL		(C_GPIOD_ADDR+COIL_GPIOD_LED1)
#define COIL_GPIOD_LED2_GLOBAL		(C_GPIOD_ADDR+COIL_GPIOD_LED2)
#define COIL_GPIOD_LED3_GLOBAL		(C_GPIOD_ADDR+COIL_GPIOD_LED3)
#define COIL_GPIOD_LED4_GLOBAL		(C_GPIOD_ADDR+COIL_GPIOD_LED4)

#define COIL_UART_CTRL							(0)
#define COIL_UART_CTRL_GLOBAL				(C_CTRL_COILS_ADDR+COIL_UART_CTRL)
#define COIL_PWM_DC_MODE						(1)
#define COIL_PWM_DC_MODE_GLOBAL			(C_CTRL_COILS_ADDR+COIL_PWM_DC_MODE)
#define COIL_PWM_CH_MODE						(2)
#define COIL_PWM_CH_MODE_GLOBAL			(C_CTRL_COILS_ADDR+COIL_PWM_CH_MODE)
#define COIL_PWM_PHASE_MODE					(3)
#define COIL_PWM_PHASE_MODE_GLOBAL	(C_CTRL_COILS_ADDR+COIL_PWM_PHASE_MODE)