Refactor/mstp zero config state machine (#676)

* Changed MS/TP master node self destination checks to be located in receive FSM

* Changed MSTP zero configuration: modified comments for state transition names; modified next station increment; refactored the UUID rand() to not be required by common zero config implementation; added more unit tests.

* Added another context to MS/TP user data to allow additional user data
This commit is contained in:
Steve Karg
2024-06-26 07:43:25 -05:00
committed by GitHub
parent 9e0751f8c9
commit ddb2b43125
16 changed files with 313 additions and 126 deletions
+38
View File
@@ -210,6 +210,44 @@ uint32_t rs485_baud_rate(void)
return Baud_Rate;
}
/**
* @brief Set the baud in kili-baud
* @param baud_k baud rate in approximate kilobaud
*/
bool rs485_kbaud_rate_set(uint8_t baud_k)
{
uint32_t baud = 38400;
if (baud_k == 255) {
baud = 38400;
} else if (baud_k >= 115) {
baud = 115200;
} else if (baud_k >= 76) {
baud = 76800;
} else if (baud_k >= 57) {
baud = 57600;
} else if (baud_k >= 38) {
baud = 38400;
} else if (baud_k >= 19) {
baud = 19200;
} else if (baud_k >= 9) {
baud = 9600;
}
return rs485_baud_rate_set(baud);
}
/**
* Converts baud in bps to kili-baud
*
* @param baud - baud rate in bps
* @return: baud rate in approximate kilo-baud
*/
uint8_t rs485_kbaud_rate(void)
{
return Baud_Rate/1000;
}
/**
* Initialize the RS-485 baud rate
*