Skip to content

feat: baud enum

To summarise this PR:

  • python passes in an integer (e.g. 9600) for baud rate which is converted to uint 9600 -- but this is not correct as it needs to map to 0x0000000d instead (uint 13).
  • create an enum class (it's typed!) in labRemote similar to CharSize (https://stackoverflow.com/questions/18335861/why-is-enum-class-preferred-over-plain-enum) that has this particular type/mapping encoded.. because we're stuck with termios.h #defines all over the place which is a PITA.
  • pybind this enum class over to python so libCom.BaudRate.B_9600 works (note: can't use B9600 as the #define preprocesses first before compilation...)
  • update the pybind signatures to accept the BaudRate typed enum

This also aligns the API with the existing CharSize enum that's already exposed. Note that the reason to do it this way, is to avoid extra parsing and try to harmonize the API between C++ and python through a strongly-typed enum.

Edited by Giordon Holtsberg Stark

Merge request reports

Loading