Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | /* grove_lcd.h - Public API for the Grove RGB LCD device */
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef DISPLAY_GROVE_LCD_H
#define DISPLAY_GROVE_LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Display Drivers
* @defgroup display_interfaces Display Drivers
* @{
* @}
*/
/**
* @brief Grove display APIs
* @defgroup grove_display Grove display APIs
* @ingroup display_interfaces
* @{
*/
#define GROVE_LCD_NAME "GLCD"
/**
* @brief Send text to the screen
*
* @param port Pointer to device structure for driver instance.
* @param data the ASCII text to display
* @param size the length of the text in bytes
*/
void glcd_print(struct device *port, char *data, u32_t size);
/**
* @brief Set text cursor position for next additions
*
* @param port Pointer to device structure for driver instance.
* @param col the column for the cursor to be moved to (0-15)
* @param row the row it should be moved to (0 or 1)
*/
void glcd_cursor_pos_set(struct device *port, u8_t col, u8_t row);
/**
* @brief Clear the current display
*
* @param port Pointer to device structure for driver instance.
*/
void glcd_clear(struct device *port);
/* Defines for the GLCD_CMD_DISPLAY_SWITCH options */
#define GLCD_DS_DISPLAY_ON (1 << 2)
#define GLCD_DS_DISPLAY_OFF (0 << 2)
#define GLCD_DS_CURSOR_ON (1 << 1)
#define GLCD_DS_CURSOR_OFF (0 << 1)
#define GLCD_DS_BLINK_ON (1 << 0)
#define GLCD_DS_BLINK_OFF (0 << 0)
/**
* @brief Function to change the display state.
* @details This function provides the user the ability to change the state
* of the display as per needed. Controlling things like powering on or off
* the screen, the option to display the cursor or not, and the ability to
* blink the cursor.
*
* @param port Pointer to device structure for driver instance.
* @param opt An 8bit bitmask of GLCD_DS_* options.
*
*/
void glcd_display_state_set(struct device *port, u8_t opt);
/**
* @brief return the display feature set associated with the device
*
* @param port the Grove LCD to get the display features set
*
* @return the display feature set associated with the device.
*/
u8_t glcd_display_state_get(struct device *port);
/* Defines for the GLCD_CMD_INPUT_SET to change text direction */
#define GLCD_IS_SHIFT_INCREMENT (1 << 1)
#define GLCD_IS_SHIFT_DECREMENT (0 << 1)
#define GLCD_IS_ENTRY_LEFT (1 << 0)
#define GLCD_IS_ENTRY_RIGHT (0 << 0)
/**
* @brief Function to change the input state.
* @details This function provides the user the ability to change the state
* of the text input. Controlling things like text entry from the left or
* right side, and how far to increment on new text
*
* @param port Pointer to device structure for driver instance.
* @param opt A bitmask of GLCD_IS_* options
*
*/
void glcd_input_state_set(struct device *port, u8_t opt);
/**
* @brief return the input set associated with the device
*
* @param port the Grove LCD to get the input features set
*
* @return the input set associated with the device.
*/
u8_t glcd_input_state_get(struct device *port);
/* Defines for the LCD_FUNCTION_SET */
#define GLCD_FS_8BIT_MODE (1 << 4)
#define GLCD_FS_ROWS_2 (1 << 3)
#define GLCD_FS_ROWS_1 (0 << 3)
#define GLCD_FS_DOT_SIZE_BIG (1 << 2)
#define GLCD_FS_DOT_SIZE_LITTLE (0 << 2)
/* Bits 0, 1 are not defined for this register */
/**
* @brief Function to set the functional state of the display.
* @param port Pointer to device structure for driver instance.
* @param opt A bitmask of GLCD_FS_* options
*
* @details This function provides the user the ability to change the state
* of the display as per needed. Controlling things like the number of rows,
* dot size, and text display quality.
*/
void glcd_function_set(struct device *port, u8_t opt);
/**
* @brief return the function set associated with the device
*
* @param port the Grove LCD to get the functions set
*
* @return the function features set associated with the device.
*/
u8_t glcd_function_get(struct device *port);
/* Available color selections */
#define GROVE_RGB_WHITE 0
#define GROVE_RGB_RED 1
#define GROVE_RGB_GREEN 2
#define GROVE_RGB_BLUE 3
/**
* @brief Set LCD background to a predefined color
* @param port Pointer to device structure for driver instance.
* @param color One of the predefined color options
*/
void glcd_color_select(struct device *port, u8_t color);
/**
* @brief Set LCD background to custom RGB color value
*
* @param port Pointer to device structure for driver instance.
* @param r A numeric value for the red color (max is 255)
* @param g A numeric value for the green color (max is 255)
* @param b A numeric value for the blue color (max is 255)
*/
void glcd_color_set(struct device *port, u8_t r, u8_t g, u8_t b);
/**
* @brief Initialize the Grove LCD panel
*
* @param port Pointer to device structure for driver instance.
*
* @return Returns 0 if all passes
*/
int glcd_initialize(struct device *port);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* DISPLAY_GROVE_LCD_H */
|