CLOCK_XMC1: Methods

CLOCK XMC1

CLOCK_XMC1
Methods
DAVE_APP_VERSION_t CLOCK_XMC1_GetAppVersion (void)
 Get CLOCK_XMC1 APP version.
CLOCK_XMC1_STATUS_t CLOCK_XMC1_Init (CLOCK_XMC1_t *handle)
 Initializes a CLOCK_XMC1 APP instance.
void CLOCK_XMC1_SetMCLKFrequency (uint32_t freq_khz)
 API for ramping up/down the system clock frequency.
uint32_t OSCHP_GetFrequency (void)
 This is a non-weak function, which retrieves high precision external oscillator frequency.
Note: This function is used by xmc1_scu LLD for internal operations. Therefore the user do not required to call this API explicitly.
bool CLOCK_XMC1_IsDCO1ExtRefCalibrationReady (void)
 API to check whether DCO1 is synchronized to the XTAL frequency.

Methods


Function Documentation

DAVE_APP_VERSION_t CLOCK_XMC1_GetAppVersion ( void  )

Get CLOCK_XMC1 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 CLOCK_XMC1 APP:
   // SystemCoreClockSetup() is called from SystemInit().
   init_status = DAVE_Init();
  if(DAVE_STATUS_SUCCESS == init_status)
  {
    version = CLOCK_XMC1_GetAppVersion();
    if (version.major != 4U) {
      // Probably, not the right version.
    }

    // More code here
    while(1) {
    }
  }
  return (1);
 }


Definition at line 75 of file CLOCK_XMC1.c.

CLOCK_XMC1_STATUS_t CLOCK_XMC1_Init ( CLOCK_XMC1_t handle)

Initializes a CLOCK_XMC1 APP instance.

Parameters:
handleaddress of CLOCK_XMC1 APP handler
Returns:
CLOCK_XMC1_STATUS_SUCCESS : if initialization is successful
CLOCK_XMC1_STATUS_FAILURE : if initialization is failed
Description:
CLOCK_XMC1_Init API is called during initialization of DAVE APPS. This API Initializes GLOBAL_SCU_XMC1 APP for setting the interrupts and user callback registration.
Example Usage:
 #include <DAVE.h>

 int main(void)
 {
   DAVE_STATUS_t status;

   status = DAVE_Init();  //  CLOCK_XMC1_Init API is called during initialization of DAVE APPS
   if(DAVE_STATUS_SUCCESS == status)
   {
    // user code

     while(1)
     {

     }
   }
   return (1);
 }


Definition at line 88 of file CLOCK_XMC1.c.

References CLOCK_XMC1_STATUS_SUCCESS, and CLOCK_XMC1::init_status.

API to check whether DCO1 is synchronized to the XTAL frequency.

Parameters:
none
Returns:
bool
true : if DCO1 is synchronized to the XTAL frequency
false : if DCO1 is not synchronized to the XTAL frequency
Description:
The function can be used to check whether DCO1 is synchronized to the XTAL frequency.

Example Usage:

 #include <DAVE.h>

 int main(void)
 {
   DAVE_STATUS_t init_status;
   #if(CLOCK_XMC1_DCO1_CALIBRATION_ENABLED)
   bool is_synchronized = false;
   #endif
   // Initialize CLOCK_XMC1 APP:
   // SystemCoreClockSetup() is called from SystemInit().
   init_status = DAVE_Init();
  if(DAVE_STATUS_SUCCESS == init_status)
  {
    // User code here
  #if(CLOCK_XMC1_DCO1_CALIBRATION_ENABLED)
    is_synchronized = CLOCK_XMC1_IsDCO1ExtRefCalibrationReady();  // check whether DCO1 is synchronized
                                                                  // to the XTAL frequency or not
    if(is_synchronized == true)
    {
     // User code here
     // Do baud rate configuration related to communication protocol
     // start PWM in compare mode
     // start RTC in the RTC domain

    }
  #endif
    // More code here
    while(1) {

    }
  }
  return (1);
 }


Definition at line 164 of file CLOCK_XMC1.c.

void CLOCK_XMC1_SetMCLKFrequency ( uint32_t  freq_khz)

API for ramping up/down the system clock frequency.

Parameters:
target_freqrequired frequency in Hz.
Returns:
none
Description:
The function can be used for ramping up/down the system clock frequency.

Example Usage:

 #include <DAVE.h>

 int main(void)
 {
   DAVE_STATUS_t init_status;
   uint32_t freq_khz = 1000U;  // 1MHz is the target frequency
   // Initialize CLOCK_XMC1 APP:
   // SystemCoreClockSetup() is called from SystemInit().
   init_status = DAVE_Init();
  if(DAVE_STATUS_SUCCESS == init_status)
  {
    CLOCK_XMC1_SetMCLKFrequency(freq_khz);  // system clock frequency is ramping down to 1 MHz
    // More code here
    while(1) {

    }
  }
  return (1);
 }


Definition at line 149 of file CLOCK_XMC1.c.

uint32_t OSCHP_GetFrequency ( void  )

This is a non-weak function, which retrieves high precision external oscillator frequency.
Note: This function is used by xmc1_scu LLD for internal operations. Therefore the user do not required to call this API explicitly.

Returns:
uint32_t Range: 4 to 20 in External Crystal Mode / External Direct Input Mode.
Description:
This function to retrieves the external high precision oscillator frequency value, derived from either "External Crystal Mode" or "External Direct Input Mode"

Definition at line 156 of file CLOCK_XMC1.c.