Driver API for GCLK (plib_gclk.h) More...
Typedefs | |
| typedef uint32_t | GCLK_GENERATOR_ID |
| GCLK Generator identifier. | |
| typedef uint32_t | GCLK_PERIPHERAL_CHANNEL_ID |
| GCLK Peripheral Channel identifier. | |
| typedef uint32_t | GCLK_SOURCE |
| GCLK generator clock source identifier. | |
Enumerations | |
| enum | GCLK_GENERATOR_ID_ENUM |
| Select a specific Generic Clock Generator in the GCLK module. More... | |
| enum | GCLK_DIVIDE_TYPE { GCLK_DIVISION_INTEGER = GCLK_GENCTRL_DIVSEL_DIV1_Val , GCLK_DIVISION_POWER_OF_TWO_PLUS_ONE = GCLK_GENCTRL_DIVSEL_DIV2_Val } |
| Specifies the method used to divide the clock source frequency for a GCLK generator. More... | |
| enum | GCLK_PERIPHERAL_CHANNEL_ID_ENUM |
| Select a specific Peripheral control in the GCLK module. More... | |
| enum | GCLK_SOURCE_ENUM |
| GCLK generator clock source selection. More... | |
Functions | |
| void | GCLK_Initialize (void) |
| Initializes the GCLK module. | |
| bool | GCLK_GetGeneratorControlSyncStatus (GCLK_GENERATOR_ID generator_id) |
| Checks synchronization status of a GCLK generator control register. | |
| void | GCLK_SetGeneratorSource (GCLK_GENERATOR_ID generator_id, GCLK_SOURCE source) |
| Sets the clock source for a specified GCLK generator. Before changing the source in GENERATOR 0, ensure that the ONDEMAND feature of the source is enabled. | |
| uint32_t | GCLK_GetGeneratorSource (GCLK_GENERATOR_ID generator_id) |
| Gets the clock source for a specified GCLK generator. | |
| void | GCLK_SetDivisionParameters (GCLK_GENERATOR_ID generator_id, uint16_t divide_factor, GCLK_DIVIDE_TYPE divide_type, bool improve_duty_cycle) |
| Sets the division factor and type for a GCLK generator. | |
| uint32_t | GCLK_GetDivideType (GCLK_GENERATOR_ID generator_id) |
| Returns the division type for a specified GCLK generator. | |
| uint16_t | GCLK_GetDivideFactor (GCLK_GENERATOR_ID generator_id) |
| Returns the division factor for a specified GCLK generator. | |
| void | GCLK_SetOutputOffValue (GCLK_GENERATOR_ID generator_id, uint32_t output_off_value) |
| Sets the output value when the GCLK generator is off. | |
| void | GCLK_SetOutputEnable (GCLK_GENERATOR_ID generator_id, bool output_enable) |
| Enables or disables output for a GCLK generator. | |
| void | GCLK_EnableStandbyRun (GCLK_GENERATOR_ID generator_id) |
| Enables GCLK generator operation in standby mode. | |
| void | GCLK_DisableStandbyRun (GCLK_GENERATOR_ID generator_id) |
| Disables GCLK generator operation in standby mode. | |
| void | GCLK_GeneratorEnable (GCLK_GENERATOR_ID generator_id) |
| Enables the specified GCLK generator. | |
| void | GCLK_GeneratorDisable (GCLK_GENERATOR_ID generator_id) |
| Disables the specified GCLK generator. | |
| void | GCLK_SetPeripheralChannelGenSrc (GCLK_PERIPHERAL_CHANNEL_ID channel_id, GCLK_GENERATOR_ID generator_id) |
| Assigns a GCLK generator to a peripheral channel. | |
| void | GCLK_EnablePeripheralChannel (GCLK_PERIPHERAL_CHANNEL_ID channel_id) |
| Enables a GCLK peripheral channel. | |
| void | GCLK_PeripheralChannelDisable (GCLK_PERIPHERAL_CHANNEL_ID channel_id) |
| Disables a GCLK peripheral channel. | |
| bool | GCLK_PeripheralChannelIsEnabled (GCLK_PERIPHERAL_CHANNEL_ID channel_id) |
| Checks if a GCLK peripheral channel is enabled. | |
| void | GCLK_EnablePeripheralChannelWriteLock (GCLK_PERIPHERAL_CHANNEL_ID channel_id) |
| Enables write lock for a GCLK peripheral channel. | |
Driver API for GCLK (plib_gclk.h)
GCLK Generator identifier.
Accepts GCLK_GENERATOR_* enum values (GCLK_GENERATOR_0 through GCLK_GENERATOR_8, device-dependent availability) or raw uint32_t values for generators not present in the enum.
Example usage:
GCLK Peripheral Channel identifier.
Each peripheral requiring a GCLK is connected to a peripheral channel (PCHCTRL[m]) in the Generic Clock Controller (GCLK).
The value of a peripheral channel identifier is defined by the device DFP and must be one of the DFP-provided macros, for example:
Example Mapping:
Datasheet Name DFP Macro To Use --------------------------- -------------------------- GCLK_EIC EIC_GCLK_ID GCLK_TC0 TC0_GCLK_ID GCLK_SERCOM0_CORE SERCOM0_GCLK_ID_CORE GCLK_EVSYS_CHANNEL0 EVSYS_GCLK_ID_0
GCLK generator clock source identifier.
Each GCLK generator can select a clock source. The value of the clock source is defined by the device DFP and must be one of the GCLK_GENCTRL_SRC_*_Val macros, for example:
| enum GCLK_DIVIDE_TYPE |
Select a specific Generic Clock Generator in the GCLK module.
Select a specific Peripheral control in the GCLK module.
| enum GCLK_SOURCE_ENUM |
GCLK generator clock source selection.
| void GCLK_DisableStandbyRun | ( | GCLK_GENERATOR_ID | generator_id | ) |
Disables GCLK generator operation in standby mode.
| generator_id | The GCLK generator to configure. |
| void GCLK_EnablePeripheralChannel | ( | GCLK_PERIPHERAL_CHANNEL_ID | channel_id | ) |
Enables a GCLK peripheral channel.
| channel_id | The peripheral channel to enable. |
| void GCLK_EnablePeripheralChannelWriteLock | ( | GCLK_PERIPHERAL_CHANNEL_ID | channel_id | ) |
Enables write lock for a GCLK peripheral channel.
| channel_id | The peripheral channel to lock. |
| void GCLK_EnableStandbyRun | ( | GCLK_GENERATOR_ID | generator_id | ) |
Enables GCLK generator operation in standby mode.
| generator_id | The GCLK generator to configure. |
| void GCLK_GeneratorDisable | ( | GCLK_GENERATOR_ID | generator_id | ) |
Disables the specified GCLK generator.
| generator_id | The GCLK generator to disable. |
| void GCLK_GeneratorEnable | ( | GCLK_GENERATOR_ID | generator_id | ) |
Enables the specified GCLK generator.
| generator_id | The GCLK generator to enable. |
| uint16_t GCLK_GetDivideFactor | ( | GCLK_GENERATOR_ID | generator_id | ) |
Returns the division factor for a specified GCLK generator.
| generator_id | The GCLK generator to query. |
| uint32_t GCLK_GetDivideType | ( | GCLK_GENERATOR_ID | generator_id | ) |
Returns the division type for a specified GCLK generator.
| generator_id | The GCLK generator to query. |
| bool GCLK_GetGeneratorControlSyncStatus | ( | GCLK_GENERATOR_ID | generator_id | ) |
Checks synchronization status of a GCLK generator control register.
| generator_id | The GCLK generator ID to check. |
| uint32_t GCLK_GetGeneratorSource | ( | GCLK_GENERATOR_ID | generator_id | ) |
Gets the clock source for a specified GCLK generator.
| generator_id | The GCLK generator to query. |
| void GCLK_Initialize | ( | void | ) |
Initializes the GCLK module.
| None. |
| void GCLK_PeripheralChannelDisable | ( | GCLK_PERIPHERAL_CHANNEL_ID | channel_id | ) |
Disables a GCLK peripheral channel.
| channel_id | The peripheral channel to disable. |
| bool GCLK_PeripheralChannelIsEnabled | ( | GCLK_PERIPHERAL_CHANNEL_ID | channel_id | ) |
Checks if a GCLK peripheral channel is enabled.
| channel_id | The peripheral channel to check. |
| void GCLK_SetDivisionParameters | ( | GCLK_GENERATOR_ID | generator_id, |
| uint16_t | divide_factor, | ||
| GCLK_DIVIDE_TYPE | divide_type, | ||
| bool | improve_duty_cycle ) |
Sets the division factor and type for a GCLK generator.
| generator_id | The GCLK generator to configure. |
| divide_factor | The division factor to set. |
| divide_type | The division selection type to set. |
| improve_duty_cycle | Set to true to enable improved duty cycle, false to disable. |
| void GCLK_SetGeneratorSource | ( | GCLK_GENERATOR_ID | generator_id, |
| GCLK_SOURCE | source ) |
Sets the clock source for a specified GCLK generator. Before changing the source in GENERATOR 0, ensure that the ONDEMAND feature of the source is enabled.
| generator_id | The GCLK generator to configure. |
| source | The clock source to select for the generator. |
| void GCLK_SetOutputEnable | ( | GCLK_GENERATOR_ID | generator_id, |
| bool | output_enable ) |
Enables or disables output for a GCLK generator.
| generator_id | The GCLK generator to configure. |
| output_enable | Set to true to enable output, false to disable. |
| void GCLK_SetOutputOffValue | ( | GCLK_GENERATOR_ID | generator_id, |
| uint32_t | output_off_value ) |
Sets the output value when the GCLK generator is off.
| generator_id | The GCLK generator to configure. |
| output_off_value | Value to set when the generator is off (0 or 1) . |
| void GCLK_SetPeripheralChannelGenSrc | ( | GCLK_PERIPHERAL_CHANNEL_ID | channel_id, |
| GCLK_GENERATOR_ID | generator_id ) |
Assigns a GCLK generator to a peripheral channel.
| channel_id | The peripheral channel to configure. |
| generator_id | The GCLK generator to assign to the channel. |