//
// Created by DELL on 2024/10/16.
//

#ifndef GMV_GATEWAY_BOARD_MINI_GATEWAY_MASTER_H
#define GMV_GATEWAY_BOARD_MINI_GATEWAY_MASTER_H

#include "ffx_master.h"

#define INNER_SLAVE_ADDRESS_START 1
#define INNER_POWER_ON 0xAA
#define INNER_POWER_OFF 0x55
#define INNER_SLAVE_ADDRESS_END 8
#define MINI_GATEWAY_SLAVE_ADDRESS 0x01     // MINI_GATEWAI从机地址
#define MINI_GATEWAY_INNER_POWER_ADDRESS 102 // 寄存器地址
#define MINI_GATEWAY_INNER_COIL_ADDRESS 120 // 内机1，线圈起始地址，1~8
#define MINI_GATEWAY_INNER_COIL2_ADDRESS 128// 内机9，线圈起始地址，9~16
#define MINI_GATEWAY_INNER_COIL_ERROR1_ADDRESS (319 + 64 * 0)   // 内机1总故障
#define MINI_GATEWAY_INNER_COIL_ERROR2_ADDRESS (319 + 64 * 1)   // 内机2总故障
#define MINI_GATEWAY_INNER_COIL_ERROR3_ADDRESS (319 + 64 * 2)   // 内机3总故障
#define MINI_GATEWAY_INNER_COIL_ERROR4_ADDRESS (319 + 64 * 3)   // 内机4总故障
#define MINI_GATEWAY_INNER_COIL_ERROR5_ADDRESS (319 + 64 * 4)   // 内机5总故障
#define MINI_GATEWAY_INNER_COIL_ERROR6_ADDRESS (319 + 64 * 5)   // 内机6总故障
#define MINI_GATEWAY_INNER_COIL_ERROR7_ADDRESS (319 + 64 * 6)   // 内机7总故障
#define MINI_GATEWAY_INNER_COIL_ERROR8_ADDRESS (319 + 64 * 7)   // 内机8总故障

void mini_gateway_master_init(void);

void sync_ac_status(ffx_status_t *status);

#endif //GMV_GATEWAY_BOARD_MINI_GATEWAY_MASTER_H
