diff options
author | Fabien Poussin <fabien.poussin@gmail.com> | 2019-09-17 19:43:24 +0200 |
---|---|---|
committer | Fabien Poussin <fabien.poussin@gmail.com> | 2019-09-18 11:49:12 +0200 |
commit | 6736a9099b184ba3fed01fb36e915d86ffa4f0da (patch) | |
tree | fc619a867cf39bc3a6a5f19dcf58cc296c9e2e8d /os/hal/ports/STM32/LLD/COMPv1 | |
parent | a8bd0ca9da23f75897fe466db179c3da34a8a946 (diff) | |
download | ChibiOS-Contrib-6736a9099b184ba3fed01fb36e915d86ffa4f0da.tar.gz ChibiOS-Contrib-6736a9099b184ba3fed01fb36e915d86ffa4f0da.tar.bz2 ChibiOS-Contrib-6736a9099b184ba3fed01fb36e915d86ffa4f0da.zip |
Fixes for STM32L4, Comp and eeprom.
Diffstat (limited to 'os/hal/ports/STM32/LLD/COMPv1')
-rw-r--r-- | os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c index 49bc6a7..b1dde2f 100644 --- a/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c +++ b/os/hal/ports/STM32/LLD/COMPv1/hal_comp_lld.c @@ -34,6 +34,14 @@ /* Driver local definitions. */ /*===========================================================================*/ +#ifndef COMP_CSR_EN +#define COMP_CSR_EN COMP_CSR_COMPxEN +#endif + +#ifndef COMP_CSR_POLARITY +#define COMP_CSR_POLARITY COMP_CSR_COMPxPOL +#endif + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ @@ -191,6 +199,8 @@ void comp_lld_init(void) { } +#if STM32_COMP_USE_INTERRUPTS + /** * @brief COMP1, COMP2, COMP3 interrupt handler. * @@ -369,6 +379,8 @@ void comp_ext_lld_channel_disable(COMPDriver *compp, uint32_t channel) { #endif } +#endif + /** * @brief Configures and activates the COMP peripheral. * @@ -379,11 +391,11 @@ void comp_ext_lld_channel_disable(COMPDriver *compp, uint32_t channel) { void comp_lld_start(COMPDriver *compp) { // Apply CSR Execpt the enable bit. - compp->reg->CSR = compp->config->csr & ~COMP_CSR_COMPxEN; + compp->reg->CSR = compp->config->csr & ~COMP_CSR_EN; // Inverted output if (compp->config->output_mode == COMP_OUTPUT_INVERTED) - compp->reg->CSR |= COMP_CSR_COMPxPOL; + compp->reg->CSR |= COMP_CSR_POLARITY; #if STM32_COMP_USE_INTERRUPTS #if STM32_COMP_USE_COMP1 @@ -500,7 +512,7 @@ void comp_lld_stop(COMPDriver *compp) { */ void comp_lld_enable(COMPDriver *compp) { - compp->reg->CSR |= COMP_CSR_COMPxEN; /* Enable */ + compp->reg->CSR |= COMP_CSR_EN; /* Enable */ } /** @@ -512,7 +524,7 @@ void comp_lld_enable(COMPDriver *compp) { */ void comp_lld_disable(COMPDriver *compp) { - compp->reg->CSR &= ~COMP_CSR_COMPxEN; /* Disable */ + compp->reg->CSR &= ~COMP_CSR_EN; /* Disable */ } #endif /* HAL_USE_COMP */ |