stmhal: Use mp_hal_delay_ms instead of HAL_Delay.
This commit is contained in:
parent
1f549a3496
commit
6ab5512132
|
@ -76,9 +76,9 @@ STATIC void accel_start(void) {
|
|||
|
||||
// turn off AVDD, wait 30ms, turn on AVDD, wait 30ms again
|
||||
mp_hal_pin_low(&MICROPY_HW_MMA_AVDD_PIN); // turn off
|
||||
HAL_Delay(30);
|
||||
mp_hal_delay_ms(30);
|
||||
mp_hal_pin_high(&MICROPY_HW_MMA_AVDD_PIN); // turn on
|
||||
HAL_Delay(30);
|
||||
mp_hal_delay_ms(30);
|
||||
|
||||
HAL_StatusTypeDef status;
|
||||
|
||||
|
@ -98,7 +98,7 @@ STATIC void accel_start(void) {
|
|||
status = HAL_I2C_Mem_Write(&I2CHandle1, MMA_ADDR, MMA_REG_MODE, I2C_MEMADD_SIZE_8BIT, data, 1, 200);
|
||||
|
||||
// wait for MMA to become active
|
||||
HAL_Delay(30);
|
||||
mp_hal_delay_ms(30);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -346,7 +346,7 @@ STATIC void i2c_reset_after_error(I2C_HandleTypeDef *i2c) {
|
|||
// stop bit was generated and bus is back to normal
|
||||
return;
|
||||
}
|
||||
HAL_Delay(1);
|
||||
mp_hal_delay_ms(1);
|
||||
}
|
||||
// bus was/is busy, need to reset the peripheral to get it to work again
|
||||
i2c_deinit(i2c);
|
||||
|
|
|
@ -274,11 +274,11 @@ STATIC mp_obj_t pyb_lcd_make_new(const mp_obj_type_t *type, size_t n_args, size_
|
|||
mp_hal_pin_output(lcd->pin_bl);
|
||||
|
||||
// init the LCD
|
||||
HAL_Delay(1); // wait a bit
|
||||
mp_hal_delay_ms(1); // wait a bit
|
||||
mp_hal_pin_low(lcd->pin_rst); // RST=0; reset
|
||||
HAL_Delay(1); // wait for reset; 2us min
|
||||
mp_hal_delay_ms(1); // wait for reset; 2us min
|
||||
mp_hal_pin_high(lcd->pin_rst); // RST=1; enable
|
||||
HAL_Delay(1); // wait for reset; 2us min
|
||||
mp_hal_delay_ms(1); // wait for reset; 2us min
|
||||
lcd_out(lcd, LCD_INSTR, 0xa0); // ADC select, normal
|
||||
lcd_out(lcd, LCD_INSTR, 0xc0); // common output mode select, normal (this flips the display)
|
||||
lcd_out(lcd, LCD_INSTR, 0xa2); // LCD bias set, 1/9 bias
|
||||
|
|
|
@ -275,7 +275,7 @@ void led_debug(int n, int delay) {
|
|||
led_state(2, n & 2);
|
||||
led_state(3, n & 4);
|
||||
led_state(4, n & 8);
|
||||
HAL_Delay(delay);
|
||||
mp_hal_delay_ms(delay);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -71,10 +71,10 @@ void flash_error(int n) {
|
|||
for (int i = 0; i < n; i++) {
|
||||
led_state(PYB_LED_RED, 1);
|
||||
led_state(PYB_LED_GREEN, 0);
|
||||
HAL_Delay(250);
|
||||
mp_hal_delay_ms(250);
|
||||
led_state(PYB_LED_RED, 0);
|
||||
led_state(PYB_LED_GREEN, 1);
|
||||
HAL_Delay(250);
|
||||
mp_hal_delay_ms(250);
|
||||
}
|
||||
led_state(PYB_LED_GREEN, 0);
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ STATIC uint update_reset_mode(uint reset_mode) {
|
|||
if (!switch_get()) {
|
||||
break;
|
||||
}
|
||||
HAL_Delay(20);
|
||||
mp_hal_delay_ms(20);
|
||||
if (i % 30 == 29) {
|
||||
if (++reset_mode > 3) {
|
||||
reset_mode = 1;
|
||||
|
@ -364,13 +364,13 @@ STATIC uint update_reset_mode(uint reset_mode) {
|
|||
led_state(2, 0);
|
||||
led_state(3, 0);
|
||||
led_state(4, 0);
|
||||
HAL_Delay(50);
|
||||
mp_hal_delay_ms(50);
|
||||
led_state(2, reset_mode & 1);
|
||||
led_state(3, reset_mode & 2);
|
||||
led_state(4, reset_mode & 4);
|
||||
HAL_Delay(50);
|
||||
mp_hal_delay_ms(50);
|
||||
}
|
||||
HAL_Delay(400);
|
||||
mp_hal_delay_ms(400);
|
||||
|
||||
#elif defined(MICROPY_HW_LED1)
|
||||
|
||||
|
@ -383,11 +383,11 @@ STATIC uint update_reset_mode(uint reset_mode) {
|
|||
break;
|
||||
}
|
||||
led_state(1, 1);
|
||||
HAL_Delay(100);
|
||||
mp_hal_delay_ms(100);
|
||||
led_state(1, 0);
|
||||
HAL_Delay(200);
|
||||
mp_hal_delay_ms(200);
|
||||
}
|
||||
HAL_Delay(400);
|
||||
mp_hal_delay_ms(400);
|
||||
if (!switch_get()) {
|
||||
break;
|
||||
}
|
||||
|
@ -399,11 +399,11 @@ STATIC uint update_reset_mode(uint reset_mode) {
|
|||
for (uint i = 0; i < 2; i++) {
|
||||
for (uint j = 0; j < reset_mode; j++) {
|
||||
led_state(1, 1);
|
||||
HAL_Delay(100);
|
||||
mp_hal_delay_ms(100);
|
||||
led_state(1, 0);
|
||||
HAL_Delay(200);
|
||||
mp_hal_delay_ms(200);
|
||||
}
|
||||
HAL_Delay(400);
|
||||
mp_hal_delay_ms(400);
|
||||
}
|
||||
#else
|
||||
#error Need a reset mode update method
|
||||
|
|
|
@ -324,7 +324,7 @@ STATIC mp_obj_t machine_freq(mp_uint_t n_args, const mp_obj_t *args) {
|
|||
//printf("%lu %lu %lu %lu %lu\n", sysclk_source, m, n, p, q);
|
||||
|
||||
// let the USB CDC have a chance to process before we change the clock
|
||||
HAL_Delay(5);
|
||||
mp_hal_delay_ms(5);
|
||||
|
||||
// desired system clock source is in sysclk_source
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
|
|
|
@ -120,7 +120,7 @@ STATIC int cc3k_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, uin
|
|||
if (retry == 0 || CC3000_EXPORT(errno) != -95) {
|
||||
return CC3000_EXPORT(errno);
|
||||
}
|
||||
HAL_Delay(50);
|
||||
mp_hal_delay_ms(50);
|
||||
}
|
||||
|
||||
if (ip == 0) {
|
||||
|
|
|
@ -202,7 +202,7 @@ STATIC int wiznet5k_socket_accept(mod_network_socket_obj_t *socket, mod_network_
|
|||
*_errno = MP_ENOTCONN; // ??
|
||||
return -1;
|
||||
}
|
||||
HAL_Delay(1);
|
||||
mp_hal_delay_ms(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,9 +348,9 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
|
|||
mp_hal_pin_output(wiznet5k_obj.rst);
|
||||
|
||||
mp_hal_pin_low(wiznet5k_obj.rst);
|
||||
HAL_Delay(1); // datasheet says 2us
|
||||
mp_hal_delay_ms(1); // datasheet says 2us
|
||||
mp_hal_pin_high(wiznet5k_obj.rst);
|
||||
HAL_Delay(160); // datasheet says 150ms
|
||||
mp_hal_delay_ms(160); // datasheet says 150ms
|
||||
|
||||
reg_wizchip_cris_cbfunc(wiz_cris_enter, wiz_cris_exit);
|
||||
reg_wizchip_cs_cbfunc(wiz_cs_select, wiz_cs_deselect);
|
||||
|
@ -371,7 +371,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
|
|||
ctlnetwork(CN_SET_NETINFO, (void*)&netinfo);
|
||||
|
||||
// seems we need a small delay after init
|
||||
HAL_Delay(250);
|
||||
mp_hal_delay_ms(250);
|
||||
|
||||
// register with network module
|
||||
mod_network_register_nic(&wiznet5k_obj);
|
||||
|
|
|
@ -145,7 +145,7 @@ bool sdcard_power_on(void) {
|
|||
if (retry == 0) {
|
||||
goto error;
|
||||
}
|
||||
HAL_Delay(50);
|
||||
mp_hal_delay_ms(50);
|
||||
}
|
||||
|
||||
// configure the SD bus width for wide operation
|
||||
|
|
Loading…
Reference in New Issue