Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <rflpc17xx/rflpc17xx.h>
  2. #include <nhd_spi_lcd.h>
  3.  
  4. uint8_t buffer[128*4];
  5.  
  6. #define WIDTH 128
  7. #define HEIGHT 32
  8. #define COORD_TO_BYTE(x,y) ((((y)>>3) * WIDTH) + (x))
  9. #define COORD_TO_BIT(x,y) (((y) & 7))
  10.  
  11. void pixel_set(uint8_t x, uint8_t y) {
  12. int byte_idx = COORD_TO_BYTE(x,y);
  13. buffer[byte_idx] |= (1 << COORD_TO_BIT(x,y));
  14. }
  15.  
  16. void clr_pixel(uint8_t x, uint8_t y) {
  17. int byte_idx = COORD_TO_BYTE(x,y);
  18. buffer[byte_idx] &= (1 << COORD_TO_BIT(x,y));
  19. }
  20.  
  21. void lcd_clear() {
  22. int i, j;
  23. for (i = 0; i < WIDTH; i++)
  24. for (j = 0; j < HEIGHT; j++)
  25. clr_pixel(i,j);
  26. }
  27.  
  28. void draw_ball(uint8_t x, uint8_t y) {
  29.  
  30. }
  31.  
  32.  
  33.  
  34. int main() {
  35. nhd_spi_lcd_init(NHD_MAKE_SIZE(128,32),MBED_DIP6,MBED_DIP8,MBED_DIP11,RFLPC_SPI1);
  36. int i;
  37. for (i = 3; i < 19; i++) {
  38. pixel_set(0,i);
  39. pixel_set(1,i);
  40. }
  41. nhd_spi_lcd_display_buffer(buffer);
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement