Wafer.Guards (wafer v0.1.6)

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

Link to this section 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

Link to this section Functions

Link to this macro

is_byte_size(bytes)

(macro)

Byte sizes are non negative integers

Link to this macro

is_i2c_address(address)

(macro)

An integer between 0 and 0x7F

Link to this macro

is_pin_condition(condition)

(macro)

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

Link to this macro

is_pin_direction(direction)

(macro)

Either :in or :out

Link to this macro

is_pin_number(pin)

(macro)

Pin numbers are non negative integers

Link to this macro

is_pin_pull_mode(mode)

(macro)

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

Link to this macro

is_pin_value(value)

(macro)

Either 0 or 1

Link to this macro

is_register_address(address)

(macro)

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