Advertisement
jh_elec

GLCD - Set / Clear Pixel

Feb 23rd, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. uint8_t VRAM[8][128]; // 8 * 8 (Bits) = 64
  2.  
  3.  
  4. void setPixel( uint8_t y, uint8_t x )
  5. {
  6.     uint8_t index   = y / 8;
  7.     uint8_t yBitPos = y % 8;
  8.    
  9.     VRAM[index][x] |= 1<<yBitPos;  
  10. }
  11.  
  12. void clearPixel( uint8_t y, uint8_t x )
  13. {
  14.     uint8_t index   = y / 8;
  15.     uint8_t yBitPos = y % 8;
  16.    
  17.     VRAM[index][x] &= ~(1<<yBitPos);   
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement