ANALOG_IO
|
ANALOG_IO.h
Go to the documentation of this file.
00001 00060 /*********************************************************************************************************************** 00061 * HEADER FILES 00062 **********************************************************************************************************************/ 00063 00064 #ifndef ANALOG_IO_H 00065 #define ANALOG_IO_H 00066 00067 #include <xmc_gpio.h> 00068 #include <DAVE_Common.h> 00069 #include "analog_io_conf.h" 00070 00071 /*********************************************************************************************************************** 00072 * MACROS 00073 **********************************************************************************************************************/ 00074 #if (!((XMC_LIB_MAJOR_VERSION == 2U) && \ 00075 (XMC_LIB_MINOR_VERSION >= 0U) && \ 00076 (XMC_LIB_PATCH_VERSION >= 0U))) 00077 #error "ANALOG_IO requires XMC Peripheral Library v2.0.0 or higher" 00078 #endif 00079 00080 /********************************************************************************************************************** 00081 * ENUMS 00082 **********************************************************************************************************************/ 00083 00092 typedef enum ANALOG_IO_STATUS 00093 { 00094 ANALOG_IO_STATUS_OK = 0U, 00095 ANALOG_IO_STATUS_FAILURE = 1U 00096 } ANALOG_IO_STATUS_t; 00097 00102 typedef enum ANALOG_IO_STATE 00103 { 00104 ANALOG_IO_STATE_NOT_INITIALIZED = 0, 00105 ANALOG_IO_STATE_INITIALIZED 00106 } ANALOG_IO_STATE_t; 00107 00108 00113 /********************************************************************************************************************** 00114 * DATA STRUCTURES 00115 **********************************************************************************************************************/ 00123 typedef void (*ANALOG_IO_CONFIG_PTR_t)(void); 00124 00128 typedef struct ANALOG_IO 00129 { 00130 ANALOG_IO_CONFIG_PTR_t config_ptr; 00131 ANALOG_IO_STATE_t *state; 00132 XMC_GPIO_PORT_t *port; 00133 uint8_t pin; 00134 } ANALOG_IO_t; 00135 00136 00141 /*********************************************************************************************************************** 00142 * LOCAL ROUTINES 00143 **********************************************************************************************************************/ 00144 00145 /********************************************************************************************************************** 00146 * API IMPLEMENTATION 00147 **********************************************************************************************************************/ 00148 00149 #ifdef __cplusplus 00150 extern "C" { 00151 #endif 00152 00198 DAVE_APP_VERSION_t ANALOG_IO_GetAppVersion(void); 00199 00239 ANALOG_IO_STATUS_t ANALOG_IO_Init(const ANALOG_IO_t *const handle); 00240 00241 00290 __STATIC_INLINE uint32_t ANALOG_IO_GetInput(const ANALOG_IO_t *const handler) 00291 { 00292 XMC_ASSERT("ANALOG_IO_GetInput: handler null pointer", handler != NULL); 00293 return XMC_GPIO_GetInput(handler->port, handler->pin); 00294 } 00295 00299 #ifdef __cplusplus 00300 } 00301 #endif 00302 00303 /* Include APP extern file */ 00304 #include "analog_io_extern.h" 00305 00306 00307 #endif /* ANALOG_IO_H */