Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions c-code/writetext.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,29 @@ int main( int argc, char **argv ) {
memset(spaces, ' ', characters_per_line);
WriteText((line_number - 1)*font_size, spaces, bg_color);
}

WriteText((line_number - 1)*font_size, (unsigned char*) argv[optind], color);

//edited for interpreting word wrap
unsigned char *s = strdup(argv[optind]);
unsigned char more = 'x';
unsigned char *p = s;

while(more)
{
while (*p && *p != '\n') p++;
more = *p;
*p = '\0';
WriteText((line_number - 1)*font_size, s, color);
line_number++;
s = ++p;
}

RAIO_SetRegister( MWCR0, 0x80 );
RAIO_SetRegister(CURH0, 0x10);
RAIO_SetRegister(CURH1, 0x01);
RAIO_SetRegister(CURV0, 0x20);
RAIO_SetRegister(CURV1, 0x01);
TFT_RegWrite( MRWC );
TFT_DataWrite( 'A' );
// TFT_DataWrite( 'A' ); // Wrights an A on the Display - removed

cursor_x.split.low = (uint8_t) RAIO_GetRegister(RCURH0);
cursor_x.split.high = (uint8_t) RAIO_GetRegister(RCURH01);
Expand Down