Fixing putc and puts to use pointers correctly
This commit is contained in:
parent
f0243cb45e
commit
2c6826e293
2 changed files with 17 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "framebuffer.h"
|
||||
#include "font8x8_basic.h"
|
||||
#include "serial.h"
|
||||
#include "xtoa.h"
|
||||
|
||||
static unsigned long fb_address;
|
||||
static unsigned long fb_pitch;
|
||||
|
@ -48,8 +49,8 @@ void putpixel(
|
|||
}
|
||||
}
|
||||
|
||||
static void putc(
|
||||
const unsigned char character,
|
||||
void putc(
|
||||
const unsigned char *character,
|
||||
unsigned short x,
|
||||
unsigned short y,
|
||||
unsigned char r,
|
||||
|
@ -57,16 +58,13 @@ static void putc(
|
|||
unsigned char b
|
||||
){
|
||||
// Limit to ASCII printable
|
||||
if (character < 0x20) {
|
||||
serial_write_string("\nASCII too low");
|
||||
return;
|
||||
}
|
||||
if (character > 0x7e) {
|
||||
serial_write_string("\nASCII too hihg");
|
||||
if (*character < 0x20 || *character > 0x7e) {
|
||||
serial_write_string("\nputc ASCII out of range: ");
|
||||
serial_write_string(uitoa(*character, 16));
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char *rowdata = font8x8_basic[character];
|
||||
unsigned char *rowdata = font8x8_basic[*character];
|
||||
unsigned char charx, chary, iy, ix;
|
||||
unsigned char sizex=1;
|
||||
unsigned char sizey=1;
|
||||
|
@ -94,7 +92,7 @@ void puts(
|
|||
){
|
||||
unsigned char i = 0;
|
||||
while (text[i]) {
|
||||
putc(text[i], x+i*8, y, r, g, b);
|
||||
putc(text+i, x+i*8, y, r, g, b);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,14 @@ void putpixel(
|
|||
unsigned char g,
|
||||
unsigned char b
|
||||
);
|
||||
void putc(
|
||||
const unsigned char *character,
|
||||
unsigned short x,
|
||||
unsigned short y,
|
||||
unsigned char r,
|
||||
unsigned char g,
|
||||
unsigned char b
|
||||
);
|
||||
void puts(
|
||||
const unsigned char *text,
|
||||
unsigned short x,
|
||||
|
|
Loading…
Reference in a new issue