ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_ulpt.h
Go to the documentation of this file.
1
11
12#pragma once
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#include <stdint.h>
19
20#include "ra8_err.h"
21#include "ra8_ulpt_regs.h"
22
28[[nodiscard]] ra8_err_t ra8_ulpt_init(void);
29
38[[nodiscard]] ra8_err_t ra8_ulpt_start(uint8_t channel, uint32_t period);
39
69[[nodiscard]] ra8_err_t ra8_ulpt_stop(uint8_t channel);
70
75typedef void (*ra8_ulpt_event_fn_t)(void* ctx, uint8_t channel);
76
81[[nodiscard]] ra8_err_t ra8_ulpt_deinit(uint8_t channel);
82
87[[nodiscard]] ra8_err_t ra8_ulpt_set_period(uint8_t channel, uint32_t period);
88
93[[nodiscard]] ra8_err_t ra8_ulpt_get_status(uint8_t channel, uint8_t* out_mask);
94
99[[nodiscard]] ra8_err_t ra8_ulpt_attach_handler(ra8_ulpt_event_fn_t fn, void* ctx);
100
121void ra8_ulpt_dispatch(uint8_t channel);
122
127[[nodiscard]] ra8_err_t ra8_ulpt_enter_stop(uint8_t channel);
128
133[[nodiscard]] ra8_err_t ra8_ulpt_exit_stop(uint8_t channel);
134
135#ifdef __cplusplus
136}
137#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t ra8_ulpt_enter_stop(uint8_t channel)
Put one channel into MSTP-gated stop.
Definition ra8_ulpt.c:344
ra8_err_t ra8_ulpt_deinit(uint8_t channel)
Tear down a ULPT channel.
Definition ra8_ulpt.c:177
void ra8_ulpt_dispatch(uint8_t channel)
Dispatch a ULPT event – fire callback.
Definition ra8_ulpt.c:308
ra8_err_t ra8_ulpt_set_period(uint8_t channel, uint32_t period)
Change the ULPT period at runtime.
Definition ra8_ulpt.c:213
void(* ra8_ulpt_event_fn_t)(void *ctx, uint8_t channel)
ULPT event callback.
Definition ra8_ulpt.h:75
ra8_err_t ra8_ulpt_attach_handler(ra8_ulpt_event_fn_t fn, void *ctx)
Attach a ULPT event callback (shared across channels).
Definition ra8_ulpt.c:282
ra8_err_t ra8_ulpt_get_status(uint8_t channel, uint8_t *out_mask)
Read ULPTCR status bits.
Definition ra8_ulpt.c:249
ra8_err_t ra8_ulpt_stop(uint8_t channel)
Stop a ULPT channel and confirm the counter has halted.
Definition ra8_ulpt.c:121
ra8_err_t ra8_ulpt_exit_stop(uint8_t channel)
Exit MSTP-gated stop.
Definition ra8_ulpt.c:375
ra8_err_t ra8_ulpt_init(void)
Reset both ULPT channels to their power-on state.
Definition ra8_ulpt.c:64
ra8_err_t ra8_ulpt_start(uint8_t channel, uint32_t period)
Start a ULPT channel counting down from period.
Definition ra8_ulpt.c:93
Ultra-Low-Power Timer (ULPT) register layout for the Renesas RA8D2.