这个页面的 最新开发版本 可能比这个发布的 2.3-beta.1 版本新。

SEG_LCD API 参考

API 参考

Structures

struct seg_lcd_table_t

Defines a mapping between segment names and their corresponding hardware identifiers.

This structure is used to relate the logical names of segments to their actual hardware configuration identifiers, including the COM address and the segment bit representation.

Public Members

char seg_name[8]

The logical name of the segment

wm_seg_lcd_com_id_t com

The hardware COM identifier for the segment

wm_seg_lcd_seg_id_t seg

The hardware SEG identifier for the segment

struct seg_lcd_display_t

Represents the display state of a segment on the LCD.

This structure is used to define whether a particular segment should be turned on or off for display purposes.

Public Members

char seg_name[8]

The logical name of the segment

bool is_on

Boolean indicating whether the segment is on or off

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.

int wm_drv_seg_lcd_register_table(wm_device_t *dev, const seg_lcd_table_t *seg_table, uint32_t seg_count)

Registers the segment table for the segment LCD device.

This function is used to register the segment table for the segment LCD device.

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

  • seg_table[in] Pointer to the segment table to be registered.

  • seg_count[in] The number of segments to register.

返回:

  • WM_ERR_SUCCESS if the segment table is successfully registered.

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

int wm_drv_seg_lcd_display_seg(wm_device_t *dev, seg_lcd_display_t *seg_lcd_display, uint32_t seg_count)

Displays the segments on the segment LCD device.

This function is used to display the segments on the segment LCD device.

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

  • seg_lcd_display[in] Pointer to the segment display structure.

  • seg_count[in] The number of segments to display.

返回:

  • WM_ERR_SUCCESS if the segments are successfully displayed.

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