You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
voidserial_baud(serial_t *obj, int baudrate)
{
if (baudrate<=1200) {
obj->uart->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1200;
return;
}
for (int i = 1; i<17; i++) {
if (baudrate<acceptedSpeeds[i][0]) {
obj->uart->BAUDRATE = acceptedSpeeds[i - 1][1];
return;
}
}
obj->uart->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1M;
}
So this would align better with the V1 behaviour and also provide a baud rate closer to the one requested by the user (like DAL/CODAL do in other places like setting the acc/mag sampling rates, etc).
Currently it's just a switch case where the users has to specify the exact baud rate from those available, or the defaul 115200 is applied instead:
The micro:bit V1 Mbed implementation did something very similar to
KeyValueTable
, where best approximation below the request is applied instead:So this would align better with the V1 behaviour and also provide a baud rate closer to the one requested by the user (like DAL/CODAL do in other places like setting the acc/mag sampling rates, etc).
Somewhat related:
The text was updated successfully, but these errors were encountered: