25.6.4.9.1 Function tcc_set_top_value()
Set the timer TOP/PERIOD value.
enum status_code tcc_set_top_value( const struct tcc_module *const module_inst, const uint32_t top_value)
This function writes the given value to the PER/PERB register.
If double buffering is enabled it always write to the buffer register (PERB). The value will then be updated immediately by calling tcc_force_double_buffer_update(), or be updated when the lock update bit is cleared and the UPDATE condition happen.
When using MFRQ, the top value is defined by the CC0 register value and the PER value is ignored, so tcc_set_compare_value (module,channel_0,value) must be used instead of this function to change the actual top value in that case. For all other waveforms operation the top value is defined by PER register value.
Data direction | Parameter name | Description |
---|---|---|
[in] |
module_inst |
Pointer to the software module instance struct |
[in] |
top_value |
New value to be loaded into the PER/PERB register |
Returns
Status of the TOP set procedure.
Return value | Description |
---|---|
STATUS_OK |
The timer TOP value was updated successfully |
STATUS_ERR_INVALID_ARG |
An invalid channel index was supplied or top/period value exceed resolution |