@@ -262,30 +262,40 @@ int ospi_flash_init(void) {
262
262
263
263
self -> pin = pin ;
264
264
265
- uint32_t ck_pad_ctrl = PADCTRL_OUTPUT_DRIVE_STRENGTH_12MA | PADCTRL_SLEW_RATE_FAST ;
266
- uint32_t io_pad_ctrl = PADCTRL_OUTPUT_DRIVE_STRENGTH_12MA | PADCTRL_SLEW_RATE_FAST | PADCTRL_READ_ENABLE ;
267
-
268
- pinconf_set (pin -> pin_cs -> port , pin -> pin_cs -> pin , OSPI_PIN_FUNCTION , PADCTRL_OUTPUT_DRIVE_STRENGTH_12MA );
269
- pinconf_set (pin -> pin_clk_p -> port , pin -> pin_clk_p -> pin , OSPI_PIN_FUNCTION , ck_pad_ctrl );
265
+ mp_hal_pin_config (pin -> pin_cs , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
266
+ MP_HAL_PIN_SPEED_LOW , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , false);
267
+ mp_hal_pin_config (pin -> pin_clk_p , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
268
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , false);
270
269
if (pin -> pin_clk_n != NULL ) {
271
- pinconf_set (pin -> pin_clk_n -> port , pin -> pin_clk_n -> pin , OSPI_PIN_FUNCTION , ck_pad_ctrl );
270
+ mp_hal_pin_config (pin -> pin_clk_n , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
271
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , false);
272
272
}
273
273
if (pin -> pin_rwds != NULL ) {
274
- pinconf_set (pin -> pin_rwds -> port , pin -> pin_rwds -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
274
+ mp_hal_pin_config (pin -> pin_rwds , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
275
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
275
276
if (pin -> pin_rwds -> port == PORT_10 && pin -> pin_rwds -> pin == PIN_7 ) {
276
277
// Alif: P5_6 is needed to support proper alt function selection of P10_7.
277
- pinconf_set (PORT_5 , PIN_6 , OSPI_PIN_FUNCTION , io_pad_ctrl );
278
+ mp_hal_pin_config (pin_P5_6 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
279
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
278
280
}
279
281
}
280
- pinconf_set (pin -> pin_d0 -> port , pin -> pin_d0 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
281
- pinconf_set (pin -> pin_d1 -> port , pin -> pin_d1 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
282
- pinconf_set (pin -> pin_d2 -> port , pin -> pin_d2 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl | PADCTRL_DRIVER_DISABLED_PULL_UP );
283
- pinconf_set (pin -> pin_d3 -> port , pin -> pin_d3 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
282
+ mp_hal_pin_config (pin -> pin_d0 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
283
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
284
+ mp_hal_pin_config (pin -> pin_d1 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
285
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
286
+ mp_hal_pin_config (pin -> pin_d2 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_UP ,
287
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
288
+ mp_hal_pin_config (pin -> pin_d3 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
289
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
284
290
if (pin -> pin_d4 != NULL ) {
285
- pinconf_set (pin -> pin_d4 -> port , pin -> pin_d4 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
286
- pinconf_set (pin -> pin_d5 -> port , pin -> pin_d5 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
287
- pinconf_set (pin -> pin_d6 -> port , pin -> pin_d6 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
288
- pinconf_set (pin -> pin_d7 -> port , pin -> pin_d7 -> pin , OSPI_PIN_FUNCTION , io_pad_ctrl );
291
+ mp_hal_pin_config (pin -> pin_d4 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
292
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
293
+ mp_hal_pin_config (pin -> pin_d5 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
294
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
295
+ mp_hal_pin_config (pin -> pin_d6 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
296
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
297
+ mp_hal_pin_config (pin -> pin_d7 , MP_HAL_PIN_MODE_ALT , MP_HAL_PIN_PULL_NONE ,
298
+ MP_HAL_PIN_SPEED_HIGH , MP_HAL_PIN_DRIVE_12MA , MP_HAL_PIN_ALT_OSPI , true);
289
299
}
290
300
291
301
// Reset the SPI flash.
0 commit comments