ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1
59
60#include <stddef.h>
61#include <stdint.h>
62#include <string.h>
63
64#include "ra8_attributes.h"
65#include "ra8_board_ek_ra8d2.h"
67#include "ra8_boot_entry.h"
68#include "ra8_cgc.h"
69#include "ra8_display_pal.h"
70#include "ra8_display_pal_lcd.h"
71#include "ra8_err.h"
72#include "ra8_glcdc.h"
73#include "ra8_isr.h"
74#include "ra8_mstp.h"
75#include "ra8_panel.h"
76#include "ra8_panel_timing.h"
77#include "ra8_time.h"
78#include "ra8_touch.h"
79#include "ra8_touch_cal.h"
80
91typedef enum : uint16_t {
92 k_tc_fb_w = 512U,
93 k_tc_fb_h = 512U,
97} tc_geom_t;
98
103typedef enum : uint16_t {
104 k_tc_color_bg = 0x0000U,
107} tc_color_t;
108
113typedef enum : uint32_t {
114 k_tc_uart_baud = 115200U,
116 k_tc_poll_max = 20000U,
120
142
150[[gnu::aligned(k_ra8_board_fb_align_bytes)]] static uint16_t
151 s_framebuffer[(uint32_t)k_tc_fb_w * (uint32_t)k_tc_fb_h];
152
161
171 .framebuffer = s_framebuffer,
172 .framebuffer_bytes = sizeof(s_framebuffer),
173 .width_px = (uint16_t)k_tc_fb_w,
174 .height_px = (uint16_t)k_tc_fb_h,
175 .pixfmt = k_display_pixfmt_rgb565,
176 .panel_timing = &s_ra8_panel_ek_ra8d2_timing,
177};
178
185static const uint8_t s_tc_msg_boot[] = "touchcal: boot\r\n";
192static const uint8_t s_tc_msg_fail_in[] = "touchcal: FAIL init\r\n";
199static const uint8_t s_tc_msg_fail_gl[] = "touchcal: FAIL glcdc\r\n";
206static const uint8_t s_tc_msg_fail_op[] = "touchcal: FAIL open\r\n";
213static const uint8_t s_tc_msg_tgt[] = "touchcal: target ";
220static const uint8_t s_tc_msg_cal_ok[] = "touchcal: cal=OK verify=";
227static const uint8_t s_tc_msg_ok[] = "OK";
234static const uint8_t s_tc_msg_bad[] = "FAIL";
241static const uint8_t s_tc_msg_maxerr[] = " maxerr=";
248static const uint8_t s_tc_msg_skip[] = "touchcal: cal=SKIP got=";
255static const uint8_t s_tc_msg_ready[] = "touchcal: ready dim=512x512\r\n";
262static const uint8_t s_tc_msg_comma[] = ",";
269static const uint8_t s_tc_msg_eol[] = "\r\n";
270
271/* ===========================================================================
272 * Console
273 * ===========================================================================
274 */
275
289RA8_INTERNAL static void internal_tc_print(const uint8_t* msg, uint32_t len)
290{
291 (void)ra8_board_uart_console_write(msg, (size_t)len);
292}
293
307RA8_INTERNAL static void internal_tc_panic_halt(const uint8_t* msg, uint32_t len)
308{
309 internal_tc_print(msg, len);
310 __asm__ volatile("bkpt #0");
311 while (1) {
312 __asm__ volatile("wfi");
313 }
314}
315
328RA8_INTERNAL static void internal_tc_print_uint(uint32_t value)
329{
330 uint8_t buf[k_tc_dec_ten];
331 uint32_t n = 0U;
332 if (value == 0U) {
333 buf[n] = (uint8_t)'0';
334 n++;
335 }
336 while ((value > 0U) && (n < (uint32_t)k_tc_dec_ten)) {
337 buf[n] = (uint8_t)('0' + (value % (uint32_t)k_tc_dec_ten));
338 n++;
339 value /= (uint32_t)k_tc_dec_ten;
340 }
341 for (uint32_t i = 0U; i < n; i++) {
342 internal_tc_print(&buf[n - 1U - i], 1U);
343 }
344}
345
346/* ===========================================================================
347 * Framebuffer cross-hair painting
348 * ===========================================================================
349 */
350
368RA8_INTERNAL static bool internal_tc_pixel_in_bounds(int32_t v, int32_t dim)
369{
370 return (v >= 0) && (v < dim);
371}
372
387RA8_INTERNAL static void internal_tc_put_px(int32_t x, int32_t y, uint16_t color)
388{
389 if (internal_tc_pixel_in_bounds(x, (int32_t)k_tc_fb_w) &&
391 s_framebuffer[((uint32_t)y * (uint32_t)k_tc_fb_w) + (uint32_t)x] = color;
392 }
393}
394
407RA8_INTERNAL static void internal_tc_fb_fill(uint16_t color)
408{
409 for (uint32_t i = 0U; i < (uint32_t)k_tc_fb_w * (uint32_t)k_tc_fb_h; i++) {
410 s_framebuffer[i] = color;
411 }
412}
413
428RA8_INTERNAL static void internal_tc_draw_cross(int32_t cx, int32_t cy, uint16_t color)
429{
430 const int32_t half = (int32_t)k_tc_cross_half;
431 for (int32_t d = -half; d <= half; d++) {
432 internal_tc_put_px(cx + d, cy, color);
433 internal_tc_put_px(cx, cy + d, color);
434 }
435}
436
437/* ===========================================================================
438 * GLCDC + touch bring-up
439 * ===========================================================================
440 */
441
454{
455 uint32_t cpuclk0_hz = 0U;
456 if ((ra8_cgc_init() != k_ra8_ok) || (ra8_mstp_init() != k_ra8_ok)) {
458 }
461 }
462 if (ra8_time_init(cpuclk0_hz) != k_ra8_ok) {
464 }
467 }
468}
469
488{
490 display_handle_t* d = nullptr;
492 return false;
493 }
494 if (d == nullptr) {
495 return false;
496 }
497 display_fb_t fb = {};
498 if (display_get_framebuffer(d, &fb) != k_ra8_ok) {
499 return false;
500 }
501 if (fb.pixels != (void*)s_framebuffer) {
502 return false;
503 }
504 *out_disp = d;
505 return true;
506}
507
526{
527 const ra8_board_touch_cfg_t cfg = {.max_points = (uint8_t)k_tc_max_points,
528 .irq_pin = (uint8_t)k_ra8_touch_irq_pin_unset};
529 return ra8_board_touch_open(&cfg) == k_ra8_ok;
530}
531
532/* ===========================================================================
533 * Calibration shims (SOLID-D seams inverted onto by ra8_touch_cal_run)
534 * ===========================================================================
535 */
536
556{
557 tc_capture_t* cap = (tc_capture_t*)ctx;
558 if ((cap == nullptr) || (cap->n_drawn >= (uint8_t)k_ra8_touch_cal_n_targets)) {
560 }
561 cap->targets[cap->n_drawn] = target;
562 cap->n_drawn++;
563 internal_tc_draw_cross(target.x, target.y, (uint16_t)k_tc_color_target);
564 if (cap->disp != nullptr) {
566 }
567 internal_tc_print(s_tc_msg_tgt, (uint32_t)sizeof(s_tc_msg_tgt) - 1U);
568 internal_tc_print_uint((uint32_t)target.x);
569 internal_tc_print(s_tc_msg_comma, (uint32_t)sizeof(s_tc_msg_comma) - 1U);
570 internal_tc_print_uint((uint32_t)target.y);
571 internal_tc_print(s_tc_msg_eol, (uint32_t)sizeof(s_tc_msg_eol) - 1U);
572 return k_ra8_ok;
573}
574
593{
594 return (rc == k_ra8_ok) && (got >= 1U);
595}
596
619{
620 tc_capture_t* cap = (tc_capture_t*)ctx;
621 if ((cap == nullptr) || (out_raw == nullptr) ||
622 (cap->n_read >= (uint8_t)k_ra8_touch_cal_n_targets)) {
624 }
626 for (uint32_t i = 0U; i < (uint32_t)k_tc_poll_max; i++) {
627 uint8_t got = 0U;
628 const ra8_err_t rc = ra8_touch_read(pts, (uint8_t)k_tc_max_points, &got);
629 if (internal_tc_sample_usable(rc, got)) {
630 out_raw->x = (int32_t)pts[0].x;
631 out_raw->y = (int32_t)pts[0].y;
632 cap->raws[cap->n_read] = *out_raw;
633 cap->n_read++;
634 return k_ra8_ok;
635 }
636 }
637 return k_ra8_err_hw_error;
638}
639
640/* ===========================================================================
641 * Verify pass
642 * ===========================================================================
643 */
644
660RA8_INTERNAL static int32_t internal_tc_axis_err(int32_t a, int32_t b)
661{
662 const int32_t d = a - b;
663 return (d < 0) ? -d : d;
664}
665
686RA8_INTERNAL static bool
687internal_tc_cal_pass(ra8_err_t run_rc, int32_t maxerr, int32_t tol, bool blob_ok)
688{
689 return (run_rc == k_ra8_ok) && (maxerr <= tol) && blob_ok;
690}
691
715{
716 uint8_t blob0[k_tc_blob_cap] = {};
717 uint8_t blob1[k_tc_blob_cap] = {};
718 ra8_touch_cal_matrix_t back = {};
719 if (ra8_touch_cal_save(m, blob0, sizeof(blob0)) != k_ra8_ok) {
720 return false;
721 }
722 if (ra8_touch_cal_load(blob0, sizeof(blob0), &back) != k_ra8_ok) {
723 return false;
724 }
725 if (ra8_touch_cal_save(&back, blob1, sizeof(blob1)) != k_ra8_ok) {
726 return false;
727 }
728 return memcmp(blob0, blob1, sizeof(blob0)) == 0;
729}
730
754{
755 if ((m == nullptr) || (cap == nullptr) || (out_max == nullptr)) {
756 return k_ra8_err_null_ptr;
757 }
758 int32_t worst = 0;
759 for (uint8_t i = 0U; i < cap->n_read; i++) {
760 ra8_touch_cal_point_t screen = {};
761 const ra8_err_t rc =
762 ra8_touch_cal_apply(cap->raws[i], m, (uint16_t)k_tc_fb_w, (uint16_t)k_tc_fb_h, &screen);
763 if (rc != k_ra8_ok) {
764 return rc;
765 }
766 const int32_t ex = internal_tc_axis_err(screen.x, cap->targets[i].x);
767 const int32_t ey = internal_tc_axis_err(screen.y, cap->targets[i].y);
768 worst = (ex > worst) ? ex : worst;
769 worst = (ey > worst) ? ey : worst;
770 internal_tc_draw_cross(screen.x, screen.y, (uint16_t)k_tc_color_corrected);
771 }
772 if (cap->disp != nullptr) {
774 }
775 *out_max = worst;
776 return k_ra8_ok;
777}
778
779/* ===========================================================================
780 * Calibration orchestration + result banner
781 * ===========================================================================
782 */
783
803 ra8_touch_cal_matrix_t* out_matrix)
804{
806 s_capture.disp = disp;
807 const ra8_touch_cal_run_cfg_t cfg = {
808 .screen_width = (uint16_t)k_tc_fb_w,
809 .screen_height = (uint16_t)k_tc_fb_h,
810 .inset_px = (uint16_t)k_tc_inset_px,
811 .draw_target = internal_tc_draw_target,
812 .draw_ctx = &s_capture,
813 .read_raw = internal_tc_read_raw,
814 .read_ctx = &s_capture,
815 };
816 return ra8_touch_cal_run(&cfg, out_matrix);
817}
818
832RA8_INTERNAL static void internal_tc_report_ok(int32_t maxerr, bool verify_ok)
833{
834 internal_tc_print(s_tc_msg_cal_ok, (uint32_t)sizeof(s_tc_msg_cal_ok) - 1U);
835 if (verify_ok) {
836 internal_tc_print(s_tc_msg_ok, (uint32_t)sizeof(s_tc_msg_ok) - 1U);
837 } else {
838 internal_tc_print(s_tc_msg_bad, (uint32_t)sizeof(s_tc_msg_bad) - 1U);
839 }
840 internal_tc_print(s_tc_msg_maxerr, (uint32_t)sizeof(s_tc_msg_maxerr) - 1U);
841 internal_tc_print_uint((uint32_t)maxerr);
842 internal_tc_print(s_tc_msg_eol, (uint32_t)sizeof(s_tc_msg_eol) - 1U);
843}
844
857RA8_INTERNAL static void internal_tc_report_skip(uint8_t got)
858{
859 internal_tc_print(s_tc_msg_skip, (uint32_t)sizeof(s_tc_msg_skip) - 1U);
860 internal_tc_print_uint((uint32_t)got);
861 internal_tc_print(s_tc_msg_eol, (uint32_t)sizeof(s_tc_msg_eol) - 1U);
862}
863
880{
881 ra8_touch_cal_matrix_t matrix = {};
882 const ra8_err_t run_rc = internal_tc_run_calibration(disp, &matrix);
883 if (run_rc != k_ra8_ok) {
885 return;
886 }
887 int32_t maxerr = 0;
888 if (internal_tc_apply_and_measure(&matrix, &s_capture, &maxerr) != k_ra8_ok) {
889 internal_tc_report_ok(maxerr, false);
890 return;
891 }
892 const bool blob_ok = internal_tc_blob_roundtrip(&matrix);
893 const bool verify_ok = internal_tc_cal_pass(run_rc, maxerr, (int32_t)k_tc_verify_tol, blob_ok);
894 internal_tc_report_ok(maxerr, verify_ok);
895}
896
897/* ===========================================================================
898 * Boot + main
899 * ===========================================================================
900 */
901
911void main(void)
912{
915 internal_tc_print(s_tc_msg_boot, (uint32_t)sizeof(s_tc_msg_boot) - 1U);
916
917 display_handle_t* disp = nullptr;
918 if (!internal_tc_glcdc_bringup(&disp)) {
920 }
923 }
924
926
927 /* Finger-free bring-up sentinel: prints in every environment (bench + EIL),
928 * so hil.conf asserts this line and lets the negative set catch a solver
929 * regression (verify=FAIL / cal=FAIL). */
930 internal_tc_print(s_tc_msg_ready, (uint32_t)sizeof(s_tc_msg_ready) - 1U);
931
932 while (1) {
933 __asm__ volatile("wfi");
934 }
935}
void main(void)
Secure fallback main entry point.
Definition main.c:37
static uint16_t s_framebuffer[(size_t) k_panel_height_px *(size_t) k_panel_width_px]
1024x600 RGB565 framebuffer in external SDRAM (GLCDC scans this).
Definition main.c:67
static const uint8_t s_tc_msg_boot[]
Startup banner emitted after the console becomes available.
Definition main.c:185
static const uint8_t s_tc_msg_cal_ok[]
Prefix for the solved calibration verification result.
Definition main.c:220
static const uint8_t s_tc_msg_skip[]
Prefix for the no-contact calibration skip result.
Definition main.c:248
static bool internal_tc_pixel_in_bounds(int32_t v, int32_t dim)
Report whether a framebuffer coordinate is inside the panel.
Definition main.c:368
static int32_t internal_tc_axis_err(int32_t a, int32_t b)
Compute the absolute difference of two signed coordinates.
Definition main.c:660
static bool internal_tc_sample_usable(ra8_err_t rc, uint8_t got)
Decide whether a touch read yielded a usable contact.
Definition main.c:592
static const uint8_t s_tc_msg_ready[]
Finger-independent HIL bring-up sentinel.
Definition main.c:255
tc_geom_t
Framebuffer + calibration geometry (no magic numbers).
Definition main.c:91
@ k_tc_verify_tol
Max allowed fit residual, pixels.
Definition main.c:96
@ k_tc_cross_half
Cross-hair arm half-length, pixels.
Definition main.c:95
@ k_tc_inset_px
Corner-target inset from each panel edge.
Definition main.c:94
@ k_tc_fb_h
Framebuffer / screen height, pixels.
Definition main.c:93
@ k_tc_fb_w
Framebuffer / screen width, pixels.
Definition main.c:92
static const uint8_t s_tc_msg_comma[]
Separator between target X and Y coordinates.
Definition main.c:262
static ra8_err_t internal_tc_draw_target(void *ctx, ra8_touch_cal_point_t target)
Draw shim: paint a target cross-hair and record it.
Definition main.c:555
static const uint8_t s_tc_msg_fail_gl[]
Fatal banner for display-controller bring-up failure.
Definition main.c:199
static const uint8_t s_tc_msg_ok[]
Success token used in the verification result banner.
Definition main.c:227
static void internal_tc_print_uint(uint32_t value)
Print a small unsigned integer in decimal.
Definition main.c:328
static const uint8_t s_tc_msg_eol[]
CRLF terminator shared by composed console reports.
Definition main.c:269
static void internal_tc_put_px(int32_t x, int32_t y, uint16_t color)
Write one RGB565 pixel, clipped to the framebuffer rectangle.
Definition main.c:387
static ra8_err_t internal_tc_apply_and_measure(const ra8_touch_cal_matrix_t *m, tc_capture_t *cap, int32_t *out_max)
Apply the solved matrix to every captured raw, paint the corrected cross-hairs, and return the larges...
Definition main.c:753
static void internal_tc_panic_halt(const uint8_t *msg, uint32_t len)
Print the fail banner and trap (ra8_emulator halts on the BKPT).
Definition main.c:307
tc_color_t
RGB565 palette for the calibration UI.
Definition main.c:103
@ k_tc_color_target
White target cross-hair.
Definition main.c:105
@ k_tc_color_corrected
Green corrected-coordinate mark.
Definition main.c:106
@ k_tc_color_bg
Black field.
Definition main.c:104
static void internal_tc_draw_cross(int32_t cx, int32_t cy, uint16_t color)
Draw a plus-shaped cross-hair centred at (cx, cy).
Definition main.c:428
static const uint8_t s_tc_msg_maxerr[]
Label introducing the maximum calibration residual.
Definition main.c:241
static ra8_err_t internal_tc_read_raw(void *ctx, ra8_touch_cal_point_t *out_raw)
Read shim: block (bounded) on one settled raw GT911 sample.
Definition main.c:618
static bool internal_tc_blob_roundtrip(const ra8_touch_cal_matrix_t *m)
Round-trip the matrix through ra8_touch_cal_save / ra8_touch_cal_load and report stable reproduction.
Definition main.c:714
static const display_cfg_t s_tc_display_cfg
Display PAL config selecting the GLCDC LCD backend.
Definition main.c:169
static bool internal_tc_cal_pass(ra8_err_t run_rc, int32_t maxerr, int32_t tol, bool blob_ok)
Verdict: did the whole calibration pipeline pass?
Definition main.c:687
static void internal_tc_print(const uint8_t *msg, uint32_t len)
Emit a byte run on the SCI8 console.
Definition main.c:289
static void internal_tc_report_ok(int32_t maxerr, bool verify_ok)
Print the solved-and-verified result banner.
Definition main.c:832
static const uint8_t s_tc_msg_tgt[]
Prefix for a target-coordinate progress report.
Definition main.c:213
static const uint8_t s_tc_msg_fail_op[]
Fatal banner for touch-controller open failure.
Definition main.c:206
static const uint8_t s_tc_msg_bad[]
Failure token used in the verification result banner.
Definition main.c:234
static ra8_err_t internal_tc_run_calibration(display_handle_t *disp, ra8_touch_cal_matrix_t *out_matrix)
Reset the capture and run the five-point calibration collect+solve.
Definition main.c:802
static const uint8_t s_tc_msg_fail_in[]
Fatal banner for clock, timebase, or console setup failure.
Definition main.c:192
tc_consts_t
Console / GT911 / poll knobs (no magic numbers).
Definition main.c:113
@ k_tc_max_points
Read up to the GT911 capacity.
Definition main.c:115
@ k_tc_blob_cap
k_ra8_touch_cal_blob_size mirror.
Definition main.c:118
@ k_tc_dec_ten
Decimal radix / small-buf cap.
Definition main.c:117
@ k_tc_poll_max
Bounded per-target poll (NASA R2).
Definition main.c:116
@ k_tc_uart_baud
Console baud.
Definition main.c:114
static void internal_tc_fb_fill(uint16_t color)
Fill the whole framebuffer with color.
Definition main.c:407
static bool internal_tc_glcdc_bringup(display_handle_t **out_disp)
Bring the GLCDC layer-1 path up and confirm it is programmed.
Definition main.c:487
static void internal_tc_report_skip(uint8_t got)
Print the no-taps skip banner (bare automated bench).
Definition main.c:857
static bool internal_tc_touch_bringup(void)
Bring up IIC_B (I2C-compat) and open the GT911 touch driver.
Definition main.c:525
static void internal_tc_calibrate_and_report(display_handle_t *disp)
Solve, verify, and report; degrade to SKIP if no taps arrived.
Definition main.c:879
static tc_capture_t s_capture
The single calibration capture the shims fill.
Definition main.c:160
static void internal_tc_setup_or_halt(void)
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Definition main.c:453
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_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
One-call bring-up of the EK-RA8D2 panel's GoodIX GT911 touch controller.
ra8_err_t ra8_board_touch_open(const ra8_board_touch_cfg_t *cfg)
Bring the on-board GT911 up and open the touch driver against it.
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.
Definition ra8_cgc.c:132
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
Definition ra8_cgc.h:70
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Definition ra8_cgc.c:727
Display Platform Abstraction Layer for the RA8D2.
@ k_display_pixfmt_rgb565
16 bpp, 5/6/5 packed.
display_rect_t display_full_rect(const display_handle_t *d)
Convenience helper returning the rect covering the whole framebuffer.
ra8_err_t display_get_framebuffer(const display_handle_t *d, display_fb_t *out)
Return the framebuffer descriptor the backend is targeting.
ra8_err_t display_flush(const display_handle_t *d, display_rect_t rect, display_refresh_hint_t hint)
Commit pending framebuffer changes to the panel.
struct display_handle display_handle_t
ra8_err_t display_init(const display_cfg_t *cfg, display_handle_t **out_handle)
Initialise the display PAL and bring the selected backend up to a state where display_flush succeeds.
@ k_display_refresh_fast
Prioritise latency.
LCD backend (ra8_glcdc) for the display PAL.
const display_backend_iface_t k_display_backend_lcd_ra8_glcdc
LCD backend vtable – pass its address through display_cfg_t.iface to drive the EK-RA8D2 panel.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
Definition ra8_err.h:152
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
Definition ra8_err.h:478
@ k_ra8_err_hw_error
Generic hardware fault detected (error flag set, fault interrupt).
Definition ra8_err.h:310
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
int memcmp(const void *a, const void *b, size_t n)
Compare bytes in two memory areas.
Graphics LCD Controller driver (two-layer with alpha blending).
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Definition ra8_isr.c:439
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
Definition ra8_mstp.c:291
Active display-panel descriptor for the EK-RA8D2 (ER-TFT070-6).
@ k_ra8_board_fb_align_bytes
GLCDC AXI burst alignment, in bytes.
Definition ra8_panel.h:108
EK-RA8D2 panel timing as the HAL's ra8_glcdc_timing_t (ER-TFT070-6).
static const ra8_glcdc_timing_t s_ra8_panel_ek_ra8d2_timing
EK-RA8D2 ER-TFT070-6 RGB timing for ra8_glcdc_init / the LCD backend.
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.
Definition ra8_time.c:59
Multi-touch input driver – GoodIX GT911 backend.
ra8_err_t ra8_touch_read(ra8_touch_point_t *out_points, uint8_t max_count, uint8_t *got_count)
Drain the current touch frame.
Definition ra8_touch.c:551
@ k_ra8_touch_irq_pin_unset
Sentinel for "no IRQ pin attached".
Definition ra8_touch.h:72
Resistive/capacitive touch-screen calibration utility.
ra8_err_t ra8_touch_cal_save(const ra8_touch_cal_matrix_t *matrix, uint8_t *dst, size_t dst_size)
Serialise a calibration matrix to a fixed-size byte blob.
@ k_ra8_touch_cal_n_targets
4 corners + centre.
ra8_err_t ra8_touch_cal_load(const uint8_t *src, size_t src_size, ra8_touch_cal_matrix_t *out_matrix)
Deserialise a calibration matrix from a byte blob.
ra8_err_t ra8_touch_cal_apply(ra8_touch_cal_point_t raw, const ra8_touch_cal_matrix_t *matrix, uint16_t screen_width, uint16_t screen_height, ra8_touch_cal_point_t *out_screen)
Apply a calibration matrix to a single raw touch sample.
ra8_err_t ra8_touch_cal_run(const ra8_touch_cal_run_cfg_t *cfg, ra8_touch_cal_matrix_t *out_matrix)
Drive the on-screen calibration sequence and produce a matrix.
Configuration descriptor passed into display_init.
Framebuffer descriptor returned by display_get_framebuffer.
void * pixels
Base of pixel data (RGB565 unless noted).
The two touch settings that are an APPLICATION choice, not a board fact.
2-D affine transform screen = [a b; d e] * raw + [c; f].
One (x, y) integer coordinate pair.
int32_t y
Vertical coordinate.
int32_t x
Horizontal coordinate.
Configuration for ra8_touch_cal_run.
One decoded touch contact.
Definition ra8_touch.h:93
Per-run capture the calibration shims fill for the verify pass.
Definition main.c:135
uint8_t n_drawn
Targets drawn.
Definition main.c:139
uint8_t n_read
Raws captured.
Definition main.c:140
ra8_touch_cal_point_t raws[k_ra8_touch_cal_n_targets]
Captured raws.
Definition main.c:138
display_handle_t * disp
Live panel handle.
Definition main.c:136
ra8_touch_cal_point_t targets[k_ra8_touch_cal_n_targets]
Drawn targets.
Definition main.c:137