Changed the STM32 Analog Comparator driver.

This commit is contained in:
Daniel P. Carvalho 2021-06-17 12:32:46 -03:00 committed by Xiang Xiao
parent b83769feb7
commit 91e82d1597
6 changed files with 1158 additions and 1056 deletions

View File

@ -1553,6 +1553,7 @@ config STM32_STM32F33XX
select STM32_HAVE_IP_DBGMCU_V2
select STM32_HAVE_IP_TIMERS_V2
select STM32_HAVE_IP_ADC_V2
select STM32_HAVE_IP_COMP_V1
select STM32_HAVE_IP_DMA_V1
select STM32_HAVE_IP_I2C_V2
@ -2616,6 +2617,10 @@ config STM32_HAVE_IP_ADC_V2_BASIC
default n
select STM32_HAVE_IP_ADC_V2
config STM32_HAVE_IP_COMP_V1
bool
default n
# These are the peripheral selections proper
config STM32_ADC1

View File

@ -0,0 +1,52 @@
/****************************************************************************
* arch/arm/src/stm32/hardware/stm32_comp.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32_HARDWARE_STM32_COMP_H
#define __ARCH_ARM_SRC_STM32_HARDWARE_STM32_COMP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
#ifdef CONFIG_STM32_COMP
/* Include the correct COMP register definitions for
* selected STM32 COMP IP core:
*/
/* If more than one COMP IP ensure that only one is selected */
#if defined(CONFIG_STM32_HAVE_IP_COMP_V1)
# if defined(CONFIG_STM32_STM32F33XX)
# include "stm32f33xxx_comp.h"
# else
# error "Device not supported."
# endif
#else
# error "STM32 COMP IP not supported."
#endif
#endif /* CONFIG_STM32_COMP */
#endif /* __ARCH_ARM_SRC_STM32_HARDWARE_STM32_COMP_H */

View File

@ -18,8 +18,8 @@
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32_HARDWARE_STM32_COMP_H
#define __ARCH_ARM_SRC_STM32_HARDWARE_STM32_COMP_H
#ifndef __ARCH_ARM_SRC_STM32_HARDWARE_STM32F33XXX_COMP_H
#define __ARCH_ARM_SRC_STM32_HARDWARE_STM32F33XXX_COMP_H
/****************************************************************************
* Included Files
@ -33,6 +33,14 @@
* Pre-processor Definitions
****************************************************************************/
/* This is implementation for STM32 COMP IP version 1. Supported devices
* - STM32F33XX
*/
#define HAVE_IP_COMP_V1 1
/* TODO: Undef other STM32 COMP IP versions */
/* Register Offsets *********************************************************/
#define STM32_COMP2_CSR_OFFSET 0x0020 /* COMP2 Control register */
@ -105,4 +113,4 @@
#define COMP_CSR_OUT (1 << 30) /* Bit 30: comparator output */
#define COMP_CSR_LOCK (1 << 31) /* Bit 31: comparator lock */
#endif /* __ARCH_ARM_SRC_STM32_HARDWARE_STM32_COMP_H */
#endif /* __ARCH_ARM_SRC_STM32_HARDWARE_STM32F33XXX_COMP_H */

File diff suppressed because it is too large Load Diff

View File

@ -29,15 +29,9 @@
#include "chip.h"
#ifdef CONFIG_STM32_COMP
#include "hardware/stm32_comp.h"
#if defined(CONFIG_STM32_STM32F30XX)
# error "COMP support for STM32F30XX not implemented yet"
#elif defined(CONFIG_STM32_STM32F33XX)
# include "hardware/stm32f33xxx_comp.h"
#elif defined(CONFIG_STM32_STM32F37XX)
# error "COMP support for STM32F37XX not implemented yet"
#endif
#ifdef CONFIG_STM32_COMP
/****************************************************************************
* Pre-processor definitions

File diff suppressed because it is too large Load Diff