Operating System
step_3
kernel
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
);
26
draw_char_style
(
ch
,
y
,
x
,
style
);
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
}
timeout
void timeout()
Definition:
timeout.c:19
style
uint8_t style
Definition:
timeout.c:16
draw_char_style
static int16_t draw_char_style(char ch, int row, int col, uint8_t style)
Definition:
stdio.h:131
ch
char ch
Definition:
timeout.c:9
y
int y
Definition:
timeout.c:15
nextAlphabet
char nextAlphabet(char)
Definition:
timeout.c:34
x
int x
Definition:
timeout.c:14
delX
int delX[]
Definition:
timeout.c:11
direction
int direction
Definition:
timeout.c:13
callback
void callback()
Definition:
timeout.c:23
delY
int delY[]
Definition:
timeout.c:12
Generated by
1.8.15