R01AN2653EJ0150 Rev.1.50 Page 15 of 75
May. 14, 2021
RZ/T1 Group Multi-function Timer Pulse Unit (MTU3a)
/* The possible counter clearing source selections. Index into register settings table. */
typedef enum mtu_clear_src_e
{
MTU_CLR_TIMER_A = 0, // Clear the channel counter on the "A" compare or capture event.
MTU_CLR_TIMER_B, // Clear the channel counter on the "B" compare or capture event.
MTU_CLR_TIMER_C, // Clear the channel counter on the "C" compare or capture event.
MTU_CLR_TIMER_D, // Clear the channel counter on the "D" compare or capture event.
MTU_CLR_SYNC, // Clear the channel counter when another sync'ed channel clears.
MTU_CLR_DISABLED // Never clear the channel counter.
} mtu_clear_src_t;
/* PCLK divisor for internal clocking source. Index into register settings table. */
typedef enum mtu_pclk_divisor_e
{
MTU_SRC_CLK_DIV_1 = 0, // PCLK/1
MTU_SRC_CLK_DIV_4, // PCLK/4
MTU_SRC_CLK_DIV_16, // PCLK/16
MTU_SRC_CLK_DIV_64, // PCLK/64
MTU_SRC_CLK_DIV_256, // PCLK/256
MTU_SRC_CLK_DIV_1024, // PCLK/1024
MTU_SRC_CLK_DIV_2, // PCLK/2
MTU_SRC_CLK_DIV_8, // PCLK/8
MTU_SRC_CLK_DIV_32 // PCLK/32
} mtu_src_clk_divisor_t;
/* Actions to be done upon timer or capture event. Multiple selections to be ORed together. */
typedef enum mtu_actions_e
{
MTU_ACTION_NONE = 0x00, // Do nothing with this timer.
MTU_ACTION_OUTPUT = 0x01, // Change state of output pin.
MTU_ACTION_INTERRUPT = 0x02, // Generate interrupt request.
MTU_ACTION_CALLBACK = 0x04, // Generate interrupt request and execute user-defined callback on interrupt.
MTU_ACTION_REPEAT = 0x10, // Continuously repeat the timer cycle and actions
MTU_ACTION_TRIGGER_ADC = 0x20, // Trigger ADC on this event. Timer A events only.
MTU_ACTION_CAPTURE = 0x40, // Default input capture action. Placeholder value, does not to be specified.
} mtu_actions_t;
Figure 6.4 Structures/Unions/Enumerated Types for Sample Program (3)