aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorFabien Poussin <fabien.poussin@gmail.com>2019-01-31 17:52:13 +0100
committerFabien Poussin <fabien.poussin@gmail.com>2019-01-31 17:52:13 +0100
commit6076bdf27d3c70675dff3b1866a3bbc82aa1eb00 (patch)
treedc3a31358975a3594ce7c59d6ec5a6afa496d13c /testhal
parentbdcee915863d3f4bcc561c192cef1155e1f65b02 (diff)
downloadChibiOS-Contrib-6076bdf27d3c70675dff3b1866a3bbc82aa1eb00.tar.gz
ChibiOS-Contrib-6076bdf27d3c70675dff3b1866a3bbc82aa1eb00.tar.bz2
ChibiOS-Contrib-6076bdf27d3c70675dff3b1866a3bbc82aa1eb00.zip
Updating OpAmp code with calibration functions, cleaning.
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/STM32F3xx/OPAMP/main.c9
-rw-r--r--testhal/STM32/STM32F3xx/OPAMP/mcuconf_community.h1
2 files changed, 6 insertions, 4 deletions
diff --git a/testhal/STM32/STM32F3xx/OPAMP/main.c b/testhal/STM32/STM32F3xx/OPAMP/main.c
index 2bdb755..39af13c 100644
--- a/testhal/STM32/STM32F3xx/OPAMP/main.c
+++ b/testhal/STM32/STM32F3xx/OPAMP/main.c
@@ -83,10 +83,10 @@ static const GPTConfig gpt6cfg1 = {
* We will double the input voltage
*/
static const OPAMPConfig opamp1_conf = {
- STM32_OPAMP_NonInvertingInput_IO4 | // INP connectd to PA1
- STM32_OPAMP_InvertingInput_PGA | // INM connected to PGA
- STM32_OPAMP_PGAGain_2 | // Gain of 2x
- STM32_OPAMP_PGAConnect_No // PGA connected to ground
+ OPAMP1_CSR_VPSEL_PA01 | // INP connectd to PA1
+ OPAMP1_CSR_VMSEL_PGA | // INM connected to PGA
+ OPAMPx_CSR_PGAGAIN_x2 | // Gain of 2x
+ OPAMPx_CSR_PGACONNECT_GROUND // PGA connected to ground
};
/*
@@ -118,6 +118,7 @@ int main(void) {
gptStartContinuous(&GPTD6, 2U);
opampEnable(&OPAMPD1);
+ opampCalibrate();
/*
* Normal main() thread activity.
diff --git a/testhal/STM32/STM32F3xx/OPAMP/mcuconf_community.h b/testhal/STM32/STM32F3xx/OPAMP/mcuconf_community.h
index 76f9429..2f44dc1 100644
--- a/testhal/STM32/STM32F3xx/OPAMP/mcuconf_community.h
+++ b/testhal/STM32/STM32F3xx/OPAMP/mcuconf_community.h
@@ -92,6 +92,7 @@
#define STM32_OPAMP_USE_OPAMP2 TRUE
#define STM32_OPAMP_USE_OPAMP3 TRUE
#define STM32_OPAMP_USE_OPAMP4 TRUE
+#define STM32_OPAMP_USER_TRIM_ENABLED TRUE
/*
* USBH driver system settings.