/* * @Date: 2025-07-21 17:15:52 * @Author: mypx * @LastEditors: mypx mypx_coder@163.com * @LastEditTime: 2025-07-22 13:16:52 * @FilePath: h06_speed_control.c * @Description: * Copyright (c) 2025 by mypx, All Rights Reserved. */ #include "h06_speed_control.h" /** * @brief Read main speed command A source * @param dev Device handle * @param src Output parameter for main speed command A source * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_00_read_main_speed_cmd_a_src(sv630p_handle_t *dev, SV630P_MainSpeedCmdASource *src) { uint16_t reg_val = 0; SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_00_MAIN_SPEED_CMD_A_SRC, 1, ®_val) == SV630P_OK) { *src = (SV630P_MainSpeedCmdASource)reg_val; return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write main speed command A source * @param dev Device handle * @param src Main speed command A source to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_00_write_main_speed_cmd_a_src(sv630p_handle_t *dev, SV630P_MainSpeedCmdASource src) { SV630P_ARGS_CHECK(dev); return dev->ops->write_single_reg(dev, REG_H06_00_MAIN_SPEED_CMD_A_SRC, (uint16_t)src); } /** * @brief Read auxiliary speed command B source * @param dev Device handle * @param src Output parameter for auxiliary speed command B source * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_01_read_aux_speed_cmd_b_src(sv630p_handle_t *dev, SV630P_AuxSpeedCmdBSource *src) { uint16_t reg_val = 0; SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_01_AUX_SPEED_CMD_B_SRC, 1, ®_val) == SV630P_OK) { *src = (SV630P_AuxSpeedCmdBSource)reg_val; return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write auxiliary speed command B source * @param dev Device handle * @param src Auxiliary speed command B source to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_01_write_aux_speed_cmd_b_src(sv630p_handle_t *dev, SV630P_AuxSpeedCmdBSource src) { SV630P_ARGS_CHECK(dev); return dev->ops->write_single_reg(dev, REG_H06_01_AUX_SPEED_CMD_B_SRC, (uint16_t)src); } /** * @brief Read speed command selection mode * @param dev Device handle * @param select Output parameter for speed command selection mode * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_02_read_speed_cmd_select(sv630p_handle_t *dev, SV630P_SpeedCmdSelect *select) { uint16_t reg_val = 0; SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_02_SPEED_CMD_SELECT, 1, ®_val) == SV630P_OK) { *select = (SV630P_SpeedCmdSelect)reg_val; return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write speed command selection mode * @param dev Device handle * @param select Speed command selection mode to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_02_write_speed_cmd_select(sv630p_handle_t *dev, SV630P_SpeedCmdSelect select) { SV630P_ARGS_CHECK(dev); return dev->ops->write_single_reg(dev, REG_H06_02_SPEED_CMD_SELECT, (uint16_t)select); } /** * @brief Read keyboard setting value of speed command * @param dev Device handle * @param speed Output parameter for speed value (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_03_read_speed_cmd_keyboard(sv630p_handle_t *dev, int16_t *speed) { uint16_t reg_val = 0; SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_03_SPEED_CMD_KEYBOARD, 1, ®_val) == SV630P_OK) { *speed = (int16_t)reg_val; return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write keyboard setting value of speed command * @param dev Device handle * @param speed Speed value to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_03_write_speed_cmd_keyboard(sv630p_handle_t *dev, int16_t speed) { SV630P_ARGS_CHECK(dev); if (speed < H06_03_SPEED_CMD_KEYBOARD_MIN || speed > H06_03_SPEED_CMD_KEYBOARD_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_03_SPEED_CMD_KEYBOARD, (uint16_t)speed); } /** * @brief Read jog speed setting value * @param dev Device handle * @param speed Output parameter for jog speed (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_04_read_jog_speed(sv630p_handle_t *dev, uint16_t *speed) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_04_JOG_SPEED_SET, 1, speed); } /** * @brief Write jog speed setting value * @param dev Device handle * @param speed Jog speed to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_04_write_jog_speed(sv630p_handle_t *dev, uint16_t speed) { SV630P_ARGS_CHECK(dev); if (speed > H06_04_JOG_SPEED_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_04_JOG_SPEED_SET, speed); } /** * @brief Read acceleration ramp time constant * @param dev Device handle * @param time Output parameter for acceleration time (ms) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_05_read_accel_ramp_time(sv630p_handle_t *dev, uint16_t *time) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_05_ACCEL_RAMP_TIME, 1, time); } /** * @brief Write acceleration ramp time constant * @param dev Device handle * @param time Acceleration time to set (ms) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_05_write_accel_ramp_time(sv630p_handle_t *dev, uint16_t time) { SV630P_ARGS_CHECK(dev); // if (time < H06_05_ACCEL_RAMP_MIN || time > H06_05_ACCEL_RAMP_MAX) // return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_05_ACCEL_RAMP_TIME, time); } /** * @brief Read deceleration ramp time constant * @param dev Device handle * @param time Output parameter for deceleration time (ms) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_06_read_decel_ramp_time(sv630p_handle_t *dev, uint16_t *time) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_06_DECEL_RAMP_TIME, 1, time); } /** * @brief Write deceleration ramp time constant * @param dev Device handle * @param time Deceleration time to set (ms) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_06_write_decel_ramp_time(sv630p_handle_t *dev, uint16_t time) { SV630P_ARGS_CHECK(dev); // if (time < H06_06_DECEL_RAMP_MIN || time > H06_06_DECEL_RAMP_MAX) // return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_06_DECEL_RAMP_TIME, time); } /** * @brief Read maximum speed threshold * @param dev Device handle * @param threshold Output parameter for maximum speed threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_07_read_max_speed_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_07_MAX_SPEED_THRESHOLD, 1, threshold); } /** * @brief Write maximum speed threshold * @param dev Device handle * @param threshold Maximum speed threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_07_write_max_speed_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold > H06_07_MAX_SPEED_THRESHOLD_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_07_MAX_SPEED_THRESHOLD, threshold); } /** * @brief Read forward speed threshold * @param dev Device handle * @param threshold Output parameter for forward speed threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_08_read_forward_speed_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_08_FORWARD_SPEED_THRESHOLD, 1, threshold); } /** * @brief Write forward speed threshold * @param dev Device handle * @param threshold Forward speed threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_08_write_forward_speed_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold > H06_08_FORWARD_SPEED_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_08_FORWARD_SPEED_THRESHOLD, threshold); } /** * @brief Read reverse speed threshold * @param dev Device handle * @param threshold Output parameter for reverse speed threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_09_read_reverse_speed_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_09_REVERSE_SPEED_THRESHOLD, 1, threshold); } /** * @brief Write reverse speed threshold * @param dev Device handle * @param threshold Reverse speed threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_09_write_reverse_speed_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold > H06_09_REVERSE_SPEED_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_09_REVERSE_SPEED_THRESHOLD, threshold); } /** * @brief Read torque feedforward control selection * @param dev Device handle * @param select Output parameter for torque feedforward control selection * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_11_read_torque_feedforward_sel(sv630p_handle_t *dev, SV630P_TorqueFeedforwardSelect *select) { uint16_t reg_val = 0; SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_11_TORQUE_FEEDFORWARD_SEL, 1, ®_val) == SV630P_OK) { *select = (SV630P_TorqueFeedforwardSelect)reg_val; return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write torque feedforward control selection * @param dev Device handle * @param select Torque feedforward control selection to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_11_write_torque_feedforward_sel(sv630p_handle_t *dev, SV630P_TorqueFeedforwardSelect select) { SV630P_ARGS_CHECK(dev); return dev->ops->write_single_reg(dev, REG_H06_11_TORQUE_FEEDFORWARD_SEL, (uint16_t)select); } /** * @brief Read speed smooth filter time * @param dev Device handle * @param time Output parameter for speed smooth filter time (μs) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_13_read_speed_smooth_filter_time(sv630p_handle_t *dev, uint16_t *time) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_13_SPEED_SMOOTH_FILTER_TIME, 1, time); } /** * @brief Write speed smooth filter time * @param dev Device handle * @param time Speed smooth filter time to set (μs) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_13_write_speed_smooth_filter_time(sv630p_handle_t *dev, uint16_t time) { SV630P_ARGS_CHECK(dev); // if (time < H06_13_FILTER_TIME_MIN || time > H06_13_FILTER_TIME_MAX) // return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_13_SPEED_SMOOTH_FILTER_TIME, time); } /** * @brief Read zero position fixed speed threshold * @param dev Device handle * @param threshold Output parameter for zero position fixed speed threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_15_read_zero_pos_speed_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_15_ZERO_POS_SPEED_THRESHOLD, 1, threshold); } /** * @brief Write zero position fixed speed threshold * @param dev Device handle * @param threshold Zero position fixed speed threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_15_write_zero_pos_speed_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold > H06_15_ZERO_POS_THRESHOLD_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_15_ZERO_POS_SPEED_THRESHOLD, threshold); } /** * @brief Read motor rotation speed threshold * @param dev Device handle * @param threshold Output parameter for motor rotation speed threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_16_read_motor_rotate_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_16_MOTOR_ROTATE_THRESHOLD, 1, threshold); } /** * @brief Write motor rotation speed threshold * @param dev Device handle * @param threshold Motor rotation speed threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_16_write_motor_rotate_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold > H06_16_ROTATE_THRESHOLD_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_16_MOTOR_ROTATE_THRESHOLD, threshold); } /** * @brief Read speed consistent signal threshold * @param dev Device handle * @param threshold Output parameter for speed consistent signal threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_17_read_speed_consistent_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_17_SPEED_CONSISTENT_THRESHOLD, 1, threshold); } /** * @brief Write speed consistent signal threshold * @param dev Device handle * @param threshold Speed consistent signal threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_17_write_speed_consistent_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold > H06_17_CONSISTENT_THRESHOLD_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_17_SPEED_CONSISTENT_THRESHOLD, threshold); } /** * @brief Read speed arrive signal threshold * @param dev Device handle * @param threshold Output parameter for speed arrive signal threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_18_read_speed_arrive_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); return dev->ops->read_holding_regs(dev, REG_H06_18_SPEED_ARRIVE_THRESHOLD, 1, threshold); } /** * @brief Write speed arrive signal threshold * @param dev Device handle * @param threshold Speed arrive signal threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_18_write_speed_arrive_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold < H06_18_ARRIVE_THRESHOLD_MIN || threshold > H06_18_ARRIVE_THRESHOLD_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_18_SPEED_ARRIVE_THRESHOLD, threshold); } /** * @brief Read zero speed output signal threshold * @param dev Device handle * @param threshold Output parameter for zero speed output signal threshold (rpm) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_19_read_zero_speed_output_threshold(sv630p_handle_t *dev, uint16_t *threshold) { SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_19_ZERO_SPEED_OUTPUT_THRESHOLD, 1, threshold) == SV630P_OK) { return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write zero speed output signal threshold * @param dev Device handle * @param threshold Zero speed output signal threshold to set (rpm) * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_19_write_zero_speed_output_threshold(sv630p_handle_t *dev, uint16_t threshold) { SV630P_ARGS_CHECK(dev); if (threshold < H06_19_ZERO_SPEED_THRESHOLD_MIN || threshold > H06_19_ZERO_SPEED_THRESHOLD_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_19_ZERO_SPEED_OUTPUT_THRESHOLD, threshold); } /** * @brief Read cogging torque ripple compensation enable status * @param dev Device handle * @param enable Output parameter for cogging compensation enable status * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_28_read_cogging_comp_enable(sv630p_handle_t *dev, SV630P_CoggingCompEnable *enable) { uint16_t reg_val = 0; SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_28_COGGING_COMP_ENABLE, 1, ®_val) == SV630P_OK) { *enable = (SV630P_CoggingCompEnable)reg_val; return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write cogging torque ripple compensation enable status * @param dev Device handle * @param enable Cogging compensation enable status to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_28_write_cogging_comp_enable(sv630p_handle_t *dev, SV630P_CoggingCompEnable enable) { SV630P_ARGS_CHECK(dev); return dev->ops->write_single_reg(dev, REG_H06_28_COGGING_COMP_ENABLE, (uint16_t)enable); } /** * @brief Read sine frequency setting * @param dev Device handle * @param freq Output parameter for sine frequency * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_31_read_sine_frequency(sv630p_handle_t *dev, uint16_t *freq) { SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_31_SINE_FREQUENCY, 1, freq) == SV630P_OK) { return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write sine frequency setting * @param dev Device handle * @param freq Sine frequency to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_31_write_sine_frequency(sv630p_handle_t *dev, uint16_t freq) { SV630P_ARGS_CHECK(dev); if (freq > H06_31_SINE_FREQ_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_31_SINE_FREQUENCY, freq); } /** * @brief Read sine amplitude (H06.32) * @param dev Device handle * @param amp Output parameter for sine amplitude * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_32_read_sine_amplitude(sv630p_handle_t *dev, uint16_t *amp) { SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_32_SINE_AMPLITUDE, 1, amp) == SV630P_OK) { return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write sine amplitude (H06.32) * @param dev Device handle * @param amp Sine amplitude to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_32_write_sine_amplitude(sv630p_handle_t *dev, uint16_t amp) { SV630P_ARGS_CHECK(dev); if (amp > H06_32_SINE_AMP_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_32_SINE_AMPLITUDE, amp); } /** * @brief Read sine amplitude (H06.33) * @param dev Device handle * @param amp Output parameter for sine amplitude (H06.33) * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_33_read_sine_amplitude(sv630p_handle_t *dev, uint16_t *amp) { SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_33_SINE_AMPLITUDE, 1, amp) == SV630P_OK) { return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write sine amplitude (H06.33) * @param dev Device handle * @param amp Sine amplitude (H06.33) to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_33_write_sine_amplitude(sv630p_handle_t *dev, uint16_t amp) { SV630P_ARGS_CHECK(dev); if (amp > H06_33_SINE_AMP_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_33_SINE_AMPLITUDE, amp); } /** * @brief Read sine offset * @param dev Device handle * @param offset Output parameter for sine offset * @return Operation result * @retval SV630P_OK Success * @retval SV630P_BUS_ERR Communication bus error */ int sv630p_h06_35_read_sine_offset(sv630p_handle_t *dev, int16_t *offset) { uint16_t reg_val = 0; SV630P_ARGS_CHECK(dev); if (dev->ops->read_holding_regs(dev, REG_H06_35_SINE_OFFSET, 1, ®_val) == SV630P_OK) { *offset = (int16_t)reg_val; return SV630P_OK; } return SV630P_BUS_ERR; } /** * @brief Write sine offset * @param dev Device handle * @param offset Sine offset to set * @return Operation result * @retval SV630P_OK Success * @retval Other values Failure */ int sv630p_h06_35_write_sine_offset(sv630p_handle_t *dev, int16_t offset) { SV630P_ARGS_CHECK(dev); if (offset < H06_35_SINE_OFFSET_MIN || offset > H06_35_SINE_OFFSET_MAX) return SV630P_PARAM_ERR; return dev->ops->write_single_reg(dev, REG_H06_35_SINE_OFFSET, (uint16_t)offset); }