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

GDC0689 API 参考

API参考

Enumerations

enum wm_gdc0689_service_icon_t

Enumeration for service icon display states on the segment LCD.

This enum defines the possible states for displaying service icons on the segment LCD, such as turning the service icon on or off.

Values:

enumerator WM_GDC0689_SERVICE_ICON_OFF

Turns the service icon off

enumerator WM_GDC0689_SERVICE_ICON_ON

Turns the service icon on

enumerator WM_GDC0689_SERVICE_ICON_MAX

Maximum value for service icon states (should not be used directly)

enum wm_gdc0689_battery_level_t

Enumeration for battery level display states on the segment LCD.

This enum represents the different battery level states that can be displayed on the segment LCD, ranging from 0% to 100% battery level, as well as an ‘OFF’ state.

Values:

enumerator WM_GDC0689_BATTERY_LEVEL_OFF

Represents the battery level display is turned off

enumerator WM_GDC0689_BATTERY_LEVEL_PERCENT_0

Represents a 0% battery level on the display

enumerator WM_GDC0689_BATTERY_LEVEL_PERCENT_25

Represents a 25% battery level

enumerator WM_GDC0689_BATTERY_LEVEL_PERCENT_50

Represents a 50% battery level

enumerator WM_GDC0689_BATTERY_LEVEL_PERCENT_75

Represents a 75% battery level

enumerator WM_GDC0689_BATTERY_LEVEL_PERCENT_100

Represents a 100% full battery level

enumerator WM_GDC0689_BATTERY_LEVEL_MAX

Maximum value for battery level states (should not be used directly)

enum wm_gdc0689_signal_level_t

Enumeration for signal level display states on the segment LCD.

This enum is used to define the different signal level states that can be displayed on the segment LCD, with specific percentages indicating the strength.

Values:

enumerator WM_GDC0689_SIGNAL_LEVEL_OFF

Represents the signal level display is turned off

enumerator WM_GDC0689_SIGNAL_LEVEL_PERCENT_25

Represents a signal level at 25%

enumerator WM_GDC0689_SIGNAL_LEVEL_PERCENT_50

Represents a signal level at 50%

enumerator WM_GDC0689_SIGNAL_LEVEL_PERCENT_75

Represents a signal level at 75%

enumerator WM_GDC0689_SIGNAL_LEVEL_PERCENT_100

Represents a signal level at 100% (full signal strength)

enumerator WM_GDC0689_SIGNAL_LEVEL_MAX

Maximum value for signal level states (should not be used directly)

enum wm_gdc0689_unit_t

Enumeration for unit display types on the segment LCD.

This enum lists the different unit types that can be displayed on the segment LCD to represent various measurements, such as temperature, force, pressure, etc.

Values:

enumerator WM_GDC0689_UNIT_OFF

Represents no unit display or ‘OFF’ state

enumerator WM_GDC0689_UNIT_MILLIVOLT

Unit for millivolts: mV

enumerator WM_GDC0689_UNIT_NEWTON_METER

Unit for Newton meter: N.m, a measure of torque

enumerator WM_GDC0689_UNIT_KILOGRAM

Unit for kilograms: kg

enumerator WM_GDC0689_UNIT_GRAM

Unit for grams: g

enumerator WM_GDC0689_UNIT_MILLIMETER

Unit for millimeters: mm

enumerator WM_GDC0689_UNIT_MICROSTRAIN

Unit for microstrain: με, a measure of deformation

enumerator WM_GDC0689_UNIT_KILOPASCAL

Unit for kilopascals: kPa, a measure of pressure

enumerator WM_GDC0689_UNIT_MEGAPASCAL

Unit for megapascals: MPa, a higher measure of pressure

enumerator WM_GDC0689_UNIT_CELSIUS

Unit for Celsius: ℃, a measure of temperature

enumerator WM_GDC0689_UNIT_MAX

Maximum value for unit types (should not be used directly)

Functions

wm_device_t *wm_gdc0689_init(char *dev_name)

Initializes the segment LCD device.

This function performs the necessary steps to initialize the segment LCD device, preparing it for use. This typically includes configuring the hardware interface and setting up the display parameters.

参数:

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

返回:

  • A pointer to the initialized device structure if the initialization is successful.

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

int wm_gdc0689_deinit(wm_device_t *dev)

Deinitializes the segment LCD device.

This function is used to release resources and perform cleanup operations for the segment LCD device that was previously initialized with wm_gdc0689_init. It is important to call this function when the device is no longer needed to avoid resource leaks.

参数:

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

返回:

  • WM_ERR_SUCCESS if the device is successfully deinitialized.

  • WM_ERR_INVALID_PARAM if the provided device pointer is invalid.

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

int wm_gdc0689_clear(wm_device_t *dev)

Clears the display on the segment LCD.

This function is used to clear the content displayed on the segment LCD, effectively turning off all segments. This can be used to blank the display or reset the LCD to a known state.

参数:

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

返回:

  • WM_ERR_SUCCESS if the display is successfully cleared.

  • WM_ERR_INVALID_PARAM if the provided device pointer is invalid.

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

int wm_gdc0689_display_service_icon(wm_device_t *dev, wm_gdc0689_service_icon_t service_icon)

Displays a service icon on the segment LCD.

This function updates the display to show a specified service icon, which can indicate various statuses or information to the user.

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

  • service_icon[in] The type of service icon to display, as defined in the enumeration.

返回:

  • WM_ERR_SUCCESS if the service icon is successfully displayed.

  • WM_ERR_INVALID_PARAM if the provided device pointer or service icon type is invalid.

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

int wm_gdc0689_display_battery_level(wm_device_t *dev, wm_gdc0689_battery_level_t battery_level)

Displays the battery level on the segment LCD.

This function is used to indicate the current battery level on the LCD. It is important for users to be aware of the device’s battery status.

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

  • battery_level[in] The battery level to display, as defined in the enumeration.

返回:

  • WM_ERR_SUCCESS if the battery level is successfully displayed.

  • WM_ERR_INVALID_PARAM if the provided device pointer or battery level value is invalid.

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

int wm_gdc0689_display_signal_level(wm_device_t *dev, wm_gdc0689_signal_level_t signal_level)

Displays the signal level on the segment LCD.

This function updates the LCD to show the current signal strength, which is crucial for communication devices to inform the user about the quality of the network connection.

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

  • signal_level[in] The signal level to display, as defined in the enumeration.

返回:

  • WM_ERR_SUCCESS if the signal level is successfully displayed.

  • WM_ERR_INVALID_PARAM if the provided device pointer or signal level value is invalid.

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

int wm_gdc0689_display_unit(wm_device_t *dev, wm_gdc0689_unit_t unit)

Displays a unit of measurement on the segment LCD.

This function allows the display of various units of measurement on the segment LCD, which can be useful for devices that measure different physical quantities.

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

  • unit[in] The unit of measurement to display, as defined in the enumeration.

返回:

  • WM_ERR_SUCCESS if the unit is successfully displayed.

  • WM_ERR_INVALID_PARAM if the provided device pointer or unit value is invalid.

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

int wm_gdc0689_display_time(wm_device_t *dev, int tm_hour, int tm_min)

Displays the current time on the segment LCD.

This function is used to show the time in hours and minutes on the LCD, which is essential for devices that need to display the current time to the user.

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

  • tm_hour[in] The hour component of the time to display.

  • tm_min[in] The minute component of the time to display.

返回:

  • WM_ERR_SUCCESS if the time is successfully displayed.

  • WM_ERR_INVALID_PARAM if the provided device pointer or time values are invalid.

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

int wm_gdc0689_display_integer(wm_device_t *dev, uint32_t value)

Displays an integer value on the segment LCD.

This function allows the display of integer values on the LCD, which can be used to show numerical data such as scores, counts, or measurements.

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

  • value[in] The integer value to be displayed.

返回:

  • WM_ERR_SUCCESS if the integer value is successfully displayed.

  • WM_ERR_INVALID_PARAM if the provided device pointer is invalid.

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

int wm_gdc0689_display_decimal(wm_device_t *dev, float value)

Displays a decimal value on the segment LCD.

This function enables the display of decimal (floating-point) values on the segment LCD, which can be used for precise measurements or other data that requires fractional representation.

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

  • value[in] The decimal (floating-point) value to be displayed.

返回:

  • WM_ERR_SUCCESS if the decimal value is successfully displayed.

  • WM_ERR_INVALID_PARAM if the provided device pointer is invalid.

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

int wm_gdc0689_display_all(wm_device_t *dev)

Displays all segments on the segment LCD.

This function turns on all segments of the LCD to their display state. It is typically used for testing the functionality of the LCD or to ensure that all segments are visible and working correctly.

参数:

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

返回:

  • WM_ERR_SUCCESS if all segments are successfully displayed.

  • WM_ERR_NO_INITED if the device is not initialized.

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

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