/* * @Date: 2025-07-22 10:35:36 * @Author: mypx * @LastEditors: mypx mypx_coder@163.com * @LastEditTime: 2025-07-22 13:43:33 * @FilePath: h31_comm_related_var.h * @Description: * Copyright (c) 2025 by mypx, All Rights Reserved. */ #ifndef __H31_COMM_RELATED_VAR_H__ #define __H31_COMM_RELATED_VAR_H__ #include "sv_common.h" // H31.00 Communication given VDI virtual level #define REG_H31_00_VDI_LEVEL 0x3100 #define H31_00_VDI_VIRTUAL_LEVEL_MIN 0x0000 #define H31_00_VDI_VIRTUAL_LEVEL_MAX 0xFFFF #define H31_00_VDI_VIRTUAL_LEVEL_DEF 0x0000 typedef union { uint16_t all; struct { uint16_t vdi1 : 1; // Bit 0: VDI1 virtual level uint16_t vdi2 : 1; // Bit 1: VDI2 virtual level uint16_t vdi3 : 1; // Bit 2: VDI3 virtual level uint16_t vdi4 : 1; // Bit 3: VDI4 virtual level uint16_t vdi5 : 1; // Bit 4: VDI5 virtual level uint16_t vdi6 : 1; // Bit 5: VDI6 virtual level uint16_t reserved : 10; // Bits 6-15: Reserved } bits; } H31_VDI_LevelTypeDef; // H31.04 Communication given DO output status #define REG_H31_04_DO_STATUS 0x3104 #define H31_04_DO_OUTPUT_STATUS_MIN 0x0000 #define H31_04_DO_OUTPUT_STATUS_MAX 0xFFFF typedef uint16_t H31_DO_StatusTypeDef; // H31.09 Communication given speed command (32-bit) #define REG_H31_09_SPEED_CMD 0x3109 #define H31_09_SPEED_CMD_MIN -9000000 #define H31_09_SPEED_CMD_MAX 9000000 #define H31_09_SPEED_CMD_DEFAULT 0 #define H31_09_SPEED_CMD_SCALE 1000 // Precision: 0.001rpm typedef int32_t H31_SpeedCmdTypeDef; // Unit: 0.001rpm // H31.11 Communication given torque command (32-bit) #define REG_H31_11_TORQUE_CMD 0x310B #define H31_11_TORQUE_CMD_MIN -100000 #define H31_11_TORQUE_CMD_MAX 100000 #define H31_11_TORQUE_CMD_DEF 0 #define H31_11_TORQUE_CMD_SCALE 1000 // Precision: 0.001% typedef int32_t H31_TorqueCmdTypeDef; // Unit: 0.001% int sv630p_h31_00_write_vdi_virtual_level(sv630p_handle_t *dev, uint16_t value); int sv630p_h31_00_read_vdi_virtual_level(sv630p_handle_t *dev, uint16_t *value); int sv630p_h31_04_write_do_output_status(sv630p_handle_t *dev, uint16_t value); int sv630p_h31_04_read_do_output_status(sv630p_handle_t *dev, uint16_t *value); int sv630p_h31_09_write_speed_command(sv630p_handle_t *dev, double rpm); int sv630p_h31_09_read_speed_command(sv630p_handle_t *dev, double *rpm); int sv630p_h31_11_write_torque_command(sv630p_handle_t *dev, int32_t value); int sv630p_h31_11_read_torque_command(sv630p_handle_t *dev, int32_t *value); #endif // __H31_COMM_RELATED_VAR_H__