Skip to content

Commit 517e8ce

Browse files
Add os_ClrHome() to examples, change fileio_tokens demo
1 parent afd5082 commit 517e8ce

File tree

10 files changed

+51
-14
lines changed

10 files changed

+51
-14
lines changed

examples/fileio_detect/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ void main(void) {
2020
ti_var_t myVar;
2121
char *var_name;
2222

23+
/* Clear the homescreen */
24+
os_ClrHome();
25+
2326
/* First couple bytes of the LibLoad AppVar, which is known to exist *
2427
/* Technically is a null-terminated string, if an odd looking one */
2528
const char search_string[] = { 0xFD, 0x21, 0x80, 0x00 };

examples/fileio_factorize/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ void main(void) {
2222
unsigned i;
2323
int in;
2424

25+
/* Clear the homescreen */
26+
os_ClrHome();
27+
2528
/* Get the answer variable */
2629
if (ti_RclVar(TI_REAL_TYPE, ti_Ans, &real_in)) return;
2730
if ((in = os_RealToInt24(real_in)) < 1) return;

examples/fileio_read_write/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ void main(void) {
3131
ti_var_t myAppVar;
3232
int x;
3333

34+
/* Clear the homescreen */
35+
os_ClrHome();
36+
3437
/* Declare some varaible values */
3538
strcpy(data.name, "My Data");
3639
data.var1 = VAR1_VALUE;

examples/fileio_tokens/src/main.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@ void printText(int8_t xpos, int8_t ypos, const char *text);
1818
/* Main Function */
1919
void main(void) {
2020
ti_var_t prgm;
21+
char *text;
2122
uint8_t *data_ptr;
22-
23+
uint8_t token_length;
24+
uint16_t size;
25+
int8_t y = 0;
26+
27+
/* Clear the homescreen */
28+
os_ClrHome();
29+
2330
/* Close any files that may be open already */
2431
ti_CloseAll();
2532

@@ -28,12 +35,16 @@ void main(void) {
2835

2936
/* Make sure we opened okay */
3037
if (!prgm) goto err;
31-
38+
3239
data_ptr = ti_GetDataPtr(prgm);
33-
printText(0, 0, ti_GetTokenString(&data_ptr, NULL, NULL));
34-
printText(0, 1, ti_GetTokenString(&data_ptr, NULL, NULL));
40+
size = ti_GetSize(prgm);
41+
42+
while (size && y < 8) {
43+
printText(0, y++, ti_GetTokenString(&data_ptr, &token_length, NULL));
44+
size -= token_length;
45+
}
3546

36-
err:
47+
err:
3748
/* Pause */
3849
while (!os_GetCSC());
3950

examples/hello_world/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ void main(void) {
2424
const char *HelloWorld = "Hello World!";
2525
const char *Welcome = "Welcome to C!";
2626

27+
/* Clear the homescreen */
28+
os_ClrHome();
29+
2730
/* Print a few strings */
2831
printText(HelloWorld, 0, 0);
2932
printText(Welcome, 0, 1);

examples/interrupt_on/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ bool exit_loop = false;
1717

1818
/* Main function */
1919
void main(void) {
20-
/* Print a little string -- NOTE: using OS routines doesn't work well when interrupts are enabled */
20+
/* Print a little string -- NOTE: OS routines don't work well when interrupts are enabled */
21+
os_ClrHome();
2122
os_SetCursorPos(0, 0);
2223
os_PutStrFull("Press ON");
2324

examples/keypad_multiple_keys/src/main.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ void main(void) {
1717
kb_key_t key;
1818
const char *erase_string = " ";
1919

20+
/* Clear the homescreen */
21+
os_ClrHome();
22+
2023
/* Loop until 2nd is pressed */
2124
do {
2225

@@ -27,24 +30,24 @@ void main(void) {
2730

2831
/* Print the current arrow key input */
2932
if (key & kb_Down) {
30-
printText(0,0,"Down");
33+
printText(0, 0, "Down");
3134
} else {
32-
printText(0,0,erase_string);
35+
printText(0, 0, erase_string);
3336
}
3437
if (key & kb_Up) {
35-
printText(0,1,"Up");
38+
printText(0, 1, "Up");
3639
} else {
37-
printText(0,1,erase_string);
40+
printText(0, 1, erase_string);
3841
}
3942
if (key & kb_Left) {
40-
printText(0,2,"Left");
43+
printText(0, 2, "Left");
4144
} else {
42-
printText(0,2,erase_string);
45+
printText(0, 2, erase_string);
4346
}
4447
if (key & kb_Right) {
45-
printText(0,3,"Right");
48+
printText(0, 3, "Right");
4649
} else {
47-
printText(0,3,erase_string);
50+
printText(0, 3, erase_string);
4851
}
4952

5053
} while (kb_Data[kb_group_1] != kb_2nd);

examples/real_time_clock/src/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ unsigned seconds = 0;
1717
bool exit_loop = false;
1818

1919
void main(void) {
20+
21+
/* Clear the homescreen */
22+
os_ClrHome();
23+
2024
/* Randomize things */
2125
srand(rtc_Time());
2226

examples/second_counter/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ void main(void) {
1616
unsigned seconds = 0;
1717
char str[10];
1818

19+
/* Clear the homescreen */
20+
os_ClrHome();
21+
1922
/* Disable the timer so it doesn't run when we don't want it to be running */
2023
timer_Control = TIMER1_DISABLE;
2124

examples/second_counter2/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ void main(void) {
2020

2121
timer_1_MatchValue_1 = ONE_SECOND;
2222

23+
/* Clear the homescreen */
24+
os_ClrHome();
25+
2326
/* Reset the counter */
2427
reset_counter();
2528

0 commit comments

Comments
 (0)