2015-10-16 02:00:07 +08:00
|
|
|
/* grove_lcd.h - Public API for the Grove RGB LCD device */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-10-16 02:00:07 +08:00
|
|
|
*/
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_DISPLAY_GROVE_LCD_H_
|
|
|
|
#define ZEPHYR_INCLUDE_DISPLAY_GROVE_LCD_H_
|
2015-10-16 02:00:07 +08:00
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-11-18 00:52:54 +08:00
|
|
|
/**
|
|
|
|
* @brief Display Drivers
|
|
|
|
* @defgroup display_interfaces Display Drivers
|
|
|
|
* @{
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Grove display APIs
|
|
|
|
* @defgroup grove_display Grove display APIs
|
|
|
|
* @ingroup display_interfaces
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2015-10-16 02:00:07 +08:00
|
|
|
#define GROVE_LCD_NAME "GLCD"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Send text to the screen
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
2015-10-16 02:00:07 +08:00
|
|
|
* @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
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
void glcd_print(struct device *port, char *data, u32_t size);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set text cursor position for next additions
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
2015-10-16 02:00:07 +08:00
|
|
|
* @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)
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
void glcd_cursor_pos_set(struct device *port, u8_t col, u8_t row);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clear the current display
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
2015-10-16 02:00:07 +08:00
|
|
|
* @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
|
2017-05-03 08:21:56 +08:00
|
|
|
* the screen, the option to display the cursor or not, and the ability to
|
2015-10-16 02:00:07 +08:00
|
|
|
* blink the cursor.
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
|
|
|
* @param port Pointer to device structure for driver instance.
|
|
|
|
* @param opt An 8bit bitmask of GLCD_DS_* options.
|
|
|
|
*
|
2015-10-16 02:00:07 +08:00
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
void glcd_display_state_set(struct device *port, u8_t opt);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief return the display feature set associated with the device
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
|
|
|
* @param port the Grove LCD to get the display features set
|
2015-10-16 02:00:07 +08:00
|
|
|
*
|
|
|
|
* @return the display feature set associated with the device.
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
u8_t glcd_display_state_get(struct device *port);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
/* 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
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
|
|
|
* @param port Pointer to device structure for driver instance.
|
|
|
|
* @param opt A bitmask of GLCD_IS_* options
|
|
|
|
*
|
2015-10-16 02:00:07 +08:00
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
void glcd_input_state_set(struct device *port, u8_t opt);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief return the input set associated with the device
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
|
|
|
* @param port the Grove LCD to get the input features set
|
2015-10-16 02:00:07 +08:00
|
|
|
*
|
|
|
|
* @return the input set associated with the device.
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
u8_t glcd_input_state_get(struct device *port);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
void glcd_function_set(struct device *port, u8_t opt);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief return the function set associated with the device
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
|
|
|
* @param port the Grove LCD to get the functions set
|
2015-10-16 02:00:07 +08:00
|
|
|
*
|
|
|
|
* @return the function features set associated with the device.
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
u8_t glcd_function_get(struct device *port);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* Available color selections */
|
|
|
|
#define GROVE_RGB_WHITE 0
|
|
|
|
#define GROVE_RGB_RED 1
|
|
|
|
#define GROVE_RGB_GREEN 2
|
|
|
|
#define GROVE_RGB_BLUE 3
|
|
|
|
/**
|
2017-05-03 08:21:56 +08:00
|
|
|
* @brief Set LCD background to a predefined color
|
2015-10-16 02:00:07 +08:00
|
|
|
* @param port Pointer to device structure for driver instance.
|
2017-05-03 08:21:56 +08:00
|
|
|
* @param color One of the predefined color options
|
2015-10-16 02:00:07 +08:00
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
void glcd_color_select(struct device *port, u8_t color);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set LCD background to custom RGB color value
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
2015-10-16 02:00:07 +08:00
|
|
|
* @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)
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
void glcd_color_set(struct device *port, u8_t r, u8_t g, u8_t b);
|
2015-10-16 02:00:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize the Grove LCD panel
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
2015-10-16 02:00:07 +08:00
|
|
|
* @param port Pointer to device structure for driver instance.
|
2015-10-20 23:10:46 +08:00
|
|
|
*
|
2016-03-10 01:01:20 +08:00
|
|
|
* @return Returns 0 if all passes
|
2015-10-16 02:00:07 +08:00
|
|
|
*/
|
|
|
|
int glcd_initialize(struct device *port);
|
|
|
|
|
2017-11-18 00:52:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_DISPLAY_GROVE_LCD_H_ */
|