这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

SEG_LCD API 参考

API 参考

Functions

wm_device_t *wm_drv_seg_lcd_init(char *dev_name)

Initializes the segment LCD device.

This function looks up the device structure by name in the device tree and initializes the segment LCD device using the operations defined for it. It is the first step to prepare the device for use.

参数:

dev_name[in] The name of the device to initialize.

返回:

  • A pointer to the device structure if the initialization succeeds.

  • NULL if the initialization fails or the device name is not recognized, or the device has already been initialized.

int wm_drv_seg_lcd_deinit(wm_device_t *dev)

Deinitializes the segment LCD device.

This function is used to release the resources and停止 any ongoing operations of the segment LCD device. It should be called when the device is no longer needed to ensure clean resource management.

参数:

dev[in] Pointer to the device structure that needs to be deinitialized.

返回:

  • WM_ERR_SUCCESS if the deinitialization succeeds.

  • WM_ERR_INVALID_PARAM if the provided device pointer is NULL or invalid.

  • Other error codes may be returned based on the specific failure.

int wm_drv_seg_lcd_clear(wm_device_t *dev)

Clears the content displayed on the segment LCD.

This function is used to clear all the segments on the LCD screen, effectively resetting the display to a blank state.

参数:

dev[in] Pointer to the device structure of the segment LCD.

返回:

  • WM_ERR_SUCCESS if the display is successfully cleared.

  • WM_ERR_INVALID_PARAM if the provided device pointer is NULL or invalid.

  • Other error codes may be returned based on the specific failure.

int wm_drv_seg_lcd_display(wm_device_t *dev, uint8_t com_id, uint32_t seg_mask, uint32_t seg_data)

Displays content on the segment LCD.

This function is used to control the display of individual segments on the segment LCD device. It allows for the selective illumination of segments based on the provided segment mask and data, enabling the creation of digits, characters, or custom patterns on the LCD.

参数:
  • dev[in] Pointer to the device structure of the segment LCD.

  • com_id[in] The common line identifier to which the segments are connected.

  • seg_mask[in] A bitmask indicating which segments should be affected by this operation.

  • seg_data[in] The data that determines the state (on/off) of the segments specified by the mask.

返回:

  • WM_ERR_SUCCESS if the display update is successfully applied.

  • WM_ERR_INVALID_PARAM if the provided device pointer is NULL, the common line identifier is out of range, or the segment mask is zero, indicating no segments to update.

  • Other error codes may be returned based on the specific failure.