You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
//
|
|
// Created by MightyPork on 2022/11/12.
|
|
//
|
|
|
|
#ifndef FRAMEBUFFER_H
|
|
#define FRAMEBUFFER_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include "framebuffer_config.h"
|
|
|
|
#define FBSET 0xFF
|
|
#define FBCLEAR 0x00
|
|
|
|
/// Framebuffer backing array.
|
|
///
|
|
/// The format is the native format for SSD1306: array of bytes representing pixels in 8 rows at once, LSB is the topmost row.
|
|
///
|
|
/// a0 b0 ... til the display width
|
|
/// a1 b1
|
|
/// a2 b2
|
|
/// ... ...
|
|
/// a7 b7
|
|
///
|
|
/// and more bytes continue rows 8-15 and so on
|
|
extern uint8_t fb[(FBH / 8) * FBW];
|
|
|
|
void fb_fill(uint8_t pattern);
|
|
void fb_clear(void);
|
|
void fb_px(uint8_t x, uint8_t y, uint8_t color);
|
|
void fb_hline(uint8_t x, uint8_t y, uint8_t w, uint8_t color);
|
|
void fb_vline(uint8_t x, uint8_t y, uint8_t h, uint8_t color);
|
|
void fb_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t color);
|
|
void fb_bitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t color);
|
|
|
|
/// Output the framebuffer array `fb` to the display device.
|
|
extern void fb_blit(void);
|
|
|
|
|
|
#endif //FRAMEBUFFER_H
|
|
|