![]() |
Speeduino
|
table axis I/O support More...
#include <table3d_axis_io.h>
Static Public Member Functions | |
| static constexpr const int16_byte * | get_converter (axis_domain domain) |
| Obtain a converter instance for a given axis domain. More... | |
| static byte | to_byte (axis_domain domain, int16_t value) |
Convert to a byte. More... | |
| static int16_t | from_byte (axis_domain domain, byte in) |
Convert from a byte. More... | |
table axis I/O support
constexpr class static variables seems to be the best combination of size and speed - constexpr implies inline, so we can't use it on traditional extern global variables.
|
inlinestatic |
Convert from a byte.
Useful for converting a single value. If converting multiple, probably faster to cache the converter rather than repeatedly calling this function.


|
inlinestaticconstexpr |
Obtain a converter instance for a given axis domain.
Often we need to deal internally with values that fit in 16-bits but do not require much accuracy. E.g. RPM. For these values we can save storage space (EEPROM) by scaling to/from 8-bits using a fixed divisor.
The divisor is dependent on the domain. I.e all axes with the same domain use the same divisor
Conversion during I/O is orthogonal to other axis concerns, so is separated and encapsulated here.

|
inlinestatic |
Convert to a byte.
Useful for converting a single value. If converting multiple, probably faster to cache the converter rather than repeatedly calling this function.

