rename routines to be clearer; fix wiznet arg types

crypto-aes
Dan Halbert 3 years ago
parent e30b1d3121
commit 817b5be320
  1. 2
      shared-bindings/analogio/AnalogIn.c
  2. 2
      shared-bindings/analogio/AnalogOut.c
  3. 6
      shared-bindings/audiobusio/I2SOut.c
  4. 4
      shared-bindings/audiobusio/PDMIn.c
  5. 4
      shared-bindings/audioio/AudioOut.c
  6. 4
      shared-bindings/audiopwmio/PWMAudioOut.c
  7. 4
      shared-bindings/bitbangio/I2C.c
  8. 2
      shared-bindings/bitbangio/OneWire.c
  9. 6
      shared-bindings/bitbangio/SPI.c
  10. 4
      shared-bindings/busio/I2C.c
  11. 2
      shared-bindings/busio/OneWire.c
  12. 6
      shared-bindings/busio/SPI.c
  13. 10
      shared-bindings/busio/UART.c
  14. 2
      shared-bindings/digitalio/DigitalInOut.c
  15. 2
      shared-bindings/displayio/Display.c
  16. 2
      shared-bindings/displayio/EPaperDisplay.c
  17. 6
      shared-bindings/displayio/FourWire.c
  18. 2
      shared-bindings/displayio/I2CDisplay.c
  19. 12
      shared-bindings/displayio/ParallelBus.c
  20. 2
      shared-bindings/frequencyio/FrequencyIn.c
  21. 4
      shared-bindings/i2cslave/I2CSlave.c
  22. 14
      shared-bindings/microcontroller/Pin.c
  23. 8
      shared-bindings/microcontroller/Pin.h
  24. 4
      shared-bindings/ps2io/Ps2.c
  25. 2
      shared-bindings/pulseio/PWMOut.c
  26. 2
      shared-bindings/pulseio/PulseIn.c
  27. 4
      shared-bindings/rotaryio/IncrementalEncoder.c
  28. 2
      shared-bindings/touchio/TouchIn.c
  29. 4
      shared-bindings/wiznet/wiznet5k.c
  30. 4
      shared-module/wiznet/wiznet5k.c
  31. 2
      shared-module/wiznet/wiznet5k.h

@ -63,7 +63,7 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type,
mp_arg_check_num(n_args, kw_args, 1, 1, false);
// 1st argument is the pin
const mcu_pin_obj_t *pin = validate_is_free_pin(args[0]);
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
analogio_analogin_obj_t *self = m_new_obj(analogio_analogin_obj_t);
self->base.type = &analogio_analogin_type;

@ -62,7 +62,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t
// check arguments
mp_arg_check_num(n_args, kw_args, 1, 1, false);
const mcu_pin_obj_t *pin = validate_is_free_pin(args[0]);
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
analogio_analogout_obj_t *self = m_new_obj(analogio_analogout_obj_t);
self->base.type = &analogio_analogout_type;

@ -105,9 +105,9 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t *bit_clock = validate_is_free_pin(args[ARG_bit_clock].u_obj);
const mcu_pin_obj_t *word_select = validate_is_free_pin(args[ARG_word_select].u_obj);
const mcu_pin_obj_t *data = validate_is_free_pin(args[ARG_data].u_obj);
const mcu_pin_obj_t *bit_clock = validate_obj_is_free_pin(args[ARG_bit_clock].u_obj);
const mcu_pin_obj_t *word_select = validate_obj_is_free_pin(args[ARG_word_select].u_obj);
const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj);
audiobusio_i2sout_obj_t *self = m_new_obj_with_finaliser(audiobusio_i2sout_obj_t);
self->base.type = &audiobusio_i2sout_type;

@ -104,8 +104,8 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t *clock_pin = validate_is_free_pin(args[ARG_clock_pin].u_obj);
const mcu_pin_obj_t *data_pin = validate_is_free_pin(args[ARG_data_pin].u_obj);
const mcu_pin_obj_t *clock_pin = validate_obj_is_free_pin(args[ARG_clock_pin].u_obj);
const mcu_pin_obj_t *data_pin = validate_obj_is_free_pin(args[ARG_data_pin].u_obj);
// create PDMIn object from the given pin
audiobusio_pdmin_obj_t *self = m_new_obj(audiobusio_pdmin_obj_t);

@ -104,8 +104,8 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t *left_channel_pin = validate_is_free_pin(args[ARG_left_channel].u_obj);
const mcu_pin_obj_t *right_channel_pin = validate_is_free_pin_or_none(args[ARG_right_channel].u_obj);
const mcu_pin_obj_t *left_channel_pin = validate_obj_is_free_pin(args[ARG_left_channel].u_obj);
const mcu_pin_obj_t *right_channel_pin = validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj);
// create AudioOut object from the given pin
audioio_audioout_obj_t *self = m_new_obj(audioio_audioout_obj_t);

@ -107,8 +107,8 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t *left_channel_pin = validate_is_free_pin(args[ARG_left_channel].u_obj);
const mcu_pin_obj_t *right_channel_pin = validate_is_free_pin_or_none(args[ARG_right_channel].u_obj);
const mcu_pin_obj_t *left_channel_pin = validate_obj_is_free_pin(args[ARG_left_channel].u_obj);
const mcu_pin_obj_t *right_channel_pin = validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj);
// create AudioOut object from the given pin
audiopwmio_pwmaudioout_obj_t *self = m_new_obj(audiopwmio_pwmaudioout_obj_t);

@ -64,8 +64,8 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args,
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* scl = validate_is_free_pin(args[ARG_scl].u_obj);
const mcu_pin_obj_t* sda = validate_is_free_pin(args[ARG_sda].u_obj);
const mcu_pin_obj_t* scl = validate_obj_is_free_pin(args[ARG_scl].u_obj);
const mcu_pin_obj_t* sda = validate_obj_is_free_pin(args[ARG_sda].u_obj);
bitbangio_i2c_obj_t *self = m_new_obj(bitbangio_i2c_obj_t);
self->base.type = &bitbangio_i2c_type;

@ -70,7 +70,7 @@ STATIC mp_obj_t bitbangio_onewire_make_new(const mp_obj_type_t *type, size_t n_a
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* pin = validate_is_free_pin(args[ARG_pin].u_obj);
const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
bitbangio_onewire_obj_t *self = m_new_obj(bitbangio_onewire_obj_t);
self->base.type = &bitbangio_onewire_type;

@ -72,9 +72,9 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args,
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* clock = validate_is_free_pin(args[ARG_clock].u_obj);
const mcu_pin_obj_t* mosi = validate_is_free_pin_or_none(args[ARG_MOSI].u_obj);
const mcu_pin_obj_t* miso = validate_is_free_pin_or_none(args[ARG_MISO].u_obj);
const mcu_pin_obj_t* clock = validate_obj_is_free_pin(args[ARG_clock].u_obj);
const mcu_pin_obj_t* mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj);
const mcu_pin_obj_t* miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj);
bitbangio_spi_obj_t *self = m_new_obj(bitbangio_spi_obj_t);
self->base.type = &bitbangio_spi_type;

@ -77,8 +77,8 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, con
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* scl = validate_is_free_pin(args[ARG_scl].u_obj);
const mcu_pin_obj_t* sda = validate_is_free_pin(args[ARG_sda].u_obj);
const mcu_pin_obj_t* scl = validate_obj_is_free_pin(args[ARG_scl].u_obj);
const mcu_pin_obj_t* sda = validate_obj_is_free_pin(args[ARG_sda].u_obj);
common_hal_busio_i2c_construct(self, scl, sda, args[ARG_frequency].u_int, args[ARG_timeout].u_int);
return (mp_obj_t)self;

@ -69,7 +69,7 @@ STATIC mp_obj_t busio_onewire_make_new(const mp_obj_type_t *type, size_t n_args,
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* pin = validate_is_free_pin(args[ARG_pin].u_obj);
const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
busio_onewire_obj_t *self = m_new_obj(busio_onewire_obj_t);
self->base.type = &busio_onewire_type;

@ -90,9 +90,9 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* clock = validate_is_free_pin(args[ARG_clock].u_obj);
const mcu_pin_obj_t* mosi = validate_is_free_pin_or_none(args[ARG_MOSI].u_obj);
const mcu_pin_obj_t* miso = validate_is_free_pin_or_none(args[ARG_MISO].u_obj);
const mcu_pin_obj_t* clock = validate_obj_is_free_pin(args[ARG_clock].u_obj);
const mcu_pin_obj_t* mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj);
const mcu_pin_obj_t* miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj);
common_hal_busio_spi_construct(self, clock, mosi, miso);
return MP_OBJ_FROM_PTR(self);

@ -105,8 +105,8 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* rx = validate_is_free_pin_or_none(args[ARG_rx].u_obj);
const mcu_pin_obj_t* tx = validate_is_free_pin_or_none(args[ARG_tx].u_obj);
const mcu_pin_obj_t* rx = validate_obj_is_free_pin_or_none(args[ARG_rx].u_obj);
const mcu_pin_obj_t* tx = validate_obj_is_free_pin_or_none(args[ARG_tx].u_obj);
if ( (tx == NULL) && (rx == NULL) ) {
mp_raise_ValueError(translate("tx and rx cannot both be None"));
@ -132,9 +132,9 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
validate_timeout(timeout);
const mcu_pin_obj_t* rts = validate_is_free_pin_or_none(args[ARG_rts].u_obj);
const mcu_pin_obj_t* cts = validate_is_free_pin_or_none(args[ARG_cts].u_obj);
const mcu_pin_obj_t* rs485_dir = validate_is_free_pin_or_none(args[ARG_rs485_dir].u_obj);
const mcu_pin_obj_t* rts = validate_obj_is_free_pin_or_none(args[ARG_rts].u_obj);
const mcu_pin_obj_t* cts = validate_obj_is_free_pin_or_none(args[ARG_cts].u_obj);
const mcu_pin_obj_t* rs485_dir = validate_obj_is_free_pin_or_none(args[ARG_rs485_dir].u_obj);
const bool rs485_invert = args[ARG_rs485_invert].u_bool;

@ -68,7 +68,7 @@ STATIC mp_obj_t digitalio_digitalinout_make_new(const mp_obj_type_t *type,
digitalio_digitalinout_obj_t *self = m_new_obj(digitalio_digitalinout_obj_t);
self->base.type = &digitalio_digitalinout_type;
mcu_pin_obj_t *pin = validate_is_free_pin(args[0]);
mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
common_hal_digitalio_digitalinout_construct(self, pin);
return MP_OBJ_FROM_PTR(self);

@ -141,7 +141,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ);
const mcu_pin_obj_t* backlight_pin = validate_is_free_pin_or_none(args[ARG_backlight_pin].u_obj);
const mcu_pin_obj_t* backlight_pin = validate_obj_is_free_pin_or_none(args[ARG_backlight_pin].u_obj);
mp_float_t brightness = mp_obj_get_float(args[ARG_brightness].u_obj);

@ -129,7 +129,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size
mp_get_buffer_raise(args[ARG_stop_sequence].u_obj, &stop_bufinfo, MP_BUFFER_READ);
const mcu_pin_obj_t* busy_pin = validate_is_free_pin_or_none(args[ARG_busy_pin].u_obj);
const mcu_pin_obj_t* busy_pin = validate_obj_is_free_pin_or_none(args[ARG_busy_pin].u_obj);
mp_int_t rotation = args[ARG_rotation].u_int;
if (rotation % 90 != 0) {

@ -73,9 +73,9 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mcu_pin_obj_t *command = validate_is_free_pin(args[ARG_command].u_obj);
mcu_pin_obj_t *chip_select = validate_is_free_pin(args[ARG_chip_select].u_obj);
mcu_pin_obj_t *reset = validate_is_free_pin_or_none(args[ARG_reset].u_obj);
mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj);
mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj);
mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj);
displayio_fourwire_obj_t* self = NULL;
mp_obj_t spi = args[ARG_spi_bus].u_obj;

@ -69,7 +69,7 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mcu_pin_obj_t *reset = validate_is_free_pin_or_none(args[ARG_reset].u_obj);
mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj);
displayio_i2cdisplay_obj_t* self = NULL;
mp_obj_t i2c = args[ARG_i2c_bus].u_obj;

@ -76,12 +76,12 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mcu_pin_obj_t *data0 = validate_is_free_pin(args[ARG_data0].u_obj);
mcu_pin_obj_t *command = validate_is_free_pin(args[ARG_command].u_obj);
mcu_pin_obj_t *chip_select = validate_is_free_pin(args[ARG_chip_select].u_obj);
mcu_pin_obj_t *write = validate_is_free_pin(args[ARG_write].u_obj);
mcu_pin_obj_t *read = validate_is_free_pin(args[ARG_read].u_obj);
mcu_pin_obj_t *reset = validate_is_free_pin(args[ARG_reset].u_obj);
mcu_pin_obj_t *data0 = validate_obj_is_free_pin(args[ARG_data0].u_obj);
mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj);
mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj);
mcu_pin_obj_t *write = validate_obj_is_free_pin(args[ARG_write].u_obj);
mcu_pin_obj_t *read = validate_obj_is_free_pin(args[ARG_read].u_obj);
mcu_pin_obj_t *reset = validate_obj_is_free_pin(args[ARG_reset].u_obj);
displayio_parallelbus_obj_t* self = NULL;
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {

@ -87,7 +87,7 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mcu_pin_obj_t* pin = validate_is_free_pin(args[ARG_pin].u_obj);
mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
const uint16_t capture_period = args[ARG_capture_period].u_int;

@ -77,8 +77,8 @@ STATIC mp_obj_t i2cslave_i2c_slave_make_new(const mp_obj_type_t *type, size_t n_
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* scl = validate_is_free_pin(args[ARG_scl].u_obj);
const mcu_pin_obj_t* sda = validate_is_free_pin(args[ARG_sda].u_obj);
const mcu_pin_obj_t* scl = validate_obj_is_free_pin(args[ARG_scl].u_obj);
const mcu_pin_obj_t* sda = validate_obj_is_free_pin(args[ARG_sda].u_obj);
mp_obj_iter_buf_t iter_buf;
mp_obj_t iterable = mp_getiter(args[ARG_addresses].u_obj, &iter_buf);

@ -84,7 +84,7 @@ const mp_obj_type_t mcu_pin_type = {
.print = mcu_pin_print
};
mcu_pin_obj_t *validate_is_pin(mp_obj_t obj) {
mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj) {
if (!MP_OBJ_IS_TYPE(obj, &mcu_pin_type)) {
mp_raise_TypeError_varg(translate("Expected a %q"), mcu_pin_type.name);
}
@ -92,25 +92,25 @@ mcu_pin_obj_t *validate_is_pin(mp_obj_t obj) {
}
// Validate that the obj is a pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly.
mcu_pin_obj_t *validate_is_pin_or_none(mp_obj_t obj) {
mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj) {
if (obj == mp_const_none) {
return NULL;
}
return validate_is_pin(obj);
return validate_obj_is_pin(obj);
}
mcu_pin_obj_t *validate_is_free_pin(mp_obj_t obj) {
mcu_pin_obj_t *pin = validate_is_pin(obj);
mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj) {
mcu_pin_obj_t *pin = validate_obj_is_pin(obj);
assert_pin_free(pin);
return pin;
}
// Validate that the obj is a free pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly.
mcu_pin_obj_t *validate_is_free_pin_or_none(mp_obj_t obj) {
mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj) {
if (obj == mp_const_none) {
return NULL;
}
mcu_pin_obj_t *pin = validate_is_pin(obj);
mcu_pin_obj_t *pin = validate_obj_is_pin(obj);
assert_pin_free(pin);
return pin;
}

@ -33,10 +33,10 @@
// Type object used in Python. Should be shared between ports.
extern const mp_obj_type_t mcu_pin_type;
mcu_pin_obj_t *validate_is_pin(mp_obj_t obj);
mcu_pin_obj_t *validate_is_pin_or_none(mp_obj_t obj);
mcu_pin_obj_t *validate_is_free_pin(mp_obj_t obj);
mcu_pin_obj_t *validate_is_free_pin_or_none(mp_obj_t obj);
mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj);
mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj);
mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj);
mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj);
void assert_pin_free(const mcu_pin_obj_t* pin);

@ -78,8 +78,8 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, con
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* clkpin = validate_is_free_pin(args[ARG_clkpin].u_obj);
const mcu_pin_obj_t* datapin = validate_is_free_pin(args[ARG_datapin].u_obj);
const mcu_pin_obj_t* clkpin = validate_obj_is_free_pin(args[ARG_clkpin].u_obj);
const mcu_pin_obj_t* datapin = validate_obj_is_free_pin(args[ARG_datapin].u_obj);
ps2io_ps2_obj_t *self = m_new_obj(ps2io_ps2_obj_t);
self->base.type = &ps2io_ps2_type;

@ -96,7 +96,7 @@ STATIC mp_obj_t pulseio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args
mp_arg_val_t parsed_args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, parsed_args);
const mcu_pin_obj_t *pin = validate_is_free_pin(parsed_args[ARG_pin].u_obj);
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(parsed_args[ARG_pin].u_obj);
uint16_t duty_cycle = parsed_args[ARG_duty_cycle].u_int;
uint32_t frequency = parsed_args[ARG_frequency].u_int;

@ -90,7 +90,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* pin = validate_is_free_pin(args[ARG_pin].u_obj);
const mcu_pin_obj_t* pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
pulseio_pulsein_obj_t *self = m_new_obj(pulseio_pulsein_obj_t);
self->base.type = &pulseio_pulsein_type;

@ -73,8 +73,8 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type,
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t* pin_a = validate_is_free_pin(args[ARG_pin_a].u_obj);
const mcu_pin_obj_t* pin_b = validate_is_free_pin(args[ARG_pin_b].u_obj);
const mcu_pin_obj_t* pin_a = validate_obj_is_free_pin(args[ARG_pin_a].u_obj);
const mcu_pin_obj_t* pin_b = validate_obj_is_free_pin(args[ARG_pin_b].u_obj);
rotaryio_incrementalencoder_obj_t *self = m_new_obj(rotaryio_incrementalencoder_obj_t);
self->base.type = &rotaryio_incrementalencoder_type;

@ -66,7 +66,7 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type,
mp_arg_check_num(n_args, kw_args, 1, 1, false);
// 1st argument is the pin
const mcu_pin_obj_t *pin = validate_is_free_pin(args[0]);
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]);
touchio_touchin_obj_t *self = m_new_obj(touchio_touchin_obj_t);
self->base.type = &touchio_touchin_type;

@ -78,8 +78,8 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, cons
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
// TODO check type of ARG_spi?
const mcu_pin_obj_t *cs = validate_is_free_pin(args[ARG_cs].u_obj);
const mcu_pin_obj_t *rst = validate_is_free_pin_or_none(args[ARG_rst].u_obj);
const mcu_pin_obj_t *cs = validate_obj_is_free_pin(args[ARG_cs].u_obj);
const mcu_pin_obj_t *rst = validate_obj_is_free_pin_or_none(args[ARG_rst].u_obj);
mp_obj_t ret = wiznet5k_create(args[ARG_spi].u_obj, cs, rst);
if (args[ARG_dhcp].u_bool) wiznet5k_start_dhcp();

@ -379,12 +379,12 @@ void wiznet5k_socket_deinit(mod_network_socket_obj_t *socket) {
}
/// Create and return a WIZNET5K object.
mp_obj_t wiznet5k_create(mp_obj_t spi_in, mp_obj_t cs_in, mp_obj_t rst_in) {
mp_obj_t wiznet5k_create(busio_spi_obj_t *spi_in, const mcu_pin_obj_t *cs_in, const mcu_pin_obj_t *rst_in) {
// init the wiznet5k object
wiznet5k_obj.base.type = (mp_obj_type_t*)&mod_network_nic_type_wiznet5k;
wiznet5k_obj.cris_state = 0;
wiznet5k_obj.spi = MP_OBJ_TO_PTR(spi_in);
wiznet5k_obj.spi = spi_in;
wiznet5k_obj.socket_used = 0;
wiznet5k_obj.dhcp_socket = -1;

@ -59,7 +59,7 @@ int wiznet5k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, m
void wiznet5k_socket_timer_tick(mod_network_socket_obj_t *socket);
void wiznet5k_socket_deinit(mod_network_socket_obj_t *socket);
mp_obj_t wiznet5k_socket_disconnect(mp_obj_t self_in);
mp_obj_t wiznet5k_create(mp_obj_t spi_in, mp_obj_t cs_in, mp_obj_t rst_in);
mp_obj_t wiznet5k_create(busio_spi_obj_t *spi_in, const mcu_pin_obj_t *cs_in, const mcu_pin_obj_t *rst_in);
int wiznet5k_start_dhcp(void);
int wiznet5k_stop_dhcp(void);

Loading…
Cancel
Save