Advertisement
Guest User

Untitled

a guest
Mar 16th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uint8_t XY (uint8_t x, uint8_t y) {
  2.   // any out of bounds address maps to the first hidden pixel
  3.   if ( (x >= LED_X) || (y >= LED_Y) ) {
  4.     return (LAST_VISIBLE_LED + 1);
  5.   }
  6.  
  7.   const uint8_t XYTable[] = {
  8.      7,   8,  23,  24,
  9.      6,   9,  22,  25,
  10.      5,  10,  21,  26,
  11.      4,  11,  20,  27,
  12.      3,  12,  19,  28,
  13.      2,  13,  18,  29,
  14.      1,  14,  17,  30,
  15.      0,  15,  16,  31
  16.   };
  17.  
  18.   uint8_t i = (y * LED_X) + x;
  19.   uint8_t j = XYTable[i];
  20.   return j;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement