You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.7 KiB

  1. #include <stdio.h>
  2. #include "st7735.h"
  3. #include <wiringPi.h>
  4. int main(int argc, char *argv[])
  5. {
  6. setbuf(stdout, NULL);
  7. wiringPiSetup();
  8. lcd_t* lcd = lcd_init(40000000, 10, 2, 0);
  9. printf("Fill display...");
  10. printf("blue...");
  11. lcd_fillScreen(0, 70, 160);
  12. delay(1000);
  13. printf("black...");
  14. lcd_fillScreen(0, 0, 0);
  15. printf("DONE\n");
  16. delay(1000);
  17. /* Draw the lines */
  18. /*printf("Lines...");
  19. lcdst_drawHLine(0, 149, 128, 0, 255, 255);
  20. lcdst_drawHLine(0, 139, 128, 255, 255, 0);
  21. lcdst_drawVLine(117, 0, 160, 0, 255, 255);
  22. lcdst_drawVLine(107, 0, 160, 255, 255, 0);
  23. printf("DONE\n");*/
  24. /*printf("Points...");
  25. for (int i = 1; i < 20; i++) {
  26. lcdst_drawPx(5 - 1, 70 + i, 100, 100, 100);
  27. lcdst_drawPx(5 + i + 1, 70 + i, 100, 100, 100);
  28. }
  29. printf("DONE\n");
  30. printf("Triangle...");
  31. for (int i = 1; i < 20; i++) {
  32. lcdst_drawHLine(5, 70 + i, i, 255, 0, 0);
  33. }
  34. printf("DONE\n");*/
  35. printf("Rectangles...");
  36. //printf("outline...");
  37. //lcd_drawRect(10, 10, 10, 10, 0, 255, 255);
  38. //lcd_drawRect(10, 30, 10, 10, 255, 255, 0);
  39. printf("filled...");
  40. lcd_fillRect(30, 10, 10, 10, 0, 255, 255);
  41. lcd_fillRect(30, 30, 10, 10, 255, 255, 0);
  42. printf("bunch...");
  43. for (int i = 0; i < 40; i++) {
  44. lcd_fillRect(40 + (i%13) * 4, 40 + (i%19) * 4, 20, 20, i % 5 * 15, i % 7 * 17, i % 3 * 23);
  45. }
  46. printf("DONE\n");
  47. printf("Text...");
  48. lcd_printChar(10, 90, 'A');
  49. lcd_printText(10, 50, "Ahoj!");
  50. lcd_printChar(10, 100, 'Z');
  51. printf("DONE\n");
  52. /* Send the raw data */
  53. /* printf("Raw...");
  54. lcdst_setWindow(20, 20, 29, 29);
  55. for(uint8 i=0; i<100; i++) lcdst_pushPx(255, 0, 255);
  56. lcdst_setWindow(0, 0, 127, 159);
  57. printf("DONE\n");*/
  58. /* Uninitialize the display */
  59. //lcd_deinit(lcd);
  60. return 0;
  61. }