Operating System
timeout.c
Go to the documentation of this file.
1 
7 #include "../include/utilities.h"
8 #include "../include/stdio.h"
9 char ch = 'A';
10 #define DELAY 2
11 int delX[] = {1, 0, -1, 0};
12 int delY[] = {0, 1, 0, -1};
13 int direction = 0;
14 int x = 0;
15 int y = 0;
16 uint8_t style = 0;
17 void callback();
18 char nextAlphabet(char);
19 void timeout() {
20  // _draw_char(ch++, 0, 0x0F);
21  callback();
22 }
23 void callback() {
24  style = (style+1) & 0b00001111;
25  ch = nextAlphabet(ch);
27  if (y == 0 && x == 0) direction = 0;
28  if (y == 0 && x == 79) direction = 1;
29  if (y == 24 && x == 79) direction = 2;
30  if (y == 24 && x == 0) direction = 3;
31  y += delY[direction];
32  x += delX[direction];
33 }
34 char nextAlphabet(char c) {
35  if (c == 'z') return 'A';
36  if (c == 'Z') return 'a';
37  return c+1;
38 }
void timeout()
Definition: timeout.c:19
uint8_t style
Definition: timeout.c:16
static int16_t draw_char_style(char ch, int row, int col, uint8_t style)
Definition: stdio.h:131
char ch
Definition: timeout.c:9
int y
Definition: timeout.c:15
char nextAlphabet(char)
Definition: timeout.c:34
int x
Definition: timeout.c:14
int delX[]
Definition: timeout.c:11
int direction
Definition: timeout.c:13
void callback()
Definition: timeout.c:23
int delY[]
Definition: timeout.c:12