diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-03-07 12:58:57 +0100 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-03-07 12:58:57 +0100 |
| commit | 4aaa0ea00864dea835161b96a75c15e8c5242744 (patch) | |
| tree | c77f420dcd489289eae300ce85722d36c2bce9d1 /shared-bindings/bitbangio | |
| parent | 3891dde7ffd96eff8d79d9816f49b7543ee15769 (diff) | |
shared-bindings: Do a pass on the docs and make sure keyword only arguments make sense and are documented correctly. Fixes #109
Diffstat (limited to 'shared-bindings/bitbangio')
| -rw-r--r-- | shared-bindings/bitbangio/I2C.c | 2 | ||||
| -rw-r--r-- | shared-bindings/bitbangio/SPI.c | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index e5c9831b5..e8153f392 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -38,7 +38,7 @@ //| :class:`I2C` --- Two wire serial protocol //| ------------------------------------------ //| -//| .. class:: I2C(scl, sda, \* frequency=400000) +//| .. class:: I2C(scl, sda, \*, frequency=400000) //| //| I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 8ce41696c..c973403f0 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -49,7 +49,7 @@ //| select line. (This is common because multiple slaves can share the `!clock`, //| `!MOSI` and `!MISO` lines and therefore the hardware.) //| -//| .. class:: SPI(clock, MOSI, MISO) +//| .. class:: SPI(clock, MOSI=None, MISO=None) //| //| Construct an SPI object on the given pins. //| @@ -118,10 +118,16 @@ static void check_lock(bitbangio_spi_obj_t *self) { } } -//| .. method:: SPI.configure(baudrate=100000) +//| .. method:: SPI.configure(\*, baudrate=100000, polarity=0, phase=0, bits=8) //| //| Configures the SPI bus. Only valid when locked. //| +//| :param int baudrate: the clock rate in Hertz +//| :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 +//| STATIC mp_obj_t bitbangio_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[] = { @@ -157,6 +163,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_configure_obj, 1, bitbangio_spi_configu //| //| Attempts to grab the SPI lock. Returns True on success. //| +//| :return: True when lock has been grabbed +//| :rtype: bool +//| STATIC mp_obj_t bitbangio_spi_obj_try_lock(mp_obj_t self_in) { return mp_obj_new_bool(shared_module_bitbangio_spi_try_lock(MP_OBJ_TO_PTR(self_in))); } |
