TFT_LCD API 参考
API 参考
Functions
-
wm_device_t *wm_drv_tft_lcd_init(const char *dev_name)
initialize tft lcd driver
- 参数:
dev_name – [in] LCD TFT device name must be identical to the name specified in the device table
- 返回:
!NULL : Initialize success, return the pointer to the TFT LCD driver device
NULL : Param error or initialize failed or already be initialized
-
int wm_drv_tft_lcd_deinit(wm_device_t *dev)
Deinitializes the TFT LCD driver and releases all allocated resources.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
-
int wm_drv_tft_lcd_draw_bitmap(wm_device_t *dev, wm_lcd_data_desc_t data_desc)
Starts the bitmap content transmission to TFT LCD device. This function is responsible for selecting a display window on the TFT LCD device and subsequently transmitting the image content to the device’s GRAM (Graphics Random Access Memory) for rendering.
备注
This funciton using cpu polling for the transmission by default. it will utilize DMA if the transmission callback is reigstered via the API wm_drv_tft_lcd_register_tx_callback and the buf size is exceeds 32 bytes.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
data_desc – [in] Display window and data descriptor, type of wm_lcd_data_desc_t
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
-
int wm_drv_tft_lcd_set_rotation(wm_device_t *dev, wm_lcd_rotate_t degree)
This function adjusts the display orientation by sending a specific configuration command to the device. It defines the order of transformation for the x and y coordinates and whether the rows and columns should be exchanged. This allows for flexible display configurations, accommodating various user interface requirements.
备注
This function solely modifies the TFT LCD rotation attribute. The application must also adjust the image content accordingly. Failure to do so may result in the image being partially obscured when a 90-degree or 270-degree rotation is applied.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
degree – [in] The rotation direction, type of wm_lcd_rotate_t
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
-
int wm_drv_tft_lcd_set_backlight(wm_device_t *dev, bool on_off)
This function is designed to manage the I/O control for the interface connected to the backlight pin of the TFT LCD device, to control it’s backlight state.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
on_off – [in] The backlight on or off setting, TRUE:backlight on, FALSE: backlight off
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
-
int wm_drv_tft_lcd_get_capability(wm_device_t *dev, wm_lcd_capabilitys_t *cap)
This function obtains the functional parameters currently in effect and in use for the LCD device.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
cap – [in] The pointer to the capabilities currently being utilized by the TFT LCD driver device. type of wm_lcd_capabilitys_t
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
-
int wm_drv_tft_lcd_send_cmd_data(wm_device_t *dev, uint16_t cmd, wm_lcd_cmd_type_t cmd_type, uint8_t *data, uint16_t data_len)
This function is purposefully engineered to dispatch commands to the TFT LCD device, with the capacity to include pertinent data payloads where necessary. Upon receipt of these commands, the TFT LCD device is capable of altering its operational attributes accordingly, such as adjusting the pixel format or other configurable parameters.
备注
It is imperative that the commands and data issued to the TFT LCD device strictly adhere to the specifications outlined in the device’s datasheet. The compatibility and functionality of the device are contingent upon the accurate implementation of these parameters. Developers should refer to the LCD device’s datasheet for detailed command sequences and data formats. Additionally, the header files associated with this TFT LCD may provide a predefined command list that encapsulates the necessary instructions for proper device operation.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
cmd – [in] The command which sending to TFT LCD device.
cmd_type – [in] The command length which sending to TFT LCD device.
data – [in] The pointer indicates the data which sending to TFT LCD device.
data_len – [in] The data len which is sending to TFT LCD device.
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
-
int wm_drv_tft_lcd_register_tx_callback(wm_device_t *dev, wm_lcd_tx_callback_t func, void *arg)
This function is register a callback to TFT LCD driver device for the async transmission. once the transmission done, this callback would be invoked in the ISR handler.
备注
Avoid handling any blocking or time-consuming processes in this callback, since it is directly called by the ISR handler. Failure to do so may result in other tasks or ISRs not being scheduled on time.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
func – [in] The pointer of callback function which need to be reigsterd to TFT LCD driver. type of wm_lcd_tx_callback_t
arg – [in] The pointer of user data which ISR handler will input to callback function.
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
-
int wm_drv_tft_lcd_unregister_tx_callback(wm_device_t *dev)
This function is unregister the callback from TFT LCD driver device.
- 参数:
dev – [in] The pointer to the TFT LCD driver device.
- 返回:
WM_ERR_SUCCESS on success, others error code on failure.
Macros
-
struct wm_lcd_data_desc_t
Enumeration with display window and data descriptor.
-
struct wm_lcd_capabilitys_t
Structure holding lcd capabilities.
Enumerations
-
enum wm_lcd_rotate_t
Enumeration with tft lcd display rotation.
Values:
-
enumerator LCD_ROTATION_NONE
NOMAL without display rotation
-
enumerator LCD_ROTATION_90_DEGREE
90 degree rotation for the display
-
enumerator LCD_ROTATION_180_DEGREE
180 degree rotation for the display
-
enumerator LCD_ROTATION_270_DEGREE
270 degree rotation for the display
-
enumerator LCD_ROTATION_MAX
The max number of rotation enum
-
enumerator LCD_ROTATION_NONE
Type Definitions
-
typedef void (*wm_lcd_tx_callback_t)(int result, void *data)
callback function of lcd module once the async trasmissioin done
备注
Avoid handling any blocking or time-consuming processes in this callback, since it is directly called by the ISR handler. Failure to do so may result in other tasks or ISRs not being scheduled on time.
- Param result:
[in] return value from driver layer once transmission done WM_ERR_SUCCESS: succeed others: this transmission is failed in driver layer
- Param data:
[in] User-defined data to pass to the callback function
- Return:
None