From f2cb0d5ddea63c04bc90f1f3468d510bdb23a844 Mon Sep 17 00:00:00 2001 From: blckmn Date: Sat, 15 Oct 2016 17:37:37 +1100 Subject: [PATCH] Updated to utilise new CRC --- src/main/drivers/pwm_output_stm32f3xx.c | 8 ++++---- src/main/drivers/pwm_output_stm32f4xx.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/drivers/pwm_output_stm32f3xx.c b/src/main/drivers/pwm_output_stm32f3xx.c index 11737cf887..5c215f779b 100644 --- a/src/main/drivers/pwm_output_stm32f3xx.c +++ b/src/main/drivers/pwm_output_stm32f3xx.c @@ -73,10 +73,10 @@ void pwmWriteDigital(uint8_t index, uint16_t value) motor->dmaBuffer[11] = MOTOR_BIT_0; /* telemetry is always false for the moment */ /* check sum */ - motor->dmaBuffer[12] = (value & 0x400) ? MOTOR_BIT_1 : MOTOR_BIT_0; - motor->dmaBuffer[13] = (value & 0x200) ? MOTOR_BIT_1 : MOTOR_BIT_0; - motor->dmaBuffer[14] = (value & 0x100) ? MOTOR_BIT_1 : MOTOR_BIT_0; - motor->dmaBuffer[15] = (value & 0x80) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[12] = (value & 0x400) ^ (value & 0x40) ^ (value & 0x4) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[13] = (value & 0x200) ^ (value & 0x20) ^ (value & 0x2) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[14] = (value & 0x100) ^ (value & 0x10) ^ (value & 0x1) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[15] = (value & 0x80) ^ (value & 0x8) ^ (0x0) ? MOTOR_BIT_1 : MOTOR_BIT_0; DMA_SetCurrDataCounter(motor->timerHardware->dmaChannel, MOTOR_DMA_BUFFER_SIZE); DMA_Cmd(motor->timerHardware->dmaChannel, ENABLE); diff --git a/src/main/drivers/pwm_output_stm32f4xx.c b/src/main/drivers/pwm_output_stm32f4xx.c index e514b7200b..28222200c9 100644 --- a/src/main/drivers/pwm_output_stm32f4xx.c +++ b/src/main/drivers/pwm_output_stm32f4xx.c @@ -73,10 +73,10 @@ void pwmWriteDigital(uint8_t index, uint16_t value) motor->dmaBuffer[11] = MOTOR_BIT_0; /* telemetry is always false for the moment */ /* check sum */ - motor->dmaBuffer[12] = (value & 0x400) ? MOTOR_BIT_1 : MOTOR_BIT_0; - motor->dmaBuffer[13] = (value & 0x200) ? MOTOR_BIT_1 : MOTOR_BIT_0; - motor->dmaBuffer[14] = (value & 0x100) ? MOTOR_BIT_1 : MOTOR_BIT_0; - motor->dmaBuffer[15] = (value & 0x80) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[12] = (value & 0x400) ^ (value & 0x40) ^ (value & 0x4) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[13] = (value & 0x200) ^ (value & 0x20) ^ (value & 0x2) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[14] = (value & 0x100) ^ (value & 0x10) ^ (value & 0x1) ? MOTOR_BIT_1 : MOTOR_BIT_0; + motor->dmaBuffer[15] = (value & 0x80) ^ (value & 0x8) ^ (0x0) ? MOTOR_BIT_1 : MOTOR_BIT_0; DMA_SetCurrDataCounter(motor->timerHardware->dmaStream, MOTOR_DMA_BUFFER_SIZE); DMA_Cmd(motor->timerHardware->dmaStream, ENABLE);