Skip to content

Commit 5fc400c

Browse files
committed
stmhal: Document physical pins for SPI, I2C, UART busses.
1 parent cda363a commit 5fc400c

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

stmhal/i2c.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ STATIC mp_obj_t pyb_i2c_init_helper(const pyb_i2c_obj_t *self, uint n_args, cons
258258
/// initialised (it has the settings from the last initialisation of
259259
/// the bus, if any). If extra arguments are given, the bus is initialised.
260260
/// See `init` for parameters of initialisation.
261+
///
262+
/// The physical pins of the I2C busses are:
263+
///
264+
/// - `I2C(1)` is on the X position: `(SCL, SDA) = (X9, X10) = (PB6, PB7)`
265+
/// - `I2C(2)` is on the Y position: `(SCL, SDA) = (Y9, Y10) = (PB10, PB11)`
261266
STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
262267
// check arguments
263268
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);

stmhal/spi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,14 @@ STATIC mp_obj_t pyb_spi_init_helper(const pyb_spi_obj_t *self, uint n_args, cons
301301
/// initialised (it has the settings from the last initialisation of
302302
/// the bus, if any). If extra arguments are given, the bus is initialised.
303303
/// See `init` for parameters of initialisation.
304+
///
305+
/// The physical pins of the SPI busses are:
306+
///
307+
/// - `SPI(1)` is on the X position: `(NSS, SCK, MISO, MOSI) = (X5, X6, X7, X8) = (PA4, PA5, PA6, PA7)`
308+
/// - `SPI(2)` is on the Y position: `(NSS, SCK, MISO, MOSI) = (Y5, Y6, Y7, Y8) = (PB12, PB13, PB14, PB15)`
309+
///
310+
/// At the moment, the NSS pin is not used by the SPI driver and is free
311+
/// for other use.
304312
STATIC mp_obj_t pyb_spi_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
305313
// check arguments
306314
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);

stmhal/uart.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,14 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, uint n_args, const mp
311311
/// initialised (it has the settings from the last initialisation of
312312
/// the bus, if any). If extra arguments are given, the bus is initialised.
313313
/// See `init` for parameters of initialisation.
314+
///
315+
/// The physical pins of the UART busses are:
316+
///
317+
/// - `UART(4)` is on `XA`: `(TX, RX) = (X1, X2) = (PA0, PA1)`
318+
/// - `UART(1)` is on `XB`: `(TX, RX) = (X9, X10) = (PB6, PB7)`
319+
/// - `UART(6)` is on `YA`: `(TX, RX) = (Y1, Y2) = (PC6, PC7)`
320+
/// - `UART(3)` is on `YB`: `(TX, RX) = (Y9, Y10) = (PB10, PB11)`
321+
/// - `UART(2)` is on: `(TX, RX) = (X3, X4) = (PA2, PA3)`
314322
STATIC mp_obj_t pyb_uart_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
315323
// check arguments
316324
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);

0 commit comments

Comments
 (0)