@@ -364,8 +364,6 @@ mp_obj_t wiznet5k_create(mp_obj_t spi_in, mp_obj_t cs_in, mp_obj_t rst_in) {
364
364
wiznet5k_obj .base .type = (mp_obj_type_t * )& mod_network_nic_type_wiznet5k ;
365
365
wiznet5k_obj .cris_state = 0 ;
366
366
wiznet5k_obj .spi = MP_OBJ_TO_PTR (spi_in );
367
- common_hal_digitalio_digitalinout_construct (& wiznet5k_obj .cs , cs_in );
368
- common_hal_digitalio_digitalinout_construct (& wiznet5k_obj .rst , rst_in );
369
367
wiznet5k_obj .socket_used = 0 ;
370
368
wiznet5k_obj .dhcp_socket = -1 ;
371
369
@@ -380,13 +378,17 @@ mp_obj_t wiznet5k_create(mp_obj_t spi_in, mp_obj_t cs_in, mp_obj_t rst_in) {
380
378
8 // 8 BITS
381
379
);
382
380
381
+ common_hal_digitalio_digitalinout_construct (& wiznet5k_obj .cs , cs_in );
383
382
common_hal_digitalio_digitalinout_switch_to_output (& wiznet5k_obj .cs , 1 , DRIVE_MODE_PUSH_PULL );
384
- common_hal_digitalio_digitalinout_switch_to_output (& wiznet5k_obj .rst , 1 , DRIVE_MODE_PUSH_PULL );
385
383
386
- common_hal_digitalio_digitalinout_set_value (& wiznet5k_obj .rst , 0 );
387
- mp_hal_delay_us (10 ); // datasheet says 2us
388
- common_hal_digitalio_digitalinout_set_value (& wiznet5k_obj .rst , 1 );
389
- mp_hal_delay_ms (160 ); // datasheet says 150ms
384
+ if (rst_in ) {
385
+ common_hal_digitalio_digitalinout_construct (& wiznet5k_obj .rst , rst_in );
386
+ common_hal_digitalio_digitalinout_switch_to_output (& wiznet5k_obj .rst , 1 , DRIVE_MODE_PUSH_PULL );
387
+ common_hal_digitalio_digitalinout_set_value (& wiznet5k_obj .rst , 0 );
388
+ mp_hal_delay_us (10 ); // datasheet says 2us
389
+ common_hal_digitalio_digitalinout_set_value (& wiznet5k_obj .rst , 1 );
390
+ mp_hal_delay_ms (160 ); // datasheet says 150ms
391
+ }
390
392
391
393
reg_wizchip_cris_cbfunc (wiz_cris_enter , wiz_cris_exit );
392
394
reg_wizchip_cs_cbfunc (wiz_cs_select , wiz_cs_deselect );
0 commit comments