aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2020-02-09 11:30:30 -0600
committerRossTheRoss <msattr@gmail.com>2020-02-09 11:32:17 -0600
commit98004bbcbed1ea89463d00dcf11a47ede5c43ef8 (patch)
treef13d30c70921c5ddc5b5f9b5f1a54f214f240516
parents p a c i n g (diff)
downloadee2361-98004bbcbed1ea89463d00dcf11a47ede5c43ef8.tar
ee2361-98004bbcbed1ea89463d00dcf11a47ede5c43ef8.tar.gz
ee2361-98004bbcbed1ea89463d00dcf11a47ede5c43ef8.tar.bz2
ee2361-98004bbcbed1ea89463d00dcf11a47ede5c43ef8.tar.lz
ee2361-98004bbcbed1ea89463d00dcf11a47ede5c43ef8.tar.xz
ee2361-98004bbcbed1ea89463d00dcf11a47ede5c43ef8.tar.zst
ee2361-98004bbcbed1ea89463d00dcf11a47ede5c43ef8.zip
add some c o m m e n t s
Diffstat (limited to '')
-rw-r--r--Lab_2B.X/lab2b_c.c88
1 files changed, 47 insertions, 41 deletions
diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c
index 21fdcba..bf917a3 100644
--- a/Lab_2B.X/lab2b_c.c
+++ b/Lab_2B.X/lab2b_c.c
@@ -36,73 +36,79 @@ int main(void) {
}
void writeColor(int r, int g, int b) {
+ int i = 0;
LATA = 0x0000;
wait_100us();
-
- for (int i = 0; i < 8; i++){
+ //RED
+ while (i < 8) {
if (r & 1) {
write_1();
} else {
write_0();
}
r >> 1;
+ ++i;
}
- for (int j = 0; j < 8; j++){
+ //GREEN
+ while (i > 0) {
if (g & 1) {
write_1();
} else {
write_0();
}
- g >> 1;
+ g >> 1;
+ --i;
}
- for (int k = 0; k < 8; k++){
+ //BLUE
+ while (i < 8){
if (b & 1) {
write_1();
} else {
write_0();
}
b >> 1;
+ ++i;
}
}
void loop(void) {
while (1) {
- LATA = 0x0000;
- wait_100us();
+// LATA = 0x0000;
+// wait_100us();
+//
+// //RED
+// write_1();
+// write_1();
+// write_1();
+// write_1();
+//
+// write_1();
+// write_1();
+// write_1();
+// write_1();
+//
+// //GREEN
+// write_1();
+// write_0();
+// write_0();
+// write_1();
+//
+// write_1();
+// write_0();
+// write_1();
+// write_1();
+//
+// //BLUE
+// write_0();
+// write_0();
+// write_0();
+// write_0();
+//
+// write_0();
+// write_0();
+// write_0();
+// write_0();
- //RED
- write_1();
- write_1();
- write_1();
- write_1();
-
- write_1();
- write_1();
- write_1();
- write_1();
-
- //GREEN
- write_1();
- write_0();
- write_0();
- write_1();
-
- write_1();
- write_0();
- write_1();
- write_1();
-
- //BLUE
- write_0();
- write_0();
- write_0();
- write_0();
-
- write_0();
- write_0();
- write_0();
- write_0();
-
- //writeColor(255, 155, 0);
+ writeColor(255, 155, 0);
}
} \ No newline at end of file