View Source Wafer.Guards (wafer v1.1.0)

Handy guards which you can use in your code to assert correct values.

Summary

Functions

Byte sizes are non negative integers

An integer between 0 and 0x7F

One of :none, :rising, :falling or :both

Either :in or :out

Pin numbers are non negative integers

One of :not_set, :none, :pull_up or :pull_down

Either 0 or 1

Register addresses are non negative integers usually only one byte, but we don't enforce that here

Functions

Link to this macro

is_byte_size(bytes)

View Source (macro)

Byte sizes are non negative integers

Link to this macro

is_i2c_address(address)

View Source (macro)

An integer between 0 and 0x7F

Link to this macro

is_pin_condition(condition)

View Source (macro)

One of :none, :rising, :falling or :both

Link to this macro

is_pin_direction(direction)

View Source (macro)

Either :in or :out

Link to this macro

is_pin_number(pin)

View Source (macro)

Pin numbers are non negative integers

Link to this macro

is_pin_pull_mode(mode)

View Source (macro)

One of :not_set, :none, :pull_up or :pull_down

Link to this macro

is_pin_value(value)

View Source (macro)

Either 0 or 1

Link to this macro

is_register_address(address)

View Source (macro)

Register addresses are non negative integers usually only one byte, but we don't enforce that here