1.1 --- a/include/display.h Sat Nov 03 16:42:17 2018 +0100
1.2 +++ b/include/display.h Sat Nov 03 21:47:40 2018 +0100
1.3 @@ -28,19 +28,43 @@
1.4
1.5 typedef struct
1.6 {
1.7 - /* Framebuffer pointer and size. */
1.8 + /* Framebuffer address, potentially referencing many frames. */
1.9
1.10 uint8_t *framebuffer;
1.11 - uint32_t screen_size;
1.12 +
1.13 + /* The total number of lines in the framebuffer including spare lines to
1.14 + support horizontal scrolling. */
1.15 +
1.16 + uint32_t total_lines;
1.17 +
1.18 + /* The screen dimensions and size (derived from the dimensions). */
1.19 +
1.20 uint32_t line_length, line_count; /* width, height */
1.21 + uint32_t screen_size; /* = width * height */
1.22 +
1.23 + /* The current frame, number of frames, and the maximum number supported. */
1.24 +
1.25 + int frame, frames, max_frames;
1.26
1.27 - /* Screen start/top and limit pointers. */
1.28 + /* The fixed start address of the current frame. */
1.29 +
1.30 + uint8_t *frame_start; /* = framebuffer + (frame_size * frame) */
1.31 +
1.32 + /* The floating screen start/top pointer. */
1.33 +
1.34 + uint8_t *screen_start; /* >= frame_start; < screen_limit */
1.35
1.36 - uint8_t *screen_start, *screen_limit;
1.37 + /* The fixed end address of the current frame. */
1.38 +
1.39 + uint8_t *screen_limit; /* = frame_start + screen_size */
1.40 +
1.41 + /* Number of scanlines on the display. */
1.42 +
1.43 + uint32_t scanlines;
1.44
1.45 /* Number of scanlines per display line. */
1.46
1.47 - int line_multiplier;
1.48 + int line_multiplier; /* = scanlines / line_count */
1.49
1.50 /* Number of consecutive pixels provided by a framebuffer region. */
1.51
1.52 @@ -62,6 +86,19 @@
1.53
1.54
1.55
1.56 +/* Configuration functions. */
1.57 +
1.58 +void init_display(display_config_t *cfg, uint8_t *framebuffer,
1.59 + uint32_t line_length, uint32_t line_count, int frames);
1.60 +
1.61 +void init_display_properties(display_config_t *cfg, uint32_t offset);
1.62 +
1.63 +void select_frame(display_config_t *cfg, int frame, uint32_t offset);
1.64 +
1.65 +void set_frames(display_config_t *cfg, int frames);
1.66 +
1.67 +uint32_t get_start_offset(display_config_t *cfg);
1.68 +
1.69 /* Access functions. */
1.70
1.71 int get_position(display_config_t *cfg, int x);