Skip to content

Conversation

@tolauwae
Copy link
Member

@tolauwae tolauwae commented Oct 28, 2025

Cardputer display hardware support

The M5stack cardputer built-in display can be controlled with the M5Cardputer library.

  • This PR ports the display functions to WARDuino, needed for the Basic example.
  • This includes a new random primitive for Arduino.

hardware: https://docs.m5stack.com/en/core/Cardputer
library: https://docs.arduino.cc/libraries/m5cardputer/
example: https://github.com/m5stack/M5Cardputer/blob/master/examples/Basic/display/display.ino

@tolauwae tolauwae changed the title Cardputer Cardputer display Oct 28, 2025
@MaartenS11
Copy link
Member

MaartenS11 commented Oct 29, 2025

I might try to get the rectangle drawing working on zephyr, already did a small experiment to draw a rectangle using the display API on the esp32-wrover-kit.

Just for future reference once I work on it, this code can be used to draw the yellow rectangle:

void draw_rect(struct device *display_dev, int xpos, int ypos, int w, int h, uint64_t color) {
	struct display_buffer_descriptor new_buf_desc;
	new_buf_desc.width = w;
	new_buf_desc.height = h;
	new_buf_desc.buf_size = new_buf_desc.width * new_buf_desc.height;
	new_buf_desc.pitch = new_buf_desc.width;
	new_buf_desc.frame_incomplete = false;
	uint16_t* new_buf = malloc(sizeof(uint16_t) * new_buf_desc.buf_size); // 16 bit color
	for (int y = 0; y < new_buf_desc.height; y++) {
		for(int x = 0; x < new_buf_desc.width; x++) {
			new_buf[y * new_buf_desc.width + x] = color;
		}
	}
	display_write(display_dev, xpos, ypos, &new_buf_desc, new_buf);
	free(new_buf);
}
draw_rect(display_dev, 64, 32, 128, 64, 0b0000000000011111);
draw_rect(display_dev, 64, 96, 128, 64, 0b1111100000000000);
draw_rect(display_dev, 64, 160, 128, 64, 0b0000011111100000);
image

@tolauwae
Copy link
Member Author

⚠️ Current sketches compiled with Arduino take up too much space. 1310832 out of 1310720 bytes.
Temporarily removed some other primitives to fix this.

@tolauwae tolauwae added the do not merge Warning: this PR should not be merged yet. label Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Warning: this PR should not be merged yet.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants