ANALOG_IO
|
Methods
DAVE_APP_VERSION_t | ANALOG_IO_GetAppVersion (void) |
Get ANALOG_IO APP version. | |
ANALOG_IO_STATUS_t | ANALOG_IO_Init (const ANALOG_IO_t *const handle) |
Function to initialize the port pin as per UI settings. | |
__STATIC_INLINE uint32_t | ANALOG_IO_GetInput (const ANALOG_IO_t *const handler) |
Function to read input level of port pin. |
Methods
Function Documentation
DAVE_APP_VERSION_t ANALOG_IO_GetAppVersion | ( | void | ) |
Get ANALOG_IO APP version.
- Returns:
- DAVE_APP_VERSION_t APP version information (major, minor and patch number)
- Description:
- The function can be used to check application software compatibility with a specific version of the APP.
Example Usage:
#include <DAVE.h> int main(void) { DAVE_STATUS_t init_status; DAVE_APP_VERSION_t version; // Initialize ANALOG_IO APP: // ANALOG_IO_Init() is called from within DAVE_Init(). init_status = DAVE_Init(); if(init_status == DAVE_STATUS_SUCCESS) { version = ANALOG_IO_GetAppVersion(); if (version.major != 4U) { // Probably, not the right version. } } // More code here while(1) { } return (1); }
Definition at line 78 of file ANALOG_IO.c.
__STATIC_INLINE uint32_t ANALOG_IO_GetInput | ( | const ANALOG_IO_t *const | handler | ) |
Function to read input level of port pin.
- Parameters:
-
handler Pointer pointing to APP data structure. Refer ANALOG_IO_t for details.
- Returns:
- uint32_t input logic level. Range:0-1
- Description:
- This function reads the Pn_IN register and returns the current logical value at the GPIO pin.
- Related APIs:
- None
Example Usage:
#include <DAVE.h>//Declarations from DAVE Code Generation (includes SFR declaration) int main(void) { DAVE_STATUS_t status; uint32_t pin_status; status = DAVE_Init(); // (DAVE_STATUS_t)ANALOG_IO_Init(&ANALOG_IO_0) is called within DAVE_Init() if(status == DAVE_STATUS_SUCCESS) { XMC_DEBUG("DAVE Apps initialization success\n"); } else { XMC_DEBUG(("DAVE Apps initialization failed with status %d\n", status)); while(1U) { } } //Placeholder for user application code. The while loop below can be replaced with user application code. while(1U) { pin_status = ANALOG_IO_GetInput(&ANALOG_IO_0); if(pin_status == 1) { // Add application code here } else { // Add application code here } } return (1); }
Definition at line 290 of file ANALOG_IO.h.
References ANALOG_IO::pin, and ANALOG_IO::port.
ANALOG_IO_STATUS_t ANALOG_IO_Init | ( | const ANALOG_IO_t *const | handle | ) |
Function to initialize the port pin as per UI settings.
- Parameters:
-
handler Pointer pointing to APP data structure. Refer ANALOG_IO_t for details.
- Returns:
- ANALOG_IO_STATUS_t ANALOG_IO APP status. Refer ANALOG_IO_STATUS_t structure for details.
- Description:
- This function initializes GPIO port registers IOCR,HWSEL to configure pin direction and driver strength/hysteresis.
- Related APIs:
- None
Example Usage:
#include <DAVE.h>//Declarations from DAVE Code Generation (includes SFR declaration) int main(void) { DAVE_STATUS_t status; status = DAVE_Init(); //(DAVE_STATUS_t)ANALOG_IO_Init(&ANALOG_IO_0) is called within DAVE_Init() if(status == DAVE_STATUS_SUCCESS) { XMC_DEBUG("DAVE Apps initialization success\n"); } else { XMC_DEBUG(("DAVE Apps initialization failed with status %d\n", status)); while(1U) { } } //Placeholder for user application code. The while loop below can be replaced with user application code. while(1U) { } return 1U; }
Description : Function to initialize the analog port pin properties.
Input Parameter : Handler Pointer pointing to APP data structure. Output Parameter : ANALOG_IO_STATUS_t (ANALOG_IO APP initialization status).
Definition at line 96 of file ANALOG_IO.c.
References ANALOG_IO_STATE_INITIALIZED, ANALOG_IO_STATE_NOT_INITIALIZED, ANALOG_IO_STATUS_OK, ANALOG_IO::config_ptr, and ANALOG_IO::state.