iot_firmware.communications.utils

Utils for the communications package.

Classes

Counter([start, increment])

Counter that sums a value every time it is called.

class iot_firmware.communications.utils.Counter(start: int = 0, increment: int = 1)[source]

Counter that sums a value every time it is called.

Parameters
  • start – starting counter value

  • increment – increment value of the counter

Basic usage.

>>> counter = Counter()
>>> counter()
1
>>> counter()
2

Supports starting the counter at a specific value.

>>> counter = Counter(start=10)
>>> counter()
11

Supports modifying the increment value after each call.

>>> counter = Counter(increment=5)
>>> counter()
5