Merge pull request #1223 from dhalbert/spi-baudrate

nrf: remove error check for SPI baudrate too high; round to nearest baudrate
This commit is contained in:
Scott Shawcroft 2018-10-03 10:11:44 -07:00 committed by GitHub
commit 86ae707b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 106 additions and 122 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"POT-Creation-Date: 2018-10-01 18:52-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -361,7 +361,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:77
#: ports/nrf/common-hal/busio/I2C.c:81
msgid "Invalid pins"
msgstr ""
@ -690,18 +690,14 @@ msgstr ""
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
#: ports/nrf/common-hal/busio/I2C.c:95
msgid "All I2C peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:109
#: ports/nrf/common-hal/busio/SPI.c:115
msgid "All SPI peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
@ -1990,19 +1986,19 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
msgid "Invalid polarity"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
msgid "Invalid phase"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
msgid "buffer slices must be of equal length"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"POT-Creation-Date: 2018-10-01 18:44-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Sebastian Plamauer\n"
"Language-Team: \n"
@ -370,7 +370,7 @@ msgstr "Nicht genug Pins vorhanden"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:77
#: ports/nrf/common-hal/busio/I2C.c:81
msgid "Invalid pins"
msgstr "Ungültige Pins"
@ -699,20 +699,16 @@ msgstr ""
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
#: ports/nrf/common-hal/busio/I2C.c:95
#, fuzzy
msgid "All I2C peripherals are in use"
msgstr "Alle timer werden benutzt"
#: ports/nrf/common-hal/busio/SPI.c:109
#: ports/nrf/common-hal/busio/SPI.c:115
#, fuzzy
msgid "All SPI peripherals are in use"
msgstr "Alle timer werden benutzt"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
@ -2001,19 +1997,19 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
msgid "Invalid polarity"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
msgid "Invalid phase"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
msgid "buffer slices must be of equal length"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"POT-Creation-Date: 2018-10-01 18:44-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -361,7 +361,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:77
#: ports/nrf/common-hal/busio/I2C.c:81
msgid "Invalid pins"
msgstr ""
@ -690,18 +690,14 @@ msgstr ""
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
#: ports/nrf/common-hal/busio/I2C.c:95
msgid "All I2C peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:109
#: ports/nrf/common-hal/busio/SPI.c:115
msgid "All SPI peripherals are in use"
msgstr ""
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
@ -1990,19 +1986,19 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
msgid "Invalid polarity"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
msgid "Invalid phase"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
msgid "buffer slices must be of equal length"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"POT-Creation-Date: 2018-10-01 18:44-0400\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -376,7 +376,7 @@ msgstr "No hay suficientes pines disponibles"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:77
#: ports/nrf/common-hal/busio/I2C.c:81
msgid "Invalid pins"
msgstr "pines inválidos"
@ -620,7 +620,8 @@ msgstr "len debe de ser múltiple de 4"
#: ports/esp8266/modesp.c:274
#, c-format
msgid "memory allocation failed, allocating %u bytes for native code"
msgstr "la asignación de memoria ha fallado, asignando %u bytes para código nativo"
msgstr ""
"la asignación de memoria ha fallado, asignando %u bytes para código nativo"
#: ports/esp8266/modesp.c:317
msgid "flash location must be below 1MByte"
@ -706,18 +707,14 @@ msgstr "parámetro config desconocido"
msgid "AnalogOut functionality not supported"
msgstr ""
#: ports/nrf/common-hal/busio/I2C.c:91
#: ports/nrf/common-hal/busio/I2C.c:95
msgid "All I2C peripherals are in use"
msgstr "Todos los timers están siendo utilizados"
#: ports/nrf/common-hal/busio/SPI.c:109
#: ports/nrf/common-hal/busio/SPI.c:115
msgid "All SPI peripherals are in use"
msgstr "Todos los timers están siendo utilizados"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
@ -2033,19 +2030,19 @@ msgstr ""
msgid "Buffer must be at least length 1"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
msgid "Invalid polarity"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
msgid "Invalid phase"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
msgid "Invalid number of bits"
msgstr ""
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
msgid "buffer slices must be of equal length"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"POT-Creation-Date: 2018-10-01 18:44-0400\n"
"PO-Revision-Date: 2018-08-30 23:04-0700\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -373,7 +373,7 @@ msgstr "Hindi sapat ang magagamit na pins"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:77
#: ports/nrf/common-hal/busio/I2C.c:81
msgid "Invalid pins"
msgstr "Mali ang pins"
@ -705,20 +705,16 @@ msgstr "hindi alam na config param"
msgid "AnalogOut functionality not supported"
msgstr "Hindi supportado ang AnalogOut"
#: ports/nrf/common-hal/busio/I2C.c:91
#: ports/nrf/common-hal/busio/I2C.c:95
#, fuzzy
msgid "All I2C peripherals are in use"
msgstr "Lahat ng timer ginagamit"
#: ports/nrf/common-hal/busio/SPI.c:109
#: ports/nrf/common-hal/busio/SPI.c:115
#, fuzzy
msgid "All SPI peripherals are in use"
msgstr "Lahat ng timer ginagamit"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
@ -2030,19 +2026,19 @@ msgstr "Function nangangailangan ng lock"
msgid "Buffer must be at least length 1"
msgstr "Buffer dapat ay hindi baba sa 1 na haba"
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
msgid "Invalid polarity"
msgstr "Mali ang polarity"
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
msgid "Invalid phase"
msgstr "Mali ang phase"
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
msgid "Invalid number of bits"
msgstr "Mali ang bilang ng bits"
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
msgid "buffer slices must be of equal length"
msgstr "aarehas na haba dapat ang buffer slices"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"POT-Creation-Date: 2018-10-01 18:52-0400\n"
"PO-Revision-Date: 2018-08-14 11:01+0200\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -368,7 +368,7 @@ msgstr "Pas assez de broches disponibles"
#: ports/atmel-samd/common-hal/busio/SPI.c:132
#: ports/atmel-samd/common-hal/busio/UART.c:119
#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
#: ports/nrf/common-hal/busio/I2C.c:77
#: ports/nrf/common-hal/busio/I2C.c:81
msgid "Invalid pins"
msgstr "Broche invalide"
@ -701,20 +701,16 @@ msgstr "paramètre de config. inconnu"
msgid "AnalogOut functionality not supported"
msgstr "AnalogOut non supporté"
#: ports/nrf/common-hal/busio/I2C.c:91
#: ports/nrf/common-hal/busio/I2C.c:95
#, fuzzy
msgid "All I2C peripherals are in use"
msgstr "Tous les timers sont utilisés"
#: ports/nrf/common-hal/busio/SPI.c:109
#: ports/nrf/common-hal/busio/SPI.c:115
#, fuzzy
msgid "All SPI peripherals are in use"
msgstr "Tous les timers sont utilisés"
#: ports/nrf/common-hal/busio/SPI.c:170
msgid "Baud rate too high for this SPI peripheral"
msgstr ""
#: ports/nrf/common-hal/busio/UART.c:43 ports/nrf/common-hal/busio/UART.c:47
#: ports/nrf/common-hal/busio/UART.c:51 ports/nrf/common-hal/busio/UART.c:60
#: ports/nrf/common-hal/busio/UART.c:66 ports/nrf/common-hal/busio/UART.c:71
@ -2021,19 +2017,19 @@ msgstr "La fonction nécessite un verrou"
msgid "Buffer must be at least length 1"
msgstr "Le tampon doit être de longueur au moins 1"
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:175
msgid "Invalid polarity"
msgstr "Polarité invalide"
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:179
msgid "Invalid phase"
msgstr "Phase invalide"
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:183
msgid "Invalid number of bits"
msgstr "Nombre de bits invalide"
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:348
msgid "buffer slices must be of equal length"
msgstr "les slices de tampon doivent être de longueurs égales"

View File

@ -65,40 +65,40 @@ void spi_reset(void) {
}
}
// Convert frequency to clock-speed-dependent value
// Convert frequency to clock-speed-dependent value. Choose the next lower baudrate if in between
// available baudrates.
static nrf_spim_frequency_t baudrate_to_spim_frequency(const uint32_t baudrate) {
if (baudrate <= 125000) {
return NRF_SPIM_FREQ_125K;
}
if (baudrate <= 250000) {
return NRF_SPIM_FREQ_250K;
}
if (baudrate <= 500000) {
return NRF_SPIM_FREQ_500K;
}
if (baudrate <= 1000000) {
return NRF_SPIM_FREQ_1M;
}
if (baudrate <= 2000000) {
return NRF_SPIM_FREQ_2M;
}
if (baudrate <= 4000000) {
return NRF_SPIM_FREQ_4M;
}
if (baudrate <= 8000000) {
return NRF_SPIM_FREQ_8M;
}
#ifdef SPIM_FREQUENCY_FREQUENCY_M16
if (baudrate <= 16000000) {
return NRF_SPIM_FREQ_16M;
}
#endif
static const struct {
const uint32_t boundary;
nrf_spim_frequency_t spim_frequency;
} baudrate_map[] = {
#ifdef SPIM_FREQUENCY_FREQUENCY_M32
return NRF_SPIM_FREQ_32M;
#else
return NRF_SPIM_FREQ_8M;
{ 32000000, NRF_SPIM_FREQ_32M },
#endif
#ifdef SPIM_FREQUENCY_FREQUENCY_M16
{ 16000000, NRF_SPIM_FREQ_16M },
#endif
{ 8000000, NRF_SPIM_FREQ_8M },
{ 4000000, NRF_SPIM_FREQ_4M },
{ 2000000, NRF_SPIM_FREQ_2M },
{ 1000000, NRF_SPIM_FREQ_1M },
{ 500000, NRF_SPIM_FREQ_500K },
{ 250000, NRF_SPIM_FREQ_250K },
{ 0, NRF_SPIM_FREQ_125K },
};
size_t i = 0;
uint32_t boundary;
do {
boundary = baudrate_map[i].boundary;
if (baudrate >= boundary) {
return baudrate_map[i].spim_frequency;
}
i++;
} while (boundary != 0);
// Should not get here.
return 0;
}
void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi, const mcu_pin_obj_t * miso) {
@ -169,14 +169,14 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
// nrf52 does not support 16 bit
if (bits != 8)
return false;
if (baudrate > self->spim_peripheral->max_frequency_MHz * 1000000) {
mp_raise_ValueError(translate("Baud rate too high for this SPI peripheral"));
if (bits != 8) {
return false;
}
nrf_spim_frequency_set(self->spim_peripheral->spim.p_reg, baudrate_to_spim_frequency(baudrate));
// Set desired frequency, rounding down, and don't go above available frequency for this SPIM.
nrf_spim_frequency_set(self->spim_peripheral->spim.p_reg,
baudrate_to_spim_frequency(MIN(baudrate,
self->spim_peripheral->max_frequency_MHz * 1000000)));
nrf_spim_mode_t mode = NRF_SPIM_MODE_0;
if (polarity) {

View File

@ -136,19 +136,26 @@ static void check_lock(busio_spi_obj_t *self) {
//| .. method:: SPI.configure(\*, baudrate=100000, polarity=0, phase=0, bits=8)
//|
//| Configures the SPI bus. Only valid when locked.
//| Configures the SPI bus. The SPI object must be locked.
//|
//| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower
//| due to the granularity of available clock settings.
//| Check the `frequency` attribute for the actual clock rate.
//| **Note:** on the SAMD21, it is possible to set the baud rate to 24 MHz, but that
//| speed is not guaranteed to work. 12 MHz is the next available lower speed, and is
//| within spec for the SAMD21.
//| :param int polarity: the base state of the clock line (0 or 1)
//| :param int phase: the edge of the clock that data is captured. First (0)
//| or second (1). Rising or falling depends on clock polarity.
//| :param int bits: the number of bits per word
//|
//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that
//| speed is not guaranteed to work. 12 MHz is the next available lower speed, and is
//| within spec for the SAMD21.
//|
//| .. note:: On the nRF52832, these baudrates are available: 125kHz, 250kHz, 1MHz, 2MHz, 4MHz,
//| and 8MHz. On the nRF52840, 16MHz and 32MHz are also available, but only on the first
//| `busio.SPI` object you create. Two more ``busio.SPI`` objects can be created, but they are restricted
//| to 8MHz maximum. This is a hardware restriction: there is only one high-speed SPI peripheral.
//| If you pick a a baudrate other than one of these, the nearest lower
//| baudrate will be chosen, with a minimum of 125kHz.
STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits };
static const mp_arg_t allowed_args[] = {