DIGITAL_IO
|
DAVE_APP_VERSION_t | DIGITAL_IO_GetAppVersion (void) |
Get DIGITAL_IO APP version. | |
DIGITAL_IO_STATUS_t | DIGITAL_IO_Init (const DIGITAL_IO_t *const handler) |
Function to initialize the port pin as per UI settings. | |
__STATIC_INLINE void | DIGITAL_IO_SetOutputHigh (const DIGITAL_IO_t *const handler) |
Function to set port pin high. | |
__STATIC_INLINE void | DIGITAL_IO_SetOutputLow (const DIGITAL_IO_t *const handler) |
Function to reset port pin. | |
__STATIC_INLINE void | DIGITAL_IO_ToggleOutput (const DIGITAL_IO_t *const handler) |
Function to Toggle port pin. | |
__STATIC_INLINE uint32_t | DIGITAL_IO_GetInput (const DIGITAL_IO_t *const handler) |
Function to read input level of port pin. |
Methods
Function Documentation
DAVE_APP_VERSION_t DIGITAL_IO_GetAppVersion | ( | void | ) |
Get DIGITAL_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 DIGITAL_IO APP: // DIGITAL_IO_Init() is called from within DAVE_Init(). init_status = DAVE_Init(); if(init_status == DAVE_STATUS_SUCCESS) { version = DIGITAL_IO_GetAppVersion(); if (version.major != 4U) { // Probably, not the right version. } } // More code here while(1) { } return (1); }
- Returns:
- DAVE_APP_VERSION_t APP version information (major, minor and patch number)
Definition at line 77 of file DIGITAL_IO.c.
__STATIC_INLINE uint32_t DIGITAL_IO_GetInput | ( | const DIGITAL_IO_t *const | handler | ) |
Function to read input level of port pin.
- Parameters:
-
handler Pointer pointing to APP data structure. Refer DIGITAL_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)DIGITAL_IO_Init(&DIGITAL_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 = DIGITAL_IO_GetInput(&DIGITAL_IO_0); if(pin_status == 1) { // Add application code here } else { // Add application code here } } return (1); }
Definition at line 419 of file DIGITAL_IO.h.
References DIGITAL_IO::gpio_pin, and DIGITAL_IO::gpio_port.
DIGITAL_IO_STATUS_t DIGITAL_IO_Init | ( | const DIGITAL_IO_t *const | handler | ) |
Function to initialize the port pin as per UI settings.
- Parameters:
-
handler Pointer pointing to APP data structure. Refer DIGITAL_IO_t for details.
- Returns:
- DIGITAL_IO_STATUS_t DIGITAL_IO APP status. Refer DIGITAL_IO_STATUS_t structure for details.
- Description:
- This function initializes GPIO port registers IOCR,PDISC,OMR,PDR/PHCR to configure pin direction,initial output level, and pad 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)DIGITAL_IO_Init(&DIGITAL_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; }
- Parameters:
-
handler Pointer pointing to APP data structure.
- Returns:
- DIGITAL_IO_STATUS_t DIGITAL_IO APP status.
Definition at line 95 of file DIGITAL_IO.c.
References DIGITAL_IO_STATUS_OK, DIGITAL_IO::gpio_config, DIGITAL_IO::gpio_pin, DIGITAL_IO::gpio_port, and DIGITAL_IO::hwctrl.
__STATIC_INLINE void DIGITAL_IO_SetOutputHigh | ( | const DIGITAL_IO_t *const | handler | ) |
Function to set port pin high.
- Parameters:
-
handler Pointer pointing to APP data structure. Refer DIGITAL_IO_t for details.
- Returns:
- None
- Description:
- This function configures port output modification register Pn_OMR, to make port pin to high level.
- Related APIs:
- DIGITAL_IO_SetOutputLow()
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)DIGITAL_IO_Init(&DIGITAL_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. DIGITAL_IO_SetOutputHigh(&DIGITAL_IO_0); while(1U) { // Add application code here } return (1); }
Definition at line 266 of file DIGITAL_IO.h.
References DIGITAL_IO::gpio_pin, and DIGITAL_IO::gpio_port.
__STATIC_INLINE void DIGITAL_IO_SetOutputLow | ( | const DIGITAL_IO_t *const | handler | ) |
Function to reset port pin.
- Parameters:
-
handler Pointer pointing to APP data structure. Refer DIGITAL_IO_t for details.
- Returns:
- None
- Description:
- This function configures port output modification register Pn_OMR, to make port pin to low level.
- Related APIs:
- DIGITAL_IO_SetOutputHigh()
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)DIGITAL_IO_Init(&DIGITAL_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. DIGITAL_IO_SetOutputLow(&DIGITAL_IO_0); while(1U) { // Add application code here } return (1); }
Definition at line 313 of file DIGITAL_IO.h.
References DIGITAL_IO::gpio_pin, and DIGITAL_IO::gpio_port.
__STATIC_INLINE void DIGITAL_IO_ToggleOutput | ( | const DIGITAL_IO_t *const | handler | ) |
Function to Toggle port pin.
- Parameters:
-
handler Pointer pointing to APP data structure. Refer DIGITAL_IO_t for details.
- Returns:
- None
- Description:
- This function configures port output modification register Pn_OMR, to toggle port pin.
- Related APIs:
- DIGITAL_IO_SetOutputLow(), DIGITAL_IO_SetOutputHigh()
Example Usage:
#include <DAVE.h>//Declarations from DAVE Code Generation (includes SFR declaration) int main(void) { DAVE_STATUS_t status; uint32_t delay_count;; status = DAVE_Init(); //(DAVE_STATUS_t)DIGITAL_IO_Init(&DIGITAL_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) { DIGITAL_IO_ToggleOutput(&DIGITAL_IO_0); //toggles : 1 -> 0 (if initial output level is logic 1) //Add application code here for(delay_count = 0;delay_count<0xfffff;delay_count++); DIGITAL_IO_ToggleOutput(&DIGITAL_IO_0); //toggles : 0 -> 1 //Add application code here for(delay_count = 0;delay_count<0xfffff;delay_count++); } return (1); }
Definition at line 365 of file DIGITAL_IO.h.
References DIGITAL_IO::gpio_pin, and DIGITAL_IO::gpio_port.