Keyboard firmwares for Atmel AVR and Cortex-M
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.

HD44780.h 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2014.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
  10. Permission to use, copy, modify, distribute, and sell this
  11. software and its documentation for any purpose is hereby granted
  12. without fee, provided that the above copyright notice appear in
  13. all copies and that both that the copyright notice and this
  14. permission notice and warranty disclaimer appear in supporting
  15. documentation, and that the name of the author not be used in
  16. advertising or publicity pertaining to distribution of the
  17. software without specific, written prior permission.
  18. The author disclaims all warranties with regard to this
  19. software, including all implied warranties of merchantability
  20. and fitness. In no event shall the author be liable for any
  21. special, indirect or consequential damages or any damages
  22. whatsoever resulting from loss of use, data or profits, whether
  23. in an action of contract, negligence or other tortious action,
  24. arising out of or in connection with the use or performance of
  25. this software.
  26. */
  27. /** \file
  28. *
  29. * Header file for HD44780.c.
  30. */
  31. #ifndef _HD44780_H_
  32. #define _HD44780_H_
  33. /* Includes: */
  34. #include <avr/io.h>
  35. #include <util/delay.h>
  36. #include <avr/power.h>
  37. /* Macros: */
  38. #define RS (1 << 4) /* PD4 */
  39. #define ENABLE (1 << 7) /* PD7 */
  40. #define HI4_MASK 0xF0
  41. #define LO4_MASK 0x0F /* PD0-PD3 */
  42. #define ALL_BITS (RS | ENABLE | LO4_MASK)
  43. #define HI4(c) ((c & HI4_MASK) >> 4)
  44. #define LO4(c) ((c & LO4_MASK) >> 0)
  45. #define CMD_DISPLAY_ON 0x0C
  46. /* Function Prototypes: */
  47. void HD44780_Initialize(void);
  48. void HD44780_WriteData(const uint8_t c);
  49. void HD44780_WriteCommand(const uint8_t c);
  50. #endif