Add API to enable cursor blink.

This commit is contained in:
giomba 2024-12-15 11:11:50 +01:00
parent 66d5a6187e
commit e2d3ccd317
2 changed files with 22 additions and 2 deletions

View File

@ -2,6 +2,8 @@
#include "io.h"
static uint8_t r10 = 0;
void cursor_setRaw(uint16_t address) {
io_out(0xA0, 14);
io_out(0xA1, (address >> 8) & 0xff);
@ -15,8 +17,10 @@ void cursor_setXY(uint8_t x, uint8_t y) {
void cursor_setStartRaster(uint8_t start) {
start &= 0x1f;
r10 &= ~0x1f;
r10 |= start;
io_out(0xA0, 10);
io_out(0xA1, start);
io_out(0xA1, r10);
}
void cursor_setEndRaster(uint8_t end) {
@ -33,4 +37,12 @@ void cursor_enable(bool enable) {
cursor_setStartRaster(0xd);
cursor_setEndRaster(0x0);
}
}
}
void cursor_blink(enum cursor_blink_t blink) {
blink &= 0x60;
r10 &= ~0x60;
r10 |= blink;
io_out(0xA0, 10);
io_out(0xA1, r10);
}

View File

@ -4,6 +4,12 @@
#include <stdbool.h>
#include <stdint.h>
enum cursor_blink_t {
CURSOR_BLINK_NONE = 0x00,
CURSOR_BLINK_SLOW = 0x40,
CURSOR_BLINK_FAST = 0x60,
};
void cursor_setRaw(uint16_t address);
void cursor_setXY(uint8_t x, uint8_t y);
@ -14,4 +20,6 @@ void cursor_setEndRaster(uint8_t end);
void cursor_enable(bool enable);
void cursor_blink(enum cursor_blink_t blink);
#endif