From 6f6c9df74f776f30aac11a23d27af8f7ba4eb6f5 Mon Sep 17 00:00:00 2001 From: fruchti Date: Mon, 5 Apr 2021 15:21:36 +0200 Subject: [PATCH] Enable output enable relay --- stm32f103t8u6/build_number.txt | 2 +- stm32f103t8u6/src/pwm_output.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/stm32f103t8u6/build_number.txt b/stm32f103t8u6/build_number.txt index 6ac793b..27a69f6 100644 --- a/stm32f103t8u6/build_number.txt +++ b/stm32f103t8u6/build_number.txt @@ -1 +1 @@ -325 +327 diff --git a/stm32f103t8u6/src/pwm_output.c b/stm32f103t8u6/src/pwm_output.c index 0cc1198..985bc69 100644 --- a/stm32f103t8u6/src/pwm_output.c +++ b/stm32f103t8u6/src/pwm_output.c @@ -3,11 +3,13 @@ #include "pwm_output.h" #include "config.h" #include "pinning.h" +#include "led.h" #include "ownership.h" MODULE_OWNS_PIN(GPIOA, PIN_OUTPUT_X); MODULE_OWNS_PIN(GPIOA, PIN_OUTPUT_Y); MODULE_OWNS_PIN(GPIOB, PIN_PEN_STATE); +MODULE_OWNS_PIN(GPIOA, PIN_OUTPUT_ENABLE); MODULE_OWNS_PERIPHERAL(TIM1); MODULE_OWNS_PERIPHERAL(TIM4); @@ -96,8 +98,10 @@ static unsigned int Output_ApproximateLength(int dx, int dy) static bool Output_FetchNextPoint(void) { + LED_Off(LED_Pink); if(Output_BufferRead == Output_BufferWrite) { + LED_Off(LED_Orange); return false; } @@ -227,6 +231,13 @@ void Output_Init(void) Output_PenUp(); + GPIOA->CRL = (GPIOA->CRL + & ~(0xf << (4 * PIN_OUTPUT_ENABLE))) + | (0x02 << (PIN_OUTPUT_ENABLE * 4)) // 2 MHz push-pull output + ; + // Close relays + GPIOA->BSRR = (1 << PIN_OUTPUT_ENABLE); + GPIOA->CRH = (GPIOA->CRH & ~(0xf << (4 * PIN_OUTPUT_X - 32)) & ~(0xf << (4 * PIN_OUTPUT_Y - 32)))