@@ -1238,7 +1238,7 @@ int modbus_read_input_registers(modbus_t *ctx, int addr, int nb,
12381238
12391239/* Write a value to the specified register of the remote device.
12401240 Used by write_bit and write_register */
1241- static int write_single (modbus_t * ctx , int function , int addr , int value )
1241+ static int write_single (modbus_t * ctx , int function , int addr , const uint16_t value )
12421242{
12431243 int rc ;
12441244 int req_length ;
@@ -1249,7 +1249,7 @@ static int write_single(modbus_t *ctx, int function, int addr, int value)
12491249 return -1 ;
12501250 }
12511251
1252- req_length = ctx -> backend -> build_request_basis (ctx , function , addr , value , req );
1252+ req_length = ctx -> backend -> build_request_basis (ctx , function , addr , ( int ) value , req );
12531253
12541254 rc = send_msg (ctx , req , req_length );
12551255 if (rc > 0 ) {
@@ -1279,7 +1279,7 @@ int modbus_write_bit(modbus_t *ctx, int addr, int status)
12791279}
12801280
12811281/* Writes a value in one register of the remote device */
1282- int modbus_write_register (modbus_t * ctx , int addr , int value )
1282+ int modbus_write_register (modbus_t * ctx , int addr , const uint16_t value )
12831283{
12841284 if (ctx == NULL ) {
12851285 errno = EINVAL ;
0 commit comments