nrf6350.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. #ifndef NRF6350_H_
  13. #define NRF6350_H_
  14. #include <stdbool.h>
  15. #include <stdint.h>
  16. #define LCD_LLEN 16 //!< LCD Line length
  17. #define JS_BUTTON_NONE 0x00 //!< Joystick not touched
  18. #define JS_BUTTON_LEFT 0x01 //!< joystick pulled left
  19. #define JS_BUTTON_PUSH 0x02 //!< joystick pushed
  20. #define JS_BUTTON_DOWN 0x04 //!< joystick pulled down
  21. #define JS_BUTTON_UP 0x08 //!< joystick pulled up
  22. #define JS_BUTTON_RIGHT 0x10 //!< joystick pulled right
  23. #define LCD_UPPER_LINE 0x00 //!< LCD upper line
  24. #define LCD_LOWER_LINE 0x40 //!< LCD lower line
  25. #define LCD_CONTRAST_LOW 0x00 //!< LCD Low contrast
  26. #define LCD_CONTRAST_MEDIUM 0x02 //!< LCD Medium contrast
  27. #define LCD_CONTRAST_HIGH 0x08 //!< LCD High contrast
  28. /**
  29. * @brief Function for initializing the LCD display prior to writing.
  30. * @return
  31. * @retval true Operation succeeded
  32. * @retval false Operation failed
  33. */
  34. bool nrf6350_lcd_init(void);
  35. /**
  36. * @brief Function for writing a text string on the LCD-display.
  37. *
  38. * @param p_text A pointer to the text string to be written
  39. * @param size Size of the text string to be written
  40. * @param line The line the text should be written to
  41. * @param pos The start position of the text on the line
  42. * @return
  43. * @retval true Write succeeded
  44. * @retval false Write failed
  45. */
  46. bool nrf6350_lcd_write_string(const char *p_text, uint8_t size, uint8_t line, uint8_t pos);
  47. /**
  48. * @brief Function for clearing the contents of the LCD-display.
  49. *
  50. * @return
  51. * @retval true Operation succeeded
  52. * @retval false Operation failed
  53. */
  54. bool nrf6350_lcd_clear(void);
  55. /**
  56. * @brief Function for adjusting the contrast of the LCD-display, select between
  57. * LCD_CONTRAST_LOW, LCD_CONTRAST_MEDIUM and LCD_CONTRAST_HIGH.
  58. *
  59. * @param contrast The desired contrast of the lcd display
  60. * @return
  61. * @retval true Operation succeeded
  62. * @retval false Operation failed
  63. */
  64. bool nrf6350_lcd_set_contrast(uint8_t contrast);
  65. /**
  66. * @brief Function for turning ON the LCD-display.
  67. *
  68. * @return
  69. * @retval true Operation succeeded
  70. * @retval false Operation failed
  71. */
  72. bool nrf6350_lcd_on(void);
  73. /**
  74. * @brief Function for turning OFF the LCD-display.
  75. *
  76. * @return
  77. * @retval true Operation succeeded
  78. * @retval false Operation failed
  79. */
  80. bool nrf6350_lcd_off(void);
  81. /**
  82. * @brief Function for getting the position of the joystick.
  83. *
  84. * @param val pointer to a 2 byte array where the X,Y position is stored
  85. * @return
  86. * @retval true Operation succeeded
  87. * @retval false Operation failed
  88. */
  89. bool nrf6350_js_get_value(int8_t *val);
  90. /**
  91. * @brief Function for getting the status of the joystick.
  92. *
  93. * @param js_state pointer to a uint8_t that receives the status of the joystick
  94. * @return
  95. * @retval true Operation succeeded
  96. * @retval false Operation failed
  97. */
  98. bool nrf6350_js_get_status(uint8_t *js_state);
  99. /** @brief Function for transferring data over TWI bus. Used the first time you want to communicate nRF6350 to bypass a fail.
  100. */
  101. bool nrf6350_lcd_wake_up(void);
  102. #endif // NRF6350_H_
  103. /** @} */