diff --git a/libraries/AP_HAL_ChibiOS/RCOutput.cpp b/libraries/AP_HAL_ChibiOS/RCOutput.cpp index adbef52761..74b38e9f49 100644 --- a/libraries/AP_HAL_ChibiOS/RCOutput.cpp +++ b/libraries/AP_HAL_ChibiOS/RCOutput.cpp @@ -1727,7 +1727,7 @@ bool RCOutput::serial_write_bytes(const uint8_t *bytes, uint16_t len) */ void RCOutput::serial_bit_irq(void) { - uint32_t now = AP_HAL::micros(); + uint16_t now = AP_HAL::micros16(); uint8_t bit = palReadLine(irq.line); bool send_signal = false; @@ -1746,7 +1746,7 @@ void RCOutput::serial_bit_irq(void) irq.bitmask = 0; } } else { - systime_t dt = now - irq.byte_start_tick; + uint16_t dt = now - irq.byte_start_tick; uint8_t bitnum = (dt+(irq.bit_time_tick/2)) / irq.bit_time_tick; if (bitnum > 10) { diff --git a/libraries/AP_HAL_ChibiOS/RCOutput.h b/libraries/AP_HAL_ChibiOS/RCOutput.h index 2a56b90623..4df5473ef3 100644 --- a/libraries/AP_HAL_ChibiOS/RCOutput.h +++ b/libraries/AP_HAL_ChibiOS/RCOutput.h @@ -332,7 +332,7 @@ private: // serial output struct { // expected time per bit - uint32_t bit_time_us; + uint16_t bit_time_us; // channel to output to within group (0 to 3) uint8_t chan; @@ -411,7 +411,7 @@ private: ioline_t line; // time the current byte started - uint32_t byte_start_tick; + uint16_t byte_start_tick; // number of bits we have read in this byte uint8_t nbits; @@ -423,7 +423,7 @@ private: uint16_t byteval; // expected time per bit in micros - uint32_t bit_time_tick; + uint16_t bit_time_tick; // the bit value of the last bit received uint8_t last_bit;