#ifndef __MODBUS_H
#define __MODBUS_H


//#define MB__DEBUG

#ifdef MB__DEBUG
#define MBDBG
#else
#define MBDBG if (0)
#endif


// Коды команд управлления контроллером
typedef enum
{
    MB_COM_SETTINGS_SAVE = 1,
    MB_COM_LOG_CLEAR = 2,
    MB_COM_ARCH_CLEAR_1 = 3,
    MB_COM_ARCH_CLEAR_2 = 4,
    MB_COM_ARCH_CLEAR_3 = 5,
    MB_COM_ARCH_CLEAR_4 = 6,
    MB_COM_ARCH_CLEAR_5 = 7,
    MB_COM_ARCH_CLEAR_6 = 8,
    MB_COM_ARCH_CLEAR_7 = 9,
    MB_COM_ARCH_CLEAR_8 = 10,
      
} mb_command_t;

//
typedef enum 
{
    MB_NO_ACTION = 0,
    MB_CHANGE_ADDR,
    MB_CHANGE_PORT_SETTINGS,
    MB_DEF_SETTINGS,
    MB_PART_DEF_SETTINGS,
    MB_SAVE_SETTINGS,
    MB_SAVE_SYS_SETTINGS,
    MB_CHANGE_PWM_FREQ_1,
    MB_CHANGE_PWM_FREQ_2,
    MB_CHANGE_PWM_FREQ_3,
    MB_RESET,
    MB_PAS_OK,
    MB_PAS_ERR,
    MB_LOG_CLEAR,
    MB_ARCHIVE_CLEAR,
        
} mb_delay_action_t ;


//
void mb_init(void);

//
void modbus_reset(void const * params);

//
void settings_timer(void const * params);

//
void modbus_port_timer(void const * params);

#endif // __MODBUS_H