samd21: Limit SPI baud value to 1
authorKeith Packard <keithp@keithp.com>
Sun, 13 Nov 2022 03:36:52 +0000 (19:36 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 13 Nov 2022 03:36:52 +0000 (19:36 -0800)
Keep speeds slow enough

Signed-off-by: Keith Packard <keithp@keithp.com>
src/samd21/ao_arch_funcs.h

index beb8d1262c796b47346a58999d03c85a788eca56..32670b45ca1897bc1f6a3016a4fd9c1cf4902930 100644 (file)
@@ -286,8 +286,8 @@ ao_spi_speed(uint32_t hz)
 {
        int32_t baud = (int32_t) (AO_SYSCLK / (2 * hz)) - 1;
 
-       if (baud < 0)
-               baud = 0;
+       if (baud < 1)
+               baud = 1;
        if (baud > 255)
                baud = 255;
        return (uint8_t) baud;