lcd-twi.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _LCD_TWI_H_
  2. #define _LCD_TWI_H_
  3. #ifndef F_CPU
  4. #error "F_CPU not defined!"
  5. #endif
  6. #include <avr/io.h>
  7. #include <avr/interrupt.h>
  8. #include <util/delay.h>
  9. #define LCD_RS 0x01
  10. #define LCD_RW 0x02
  11. #define LCD_E 0x04
  12. #define LCD_LED 0x08
  13. #define LCD_CLR (1 << 0x00)
  14. #define LCD_RET (1 << 0x01)
  15. #define LCD_DIR (1 << 0x02)
  16. #define LCD_DIR_S (1 << 0x00)
  17. #define LCD_DIR_ID (1 << 0x01)
  18. #define LCD_ONOFF (1 << 0x03)
  19. #define LCD_ONOFF_B (1 << 0x00)
  20. #define LCD_ONOFF_C (1 << 0x01)
  21. #define LCD_ONOFF_D (1 << 0x02)
  22. #define LCD_SHIFT (1 << 0x04)
  23. #define LCD_SHIFT_RL (1 << 0x02)
  24. #define LCD_SHIFT_SC (1 << 0x03)
  25. #define LCD_MODEPWR ((1 << 0x04) | (3 << 0x00))
  26. #define LCD_MODEPWR_PWR (1 << 0x02)
  27. #define LCD_MODEPWR_GC (1 << 0x03)
  28. #define LCD_WIDTH (1 << 0x05)
  29. #define LCD_WIDTH_FT0 (1 << 0x00)
  30. #define LCD_WIDTH_FT1 (1 << 0x01)
  31. #define LCD_WIDTH_F (1 << 0x02)
  32. #define LCD_WIDTH_N (1 << 0x03)
  33. #define LCD_WIDTH_DL (1 << 0x04)
  34. #define LCD_CGRAM (1 << 0x06)
  35. #define LCD_DDRAM (1 << 0x07)
  36. #define LCDI2CADDR 0x4E
  37. enum { SYM_NULL, SYM_DEGREE, SYM_TCOUPLE, SYM_DIODE, SYM_RES, SYM_MOSFET, SYM_OPEN, SYM_SHORT };
  38. void I2C_SendByte(uint8_t);
  39. void LCD_SendData(uint8_t);
  40. void LCD_SendCmd(uint8_t);
  41. void LCD_SetPos(uint8_t, uint8_t);
  42. void LCD_Init(void);
  43. void LoadSymbol(void);
  44. #endif