1 /*******************************************************************************
2 * File Name: cyhal_clock_impl.h
3 *
4 * Description:
5 * Device specific implementation for clocks API.
6 *
7 ********************************************************************************
8 * \copyright
9 * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or
10 * an affiliate of Cypress Semiconductor Corporation
11 *
12 * SPDX-License-Identifier: Apache-2.0
13 *
14 * Licensed under the Apache License, Version 2.0 (the "License");
15 * you may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at
17 *
18 *     http://www.apache.org/licenses/LICENSE-2.0
19 *
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
25 *******************************************************************************/
26 
27 #pragma once
28 
29 #include "cyhal_hw_resources.h"
30 
31 #if defined(__cplusplus)
32 extern "C"
33 {
34 #endif
35 
36 /**
37  * \ingroup group_hal_impl_adc
38  * \{
39  * \section group_hal_impl_adc_interconnect Interconnect
40  * In PSoC™ each ADC has a single input trigger which, when activated, will
41  * initiate an ADC scan. Each ADC also has an output trigger which will be
42  * activated when a scan is completed.
43  */
44 
45 /** Convert all samples to be averaged back to back, before proceeding to the next channel.
46   * This is the default behavior. */
47 #define CYHAL_ADC_AVG_MODE_SEQUENTIAL (1u << (CYHAL_ADC_AVG_MODE_MAX_SHIFT + 1u))
48 
49 #if defined(CY_IP_MXS40PASS_SAR_INSTANCES)
50 /** Convert one sample to be averaged per scan, interleaved with the rest of the channels.
51   * This maintains a consistent spacing of samples regardless of whether samples are averaged
52   * or not. However, it also means that a new value will only be provided once every n scans,
53   * where n is the configured averaging count. At the conclusion of any other scan, the read
54   * operation will return the same value as the previous scan. The application is responsible
55   * for keeping tracks of the scans on which the value will be updated.
56   * \note This mode is incompatible with \ref CYHAL_ADC_AVG_MODE_ACCUMULATE
57   * \note In this mode, the averaging count should be set to less than 16 to avoid overflowing
58   * the working register that is used to accumulate intermediate results.
59   */
60 #define CYHAL_ADC_AVG_MODE_INTERLEAVED (1u << (CYHAL_ADC_AVG_MODE_MAX_SHIFT + 2u))
61 #endif
62 
63 /** \} group_hal_impl_adc */
64 
65 #if defined(__cplusplus)
66 }
67 #endif
68