-
Notifications
You must be signed in to change notification settings - Fork 2
/
raster.ino
56 lines (42 loc) · 1.14 KB
/
raster.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/////////////////////// STREAM RASTER ////////////////////////////////
#if defined (RASTER_MODE)
// Decode Simple Pixel Stream, STREAM_BITPLANES bitplane (defailt = 1)
boolean checkSerial() {
int ret = false;
while (Serial.available()) {
int a = Serial.read();
if( a == 255 ) {
setvirtualdisplay( 0 );
raster_state == 0;
return true;
}
if( a == 254 ) {
PSYCHE_MODE = !PSYCHE_MODE;
raster_state == 0;
return true;
}
byte filter = B01111111;
boolean selector = ( (a & B10000000) == 128 );
if( selector ) { // X
//if( raster_state == 0 ) {
raster_state = 1;
raster_x = a - 128;// a & filter ;
ret = false;
//}
}
else { // Y
//if( raster_state == 1 ) {
//raster_state = 0;
raster_y = a;
//setpixel16( XMAX - raster_x, raster_y, 255 );
int brush_size_x = 2;
int brush_size_y = 2;
rect16( XMAX - raster_x, raster_y, XMAX - raster_x + brush_size_x, raster_y + brush_size_y, 255 );
ret=true;
//}
}
} // end Serial
//Serial.flush();
return ret;
}
#endif