Added output_heartbeat(driver, heart_type) to the library functions.
Thus, for many drivers, creating the appropriate driver function for heartbeats should be simple.
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include "lcd.h"
|
||||
#include "render.h"
|
||||
|
||||
// ==================================================
|
||||
// LCD library of useful functions for drivers
|
||||
@@ -100,3 +102,31 @@ insert_chr_framebuf (struct lcd_logical_driver *driver, int x, int y, char c) {
|
||||
driver->framebuf[(y * driver->wid) + x] = c;
|
||||
}
|
||||
|
||||
void
|
||||
output_heartbeat (struct lcd_logical_driver *driver, int type) {
|
||||
static int timer = 0;
|
||||
int whichIcon;
|
||||
static int saved_type = HEARTBEAT_ON;
|
||||
|
||||
if (type)
|
||||
saved_type = type;
|
||||
|
||||
if (type == HEARTBEAT_ON) {
|
||||
// Set this to pulsate like a real heart beat...
|
||||
whichIcon = (! ((timer + 4) & 5));
|
||||
|
||||
// This defines a custom character EVERY time...
|
||||
// not efficient... is this necessary?
|
||||
driver->icon (whichIcon, 0);
|
||||
|
||||
// Put character on screen...
|
||||
driver->chr (driver->wid, 1, 0);
|
||||
|
||||
// change display...
|
||||
driver->flush ();
|
||||
}
|
||||
|
||||
timer++;
|
||||
timer &= 0x0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user