diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glutt-o-logique/Makefile | 7 | ||||
-rw-r--r-- | src/glutt-o-logique/analog_input.c | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/glutt-o-logique/Makefile b/src/glutt-o-logique/Makefile index 8c7bf8b..ddfd4fd 100644 --- a/src/glutt-o-logique/Makefile +++ b/src/glutt-o-logique/Makefile @@ -161,3 +161,10 @@ else /opt/openocd/bin/openocd -f /opt/openocd/share/openocd/scripts/board/stm32f4discovery.cfg -c "program bin/"$(BINELF)" verify reset" -c "init" -c "reset" -c "exit" endif +# Some STM32F4DISCOVERY have a newer ST-LINK II interface +deploy21: $(BINDIR)/$(BINELF) +ifeq ($(wildcard /opt/openocd/bin/openocd),) + /usr/bin/openocd -f stm32f4discovery-with-stlinkv2.1.cfg -c "program bin/"$(BINELF)" verify reset" -c "init" -c "reset" -c "exit" +else + /opt/openocd/bin/openocd -f stm32f4discovery-with-stlinkv2.1.cfg -c "program bin/"$(BINELF)" verify reset" -c "init" -c "reset" -c "exit" +endif diff --git a/src/glutt-o-logique/analog_input.c b/src/glutt-o-logique/analog_input.c index ebfa486..33bb662 100644 --- a/src/glutt-o-logique/analog_input.c +++ b/src/glutt-o-logique/analog_input.c @@ -88,19 +88,21 @@ static uint16_t analog_read_channel(uint8_t channel) * System clock is at 168MHz, ADC is on APB2 which has a prescaler of 2. * 480 cycles at 84Mhz is about 6us. * - * If we have no result after 10ms it is a real problem. Keep in mind + * If we have no result after 1000ms it is a real problem. Keep in mind * we could get preempted. */ int ready = 0; - for (int i = 0; i < 10; i++) { + vTaskSuspendAll(); + for (int i = 0; i < 10000; i++) { if (ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == SET) { ready = 1; break; } - vTaskDelay(pdMS_TO_TICKS(1)); + delay_us(100); } + xTaskResumeAll(); if (!ready) { trigger_fault(FAULT_SOURCE_ADC1); |