aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-12 16:29:44 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-06-12 16:29:44 +0200
commit6f95a22ce25839825c79d4529317984bd3e1b870 (patch)
tree181f6d072a4d9d3c184becd104c447eca189230d /src
parent2823a0d3833ba5faa03590dfbc5c45976439cd59 (diff)
downloadglutte-o-matic-6f95a22ce25839825c79d4529317984bd3e1b870.tar.gz
glutte-o-matic-6f95a22ce25839825c79d4529317984bd3e1b870.tar.bz2
glutte-o-matic-6f95a22ce25839825c79d4529317984bd3e1b870.zip
Improve supply voltage measurement, WIP
Diffstat (limited to 'src')
-rw-r--r--src/common/src/Core/main.c8
-rw-r--r--src/glutt-o-logique/Makefile5
-rw-r--r--src/glutt-o-logique/analog_input.c2
-rw-r--r--src/glutt-o-logique/main.c22
4 files changed, 30 insertions, 7 deletions
diff --git a/src/common/src/Core/main.c b/src/common/src/Core/main.c
index 9fe84ab..a30a3f6 100644
--- a/src/common/src/Core/main.c
+++ b/src/common/src/Core/main.c
@@ -92,7 +92,7 @@ int main(void) {
xTaskCreate(
launcher_task,
"Launcher",
- configMINIMAL_STACK_SIZE,
+ 2*configMINIMAL_STACK_SIZE,
(void*) NULL,
tskIDLE_PRIORITY + 2UL,
&task_handle);
@@ -200,6 +200,9 @@ static void launcher_task(void __attribute__ ((unused))*pvParameters)
i = 0;
leds_turn_off(LED_GREEN);
}
+
+ const float supply_voltage = analog_measure_12v();
+ usart_debug("12V monitor %dmV\r\n", (int32_t)(supply_voltage * 1000.0f));
}
}
@@ -237,9 +240,6 @@ static void detect_button_press(void __attribute__ ((unused))*pvParameters)
} else {
usart_debug_puts("No temp\r\n");
}
-
- const float supply_voltage = analog_measure_12v();
- usart_debug("12V monitor %f\r\n", supply_voltage);
}
else if (pin_high_count == 0 &&
last_pin_high_count != pin_high_count) {
diff --git a/src/glutt-o-logique/Makefile b/src/glutt-o-logique/Makefile
index b341ad1..8c7bf8b 100644
--- a/src/glutt-o-logique/Makefile
+++ b/src/glutt-o-logique/Makefile
@@ -36,9 +36,10 @@ BINHEX=outp.hex
###
# MCU FLAGS
MCFLAGS=-mcpu=cortex-m4 -mthumb -mlittle-endian \
--mfpu=fpv4-sp-d16 -mfloat-abi=softfp -mthumb-interwork
+ -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb-interwork \
+ -include stm32f4xx.h
# COMPILE FLAGS
-DEFS=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DARM_MATH_CM4 -D__FPU_PRESENT=1
+DEFS=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DARM_MATH_CM4
CWARNS += -Wextra
CWARNS += -Wformat
diff --git a/src/glutt-o-logique/analog_input.c b/src/glutt-o-logique/analog_input.c
index abf37dc..8b65cf8 100644
--- a/src/glutt-o-logique/analog_input.c
+++ b/src/glutt-o-logique/analog_input.c
@@ -53,7 +53,7 @@ void analog_init(void)
ADC_InitTypeDef ADC_InitStruct;
ADC_InitStruct.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStruct.ADC_ScanConvMode = DISABLE;
- ADC_InitStruct.ADC_ContinuousConvMode = DISABLE;
+ ADC_InitStruct.ADC_ContinuousConvMode = ENABLE;
ADC_InitStruct.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStruct.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1;
ADC_InitStruct.ADC_DataAlign = ADC_DataAlign_Right;
diff --git a/src/glutt-o-logique/main.c b/src/glutt-o-logique/main.c
index 8855141..4982dc5 100644
--- a/src/glutt-o-logique/main.c
+++ b/src/glutt-o-logique/main.c
@@ -25,6 +25,28 @@
#include "stm32f4xx_conf.h"
#include "leds.h"
+// This is a set of guards to make sure the FPU compile configuration
+// is correct
+#ifndef __FPU_USED
+# error "no __FPU_USED"
+#endif
+
+#ifndef __FPU_PRESENT
+# error "No __FPU_PRESENT"
+#endif
+
+#ifndef __GNUC__
+# error "No __GNUC__"
+#endif
+
+#ifndef __VFP_FP__
+# error "No VFP_FP"
+#endif
+
+#if defined(__SOFTFP__)
+# error "SOFTFP"
+#endif
+
void init(void);
void init()