41typedef enum : uint32_t {
64typedef enum : uint8_t {
84 __asm__
volatile(
"wfi");
104 uint32_t cpuclk0_hz = 0U;
214 uint32_t last_tick = 0U;
215 uint32_t prev_count = 0U;
216 bool have_prev =
false;
221 const uint32_t last_delta = now - last_tick;
230 if (now_count != UINT32_MAX) {
231 if (have_prev && (now_count != prev_count)) {
234 prev_count = now_count;
void main(void)
Secure fallback main entry point.
static void internal_setup_or_halt(void)
Bring up clocks, MSTP, delay timing, and the board console.
static void internal_panic_halt(void)
Park the core after an unrecoverable ADC demo failure.
static bool internal_edge(ra8_board_sw_state_t *prev)
Detect a falling edge on SW1.
static uint32_t internal_read(void)
Read current GPT counter ticks, or return UINT32_MAX on err.
gpt_capture_layout_t
Channel + LED selection.
@ k_gpt_capture_channel
GPT capture channel.
volatile uint32_t g_gpt_capture_tick
HIL liveness counter – incremented every iteration where the GPT counter advanced relative to the pre...
gpt_capture_const_t
Demo tunables.
@ k_gpt_capture_min_delta_ms
GPT capture minimum delta ms.
@ k_gpt_capture_poll_period_ms
GPT capture poll period ms.
@ k_gpt_capture_period
GPT capture period.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
ra8_err_t ra8_board_sw_read(ra8_board_sw_id_t sw, ra8_board_sw_state_t *out_pressed)
Sample the current state of sw.
ra8_err_t ra8_board_sw_init(ra8_board_sw_id_t sw)
Configure a switch pin as an input with internal pull-up.
@ k_ra8_board_sw1
SW1, P009, IRQ13-DS (jumper E31).
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
ra8_board_sw_state_t
Logical "pressed" / "released" state.
@ k_ra8_board_sw_released
RA8 board sw released.
@ k_ra8_board_sw_pressed
RA8 board sw pressed.
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Full-featured General PWM Timer (GPT) driver.
@ k_ra8_gpt_mode_saw_pwm
Saw-wave PWM (up-count).
ra8_err_t ra8_gpt_init(uint8_t channel, const ra8_gpt_cfg_t *cfg)
Initialise a GPT channel with a full config descriptor.
ra8_err_t ra8_gpt_read(uint8_t channel, uint32_t *out)
Read the current counter value.
@ k_ra8_gpt_ps_div_64
PCLKD / 64.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Configuration descriptor for ra8_gpt_init.