| PDL for FM0+ Version1.0 Peripheral Driverl Library for FM0+

- Main Page
- Modules
- Data Structures
- Files

Defines | Typedefs | Enumerations | Functions
CR-trimming Function (CR)

## Defines
#define | CR_REG_UNLOCK_CODE 0x1ACCE554
#define | CR_REG_LOCK_CODE 0
## Typedefs
typedef enum en_cr_freq_div | en_cr_freq_div_t
| Enumeration of CR dividor.
## Enumerations
enum | en_cr_freq_div { CrFreqDivBy4 = 0, CrFreqDivBy8, CrFreqDivBy16, CrFreqDivBy32, CrFreqDivBy64, CrFreqDivBy128, CrFreqDivBy256, CrFreqDivBy512 }
| Enumeration of CR dividor. More...
## Functions
en_result_t | Cr_SetFreqDiv (en_cr_freq_div_t enCrDiv)
| Set the frequency division of CR output to Base timer.
en_result_t | Cr_SetTempTrimmingData (uint8_t u8Data)
| Set CR temperature trimming register.
uint8_t | Cr_GetTempTrimmingData (void)
| Get CR temperature trimming register.
en_result_t | Cr_SetFreqTrimmingData (uint16_t u16Data)
| Set CR frequency trimming register.
uint16_t | Cr_GetFreqTrimmingData (void)
| Get frequency trimming register.

## Detailed Description

Provided functions of CR module:

- Cr_SetFreqDiv()
- Cr_SetTempTrimmingData()
- Cr_GetTempTrimmingData()
- Cr_SetFreqTrimmingData()
- Cr_GetFreqTrimmingData()

Cr_SetFreqDiv() is used to divide CR input signal, which outputs to base timer from divider output.

Cr_SetTempTrimmingData() sets the CR temperature trimming data, and Cr_GetTempTrimmingData() gets the CR temperature trimming data.

Cr_SetFreqTrimmingData() sets the CR frequency trimming data, and Cr_GetFreqTrimmingData() gets the CR frequency trimming data.

## Define Documentation

#define CR_REG_LOCK_CODE 0

Definition at line 69 of file cr.c.

Referenced by Cr_SetFreqTrimmingData(), and Cr_SetTempTrimmingData().

#define CR_REG_UNLOCK_CODE 0x1ACCE554

Definition at line 68 of file cr.c.

Referenced by Cr_SetFreqTrimmingData(), and Cr_SetTempTrimmingData().

## Typedef Documentation

typedef enum en_cr_freq_div en_cr_freq_div_t

Enumeration of CR dividor.

Attention:
  The output of CR dividor is not output to CROUT pin, but used as input internally to MFT or Base Timer for CR-trimming.

## Enumeration Type Documentation

enum en_cr_freq_div

Enumeration of CR dividor.

Attention:
  The output of CR dividor is not output to CROUT pin, but used as input internally to MFT or Base Timer for CR-trimming.

Enumerator:

  CrFreqDivBy4 | CR output (to Base Timer) prescaler: 4.
  CrFreqDivBy8 | CR output (to Base Timer) prescaler: 8.
  CrFreqDivBy16 | CR output (to Base Timer) prescaler: 16.
  CrFreqDivBy32 | CR output (to Base Timer) prescaler: 32.
  CrFreqDivBy64 | CR output (to Base Timer) prescaler: 64.
  CrFreqDivBy128 | CR output (to Base Timer) prescaler: 128.
  CrFreqDivBy256 | CR output (to Base Timer) prescaler: 256.
  CrFreqDivBy512 | CR output (to Base Timer) prescaler: 512.

Definition at line 107 of file cr.h.

## Function Documentation

uint16_t Cr_GetFreqTrimmingData | ( | void |  | ) |

Get frequency trimming register.

Return values:

  temperature | trimming value, only Bit[9:0] is valid.

Definition at line 176 of file cr.c.

uint8_t Cr_GetTempTrimmingData | ( | void |  | ) |

Get CR temperature trimming register.

Return values:

  temperature | trimming value, only Bit[4:0] is valid.

Definition at line 143 of file cr.c.

en_result_t Cr_SetFreqDiv | ( | en_cr_freq_div_t | enCrDiv | ) |

Set the frequency division of CR output to Base timer.

Parameters:

  [in] | enCrDiv | CR division CrFreqDivBy4 CrFreqDivBy8 CrFreqDivBy16 CrFreqDivBy32 CrFreqDivBy64 CrFreqDivBy128 CrFreqDivBy256 CrFreqDivBy512

Return values:

  Ok | Set the frequency division successfully
  ErrorInvalidParameter | enCrDiv > CrFreqDivBy512

Definition at line 105 of file cr.c.

References CrFreqDivBy512, ErrorInvalidParameter, and Ok.

en_result_t Cr_SetFreqTrimmingData | ( | uint16_t | u16Data | ) |

Set CR frequency trimming register.

Parameters:

  [in] | u16Data | temperature trimming value, only Bit[9:0] is valid.

Return values:

  Ok | Set CR frequency trimming successfully

Definition at line 160 of file cr.c.

References CR_REG_LOCK_CODE, CR_REG_UNLOCK_CODE, and Ok.

en_result_t Cr_SetTempTrimmingData | ( | uint8_t | u8Data | ) |

Set CR temperature trimming register.

Parameters:

  [in] | u8Data | temperature trimming value, only Bit[4:0] is valid.

Return values:

  Ok | CR temperature trimming register set successfully

Definition at line 128 of file cr.c.

References CR_REG_LOCK_CODE, CR_REG_UNLOCK_CODE, and Ok.