aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Poussin <fabien.poussin@gmail.com>2017-02-07 15:46:43 +0100
committerFabien Poussin <fabien.poussin@gmail.com>2017-02-07 15:46:43 +0100
commit8b7e318d784ff0c724c3564dc4313ba14061223e (patch)
tree17bca664e6ba6dac2d46492b37e1959ae5e57772
parent1d10f06ab48c8d7a52f50825097aade45710fb10 (diff)
downloadChibiOS-Contrib-8b7e318d784ff0c724c3564dc4313ba14061223e.tar.gz
ChibiOS-Contrib-8b7e318d784ff0c724c3564dc4313ba14061223e.tar.bz2
ChibiOS-Contrib-8b7e318d784ff0c724c3564dc4313ba14061223e.zip
[Comp] Adding more defines
-rw-r--r--os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h45
-rw-r--r--testhal/STM32/STM32F3xx/COMP/main.c2
2 files changed, 46 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h
index da3ffab..68c6bd0 100644
--- a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h
+++ b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.h
@@ -127,6 +127,51 @@
#define STM32_COMP_Output_TIM17OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 OCREF Clear */
#define STM32_COMP_Output_TIM17BKIN ((uint32_t)0x00002C00) /*!< COMP output connected to TIM16 Break Input (BKIN) */
+/* No blanking source can be selected for all comparators */
+#define STM32_COMP_BlankingSrce_None ((uint32_t)0x00000000) /*!< No blanking source */
+
+/* Blanking source common for COMP1, COMP2, COMP3 and COMP7 */
+#define STM32_COMP_BlankingSrce_TIM1OC5 COMP_CSR_COMPxBLANKING_0 /*!< TIM1 OC5 selected as blanking source for compartor */
+
+/* Blanking source common for COMP1 and COMP2 */
+#define STM32_COMP_BlankingSrce_TIM2OC3 COMP_CSR_COMPxBLANKING_1 /*!< TIM2 OC5 selected as blanking source for compartor */
+
+/* Blanking source common for COMP1, COMP2 and COMP5 */
+#define STM32_COMP_BlankingSrce_TIM3OC3 ((uint32_t)0x000C0000) /*!< TIM2 OC3 selected as blanking source for compartor */
+
+/* Blanking source common for COMP3 and COMP6 */
+#define STM32_COMP_BlankingSrce_TIM2OC4 ((uint32_t)0x000C0000) /*!< TIM2 OC4 selected as blanking source for compartor */
+
+/* Blanking source common for COMP4, COMP5, COMP6 and COMP7 */
+#define STM32_COMP_BlankingSrce_TIM8OC5 COMP_CSR_COMPxBLANKING_1 /*!< TIM8 OC5 selected as blanking source for compartor */
+
+/* Blanking source for COMP4 */
+#define STM32_COMP_BlankingSrce_TIM3OC4 COMP_CSR_COMPxBLANKING_0 /*!< TIM3 OC4 selected as blanking source for compartor */
+#define STM32_COMP_BlankingSrce_TIM15OC1 ((uint32_t)0x000C0000) /*!< TIM15 OC1 selected as blanking source for compartor */
+
+/* Blanking source common for COMP6 and COMP7 */
+#define STM32_COMP_BlankingSrce_TIM15OC2 COMP_CSR_COMPxBLANKING_2 /*!< TIM15 OC2 selected as blanking source for compartor */
+
+#define STM32_COMP_OutputPol_NonInverted ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
+#define STM32_COMP_OutputPol_Inverted COMP_CSR_COMPxPOL /*!< COMP output on GPIO is inverted */
+
+#define STM32_COMP_Hysteresis_No 0x00000000 /*!< No hysteresis */
+#define STM32_COMP_Hysteresis_Low COMP_CSR_COMPxHYST_0 /*!< Hysteresis level low */
+#define STM32_COMP_Hysteresis_Medium COMP_CSR_COMPxHYST_1 /*!< Hysteresis level medium */
+#define STM32_COMP_Hysteresis_High COMP_CSR_COMPxHYST /*!< Hysteresis level high */
+
+#define STM32_COMP_Mode_HighSpeed 0x00000000 /*!< High Speed */
+#define STM32_COMP_Mode_MediumSpeed COMP_CSR_COMPxMODE_0 /*!< Medium Speed */
+#define STM32_COMP_Mode_LowPower COMP_CSR_COMPxMODE_1 /*!< Low power mode */
+#define STM32_COMP_Mode_UltraLowPower COMP_CSR_COMPxMODE /*!< Ultra-low power mode */
+
+/* When output polarity is not inverted, comparator output is high when
+ the non-inverting input is at a higher voltage than the inverting input */
+#define STM32_COMP_OutputLevel_High COMP_CSR_COMPxOUT
+/* When output polarity is not inverted, comparator output is low when
+ the non-inverting input is at a lower voltage than the inverting input*/
+#define STM32_COMP_OutputLevel_Low ((uint32_t)0x00000000)
+
#if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F303x8) \
|| defined(STM32F318xx) || defined(STM32F328xx) || defined(STM32F334x8)
diff --git a/testhal/STM32/STM32F3xx/COMP/main.c b/testhal/STM32/STM32F3xx/COMP/main.c
index 06b35d3..eb1e1c0 100644
--- a/testhal/STM32/STM32F3xx/COMP/main.c
+++ b/testhal/STM32/STM32F3xx/COMP/main.c
@@ -34,7 +34,7 @@ void comp4_cb(COMPDriver *comp) {
static const COMPConfig comp2_conf = {
COMP_OUTPUT_NORMAL,
comp2_cb,
- STM32_COMP_InvertingInput_VREFINT // CSR
+ STM32_COMP_InvertingInput_VREFINT || STM32_COMP_Hysteresis_High // CSR
};
static const COMPConfig comp4_conf = {