|
| 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 Device Solutions Corporation 2021 |
| 11 | + ******************************************************************************* |
| 12 | + */ |
| 13 | +/*------------------------------------------------------------------------------*/ |
| 14 | +/* Define to prevent recursive inclusion */ |
| 15 | +/*------------------------------------------------------------------------------*/ |
| 16 | +#ifndef __ADC_CH_H |
| 17 | +#define __ADC_CH_H |
| 18 | + |
| 19 | +#ifdef __cplusplus |
| 20 | +extern "C" { |
| 21 | +#endif |
| 22 | + |
| 23 | +/*------------------------------------------------------------------------------*/ |
| 24 | +/* Includes */ |
| 25 | +/*------------------------------------------------------------------------------*/ |
| 26 | +#include "txz_driver_def.h" |
| 27 | + |
| 28 | +/** |
| 29 | + * @addtogroup Periph_Driver Peripheral Driver |
| 30 | + * @{ |
| 31 | + */ |
| 32 | + |
| 33 | +/** |
| 34 | + * @defgroup ADC ADC |
| 35 | + * @brief ADC Driver. |
| 36 | + * @{ |
| 37 | + */ |
| 38 | +/*------------------------------------------------------------------------------*/ |
| 39 | +/* Macro Definition */ |
| 40 | +/*------------------------------------------------------------------------------*/ |
| 41 | +/** |
| 42 | + * @defgroup ADC_Exported_define ADC Exported Define |
| 43 | + * @{ |
| 44 | + */ |
| 45 | + |
| 46 | +/* no define */ |
| 47 | + |
| 48 | +/** |
| 49 | + * @} |
| 50 | + */ /* End of group ADC_Exported_define */ |
| 51 | + |
| 52 | +/*------------------------------------------------------------------------------*/ |
| 53 | +/* Enumerated Type Definition */ |
| 54 | +/*------------------------------------------------------------------------------*/ |
| 55 | +/** |
| 56 | + * @defgroup ADC_Exported_define ADC Exported Define |
| 57 | + * @{ |
| 58 | + */ |
| 59 | + |
| 60 | +/* no define */ |
| 61 | + |
| 62 | +/** |
| 63 | + * @} |
| 64 | + */ /* End of group ADC_Exported_define */ |
| 65 | + |
| 66 | +/*------------------------------------------------------------------------------*/ |
| 67 | +/* Structure Definition */ |
| 68 | +/*------------------------------------------------------------------------------*/ |
| 69 | +/** |
| 70 | + * @defgroup ADC_Exported_typedef ADC Exported Typedef |
| 71 | + * @{ |
| 72 | + */ |
| 73 | + |
| 74 | +/*----------------------------------*/ |
| 75 | +/*! @struct adc_ch_initial_setting_t |
| 76 | + * @brief Initialize Setting. |
| 77 | +*/ |
| 78 | +/*----------------------------------*/ |
| 79 | +typedef struct { |
| 80 | + uint32_t interrupt; /*!< Interrupt Enable/Disable. |
| 81 | + : Use @ref adc_dma_int_t. */ |
| 82 | + uint32_t type; /*!< Conversion Type. |
| 83 | + : Use @ref adc_conversion_t. */ |
| 84 | + uint32_t ain; /*!< AIN. */ |
| 85 | +} adc_ch_initial_setting_t; |
| 86 | + |
| 87 | +/*----------------------------------*/ |
| 88 | +/*! @struct adc_ch_t |
| 89 | + * @brief ADC handle structure definition. |
| 90 | +*/ |
| 91 | +/*----------------------------------*/ |
| 92 | +typedef struct { |
| 93 | + __IO uint32_t *p_tset; /*!< ADxTSETn Address. */ |
| 94 | + __I uint32_t *p_reg; /*!< ADxREGx Address. */ |
| 95 | + adc_ch_initial_setting_t init; /*!< Initial setting. */ |
| 96 | +} adc_ch_t; |
| 97 | + |
| 98 | +/** |
| 99 | + * @} |
| 100 | + */ /* End of group ADC_Exported_typedef */ |
| 101 | + |
| 102 | +/*------------------------------------------------------------------------------*/ |
| 103 | +/* Functions */ |
| 104 | +/*------------------------------------------------------------------------------*/ |
| 105 | +/** |
| 106 | + * @defgroup ADC_Exported_functions ADC Exported Functions |
| 107 | + * @{ |
| 108 | + */ |
| 109 | +uint32_t get_conversion_data(uint32_t reg); |
| 110 | +TXZ_Result adc_ch_init(adc_ch_t *p_obj); |
| 111 | +TXZ_Result adc_ch_deinit(adc_ch_t *p_obj); |
| 112 | +TXZ_Result adc_ch_int_enable(adc_ch_t *p_obj); |
| 113 | +TXZ_Result adc_ch_int_disable(adc_ch_t *p_obj); |
| 114 | +TXZ_Result adc_ch_get_value(adc_ch_t *p_obj, uint32_t *p_value); |
| 115 | +/** |
| 116 | + * @} |
| 117 | + */ /* End of group ADC_Exported_functions */ |
| 118 | + |
| 119 | +/** |
| 120 | + * @} |
| 121 | + */ /* End of group ADC */ |
| 122 | + |
| 123 | +/** |
| 124 | + * @} |
| 125 | + */ /* End of group Periph_Driver */ |
| 126 | + |
| 127 | +#ifdef __cplusplus |
| 128 | +} |
| 129 | +#endif /* __cplusplus */ |
| 130 | +#endif /* __ADC_CH_H */ |
| 131 | + |
| 132 | + |
0 commit comments