Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more
ain.h
00001 /***************************************************************************//** 00002 * @file ain.h 00003 * @author PMallick (Pratyush.Mallick@analog.com) 00004 ******************************************************************************** 00005 * Copyright (c) 2021 Analog Devices, Inc. 00006 * All rights reserved. 00007 * 00008 * This software is proprietary to Analog Devices, Inc. and its licensors. 00009 * By using this software you agree to the terms of the associated 00010 * Analog Devices Software License Agreement. 00011 *******************************************************************************/ 00012 00013 #ifndef AIN_H 00014 #define AIN_H 00015 00016 /******************************************************************************/ 00017 /***************************** Include Files **********************************/ 00018 /******************************************************************************/ 00019 00020 #include <stdint.h> 00021 00022 /******************************************************************************/ 00023 /********************** Macros and Constants Definitions **********************/ 00024 /******************************************************************************/ 00025 00026 /******************************************************************************/ 00027 /*************************** Types Declarations *******************************/ 00028 /******************************************************************************/ 00029 /** 00030 * @struct ain_init_param 00031 * @brief Structure holding parameters for analog input initialization 00032 */ 00033 struct ain_init_param { 00034 /* Analog input pin number */ 00035 int32_t number; 00036 /* Analog input reference voltage */ 00037 float vref; 00038 /* Analog input platform specific functions */ 00039 const struct ain_platform_ops *platform_ops; 00040 }; 00041 00042 /** 00043 * @struct ain_desc 00044 * @brief Structure holding analog input descriptor 00045 */ 00046 struct ain_desc { 00047 /* Analog input pin number */ 00048 int32_t number; 00049 /* Analog input reference voltage */ 00050 float vref; 00051 /* Analog input platform specific functions */ 00052 const struct ain_platform_ops *platform_ops; 00053 /* Analog extra parameters (device specific) */ 00054 void *extra; 00055 }; 00056 00057 /** 00058 * @struct ain_platform_ops 00059 * @brief Structure holding analog input function pointers that 00060 * point to the platform specific function 00061 */ 00062 struct ain_platform_ops { 00063 /** Analog input initialization function pointer */ 00064 int32_t(*init)(struct ain_desc **, const struct ain_init_param *); 00065 /** Analog input read function pointer */ 00066 int32_t(*read)(struct ain_desc *, float *); 00067 /** Analog input remove function pointer */ 00068 int32_t(*remove)(struct ain_desc *); 00069 }; 00070 00071 /******************************************************************************/ 00072 /************************ Functions Declarations ******************************/ 00073 /******************************************************************************/ 00074 /* Read analog input voltage */ 00075 int32_t ain_get_voltage(struct ain_desc *desc, float *value); 00076 00077 /* Initialize the analog input pin */ 00078 int32_t ain_init(struct ain_desc **desc, 00079 const struct ain_init_param *param); 00080 00081 /* Free the resources allocated by ain_init() */ 00082 int32_t ain_remove(struct ain_desc *desc); 00083 00084 #endif
Generated on Wed Jul 13 2022 14:37:51 by
