|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
IT8951 e-paper controller SPI driver – public API. More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_epaper_waveform_cfg_t |
| Per-panel map from ra8_epaper_waveform_t onto LUT mode numbers. More... | |
| struct | ra8_epaper_dev_info_t |
| Decoded GET_DEV_INFO (0x0302) response. More... | |
| struct | ra8_epaper_cfg_t |
| Configuration descriptor for ra8_epaper_init. More... | |
| struct | ra8_epaper_area_t |
| Rectangle descriptor (top-left + size) used by load + display. More... | |
Enumerations | |
| enum | ra8_epaper_waveform_t : uint8_t { k_ra8_epaper_wf_init = 0U , k_ra8_epaper_wf_du = 1U , k_ra8_epaper_wf_gc16 = 2U , k_ra8_epaper_wf_a2 = 3U } |
| Symbolic IT8951 panel-refresh waveform selectors. More... | |
| enum | ra8_epaper_pixel_format_t : uint8_t { k_ra8_epaper_pf_1bpp = 0U , k_ra8_epaper_pf_2bpp = 1U , k_ra8_epaper_pf_4bpp = 2U , k_ra8_epaper_pf_8bpp = 3U } |
| Source pixel depth for a ra8_epaper_load_image transfer. More... | |
| enum | ra8_epaper_geom_limits_t : uint16_t { k_ra8_epaper_align_1bpp_px = 32U , k_ra8_epaper_wf_mode_max = 7U } |
| Geometry / waveform constants the driver enforces. More... | |
| enum | ra8_epaper_dev_info_limits_t : uint8_t { k_ra8_epaper_ver_chars = 16U } |
| Sizing of the GET_DEV_INFO (0x0302) response block. More... | |
| enum | ra8_epaper_endian_t : uint8_t { k_ra8_epaper_endian_little = 0U , k_ra8_epaper_endian_big = 1U } |
| Source-buffer endianness flag for the LD_IMG_AREA transfer. More... | |
Functions | |
| ra8_err_t | ra8_epaper_init (const ra8_epaper_cfg_t *cfg) |
| Bring up the IT8951 panel against the injected SPI bus seam. | |
| uint8_t | ra8_epaper_bits_per_pixel (ra8_epaper_pixel_format_t pf) |
| Bits per pixel carried by a ra8_epaper_pixel_format_t. | |
| ra8_err_t | ra8_epaper_image_bytes (const ra8_epaper_area_t *area, ra8_epaper_pixel_format_t pf, size_t *out_bytes) |
| Bytes a packed source buffer needs for area at depth pf. | |
| bool | ra8_epaper_area_is_aligned (const ra8_epaper_area_t *area, ra8_epaper_pixel_format_t pf) |
| Report whether area satisfies the depth's X/width alignment. | |
| ra8_err_t | ra8_epaper_align_area (ra8_epaper_area_t *area, ra8_epaper_pixel_format_t pf, uint16_t panel_width) |
| Grow area outward onto the alignment grid its depth requires. | |
| ra8_err_t | ra8_epaper_waveform_cfg_for_lut (const char *lut_version, ra8_epaper_waveform_cfg_t *out_cfg) |
| Fill a waveform map from a controller-reported LUT version. | |
| ra8_err_t | ra8_epaper_validate_cfg (const ra8_epaper_cfg_t *cfg) |
| Validate a panel descriptor without touching any hardware. | |
| bool | ra8_epaper_geometry_agrees (const ra8_epaper_dev_info_t *info, const ra8_epaper_cfg_t *cfg) |
| Report whether reported panel geometry matches the descriptor. | |
| ra8_err_t | ra8_epaper_dev_info (ra8_epaper_dev_info_t *out_info) |
| Hand back the GET_DEV_INFO block captured during init. | |
| ra8_err_t | ra8_epaper_decode_dev_info (const uint16_t *words, size_t count, ra8_epaper_dev_info_t *out_info) |
| Decode a raw GET_DEV_INFO word block into a device-info struct. | |
| ra8_err_t | ra8_epaper_get_vcom (uint16_t *out_mv) |
| Read the controller's current VCOM setting, in millivolts. | |
| ra8_err_t | ra8_epaper_set_vcom (uint16_t mv) |
| Programme the controller's VCOM, verify it, and grant the INV-VCOM-1 permit. | |
| bool | ra8_epaper_vcom_verified (void) |
| Report whether the INV-VCOM-1 permit is currently held. | |
| ra8_err_t | ra8_epaper_load_image (const ra8_epaper_area_t *area, const uint8_t *buf, size_t buf_len, ra8_epaper_pixel_format_t pf, ra8_epaper_endian_t endian) |
| Push a packed greyscale buffer into the controller's frame RAM. | |
| ra8_err_t | ra8_epaper_display_area (const ra8_epaper_area_t *area, ra8_epaper_waveform_t waveform) |
| Refresh the indicated rectangle on the physical panel. | |
| ra8_err_t | ra8_epaper_sleep (void) |
| Drop the panel into deep-sleep (~15 uA per Waveshare AN). | |
IT8951 e-paper controller SPI driver – public API.
Hand-written driver for the Waveshare / IT8951 e-paper timing controller. The IT8951 wraps the actual e-paper panel and exposes an SPI command/data interface to the host MCU. This driver is intended for a future custom carrier board (the EK-RA8D2 v1 dev-kit ships with a parallel TFT, not e-paper); the EPD demo apps that consume this driver compile but are gated off until the board is built.
The IT8951 SPI protocol is a "preamble" pattern documented in the IT8951 datasheet (rev 0.2 chapter 3.4 "SPI Interface" and chapter 4 "Application Note"; see also Waveshare's IT8951-AP user guide):
Public API surface:
Two properties of this controller are panel-specific and must not be baked into firmware:
Static allocation only – the driver keeps one panel context (s_panel) at file scope and rejects double-init.
Definition in file ra8_epaper.h.
| enum ra8_epaper_dev_info_limits_t : uint8_t |
Sizing of the GET_DEV_INFO (0x0302) response block.
| Enumerator | |
|---|---|
| k_ra8_epaper_ver_chars | Chars in a FW / LUT version string. |
Definition at line 213 of file ra8_epaper.h.
| enum ra8_epaper_endian_t : uint8_t |
Source-buffer endianness flag for the LD_IMG_AREA transfer.
IT8951 datasheet rev 0.2 chapter 4.1.5 – the panel can swap byte pairs on the fly so the host does not have to re-pack.
| Enumerator | |
|---|---|
| k_ra8_epaper_endian_little | Host buffer is little-endian. |
| k_ra8_epaper_endian_big | Host buffer is big-endian. |
Definition at line 263 of file ra8_epaper.h.
| enum ra8_epaper_geom_limits_t : uint16_t |
Geometry / waveform constants the driver enforces.
k_ra8_epaper_align_1bpp_px encodes the vendor requirement published on the Waveshare 6 inch HD wiki: "when we use 1bpp mode to update the 6inch e-Paper and 6inch HD e-Paper, we should align the X (begin point) and W (width) of the update area to four bytes (32bits), otherwise, the image cannot be displayed". Four bytes of a 1 bpp bitmap is 32 pixels, so both area->x and area->width must be multiples of 32 in 1 bpp mode. This is not a quality hint – a misaligned A2 update does not render at all.
| Enumerator | |
|---|---|
| k_ra8_epaper_align_1bpp_px | 4-byte (32 px) X/W grid for 1 bpp. |
| k_ra8_epaper_wf_mode_max | Highest valid LUT mode number. |
Definition at line 204 of file ra8_epaper.h.
| enum ra8_epaper_pixel_format_t : uint8_t |
Source pixel depth for a ra8_epaper_load_image transfer.
IT8951 datasheet rev 0.2 chapter 4.1.5 "Image Buffer Endianness" and the Waveshare IT8951 programming guide's IT8951_nBPP constants. These enumerators are driver-side selectors; the two-bit code the controller wants in the LD_IMG_AREA arg0 bitfield uses a different numbering (2 bpp = 0, 3 bpp = 1, 4 bpp = 2, 8 bpp = 3) and is applied internally by ra8_epaper_load_image.
Definition at line 180 of file ra8_epaper.h.
| enum ra8_epaper_waveform_t : uint8_t |
Symbolic IT8951 panel-refresh waveform selectors.
IT8951 datasheet rev 0.2 chapter 4.1.4 "Display Update Modes" / Waveshare IT8951 application note table 2. Each waveform trades refresh latency for ghosting / quality.
Definition at line 106 of file ra8_epaper.h.
|
nodiscard |
Grow area outward onto the alignment grid its depth requires.
Rounds x down and the right edge up to the next multiple of k_ra8_epaper_align_1bpp_px, then clamps the right edge to panel_width. Growing outward (never inward) guarantees the caller's requested rectangle stays wholly covered, so the refresh is a superset of what was asked for rather than a silently cropped subset. A no-op for depths other than 1 bpp.
| [in,out] | area | Rectangle to align in place; non-NULL. |
| [in] | pf | Pixel depth the rectangle will be sent at. |
| [in] | panel_width | Panel width in pixels used as the clamp; must be non-zero and itself a multiple of k_ra8_epaper_align_1bpp_px when pf is 1 bpp, otherwise the clamp could reintroduce a misaligned right edge. |
| k_ra8_ok | *area is aligned and within the panel. |
| k_ra8_err_null_ptr | area is NULL. |
| k_ra8_err_invalid_arg | panel_width is zero, area steps outside it, or the clamp cannot produce an aligned width. |
Definition at line 152 of file ra8_epaper_geom.c.
References k_ra8_epaper_align_1bpp_px, k_ra8_epaper_pf_1bpp, k_ra8_err_invalid_arg, k_ra8_ok, RA8_CHECK_NULL_PTR, s_tag, ra8_epaper_area_t::width, and ra8_epaper_area_t::x.
|
nodiscard |
Report whether area satisfies the depth's X/width alignment.
Only 1 bpp constrains geometry: the controller's bi-level LUT reads the update window in 4-byte units, so x and width must both be multiples of k_ra8_epaper_align_1bpp_px (32 pixels). Every other depth is unconstrained and always reports aligned.
| [in] | area | Rectangle to test; non-NULL. |
| [in] | pf | Pixel depth the rectangle will be transferred at. |
| true | pf is not 1 bpp, or both x and width sit on the 32-pixel grid. |
| false | pf is 1 bpp and x or width is misaligned. |
Definition at line 138 of file ra8_epaper_geom.c.
References k_ra8_epaper_align_1bpp_px, k_ra8_epaper_pf_1bpp, ra8_epaper_area_t::width, and ra8_epaper_area_t::x.
Referenced by internal_ra8_epaper_validate_load().
|
nodiscard |
Bits per pixel carried by a ra8_epaper_pixel_format_t.
Pure lookup used to size transfers. Kept public because the PAL and the host tests both need the packing arithmetic to agree with the driver's.
| [in] | pf | Pixel format selector. |
| 1 | For k_ra8_epaper_pf_1bpp. |
| 2 | For k_ra8_epaper_pf_2bpp. |
| 4 | For k_ra8_epaper_pf_4bpp. |
| 8 | For k_ra8_epaper_pf_8bpp and any out-of-range input (8 bpp is the widest format, so an unknown selector can only over-estimate the buffer a caller must supply – it can never under-run one). |
Definition at line 106 of file ra8_epaper_geom.c.
References k_ra8_epaper_bpp_1, k_ra8_epaper_bpp_2, k_ra8_epaper_bpp_4, k_ra8_epaper_bpp_8, k_ra8_epaper_pf_1bpp, k_ra8_epaper_pf_2bpp, k_ra8_epaper_pf_4bpp, and k_ra8_epaper_pf_8bpp.
Referenced by ra8_epaper_image_bytes().
|
nodiscard |
Decode a raw GET_DEV_INFO word block into a device-info struct.
The controller answers GET_DEV_INFO with 20 big-endian-assembled words: panel width, panel height, the low and high halves of the image-buffer base address, then two 16-character version strings packed two ASCII chars per word. This is the pure decode half of that read – ra8_epaper_init buffers the words off the bus and calls this.
Version bytes outside printable ASCII are dropped to NUL, because the strings are logged and a controller that has not finished loading its waveform answers early reads with garbage.
Split out so the layout can be pinned by host tests with no controller attached: the decoded lut_version is what ra8_epaper_waveform_cfg_for_lut maps to a waveform mode number, so a mis-decode silently selects the wrong A2 mode on the panel.
| [in] | words | Response words, most significant byte first as assembled by the bus layer; non-NULL. |
| [in] | count | Number of words available in words; must be at least 20. |
| [out] | out_info | Receives the decoded block; non-NULL. Fully overwritten, so it need not be pre-zeroed. |
| k_ra8_ok | Block decoded. |
| k_ra8_err_null_ptr | words or out_info is NULL. |
| k_ra8_err_invalid_arg | count is below the 20-word layout. |
Definition at line 161 of file ra8_epaper_devinfo.c.
References ra8_epaper_dev_info_t::fw_version, internal_ra8_epaper_decode_dev_word(), k_ra8_epaper_di_idx_end, k_ra8_epaper_ver_chars, k_ra8_err_invalid_arg, k_ra8_ok, ra8_epaper_dev_info_t::lut_version, RA8_CHECK_NULL_PTR, ra8_log_error, and s_tag.
Referenced by internal_ra8_epaper_read_dev_info().
|
nodiscard |
Hand back the GET_DEV_INFO block captured during init.
ra8_epaper_init decodes the 40-byte response once and caches it, so this is an O(1) copy with no bus traffic.
| [out] | out_info | Receives the decoded device block; non-NULL. |
| k_ra8_ok | Info copied. |
| k_ra8_err_null_ptr | out_info is NULL. |
| k_ra8_err_invalid_state | Panel never initialized. |
Definition at line 701 of file ra8_epaper.c.
References k_ra8_epaper_state_ready, k_ra8_err_invalid_state, k_ra8_ok, RA8_CHECK_NULL_PTR, s_panel, and s_tag.
|
nodiscard |
Refresh the indicated rectangle on the physical panel.
Resolves waveform through the panel's ra8_epaper_waveform_cfg_t (supplied at init) into the LUT mode number this panel's controller firmware expects, issues DPY_AREA (0x0034) with area and that mode number, then polls REG_LUTAFSR (0x1224) until it reads zero (no LUTs busy). IT8951 datasheet rev 0.2 chapter 4.2.4.
This call enforces INV-VCOM-1. DPY_AREA is the command that puts a bias across the electrophoretic film, so it is refused outright unless ra8_epaper_set_vcom has programmed a VCOM and read it back unchanged. There is no override and no "just this once" path: a wrong or unknown bias damages the panel cumulatively with time under bias, and a blank screen is recoverable where a degraded panel is not. Stage pixels with ra8_epaper_load_image as much as you like beforehand – loading frame RAM applies no bias and is deliberately ungated.
| [in] | area | Rectangle to refresh (panel coords); non-NULL. |
| [in] | waveform | Symbolic waveform selector – not a wire value. |
| k_ra8_ok | Panel idle and updated. |
| k_ra8_err_null_ptr | area is NULL. |
| k_ra8_err_invalid_state | Panel never initialized. |
| k_ra8_err_validation_failed | No verified VCOM – INV-VCOM-1 refusal. Resolve one through ra8_epd_cal_resolve and apply it; do not retry blind. |
| k_ra8_err_invalid_arg | waveform is not a known selector. |
| k_ra8_err_hw_timeout | LUT busy never cleared. |
Definition at line 927 of file ra8_epaper.c.
References internal_ra8_epaper_resolve_waveform(), internal_ra8_epaper_send_display_args(), internal_ra8_epaper_wait_lut_idle(), internal_ra8_epaper_write_cmd(), k_ra8_epaper_cmd_dpy_area, k_ra8_epaper_state_ready, k_ra8_err_invalid_state, k_ra8_err_validation_failed, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_log_error, s_panel, and s_tag.
Referenced by internal_eink_flush().
|
nodiscard |
Report whether reported panel geometry matches the descriptor.
ra8_epaper_init cross-checks the geometry the controller reports in its GET_DEV_INFO block against the descriptor it was handed, and warns rather than fails on a mismatch. Both halves of that are deliberate: a controller that has not finished loading its waveform answers the first read with zeroes, and an application may legitimately drive a sub-window of a larger panel, so a mismatch is information rather than an error.
Split out of ra8_epaper_init so the comparison is a pure function that host tests can vary directly. Inside init it could only be reached through a real GET_DEV_INFO exchange, whose reported dimensions the test bus cannot steer to a value that is also a legal descriptor size – which left the "agrees" case untestable.
| [in] | info | Decoded device block; NULL is treated as disagreement. |
| [in] | cfg | Descriptor to compare against; NULL likewise. |
Definition at line 250 of file ra8_epaper_geom.c.
References ra8_epaper_cfg_t::panel_height, ra8_epaper_dev_info_t::panel_height, ra8_epaper_cfg_t::panel_width, and ra8_epaper_dev_info_t::panel_width.
Referenced by ra8_epaper_init().
|
nodiscard |
Read the controller's current VCOM setting, in millivolts.
Issues the VCOM command (0x0039) with argument word 0x0000 ("get") and reads back one data word. The returned value is the magnitude of the panel common-electrode bias in millivolts: VCOM is always negative, so a panel labelled -1.53V reads back as 1530. Confirmed against the Waveshare IT8951 reference driver's EPD_IT8951_GetVCOM (USDEF_I80_CMD_VCOM = 0x0039).
| [out] | out_mv | Receives the VCOM magnitude in millivolts; non-NULL. |
| k_ra8_ok | Value read. |
| k_ra8_err_null_ptr | out_mv is NULL. |
| k_ra8_err_invalid_state | Panel never initialized. |
| k_ra8_err_hw_timeout | HRDY stuck low. |
Definition at line 711 of file ra8_epaper.c.
References internal_ra8_epaper_read_data16(), internal_ra8_epaper_write_cmd(), internal_ra8_epaper_write_data16(), k_ra8_epaper_cmd_vcom, k_ra8_epaper_state_ready, k_ra8_epaper_vcom_get, k_ra8_err_invalid_state, k_ra8_ok, RA8_CHECK_NULL_PTR, s_panel, and s_tag.
Referenced by ep_vcom_get(), and ra8_epaper_set_vcom().
|
nodiscard |
Bytes a packed source buffer needs for area at depth pf.
Rows are packed independently and each starts on a byte boundary, so the size is ceil(width * bpp / 8) * height. This is the exact value ra8_epaper_load_image requires in buf_len.
| [in] | area | Rectangle to be transferred; non-NULL. |
| [in] | pf | Source pixel depth. |
| [out] | out_bytes | Receives the required byte count; non-NULL. |
| k_ra8_ok | *out_bytes holds the size. |
| k_ra8_err_null_ptr | area or out_bytes is NULL. |
| k_ra8_err_invalid_size | area has a zero dimension. |
Definition at line 121 of file ra8_epaper_geom.c.
References ra8_epaper_area_t::height, k_ra8_epaper_geom_bits_per_byte, k_ra8_err_invalid_size, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_epaper_bits_per_pixel(), s_tag, and ra8_epaper_area_t::width.
Referenced by internal_eink_load_rect(), and internal_ra8_epaper_validate_load().
|
nodiscard |
Bring up the IT8951 panel against the injected SPI bus seam.
Algorithm:
The SPI bus itself is app-owned: initialise the peripheral behind cfg->bus (mode 0, at most the IT8951's 24 MHz ceiling) before calling this.
| [in] | cfg | Configuration descriptor. |
| k_ra8_ok | Panel responsive and identified. |
| k_ra8_err_null_ptr | cfg is NULL. |
| k_ra8_err_invalid_arg | cfg field out of range or cfg->bus.xfer8 NULL. |
| k_ra8_err_invalid_state | Driver already initialized. |
| k_ra8_err_hw_timeout | HRDY never asserted. |
Definition at line 654 of file ra8_epaper.c.
References internal_ra8_epaper_pulse_reset(), internal_ra8_epaper_read_dev_info(), internal_ra8_epaper_wait_ready(), internal_ra8_epaper_write_cmd(), k_ra8_epaper_cmd_sys_run, k_ra8_epaper_state_ready, k_ra8_epaper_state_uninit, k_ra8_err_invalid_state, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_epaper_geometry_agrees(), ra8_epaper_validate_cfg(), ra8_log_error, ra8_log_info, ra8_log_warn, s_panel, and s_tag.
Referenced by internal_eink_init().
|
nodiscard |
Push a packed greyscale buffer into the controller's frame RAM.
Sends the LD_IMG_AREA (0x0021) command then streams buf over SPI. Internally:
buf is packed at pf's depth, rows byte-aligned – exactly ra8_epaper_image_bytes(area, pf, ...) bytes. Prefer k_ra8_epaper_pf_4bpp for greyscale: it matches the panel's 16 grey levels, the controller discards the low nibble of 8 bpp data anyway, and it halves the wire time.
| [in] | area | Rectangle to update (panel coords); non-NULL. For k_ra8_epaper_pf_1bpp, x and width must be multiples of k_ra8_epaper_align_1bpp_px. |
| [in] | buf | Packed source buffer; non-NULL. |
| [in] | buf_len | Length of buf in bytes; must equal ra8_epaper_image_bytes(area, pf, ...). |
| [in] | pf | Source pixel depth. |
| [in] | endian | Source endianness. |
| k_ra8_ok | Buffer transferred. |
| k_ra8_err_null_ptr | area or buf is NULL. |
| k_ra8_err_invalid_state | Panel never initialized. |
| k_ra8_err_invalid_size | buf_len mismatch or empty area. |
| k_ra8_err_invalid_arg | 1 bpp rectangle violates the 32-pixel X/width alignment. |
| k_ra8_err_hw_timeout | HRDY stuck low. |
Definition at line 837 of file ra8_epaper.c.
References internal_ra8_epaper_reg_write(), internal_ra8_epaper_send_load_args(), internal_ra8_epaper_stream_pixels(), internal_ra8_epaper_validate_load(), internal_ra8_epaper_write_cmd(), k_ra8_epaper_cmd_ld_img_area, k_ra8_epaper_cmd_ld_img_end, k_ra8_epaper_reg_lisar_hi, k_ra8_epaper_reg_lisar_lo, k_ra8_ok, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_eink_load_rect().
|
nodiscard |
Programme the controller's VCOM, verify it, and grant the INV-VCOM-1 permit.
Issues the VCOM command (0x0039) with argument word 0x0001 ("set") followed by mv, then immediately re-reads it with argument 0x0000 and compares. Confirmed against the Waveshare IT8951 reference driver's EPD_IT8951_SetVCOM.
The readback is not a diagnostic nicety, it is the invariant. A dead COPI line, a controller that quietly ignores the command, or a bus returning zeroes all accept the write and change nothing – a failure mode that is indistinguishable from success without the compare, and that would leave the film biased at whatever unknown value the controller powered up with. Only a matching readback sets the permit that ra8_epaper_display_area requires; any other outcome revokes it and the panel stays dark.
The permit is revoked on entry, so a failed call can never leave a previous call's permit standing, and it does not survive ra8_epaper_sleep.
| [in] | mv | VCOM magnitude in millivolts (the panel's label without its minus sign, e.g. 1530 for -1.53V). Must be non-zero; the driver has no way to know the panel's legal window and does not range-check beyond that – range checking against the panel's documented limits is ra8_epd_cal's job and must happen before this call. |
| k_ra8_ok | VCOM programmed and read back equal; display commands are now permitted. |
| k_ra8_err_invalid_arg | mv is zero. |
| k_ra8_err_invalid_state | Panel never initialized. |
| k_ra8_err_validation_failed | The controller echoed a different value. The link or the controller is not to be trusted with the bias; the panel stays un-drivable. |
| k_ra8_err_hw_timeout | HRDY stuck low. |
Programme the controller's VCOM, verify it, and grant the INV-VCOM-1 permit.
Definition at line 730 of file ra8_epaper.c.
References internal_ra8_epaper_write_cmd(), internal_ra8_epaper_write_data16(), k_ra8_epaper_cmd_vcom, k_ra8_epaper_state_ready, k_ra8_epaper_vcom_set, k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_err_validation_failed, k_ra8_ok, ra8_epaper_get_vcom(), ra8_log_error, s_panel, and s_tag.
Referenced by ep_vcom_set().
|
nodiscard |
Drop the panel into deep-sleep (~15 uA per Waveshare AN).
Issues SLEEP (0x0003). Subsequent calls require a fresh ra8_epaper_init because the controller forgets all register state.
| k_ra8_ok | Panel asleep. |
| k_ra8_err_invalid_state | Panel never initialized. |
Definition at line 961 of file ra8_epaper.c.
References internal_ra8_epaper_write_cmd(), k_ra8_epaper_cmd_sleep, k_ra8_epaper_state_ready, k_ra8_epaper_state_uninit, k_ra8_err_invalid_state, and s_panel.
Referenced by internal_eink_deinit().
|
nodiscard |
Validate a panel descriptor without touching any hardware.
ra8_epaper_init calls this before it drives a single pin, so a bad descriptor is rejected with no bus traffic and no reset pulse. It is public because it is a total function over the descriptor: a board bring-up can check its own ra8_epaper_cfg_t before a controller is even attached.
Beyond range-checking the geometry, this rejects a zero-initialised waveform map. That check is load-bearing: mode 0 is INIT on every documented LUT, so a descriptor that forgot to fill the map would refresh every mode as a full INIT flash rather than fail, and a missing A2 would look like a merely slow panel instead of a misconfigured one.
| [in] | cfg | Descriptor to check; non-NULL. |
| k_ra8_ok | Every field is in range and usable. |
| k_ra8_err_null_ptr | cfg is NULL. |
| k_ra8_err_invalid_arg | A field is out of range, the bus seam is unbound, or the waveform map is unset. |
Definition at line 239 of file ra8_epaper_geom.c.
References ra8_epaper_cfg_t::bus, internal_ra8_epaper_validate_waveform(), k_ra8_epaper_geom_panel_max_dim, k_ra8_err_invalid_arg, ra8_epaper_cfg_t::panel_height, ra8_epaper_cfg_t::panel_width, RA8_CHECK_NULL_PTR, s_tag, ra8_epaper_cfg_t::waveform, and ra8_spi_bus_ops_t::xfer8.
Referenced by ra8_epaper_init().
|
nodiscard |
Report whether the INV-VCOM-1 permit is currently held.
True only while the driver is initialized and the most recent ra8_epaper_set_vcom read its value back unchanged. This is the exact predicate ra8_epaper_display_area enforces, exposed so an application can decide what to show (or, correctly, not show) without having to provoke a refused refresh to find out.
Report whether the INV-VCOM-1 permit is currently held.
Definition at line 781 of file ra8_epaper.c.
References s_panel.
|
nodiscard |
Fill a waveform map from a controller-reported LUT version.
The waveform mode numbering is a property of the firmware LUT the IT8951 loaded, which GET_DEV_INFO reports as a version string. The M641 LUT – the 6 inch and 6 inch HD panels, including the Waveshare 1448x1072 HAT – places A2 at mode 4; the vendor's generic default for the larger 7.8 / 9.7 / 10.3 inch panels is mode 6. INIT (0), DU (1) and GC16 (2) are stable across both.
The match is a prefix match on the leading M641 token, because the reported string carries a build suffix that varies between controller firmware revisions.
| [in] | lut_version | NUL-terminated LUT version string as reported in ra8_epaper_dev_info_t; non-NULL. |
| [out] | out_cfg | Receives the waveform map; non-NULL. |
| k_ra8_ok | *out_cfg populated (M641 or generic). |
| k_ra8_err_null_ptr | lut_version or out_cfg is NULL. |
Definition at line 182 of file ra8_epaper_geom.c.
References ra8_epaper_waveform_cfg_t::a2, ra8_epaper_waveform_cfg_t::du, ra8_epaper_waveform_cfg_t::gc16, ra8_epaper_waveform_cfg_t::init, k_ra8_epaper_lut_a2_gen, k_ra8_epaper_lut_a2_m641, k_ra8_epaper_lut_du, k_ra8_epaper_lut_gc16, k_ra8_epaper_lut_init, k_ra8_ok, RA8_CHECK_NULL_PTR, s_lut_m641, and s_tag.
Referenced by ep_bringup_panel_bus().