HAL_ChibiOS: use micros16() for blheli pass-thru IRQ

saves some IRQ overhead, makes time handling more consistent
This commit is contained in:
Andrew Tridgell 2021-10-02 15:40:07 +10:00
parent 5714ee113f
commit 6953778b4c
2 changed files with 5 additions and 5 deletions

View File

@ -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) {

View File

@ -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;