42typedef enum : uint16_t {
52typedef enum : uint16_t {
68typedef enum : uint16_t {
86typedef enum : uint16_t {
94typedef enum : uint16_t {
106typedef enum : uint16_t {
115typedef enum : uint16_t {
136typedef enum : uint16_t {
147typedef enum : uint8_t {
158typedef enum : uint32_t {
176typedef enum : uint8_t {
185typedef enum : uint8_t {
345 const uint16_t wire_pf =
428 const uint16_t word =
437 const bool was_attached =
s_eink.attached;
438 const uint64_t pixels =
s_eink.pixels;
439 const uint32_t refreshes =
s_eink.refreshes;
440 const uint16_t vcom_mv =
s_eink.vcom_mv;
442 s_eink.attached = was_attached;
444 s_eink.refreshes = refreshes;
465 (void)
priv_emu_io_errf(
" IT8951 e-ink : %llu pixel(s) loaded, %u refresh(es), last wf=0x%X, "
467 (
unsigned long long)
s_eink.pixels,
470 (
unsigned)
s_eink.vcom_mv);
Register-accurate peripheral-model framework for the board emulator.
void board_periph_gpio_set_input(uint8_t port, uint8_t pin, bool level)
Drive a GPIO pin's input level from outside the firmware.
eink_state_t
Host-word interpretation state.
@ k_eink_st_preamble
Next assembled word is a preamble.
@ k_eink_st_datawr
Next assembled word is data.
@ k_eink_st_cmd
Next assembled word is a command.
uint8_t board_eink_exchange(uint8_t tx)
Exchange one full-duplex SPI byte with the modelled controller.
static RA8_INTERNAL uint16_t internal_eink_reg_value(uint16_t reg)
Read-back value for a controller register.
eink_datawr_idx_t
Data-word positions within a command's argument stream.
@ k_eink_idx_ld_arg0
LD_IMG_AREA: endian/pf/rotate word.
@ k_eink_idx_vcom_dir
VCOM: direction word (get / set).
@ k_eink_idx_reg_addr
REG_RD/REG_WR: register address word.
@ k_eink_idx_vcom_val
VCOM: value word on a set.
@ k_eink_idx_ld_px_start
LD_IMG_AREA: first pixel word.
@ k_eink_idx_dpy_wf
DPY_AREA: waveform word (arg4).
@ k_eink_idx_ld_w
LD_IMG_AREA: width (arg3 after arg0).
@ k_eink_idx_ld_h
LD_IMG_AREA: height (arg4 after arg0).
static RA8_INTERNAL void internal_eink_begin_read(void)
Load rd_buf with [dummy word, value word] and open the read burst.
bool board_eink_attach(void)
Attach (arm) the modelled IT8951 e-paper controller.
void board_eink_reset(void)
Reset the controller's command / read framing to power-on.
static RA8_INTERNAL uint16_t internal_eink_dev_info_word(uint16_t idx)
Word i of the (discarded) GET_DEV_INFO block: W, H, then zeros.
static eink_model_t s_eink
The single modelled controller.
eink_preamble_t
SPI preamble words (IT8951 DS chapter 3.4 table 3-3).
@ k_eink_pre_cmd
Host -> command write.
@ k_eink_pre_wr
Host -> data write.
@ k_eink_pre_rd
Host <- data read.
eink_cmd_t
IT8951 user commands the ra8_epaper driver issues (DS chapter 4.2).
@ k_eink_cmd_vcom
Get / set VCOM bias.
@ k_eink_cmd_reg_rd
Register read.
@ k_eink_cmd_ld_img_end
End load.
@ k_eink_cmd_dpy_area
Refresh rectangle.
@ k_eink_cmd_reg_wr
Register write.
@ k_eink_cmd_sys_run
Wake from standby.
@ k_eink_cmd_sleep
Enter deep-sleep.
@ k_eink_cmd_ld_img_area
Begin load (rectangle).
@ k_eink_cmd_get_dev_info
40-byte info block.
eink_sizing_t
Byte-assembly + read-burst sizing constants (no magic numbers).
@ k_eink_dev_words
GET_DEV_INFO block length (40 / 2).
@ k_eink_byte_mask
Low-byte extraction mask.
@ k_eink_read_bytes
Bytes per read burst (dummy + value).
@ k_eink_idle_byte
Non-read response / idle byte.
@ k_eink_pf_mask
LD_IMG_AREA arg0 pixel-format mask.
@ k_eink_word_bits
Bits carried by one 16-bit word.
@ k_eink_pf_shift
LD_IMG_AREA arg0 pixel-format shift.
@ k_eink_byte_shift
Bits per byte.
eink_hrdy_pin_t
Panel HRDY "ready" GPIO on the modelled carrier.
@ k_eink_hrdy_port
HRDY on PORT4.
@ k_eink_hrdy_pin
HRDY on pin 1 (P4_01).
void board_eink_apply_gpio_defaults(void)
Re-arm the panel HRDY "ready" GPIO input high (if attached).
void board_eink_report(void)
Print the controller's end-of-run summary line (if attached).
eink_vcom_arg_t
Direction word of the VCOM command (DS user command set).
@ k_eink_vcom_set
Controller consumes the next word.
@ k_eink_vcom_get
Controller answers with its VCOM.
static RA8_INTERNAL void internal_eink_consume_word(uint16_t word)
Advance the state machine by one fully-assembled 16-bit word.
eink_vcom_default_t
VCOM the modelled controller powers up holding.
@ k_eink_vcom_power_on_mv
Reported VCOM magnitude (mV).
bool board_eink_attached(void)
Report whether the IT8951 controller is currently attached.
eink_wire_pf_t
LD_IMG_AREA arg0 pixel-format codes.
@ k_eink_wire_pf_2bpp
2 bits per pixel.
@ k_eink_wire_pf_8bpp
8 bits per pixel.
@ k_eink_wire_pf_3bpp
3 bits per pixel.
@ k_eink_wire_pf_4bpp
4 bits per pixel.
static RA8_INTERNAL uint16_t internal_eink_px_per_word(uint16_t wire_pf)
Pixels a 16-bit data word carries at the given wire pixel format.
static RA8_INTERNAL void internal_eink_consume_data(uint16_t word)
Interpret one data word against the command currently in flight.
eink_geom_t
Fixed panel geometry the model reports through GET_DEV_INFO.
@ k_eink_panel_h
Reported panel height (priv_px).
@ k_eink_panel_w
Reported panel width (priv_px).
eink_read_idx_t
Byte positions in the 4-byte (2-word) read-burst response buffer.
@ k_eink_rd_dummy_hi
High byte of the dummy word.
@ k_eink_rd_dummy_lo
Low byte of the dummy word.
@ k_eink_rd_val_lo
Low byte of the value word.
@ k_eink_rd_val_hi
High byte of the value word.
eink_reg_t
Controller registers whose read value the model must answer.
@ k_eink_reg_lutafsr
LUT busy status: 0 = idle (DS 4.2.4).
IT8951 e-paper SPI-device model for ra8_emulator (attached to SPI_B).
Bounded raw-descriptor I/O seam for the RA8 emulator.
emu_io_result_t priv_emu_io_errf(const char *format,...)
Format bounded text and write it to the injected error descriptor.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
The modelled IT8951 controller's whole state.
bool have_hi
A high byte is latched in hi.
uint16_t vcom_dir
Direction word of the VCOM in flight.
uint16_t last_wf
Waveform of the last DPY_AREA.
uint32_t refreshes
DPY_AREA refreshes issued.
uint16_t reg_addr
Register address for a REG_RD/REG_WR.
uint8_t rd_len
Valid bytes in rd_buf.
uint8_t hi
Latched high byte of the pending word.
uint16_t dev_idx
Next GET_DEV_INFO word index.
uint16_t vcom_mv
Modelled VCOM magnitude in millivolts.
bool attached
–eink armed the controller.
uint16_t px_per_word
Pixels per data word at the loaded pf.
uint64_t pixels
Pixels streamed via LD_IMG_AREA.
uint8_t rd_pos
Cursor into rd_buf.
uint16_t cur_cmd
Command in flight (0 if none).
eink_state_t st
Host-word interpretation state.
uint8_t rd_buf[k_eink_read_bytes]
Read-burst response.
uint16_t datawr_idx
Data-word index within cur_cmd.
bool reading
A read burst is serving response bytes.