|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Standalone GoodIX GT911 capacitive-touch bring-up demo + HIL (#122). More...
#include <stddef.h>#include <stdint.h>#include "ra8_attributes.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_board_ek_ra8d2_touch.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"#include "ra8_touch.h"Go to the source code of this file.
Enumerations | |
| enum | td_consts_t : uint32_t { k_td_uart_baud = 115200U , k_td_max_points = 5U , k_td_poll_max = 20000U , k_td_dec_ten = 10U } |
| Console / GT911 / poll knobs (no magic numbers). More... | |
Functions | |
| static void | internal_td_print (const uint8_t *msg, uint32_t len) |
| Emit a byte run on the SCI8 console. | |
| static void | internal_td_panic_halt (const uint8_t *msg, uint32_t len) |
| Print the fail banner and trap (ra8_emulator halts on the BKPT). | |
| static void | internal_td_print_uint (uint32_t value) |
| Print a small unsigned integer in decimal. | |
| static uint8_t | internal_td_poll_points (uint16_t *out_x, uint16_t *out_y) |
| Poll the GT911 for one touch frame; report the first contact. | |
| static void | internal_td_setup_or_halt (void) |
| Bring up clocks/MSTP/time + the SCI8 console; halt on failure. | |
| void | main (void) |
| App entry: bring up the GT911, poll a touch frame, print the banner. | |
Variables | |
| static const uint8_t | s_msg_boot [] = "touch-demo: boot\r\n" |
| Startup banner after console initialization. | |
| static const uint8_t | s_msg_fail [] = "touch-demo: FAIL init\r\n" |
| Fatal clock, timebase, module, or console setup banner. | |
| static const uint8_t | s_msg_open [] = "touch: FAIL open\r\n" |
| Fatal touch-controller open-failure banner. | |
| static const uint8_t | s_msg_pre [] = "touch: open=OK pts=" |
| Prefix for the successful open and bounded-poll report. | |
| static const uint8_t | s_msg_x [] = " x=" |
| Label introducing the first contact X coordinate. | |
| static const uint8_t | s_msg_y [] = " y=" |
| Label introducing the first contact Y coordinate. | |
| static const uint8_t | s_msg_eol [] = "\r\n" |
| CRLF terminator for the composed poll report. | |
Standalone GoodIX GT911 capacitive-touch bring-up demo + HIL (#122).
ra8_touch (GT911 over IIC_B channel 0) was only ever exercised inside ereader_ui – there was no standalone example and no CI gate for the touch driver itself. This app is that gate: it brings up the GT911 end-to-end (I2C probe + product-id wake), then polls for a touch frame and reports the first decoded contact on the SCI8 J-Link OB console:
touch: open=OK pts=1 x=<X> y=<Y>
The bring-up half (open=OK) is the deterministic, finger-free part of the gate – it proves the real ra8_touch_open -> IIC_B -> GT911 path reached the product-id check. The point half is exercised under ra8_emulator, which models the GT911 on the modelled I2C bus and injects a tap via --click X Y; that tap returns through the genuine ra8_touch_read decode, so the banner carries a real decoded coordinate. On a bare bench with no finger the poll loop times out and reports pts=0, but open=OK still holds – so hil.conf asserts only the bring-up substring, which is stable either way.
[Ring 7 / App] {World: NS}
Definition in file main.c.
| enum td_consts_t : uint32_t |
|
static |
Print the fail banner and trap (ra8_emulator halts on the BKPT).
Emits the diagnostic once, executes a debugger-visible breakpoint, then enters a permanent low-power wait loop.
| [in] | msg | Start of the failure banner. |
| [in] | len | Number of banner bytes to transmit. |
msg addresses at least len readable bytes. Definition at line 140 of file main.c.
References internal_td_print(), and RA8_INTERNAL.
Referenced by internal_td_setup_or_halt(), and main().
|
static |
Poll the GT911 for one touch frame; report the first contact.
Calls ra8_touch_read up to k_td_poll_max times (statically bounded). ra8_emulator re-arms an injected --click each SysTick chunk until the firmware drains it, so the loop catches the tap within a few chunks; on a bare bench with no finger it exhausts and reports zero points.
| [out] | out_x | Receives the first contact's X (0 if none). |
| [out] | out_y | Receives the first contact's Y (0 if none). |
| 0 | No usable touch frame arrived within the bounded poll. |
out_x and out_y are non-NULL writable pointers. Definition at line 198 of file main.c.
References k_ra8_ok, k_td_max_points, k_td_poll_max, RA8_INTERNAL, ra8_touch_read(), ra8_touch_point_t::x, and ra8_touch_point_t::y.
Referenced by main().
|
static |
Emit a byte run on the SCI8 console.
Passes caller-owned bytes and their explicit length directly to the board console.
| [in] | msg | Start of the byte run to transmit. |
| [in] | len | Number of bytes to transmit. |
msg addresses at least len readable bytes. len is nonzero. Definition at line 122 of file main.c.
References ra8_board_uart_console_write(), and RA8_INTERNAL.
Referenced by internal_td_panic_halt(), internal_td_print_uint(), and main().
|
static |
Print a small unsigned integer in decimal.
Builds digits in reverse in a fixed local buffer and emits them most-significant first.
| [in] | value | Unsigned value to render in base ten. |
Definition at line 160 of file main.c.
References internal_td_print(), k_td_dec_ten, and RA8_INTERNAL.
Referenced by main().
|
static |
Bring up clocks/MSTP/time + the SCI8 console; halt on failure.
Initializes each prerequisite in dependency order and treats any failure as terminal.
Definition at line 225 of file main.c.
References internal_td_panic_halt(), k_ra8_clock_id_cpuclk0, k_ra8_ok, k_td_uart_baud, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), RA8_INTERNAL, ra8_mstp_init(), ra8_time_init(), and s_msg_fail.
Referenced by main().
| void main | ( | void | ) |
App entry: bring up the GT911, poll a touch frame, print the banner.
The application entry point Reset_Handler hands control to.
Definition at line 250 of file main.c.
References internal_td_panic_halt(), internal_td_poll_points(), internal_td_print(), internal_td_print_uint(), internal_td_setup_or_halt(), k_ra8_ok, k_ra8_touch_irq_pin_unset, k_td_max_points, ra8_board_touch_open(), ra8_isr_globals_enable(), s_msg_boot, s_msg_eol, s_msg_open, s_msg_pre, s_msg_x, and s_msg_y.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |