helper.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef HELPER_H
  2. #define HELPER_H
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <stdint.h>
  6. #include <unistd.h>
  7. #include <string.h>
  8. #include <time.h>
  9. #include <math.h>
  10. const char EASE_IN[] = "@\x15\r\t\x07\x06\x05\x04\x04\x03\x03\x03\x03\x02\x02\x02\x02\x02\x02\x02\x02";
  11. const char EASE_OUT[] = "\x02\x02\x02\x02\x02\x02\x02\x02\x03\x03\x03\x03\x04\x04\x05\x06\x07\t\r\x15@";
  12. void umlauts(char *cTemp, int cLen) {
  13. for(int i=0; i<cLen-1; i++) {
  14. if(cTemp[i] == 0xC2) {
  15. if(cTemp[i+1] == 0xB0) {//°
  16. cTemp[i] = '\'';
  17. if(i < cLen-2) {
  18. memcpy(&cTemp[i+1], &cTemp[i+2], cLen-2-i);
  19. cTemp[cLen-1] = '\0';
  20. }
  21. else
  22. cTemp[i+1] = '\0';
  23. }
  24. } else if(cTemp[i] == 0xC3) {
  25. switch (cTemp[i+1]) {
  26. case 0xA4:
  27. memcpy(&cTemp[i], "ae", 2);
  28. break;
  29. case 0xB6:
  30. memcpy(&cTemp[i], "oe", 2);
  31. break;
  32. case 0xBC:
  33. memcpy(&cTemp[i], "ue", 2);
  34. break;
  35. case 0x84:
  36. memcpy(&cTemp[i], "Ae", 2);
  37. break;
  38. case 0x96:
  39. memcpy(&cTemp[i], "Oe", 2);
  40. break;
  41. case 0x9C:
  42. memcpy(&cTemp[i], "Ue", 2);
  43. break;
  44. case 0x9F:
  45. memcpy(&cTemp[i], "ss", 2);
  46. break;
  47. default:
  48. break;
  49. }
  50. }
  51. }
  52. }
  53. void debugPrint(uint8_t *bImg, int iPitch) {
  54. for(int row=0; row<8; row++) {
  55. for(int col=0; col<iPitch*8; col++) {
  56. char c = ' ';
  57. if(bImg[col/8+row*iPitch] & (1 << (7-col%8))) c = '#';
  58. putchar(c);
  59. }
  60. putchar('\n');
  61. }
  62. }
  63. #endif