PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
peb_image180.c
1 #include "simpletools.h"
2 #include "badgetools.h"
3 
4 volatile screen *self;
5 
6 void rotate180()
7 {
8  uint32_t screenbuf = screen_getBuffer();
9  char *scrbuf = (char *) screenbuf;
10  int byte, bit, pix, xp, yp, bytep, bitp, pixp;
11  for(int x = 0; x < 64; x++)
12  {
13  for(int y = 0; y < 64; y++)
14  {
15  byte = ((y >> 3) << 7) + x;
16  bit = y % 8;
17  pix = 1 & (scrbuf[byte] >> bit);
18 
19  xp = 127 - x;
20  yp = 63 - y;
21 
22  bytep = ((yp >> 3) << 7) + xp;
23  bitp = yp % 8;
24  pixp = 1 & (scrbuf[bytep] >> bitp);
25 
26  scrbuf[bytep] &= ~(1 << bitp);
27  scrbuf[bytep] |= (pix << bitp);
28 
29  scrbuf[byte] &= ~(1 << bit);
30  scrbuf[byte] |= (pixp << bit);
31  }
32  }
33  if (self->AutoUpdate) screen_update();
34 }
35 
36 
37 /*
38  TERMS OF USE: MIT License
39 
40  Permission is hereby granted, free of charge, to any person obtaining a
41  copy of this software and associated documentation files (the "Software"),
42  to deal in the Software without restriction, including without limitation
43  the rights to use, copy, modify, merge, publish, distribute, sublicense,
44  and/or sell copies of the Software, and to permit persons to whom the
45  Software is furnished to do so, subject to the following conditions:
46 
47  The above copyright notice and this permission notice shall be included in
48  all copies or substantial portions of the Software.
49 
50  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
53  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
55  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
56  DEALINGS IN THE SOFTWARE.
57 */
58 
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
x
int x
Definition: 07 Box and Lines.c:13
rotate180
void rotate180()
Rotate the screen image 180 degrees. See 05 Display Upside- Down.side for example.
Definition: peb_image180.c:6
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
screen_update
int screen_update(void)
Manually update the screen image after. Typically used after multiple oLED function calls after scree...
Definition: oled_asmfast.c:426
screen
Definition: badgetools.h:1709