mirror of
https://gitea.ecohim.ru:3000/RS485_Relay/RS485_Relay2_fw.git
synced 2025-08-06 16:07:17 +03:00
Update HAL version, board description, version number to 10.0
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#define BOARD_DESC_LEN (23)
|
||||
|
||||
extern TIM_HandleTypeDef htim3;
|
||||
static const char board_description[BOARD_DESC_LEN] = "RS485 Relay Module v1";
|
||||
static const char board_description[BOARD_DESC_LEN] = "RS485_Relay V1R1";
|
||||
extern uint16_t tranfer_errors_count;
|
||||
extern uint16_t last_rx_time;
|
||||
|
||||
@@ -141,22 +141,24 @@ uint8_t write_register(uint16_t address, uint16_t value)
|
||||
#ifdef UART_DEBUG
|
||||
printf("Write A=0x%X D=0x%X\n\r",address,value);
|
||||
#endif
|
||||
switch (address)
|
||||
{
|
||||
case 0x2001: relays = value; break;
|
||||
case 0x2002: motor_pwm = value;
|
||||
if(motor_pwm>MOTOR_MAX)motor_pwm=MOTOR_MAX;
|
||||
if(motor_pwm<MOTOR_MIN)motor_pwm=MOTOR_MIN;
|
||||
if(motor_pwm==0)
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
|
||||
else
|
||||
{
|
||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
|
||||
__HAL_TIM_SetCompare(&htim3, TIM_CHANNEL_1, motor_pwm);
|
||||
HAL_Delay(5);
|
||||
}
|
||||
break;
|
||||
default: ret = 1;
|
||||
switch (address) {
|
||||
case 0x2001:
|
||||
relays = value;
|
||||
break;
|
||||
case 0x2002:
|
||||
motor_pwm = value;
|
||||
if(motor_pwm>MOTOR_MAX)motor_pwm=MOTOR_MAX;
|
||||
if(motor_pwm<MOTOR_MIN)motor_pwm=MOTOR_MIN;
|
||||
if(motor_pwm==0)
|
||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
|
||||
else {
|
||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
|
||||
__HAL_TIM_SetCompare(&htim3, TIM_CHANNEL_1, motor_pwm);
|
||||
HAL_Delay(5);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user