|
| 1 | +/** |
| 2 | + ******************************************************************************* |
| 3 | + * @file txz_adc_ch.h |
| 4 | + * @brief This file provides all the functions prototypes for ADC driver. \n |
| 5 | + * Channel Class. |
| 6 | + * @version V1.0.0 |
| 7 | + * |
| 8 | + * DO NOT USE THIS SOFTWARE WITHOUT THE SOFTWARE LICENSE AGREEMENT. |
| 9 | + * |
| 10 | + * Copyright(C) TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2021 |
| 11 | + * SPDX-License-Identifier: Apache-2.0 |
| 12 | + * |
| 13 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 14 | + * you may not use this file except in compliance with the License. |
| 15 | + * You may obtain a copy of the License at |
| 16 | + * |
| 17 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 18 | + * |
| 19 | + * Unless required by applicable law or agreed to in writing, software |
| 20 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 21 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 22 | + * See the License for the specific language governing permissions and |
| 23 | + * limitations under the License. |
| 24 | + ******************************************************************************* |
| 25 | + */ |
| 26 | +/*------------------------------------------------------------------------------*/ |
| 27 | +/* Define to prevent recursive inclusion */ |
| 28 | +/*------------------------------------------------------------------------------*/ |
| 29 | +#ifndef __ADC_CH_H |
| 30 | +#define __ADC_CH_H |
| 31 | + |
| 32 | +#ifdef __cplusplus |
| 33 | +extern "C" { |
| 34 | +#endif |
| 35 | + |
| 36 | +/*------------------------------------------------------------------------------*/ |
| 37 | +/* Includes */ |
| 38 | +/*------------------------------------------------------------------------------*/ |
| 39 | +#include "txz_driver_def.h" |
| 40 | + |
| 41 | +/** |
| 42 | + * @addtogroup Periph_Driver Peripheral Driver |
| 43 | + * @{ |
| 44 | + */ |
| 45 | + |
| 46 | +/** |
| 47 | + * @defgroup ADC ADC |
| 48 | + * @brief ADC Driver. |
| 49 | + * @{ |
| 50 | + */ |
| 51 | +/*------------------------------------------------------------------------------*/ |
| 52 | +/* Macro Definition */ |
| 53 | +/*------------------------------------------------------------------------------*/ |
| 54 | +/** |
| 55 | + * @defgroup ADC_Exported_define ADC Exported Define |
| 56 | + * @{ |
| 57 | + */ |
| 58 | + |
| 59 | +/* no define */ |
| 60 | + |
| 61 | +/** |
| 62 | + * @} |
| 63 | + */ /* End of group ADC_Exported_define */ |
| 64 | + |
| 65 | +/*------------------------------------------------------------------------------*/ |
| 66 | +/* Enumerated Type Definition */ |
| 67 | +/*------------------------------------------------------------------------------*/ |
| 68 | +/** |
| 69 | + * @defgroup ADC_Exported_define ADC Exported Define |
| 70 | + * @{ |
| 71 | + */ |
| 72 | + |
| 73 | +/* no define */ |
| 74 | + |
| 75 | +/** |
| 76 | + * @} |
| 77 | + */ /* End of group ADC_Exported_define */ |
| 78 | + |
| 79 | +/*------------------------------------------------------------------------------*/ |
| 80 | +/* Structure Definition */ |
| 81 | +/*------------------------------------------------------------------------------*/ |
| 82 | +/** |
| 83 | + * @defgroup ADC_Exported_typedef ADC Exported Typedef |
| 84 | + * @{ |
| 85 | + */ |
| 86 | + |
| 87 | +/*----------------------------------*/ |
| 88 | +/*! @struct adc_ch_initial_setting_t |
| 89 | + * @brief Initialize Setting. |
| 90 | +*/ |
| 91 | +/*----------------------------------*/ |
| 92 | +typedef struct { |
| 93 | + uint32_t interrupt; /*!< Interrupt Enable/Disable. |
| 94 | + : Use @ref adc_dma_int_t. */ |
| 95 | + uint32_t type; /*!< Conversion Type. |
| 96 | + : Use @ref adc_conversion_t. */ |
| 97 | + uint32_t ain; /*!< AIN. */ |
| 98 | +} adc_ch_initial_setting_t; |
| 99 | + |
| 100 | +/*----------------------------------*/ |
| 101 | +/*! @struct adc_ch_t |
| 102 | + * @brief ADC handle structure definition. |
| 103 | +*/ |
| 104 | +/*----------------------------------*/ |
| 105 | +typedef struct { |
| 106 | + __IO uint32_t *p_tset; /*!< ADxTSETn Address. */ |
| 107 | + __I uint32_t *p_reg; /*!< ADxREGx Address. */ |
| 108 | + adc_ch_initial_setting_t init; /*!< Initial setting. */ |
| 109 | +} adc_ch_t; |
| 110 | + |
| 111 | +/** |
| 112 | + * @} |
| 113 | + */ /* End of group ADC_Exported_typedef */ |
| 114 | + |
| 115 | +/*------------------------------------------------------------------------------*/ |
| 116 | +/* Functions */ |
| 117 | +/*------------------------------------------------------------------------------*/ |
| 118 | +/** |
| 119 | + * @defgroup ADC_Exported_functions ADC Exported Functions |
| 120 | + * @{ |
| 121 | + */ |
| 122 | +uint32_t get_conversion_data(uint32_t reg); |
| 123 | +TXZ_Result adc_ch_init(adc_ch_t *p_obj); |
| 124 | +TXZ_Result adc_ch_deinit(adc_ch_t *p_obj); |
| 125 | +TXZ_Result adc_ch_int_enable(adc_ch_t *p_obj); |
| 126 | +TXZ_Result adc_ch_int_disable(adc_ch_t *p_obj); |
| 127 | +TXZ_Result adc_ch_get_value(adc_ch_t *p_obj, uint32_t *p_value); |
| 128 | +/** |
| 129 | + * @} |
| 130 | + */ /* End of group ADC_Exported_functions */ |
| 131 | + |
| 132 | +/** |
| 133 | + * @} |
| 134 | + */ /* End of group ADC */ |
| 135 | + |
| 136 | +/** |
| 137 | + * @} |
| 138 | + */ /* End of group Periph_Driver */ |
| 139 | + |
| 140 | +#ifdef __cplusplus |
| 141 | +} |
| 142 | +#endif /* __cplusplus */ |
| 143 | +#endif /* __ADC_CH_H */ |
| 144 | + |
| 145 | + |
0 commit comments