18. API - Watch Dog Timer

18.1. Regular Classes

The following classes are intended for general use with the devices they represent. All classes in this section are concrete (not abstract).

18.1.1. WDT

class lannerpsp.WDT(check_platform: bool = False)[source]

Watch Dog Timer.

Parameters:

check_platform (bool) – Set to True to check if the platform supports this feature. Defaults to False for better compatibility.

Raises:
get_info() WDTInfoModel[source]

Get Watch Dog Timer information.

Example:

>>> wdt = WDT()
>>> wdt.get_info()
WDTInfoModel(type='SuperIO', max_count=255, is_minute_support=True)
Returns:

WDT information

Return type:

WDTInfoModel

Raises:
  • PSPNotOpened – The library is not ready or opened yet.

  • PSPNotSupport – This platform does not support this function.

  • PSPError – General PSP functional error.

config(count: int, time_base: int = 1) None[source]

Configure the Watch Dog Timer for specific time.

Example for 200 seconds:

>>> wdt = WDT()
>>> wdt.config(200)

Example for 2 minutes:

>>> wdt = WDT()
>>> wdt.config(2, 2)
Parameters:
  • count (int) – The value sets the timer count down.

  • time_base (int) – The value selects time base. Set 1 to select SECOND base, Set 2 to select MINUTE base. Defaults to 1.

Raises:
  • TypeError – The input parameters type error.

  • PSPInvalid – Invalid parameter value.

  • PSPNotOpened – The library is not ready or opened yet.

  • PSPNotSupport – This platform does not support this function.

  • PSPBusyInUses – This step is skipped because WDT is already starting now.

  • PSPError – General PSP functional error.

enable(count: int = 0, time_base: int = 1) None[source]

Configure the Watch Dog Timer for specific time and start the WDT countdown.

You can enable() dircetly by a given time:

>>> wdt = WDT()
>>> wdt.enable(200)

Or config() first then enable()

>>> wdt = WDT()
>>> wdt.config(200)
>>> wdt.enable()
Parameters:
  • count (int) – The value sets the timer count down. Defaults to 0.

  • time_base (int) – The value selects time base. Set 1 to select SECOND base, Set 2 to select MINUTE base. Defaults to 1.

Raises:
  • TypeError – The input parameters type error.

  • PSPInvalid – Invalid parameter value.

  • PSPNotOpened – The library is not ready or opened yet.

  • PSPNotSupport – This platform does not support this function.

  • PSPBusyInUses – This step is skipped because WDT is already starting now.

  • PSPError – General PSP functional error.

disable() None[source]

Stop the WDT countdown.

Example:

>>> wdt = WDT()
>>> wdt.enable(10)
>>>
>>> wdt.disable()
Raises:
  • PSPNotOpened – The library is not ready or opened yet.

  • PSPNotSupport – This platform does not support this function.

  • PSPError – General PSP functional error.

reset() None[source]

Reload the timer and then re-computes it.

Example:

>>> wdt = WDT()
>>> wdt.enable(10)
>>>
>>> wdt.reset()
Raises:
  • PSPNotOpened – The library is not ready or opened yet.

  • PSPNotSupport – This platform does not support this function.

  • PSPError – General PSP functional error.

18.2. Models

The following models are used to store data for data modeling.

18.2.1. WDTInfoModel

class lannerpsp.WDTInfoModel(type: str, max_count: int, is_minute_support: bool)[source]

To store WDT info values.

to_dict() Dict[str, Any][source]

Convert to dict.

18.3. Supported Platforms

Note

Almost for all versions of Lanner PSP on all platforms.

The following platforms have been verified and confirmed to be supported: