RZT Flexible Software Package Documentation
Release v2.2.0
|
|
Driver for the MTU3 peripherals on RZ microprocessor. This module implements the Timer Interface.
The MTU3 module can be used to measure external input signals, generate a periodic interrupt, or output a periodic or PWM signal to a MTIOC pin.
This module supports the MTU3 peripherals are 16-bit timers. The 16-bit timers are all treated the same in this module from the API perspective.
The MTU3 module has the following features:
RZ microprocessor have timer peripherals: the Multi-Function Timer Pulse Unit 3 (MTU3). When selecting between them, consider these factors:
MTU3 | |
---|---|
Low Power Modes | The MTU3 can operate in sleep mode. |
Available Channels | The number of MTU3 channels is device specific. All currently supported MCUs have at least 9 MTU3 channels. |
Timer Resolution | All MCUs have at least one 16-bit MTU3 timer. |
Clock Source | -Bus clock: PCLKH |
-Core clock: PCLKH |
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Pin Output Support |
| Disabled | If selected code for outputting a waveform to a pin is included in the build. |
UVW Support |
| Disabled | If selected code for UVW is included in the build. |
Multiplex Interrupt |
| Disabled | Enable multiplex interrupt for a single driver. |
Configuration | Options | Default | Description |
---|---|---|---|
General > Name | Name must be a valid C symbol | g_timer0 | Module name. |
General > Channel | Channel number must exist on this MCU | 0 | Specify the hardware channel. |
General > Mode |
| Periodic | Mode selection. Periodic: Generates periodic interrupts or square waves. One-shot: Generate a single interrupt or a pulse wave. Note: One-shot mode is implemented in software. ISRs must be enabled for one-shot even if callback is unused. PWM: Generates basic PWM waveforms. Triangle-Wave Symmetric PWM: Generates symmetric PWM waveforms with duty cycle determined by compare match set during a crest interrupt and updated at the next trough. Triangle-Wave Asymmetric PWM: Generates asymmetric PWM waveforms with duty cycle determined by compare match set during a crest/trough interrupt and updated at the next trough/crest. |
General > TGRA(Output Compare or Input Capture Value) | Value must be a valid non-negative integer with a maximum configurable value of 0xFFFF | 0x0000 | Capture/Compare match A value. |
General > TGRB(Output Compare or Input Capture Value) | Value must be a valid non-negative integer with a maximum configurable value of 0xFFFF | 0x0000 | Capture/Compare match B value. |
General > Time Prescaler | Refer to the RZT Configuration tool for available options. | PCLKH divided by 1 (common ch) | Select time prescaler. |
General > Clock Edge |
| Rising | Select clock edge. |
General > Counter Clear Source |
| Disabled | Select counter clear source. |
Input > Phase Count > Bit Mode |
| 16-bit | Select Bit Mode |
Input > Phase Count > Counting Mode | Refer to the RZT Configuration tool for available options. | None | Select Counting Mode |
Input > Phase Count > Clock Pin Select |
| MTCLKA, MTCLKB | Select Clock pin Select |
Noise Filter > External Clock > Enable |
| Sets the noise filter for the external clock. Since it is a setting common to all channels, it may be overwritten by other Stacks settings. | |
Noise Filter > External Clock > Clock Select |
| PCLK divided by 1 | Select noise filter clock. |
Noise Filter > Input Capture > Enable |
| Select whether to enable extra features on this channel. | |
Noise Filter > Input Capture > Clock Select |
| PCLK divided by 1 | Select noise filter clock. |
Output > Initial Output A | Refer to the RZT Configuration tool for available options. | No Output | Select TGRA initial output. |
Output > Initial Output B | Refer to the RZT Configuration tool for available options. | No Output | Select TGRB initial output. |
Interrupts > Callback | Name must be a valid C symbol | NULL | A user callback function can be specified here. If this callback function is provided, it will be called from the interrupt service routine (ISR) each time the timer period elapses |
Interrupts > Overflow/Crest Interrupt Priority | MCU Specific Options | Select the overflow interrupt priority. This is the crest interrupt for triangle-wave PWM. | |
Interrupts > Capture A Interrupt Priority | MCU Specific Options | Select the interrupt priority for capture A. | |
Interrupts > Capture B Interrupt Priority | MCU Specific Options | Select the interrupt priority for capture B. | |
Interrupts (GPT_SEL) > Callback | Name must be a valid C symbol | NULL | A user callback function can be specified here. If this callback function is provided, it will be called from the interrupt service routine (ISR) each time the timer period elapses |
Interrupts (GPT_SEL) > Overflow/Crest Interrupt Source | MCU Specific Options | Select the overflow interrupt source. This is the crest interrupt for triangle-wave PWM. | |
Interrupts (GPT_SEL) > Capture A Interrupt Source | MCU Specific Options | Select the interrupt source for capture A. | |
Interrupts (GPT_SEL) > Capture B Interrupt Source | MCU Specific Options | Select the interrupt source for capture B. | |
Interrupts (GPT_SEL) > INT0 Interrupt Priority | MCU Specific Options | Select the interrupt priority for int0. | |
Interrupts (GPT_SEL) > INT1 Interrupt Priority | MCU Specific Options | Select the interrupt priority for int1. | |
Interrupts (GPT_SEL) > INT2 Interrupt Priority | MCU Specific Options | Select the interrupt priority for int2. | |
Interrupts (GPT_SEL) > INT3 Interrupt Priority | MCU Specific Options | Select the interrupt priority for int3. | |
Interrupts (GPT_SEL) > INT4 Interrupt Priority | MCU Specific Options | Select the interrupt priority for int4. | |
Extra Features > MTU5 > Interrupts > Capture U Interrupt Priority | MCU Specific Options | Select the interrupt priority for capture U. | |
Extra Features > MTU5 > Interrupts > Capture V Interrupt Priority | MCU Specific Options | Select the interrupt priority for capture V. | |
Extra Features > MTU5 > Interrupts > Capture W Interrupt Priority | MCU Specific Options | Select the interrupt priority for capture W. | |
Extra Features > MTU5 > Interrupts (GPT_SEL) > Capture U Interrupt Source | MCU Specific Options | Select the interrupt source for capture U. | |
Extra Features > MTU5 > Interrupts (GPT_SEL) > Capture V Interrupt Source | MCU Specific Options | Select the interrupt source for capture V. | |
Extra Features > MTU5 > Interrupts (GPT_SEL) > Capture W Interrupt Source | MCU Specific Options | Select the interrupt source for capture W. | |
Extra Features > MTU5 > U Count | Value must be a valid non-negative integer with a maximum configurable value of 0xFFFF | 0x0000 | Timer U Counter. |
Extra Features > MTU5 > V Count | Value must be a valid non-negative integer with a maximum configurable value of 0xFFFF | 0x0000 | Timer V Counter. |
Extra Features > MTU5 > W Count | Value must be a valid non-negative integer with a maximum configurable value of 0xFFFF | 0x0000 | Timer W Counter. |
Extra Features > MTU5 > U Clock Select | Refer to the RZT Configuration tool for available options. | PCLKH divided by 1 | Select U time prescaler. |
Extra Features > MTU5 > V Clock Select | Refer to the RZT Configuration tool for available options. | PCLKH divided by 1 | Select V time prescaler. |
Extra Features > MTU5 > W Clock Select | Refer to the RZT Configuration tool for available options. | PCLKH divided by 1 | Select W time prescaler. |
Extra Features > MTU5 > U Input Capture | Refer to the RZT Configuration tool for available options. | No func | Select U output level. |
Extra Features > MTU5 > V Input Capture | Refer to the RZT Configuration tool for available options. | No func | Select V output level. |
Extra Features > MTU5 > W Input Capture | Refer to the RZT Configuration tool for available options. | No func | Select W output level. |
Extra Features > MTU5 > UVW Noise Filter Enable |
| Disabled | Enable UVW noise filter. |
Extra Features > MTU5 > UVW Noise Filter Clock Select |
| PCLKH divided by 1 | Select UVW noise filter clock. |
Extra Features > Interrupt Skipping > Skip Mode A |
| Mode 1 | Selects interrupt skipping function 1 or 2(TIMTRA). |
Extra Features > Interrupt Skipping > Skip Mode B |
| Mode 1 | Selects interrupt skipping function 1 or 2(TIMTRB). |
Extra Features > Interrupt Skipping > TCIV4 Interrupt Skip Count |
| 0 | Select the number of TCIV4 interrupts to skip. |
Extra Features > Interrupt Skipping > TCIV3 Interrupt Skip Count |
| 0 | Select the number of TCIV3 interrupts to skip. |
Extra Features > Interrupt Skipping > TCIV7 Interrupt Skip Count |
| 0 | Select the number of TCIV7 interrupts to skip. |
Extra Features > Interrupt Skipping > TGIA6 Interrupt Skip Count |
| 0 | Select the number of TGIA6 interrupts to skip. |
Extra Features > Interrupt Skipping > TRG4AN/TRG4BN Interrupt Skip Count |
| 0 | Select the number of TRG4AN/TRG4BN interrupts to skip. |
Extra Features > Interrupt Skipping > TRG7AN/TRG7BN Interrupt Skip Count |
| 0 | Select the number of TRG7AN/TRG7BN interrupts to skip. |
Extra Features > ADC Trigger > ADC A Compare Match (Raw Counts) | Must be a valid non-negative integer with a maximum configurable value of 65535 (0xffff). | 0x0000 | Timer A/D Converter start request cycle A (MTU4 or MTU7). |
Extra Features > ADC Trigger > ADC B Compare Match (Raw Counts) | Must be a valid non-negative integer with a maximum configurable value of 65535 (0xffff). | 0x0000 | Timer A/D Converter start request cycle B (MTU4 or MTU7). |
Extra Features > ADC Trigger > MTUn.TGRA (n = 0 to 4, 6, 7) Input Capture/Compare Match |
| Disabled | A/D Conversion Start by MTUn.TGRA (n = 0 to 4, 6, 7) Input Capture/Compare Match or at Trough of MTUm.TCNT (m = 4 or 7) in Complementary PWM Mode. |
Extra Features > Extra Features |
| Disabled | Select whether to enable extra features on this channel. |
ELC > MTU0 > Trigger Source | MCU Specific Options | ELC source that will trigger MTU0 | |
ELC > MTU0 > Operation Select |
| Disabled | Select operation for MTU0 |
ELC > MTU3 > Trigger Source | MCU Specific Options | ELC source that will trigger MTU3 | |
ELC > MTU3 > Operation Select |
| Disabled | Select operation for MTU3 |
ELC > MTU4 > Trigger Source | MCU Specific Options | ELC source that will trigger MTU4 | |
ELC > MTU4 > Operation Select |
| Disabled | Select operation for MTU4 |
The MTU3 clock is based on the PCLKH frequency. You can set the PCLKH frequency using the Clocks tab of the RZ microprocessor Configuration editor.
This module can use MTIOCA and MTIOCB pins as output pins for periodic or PWM signals.
This module can use MTIOCA and MTIOCB as input pins to measure input signals.
The period and duty cycle are updated after the next counter compare match after calling R_MTU3_PeriodSet().
The MTIOC pin toggles twice each time the timer expires in periodic mode. This is achieved by defining a PWM wave at a 50 percent duty cycle so that the period of the resulting square wave (from rising edge to rising edge) matches the period of the MTU3 timer. Since the periodic output is actually a PWM output, the time at the stop level is one cycle shorter than the time opposite the stop level for odd period values.
For the PWM output signal, the signal level at the start of the cycle and at the end of the cycle can be selected arbitrarily.
The MTU3 timer can trigger the start of other peripherals. The Event Link Controller (r_elc) guide provides a list of all available peripherals.
When an interrupt skipping source is selected a hardware counter will increment each time the selected event occurs. Each interrupt past the first (up to the specified skip count) will be suppressed.
Phase count mode is provides 16-bit or 32-bit channels used in phase counting applications. The ability to set the count value of the channel and the function to obtain the count value are possible. For this operation, configure “Phase Count” appropriately. Example of setting for phase counting mode 1 are shown below.
Configuration | Options |
---|---|
General > Channel | - 1 |
General > Mode | - Periodic |
Input > Phase Count > Bit Mode | - 16 bit |
Input > Phase Count > Counting Mode | - Mode 1 |
Count > Phase Count > Pin Clock Select | - MTCLKA, MTCLKB |
This is a basic example of minimal use of the MTU3 in an application.
This is an example of a timer callback.
To use the MTU3 as a free running counter, select periodic mode and set the the Period to 0xFFFF for a 16-bit timer.
This an example of updating the period.
This is an example of using the MTU3 to operate phase counting mode.
Data Structures | |
struct | mtu3_output_pin_t |
struct | mtu3_status_t |
struct | mtu3_elc_operation_t |
struct | mtu3_counter_t |
struct | mtu3_info_t |
struct | mtu3_instance_ctrl_t |
struct | mtu3_extended_pwm_cfg_t |
struct | mtu3_extended_uvw_cfg_t |
struct | mtu3_extended_cfg_t |
Enumerations | |
enum | mtu3_io_pin_level_t |
enum | mtu3_io_pin_level_uvw_t |
enum | mtu3_clock_edge_t |
enum | mtu3_div_t |
enum | mtu3_div_uvw_t |
enum | mtu3_tcnt_clear_t |
enum | mtu3_io_pin_t |
enum | mtu3_elc_operation_option_t |
enum | mtu3_noise_filter_setting_t |
enum | mtu3_noise_filter_mtclk_setting_t |
enum | mtu3_noise_filter_setting_uvw_t |
enum | mtu3_noise_filter_clock_t |
enum | mtu3_noise_filter_external_clock_t |
enum | mtu3_interrupt_skip_mode_t |
enum | mtu3_interrupt_skip_count_t |
enum | mtu3_adc_compare_match_t |
enum | mtu3_phase_counting_mode_t |
enum | mtu3_bit_mode_t |
enum | mtu3_external_clock_t |
struct mtu3_output_pin_t |
Configurations for output pins.
Data Fields | ||
---|---|---|
mtu3_io_pin_level_t | output_pin_level_a | I/O Control A. |
mtu3_io_pin_level_t | output_pin_level_b | I/O Control B. |
struct mtu3_status_t |
Current timer status.
Data Fields | ||
---|---|---|
uint32_t | counter | Current counter value. |
uint32_t | tgru_counter | Current counter value(TGRU) |
uint32_t | tgrv_counter | Current counter value(TGRV) |
uint32_t | tgrw_counter | Current counter value(TGRW) |
timer_state_t | state | Current timer state (running or stopped) |
struct mtu3_elc_operation_t |
MTU3 configuration for event link function
Data Fields | ||
---|---|---|
mtu3_elc_operation_option_t | mtu0_elc_operation | MTU0 operation select. |
mtu3_elc_operation_option_t | mtu3_elc_operation | MTU3 operation select. |
mtu3_elc_operation_option_t | mtu4_elc_operation | MTU4 operation select. |
struct mtu3_counter_t |
struct mtu3_info_t |
MTU3 information structure to store various information for a timer resource
Data Fields | ||
---|---|---|
timer_direction_t | count_direction | Clock counting direction of the timer. |
uint32_t | clock_frequency[3] | Clock frequency of the timer counter.(For ch5, use clock_frequency[0]-[2].) |
mtu3_counter_t | count_param |
struct mtu3_instance_ctrl_t |
Channel control block. DO NOT INITIALIZE. Initialization occurs when timer_api_t::open is called.
Data Fields | |
uint32_t | open |
Whether or not channel is open. | |
const timer_cfg_t * | p_cfg |
Pointer to initial configurations. | |
void * | p_reg |
Base register for this channel. | |
R_MTU_Type * | p_reg_com |
Base register for this channel(common ch) | |
void * | p_reg_nf |
Base register for this channel(noise fileter) | |
uint32_t | channel_mask |
Channel bitmask. | |
void(* | p_callback )(timer_callback_args_t *) |
Pointer to callback. | |
timer_callback_args_t * | p_callback_memory |
Pointer to optional callback argument memory. | |
void const * | p_context |
Pointer to context to be passed into callback function. | |
struct mtu3_extended_pwm_cfg_t |
MTU3 extension for advanced PWM features.
Data Fields | ||
---|---|---|
mtu3_interrupt_skip_mode_t | interrupt_skip_mode_a | Selects interrupt skipping function 1 or 2(TIMTRA) |
mtu3_interrupt_skip_mode_t | interrupt_skip_mode_b | Selects interrupt skipping function 1 or 2(TIMTRB) |
uint16_t | adc_a_compare_match | Timer A/D Converter Start Request Cycle A (MTU4 or MTU7) |
uint16_t | adc_b_compare_match | Timer A/D Converter Start Request Cycle B (MTU4 or MTU7) |
mtu3_interrupt_skip_count_t | interrupt_skip_count_tciv4 | TCIV4 Interrupt Skipping Count Setting(TITCR1A) |
mtu3_interrupt_skip_count_t | interrupt_skip_count_tgia3 | TGIA3 Interrupt Skipping Count Setting(TITCR1A) |
mtu3_interrupt_skip_count_t | interrupt_skip_count_tciv7 | TCIV7 Interrupt Skipping Count Setting(TITCR1B) |
mtu3_interrupt_skip_count_t | interrupt_skip_count_tgia6 | TGIA6 Interrupt Skipping Count Setting(TITCR1B) |
mtu3_interrupt_skip_count_t | interrupt_skip_count_tgr4an_bn | TRG4AN/TRG4BN Interrupt Skipping Count Setting(TITCR2A) |
mtu3_interrupt_skip_count_t | interrupt_skip_count_tgr7an_bn | TRG7AN/TRG7BN Interrupt Skipping Count Setting(TITCR2B) |
struct mtu3_extended_uvw_cfg_t |
MTU3 extension for ch5.
Data Fields | ||
---|---|---|
uint16_t | tgru_val | Capture/Compare match U register. |
uint16_t | tgrv_val | Capture/Compare match V register. |
uint16_t | tgrw_val | Capture/Compare match W register. |
mtu3_div_uvw_t | mtu3_clk_div_u | Time Prescaler Select U register. |
mtu3_div_uvw_t | mtu3_clk_div_v | Time Prescaler Select V register. |
mtu3_div_uvw_t | mtu3_clk_div_w | Time Prescaler Select W register. |
mtu3_io_pin_level_uvw_t | output_pin_level_u | I/O Control U register. |
mtu3_io_pin_level_uvw_t | output_pin_level_v | I/O Control V register. |
mtu3_io_pin_level_uvw_t | output_pin_level_w | I/O Control W register. |
mtu3_noise_filter_setting_uvw_t | noise_filter_mtioc_setting_uvw | |
mtu3_noise_filter_clock_t | noise_filter_mtioc_clk_uvw | |
uint8_t | capture_u_ipl | Capture/Compare match U interrupt priority. |
uint8_t | capture_v_ipl | Capture/Compare match V interrupt priority. |
uint8_t | capture_w_ipl | Capture/Compare match W interrupt priority. |
IRQn_Type | capture_u_irq | Capture/Compare match U interrupt. |
IRQn_Type | capture_v_irq | Capture/Compare match V interrupt. |
IRQn_Type | capture_w_irq | Capture/Compare match W interrupt. |
struct mtu3_extended_cfg_t |
The MTU3 extension constitutes a unique feature of MTU3.
Data Fields | ||
---|---|---|
uint32_t | tgra_val | Capture/Compare match A register. |
uint32_t | tgrb_val | Capture/Compare match B register. |
uint32_t | tgrc_val | Capture/Compare match C register (Does not exist in MTU ch1-2) |
uint32_t | tgrd_val | Capture/Compare match D register (Does not exist in MTU ch1-2) |
mtu3_div_t | mtu3_clk_div | Time Prescaler Select. |
mtu3_clock_edge_t | clk_edge | Clock Edge Select. |
mtu3_tcnt_clear_t | mtu3_clear | Counter Clear Source Select. |
mtu3_output_pin_t | mtioc_ctrl_setting | I/O Control A, B. |
mtu3_noise_filter_setting_t | noise_filter_mtioc_setting | |
mtu3_noise_filter_clock_t | noise_filter_mtioc_clk | |
mtu3_noise_filter_mtclk_setting_t | noise_filter_mtclk_setting | |
mtu3_noise_filter_external_clock_t | noise_filter_mtclk_clk | |
bool | adc_request_enable | A/D Converter Start Request Enable(ch5 and ch8 are excluded) |
mtu3_elc_operation_t | mtu3_elc_event_operation | MTU3 event link operation. |
uint8_t | capture_a_ipl | Capture/Compare match A interrupt priority. |
uint8_t | capture_b_ipl | Capture/Compare match B interrupt priority. |
IRQn_Type | capture_a_irq | Capture/Compare match A interrupt. |
IRQn_Type | capture_b_irq | Capture/Compare match B interrupt. |
mtu3_extended_uvw_cfg_t const * | p_uvw_cfg | Advanced MTU ch5 features, optional. |
mtu3_extended_pwm_cfg_t const * | p_pwm_cfg | Advanced PWM features, optional. |
mtu3_phase_counting_mode_t | counting_mode | Select the counting mode. |
mtu3_bit_mode_t | bit_mode | Select bit mode. |
mtu3_external_clock_t | external_clock | Select External Clock Input Pins. |
uint8_t | capture_a_source_select | Identify the GPT_INT for capture a. |
uint8_t | capture_b_source_select | Identify the GPT_INT for capture b. |
uint8_t | cycle_end_source_select | Identify the GPT_INT for capture overflow/underflow. |
enum mtu3_io_pin_level_t |
I/O Level Select
I/O Level Select(MTU5)
enum mtu3_clock_edge_t |
enum mtu3_div_t |
Time Prescaler Select
enum mtu3_div_uvw_t |
Time Prescaler Select(MTU5)
enum mtu3_tcnt_clear_t |
enum mtu3_io_pin_t |
MTU3 event group operation
Disables or enables the noise filter for input from the MTIOCnA pin
Disables or enables the noise filter for the external clock input pins of the MTU
Disables or enables the noise filter for input from the MTIC5U, MTIC5V, MTIC5W pin
Number of interrupts to skip between events
enum mtu3_bit_mode_t |
fsp_err_t R_MTU3_Open | ( | timer_ctrl_t *const | p_ctrl, |
timer_cfg_t const *const | p_cfg | ||
) |
Initializes the timer module and applies configurations.
The MTU3 implementation of the general timer can accept a mtu3_extended_cfg_t extension parameter.
FSP_SUCCESS | Initialization was successful and timer has started. |
FSP_ERR_ASSERTION | A required input pointer is NULL. |
FSP_ERR_ALREADY_OPEN | Module is already open. |
FSP_ERR_INVALID_MODE | PWM is only supported if MTU3_CFG_OUTPUT_SUPPORT_ENABLE is 2. |
FSP_ERR_IP_CHANNEL_NOT_PRESENT | The channel requested in the p_cfg parameter is not available on this device. |
fsp_err_t R_MTU3_Stop | ( | timer_ctrl_t *const | p_ctrl | ) |
Stops timer.
FSP_SUCCESS | Timer successfully stopped. |
FSP_ERR_ASSERTION | p_ctrl was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_Start | ( | timer_ctrl_t *const | p_ctrl | ) |
Starts timer.
FSP_SUCCESS | Timer successfully started. |
FSP_ERR_ASSERTION | p_ctrl was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_Reset | ( | timer_ctrl_t *const | p_ctrl | ) |
Resets the counter value to 0.
FSP_SUCCESS | Counter value written successfully. |
FSP_ERR_ASSERTION | p_ctrl was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_PeriodSet | ( | timer_ctrl_t *const | p_ctrl, |
mtu3_counter_t *const | p_counter | ||
) |
Sets period value provided. If the timer is running, the period will be updated after the next compare match. If the timer is stopped, this function resets the counter and updates the period.
FSP_SUCCESS | Period value written successfully. |
FSP_ERR_ASSERTION | p_ctrl was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_InfoGet | ( | timer_ctrl_t *const | p_ctrl, |
mtu3_info_t *const | p_info | ||
) |
Get timer information and store it in provided pointer p_info.
FSP_SUCCESS | TGRx, count direction, frequency, structure successfully. |
FSP_ERR_ASSERTION | p_ctrl or p_info was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_StatusGet | ( | timer_ctrl_t *const | p_ctrl, |
mtu3_status_t *const | p_status | ||
) |
Get current timer status and store it in provided pointer p_status.
FSP_SUCCESS | Current timer state and counter value set successfully. |
FSP_ERR_ASSERTION | p_ctrl or p_status was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_CounterSet | ( | timer_ctrl_t *const | p_ctrl, |
uint32_t | counter | ||
) |
Set counter value.
FSP_SUCCESS | Counter value updated. |
FSP_ERR_ASSERTION | p_ctrl or p_status was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
FSP_ERR_IN_USE | The timer is running. Stop the timer before calling this function. |
fsp_err_t R_MTU3_OutputEnable | ( | timer_ctrl_t *const | p_ctrl, |
mtu3_output_pin_t | pin_level | ||
) |
Enable output for MTIOCA and/or MTIOCB.
FSP_SUCCESS | Output is enabled. |
FSP_ERR_ASSERTION | p_ctrl or p_status was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_OutputDisable | ( | timer_ctrl_t *const | p_ctrl, |
mtu3_io_pin_t | pin | ||
) |
Disable output for MTIOCA and/or MTIOCB.
FSP_SUCCESS | Output is disabled. |
FSP_ERR_ASSERTION | p_ctrl or p_status was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_AdcTriggerSet | ( | timer_ctrl_t *const | p_ctrl, |
mtu3_adc_compare_match_t | which_compare_match, | ||
uint16_t | compare_match_value | ||
) |
Set A/D converter start request compare match value.
FSP_SUCCESS | Counter value updated. |
FSP_ERR_ASSERTION | p_ctrl or p_status was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |
fsp_err_t R_MTU3_CallbackSet | ( | timer_ctrl_t *const | p_ctrl, |
void(*)(timer_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
timer_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback with the option to provide memory for the callback argument structure.
FSP_SUCCESS | Callback updated successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | The control block has not been opened. |
fsp_err_t R_MTU3_Close | ( | timer_ctrl_t *const | p_ctrl | ) |
Stops counter, disables output pins, and clears internal driver data.
FSP_SUCCESS | Successful close. |
FSP_ERR_ASSERTION | p_ctrl was NULL. |
FSP_ERR_NOT_OPEN | The instance is not opened. |