Subversion Repositories HomeAutomation

Rev

Rev 762 | Rev 933 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. #include <inttypes.h>
  2. #include <config.h>
  3.  
  4.  
  5. #ifndef LCD_CONTROL_PIN_E
  6.  
  7. #define LCD_DATA_PORT_DB0   PORTB
  8. #define LCD_DATA_DDR_DB0    DDRB
  9. #define LCD_DATA_PORT_DB1   PORTD
  10. #define LCD_DATA_DDR_DB1    DDRD
  11. #define LCD_DATA_PORT_DB2   PORTD
  12. #define LCD_DATA_DDR_DB2    DDRD
  13. #define LCD_DATA_PORT_DB3   PORTD
  14. #define LCD_DATA_DDR_DB3    DDRD
  15. #define LCD_DATA_PORT_DB4   PORTD
  16. #define LCD_DATA_DDR_DB4    DDRD
  17. #define LCD_DATA_PORT_DB5   PORTD
  18. #define LCD_DATA_DDR_DB5    DDRD
  19. #define LCD_DATA_PORT_DB6   PORTD
  20. #define LCD_DATA_DDR_DB6    DDRD
  21. #define LCD_DATA_PORT_DB7   PORTD
  22. #define LCD_DATA_DDR_DB7    DDRD
  23.  
  24.  
  25. #define LCD_DATA_PIN_DB0    0x00
  26. #define LCD_DATA_PIN_DB1    0x07
  27. #define LCD_DATA_PIN_DB2    0x06
  28. #define LCD_DATA_PIN_DB3    0x05
  29. #define LCD_DATA_PIN_DB4    0x04
  30. #define LCD_DATA_PIN_DB5    0x02
  31. #define LCD_DATA_PIN_DB6    0x01
  32. #define LCD_DATA_PIN_DB7    0x00
  33.  
  34. #define LCD_CONTROL_PORT    PORTB
  35. #define LCD_CONTROL_DDR     DDRB
  36. #define LCD_CONTROL_PORT_CS PORTC
  37. #define LCD_CONTROL_DDR_CS  DDRC
  38.  
  39. #define LCD_CONTROL_PIN_RS  0x07
  40. #define LCD_CONTROL_PIN_RW  0x02
  41. #define LCD_CONTROL_PIN_E   0x01
  42. #define LCD_CONTROL_PIN_CS1 0x05
  43. #define LCD_CONTROL_PIN_CS2 0x04
  44.  
  45. #endif
  46.  
  47. //H�r har vi n�gon slags tillst�ndsvariabel
  48. typedef struct struct_GrLcdStateType
  49. {
  50.     unsigned char lcdXAddr;
  51.     unsigned char lcdYAddr;
  52. } GrLcdStateType;
  53.  
  54.  
  55. //Alla funktioner
  56. void Disable(void);
  57.  
  58. void Delay(void);
  59.  
  60. void Enable(void);
  61.  
  62. void glcdWriteData(uint8_t data);
  63.  
  64. //extern void glcdWriteChar(char c);
  65.  
  66. //extern void glcdPutStr(const char *s);
  67.  
  68. void glcdWriteChar(char c);
  69.  
  70. void glcdPutStr(char *data);
  71.  
  72. void SetControls(uint8_t RS, uint8_t RW);
  73.  
  74. void SetData(uint8_t Data);
  75.  
  76. void glcdSetXY(uint8_t x, uint8_t y);
  77.  
  78. void glcdPowerOn(void);
  79.  
  80. void glcdClear(void);
  81.