Added type hints to i2cperipheral

This commit is contained in:
dherrada 2020-07-03 10:29:39 -04:00
parent 6a3968d805
commit 2e8b8c7b95

View File

@ -102,7 +102,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_make_new(const mp_obj_type_t *type,
return (mp_obj_t)self;
}
//| def deinit(self) -> Any:
//| def deinit(self) -> None:
//| """Releases control of the underlying hardware so other classes can use it."""
//| ...
//|
@ -114,13 +114,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj_deinit(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_deinit_obj, i2cperipheral_i2c_peripheral_obj_deinit);
//| def __enter__(self) -> Any:
//| def __enter__(self) -> I2CPeripheral:
//| """No-op used in Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self) -> Any:
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware on context exit. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
@ -133,7 +133,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj___exit__(size_t n_args, const m
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_obj___exit__);
//| def request(self, timeout: float = -1) -> Any:
//| def request(self, timeout: float = -1) -> i2cperipheral.I2CPeripheralRequest:
//| """Wait for an I2C request.
//|
//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once
@ -241,13 +241,13 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_make_new(const mp_obj_type_
return mp_obj_new_i2cperipheral_i2c_peripheral_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3]));
}
//| def __enter__(self) -> Any:
//| def __enter__(self) -> I2CPeripheralRequest:
//| """No-op used in Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| def __exit__(self) -> Any:
//| def __exit__(self) -> None:
//| """Close the request."""
//| ...
//|
@ -383,7 +383,7 @@ STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_write(mp_obj_t self_in, mp_
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2cperipheral_i2c_peripheral_request_write_obj, i2cperipheral_i2c_peripheral_request_write);
//| def ack(self, ack: bool = True) -> Any:
//| def ack(self, ack: bool = True) -> None:
//| """Acknowledge or Not Acknowledge last byte received.
//| Use together with :py:meth:`I2CPeripheralRequest.read` ack=False.
//|