Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
6ab55121
Commit
6ab55121
authored
Mar 02, 2017
by
Damien George
Browse files
stmhal: Use mp_hal_delay_ms instead of HAL_Delay.
parent
1f549a34
Changes
9
Hide whitespace changes
Inline
Side-by-side
stmhal/accel.c
View file @
6ab55121
...
...
@@ -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_D
elay
(
30
);
mp_hal_d
elay
_ms
(
30
);
mp_hal_pin_high
(
&
MICROPY_HW_MMA_AVDD_PIN
);
// turn on
HAL_D
elay
(
30
);
mp_hal_d
elay
_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_D
elay
(
30
);
mp_hal_d
elay
_ms
(
30
);
}
/******************************************************************************/
...
...
stmhal/i2c.c
View file @
6ab55121
...
...
@@ -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_D
elay
(
1
);
mp_hal_d
elay
_ms
(
1
);
}
// bus was/is busy, need to reset the peripheral to get it to work again
i2c_deinit
(
i2c
);
...
...
stmhal/lcd.c
View file @
6ab55121
...
...
@@ -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_D
elay
(
1
);
// wait a bit
mp_hal_d
elay
_ms
(
1
);
// wait a bit
mp_hal_pin_low
(
lcd
->
pin_rst
);
// RST=0; reset
HAL_D
elay
(
1
);
// wait for reset; 2us min
mp_hal_d
elay
_ms
(
1
);
// wait for reset; 2us min
mp_hal_pin_high
(
lcd
->
pin_rst
);
// RST=1; enable
HAL_D
elay
(
1
);
// wait for reset; 2us min
mp_hal_d
elay
_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
...
...
stmhal/led.c
View file @
6ab55121
...
...
@@ -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_D
elay
(
delay
);
mp_hal_d
elay
_ms
(
delay
);
}
/******************************************************************************/
...
...
stmhal/main.c
View file @
6ab55121
...
...
@@ -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_D
elay
(
250
);
mp_hal_d
elay
_ms
(
250
);
led_state
(
PYB_LED_RED
,
0
);
led_state
(
PYB_LED_GREEN
,
1
);
HAL_D
elay
(
250
);
mp_hal_d
elay
_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_D
elay
(
20
);
mp_hal_d
elay
_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_D
elay
(
50
);
mp_hal_d
elay
_ms
(
50
);
led_state
(
2
,
reset_mode
&
1
);
led_state
(
3
,
reset_mode
&
2
);
led_state
(
4
,
reset_mode
&
4
);
HAL_D
elay
(
50
);
mp_hal_d
elay
_ms
(
50
);
}
HAL_D
elay
(
400
);
mp_hal_d
elay
_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_D
elay
(
100
);
mp_hal_d
elay
_ms
(
100
);
led_state
(
1
,
0
);
HAL_D
elay
(
200
);
mp_hal_d
elay
_ms
(
200
);
}
HAL_D
elay
(
400
);
mp_hal_d
elay
_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_D
elay
(
100
);
mp_hal_d
elay
_ms
(
100
);
led_state
(
1
,
0
);
HAL_D
elay
(
200
);
mp_hal_d
elay
_ms
(
200
);
}
HAL_D
elay
(
400
);
mp_hal_d
elay
_ms
(
400
);
}
#else
#error Need a reset mode update method
...
...
stmhal/modmachine.c
View file @
6ab55121
...
...
@@ -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_D
elay
(
5
);
mp_hal_d
elay
_ms
(
5
);
// desired system clock source is in sysclk_source
RCC_ClkInitTypeDef
RCC_ClkInitStruct
;
...
...
stmhal/modnwcc3k.c
View file @
6ab55121
...
...
@@ -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_D
elay
(
50
);
mp_hal_d
elay
_ms
(
50
);
}
if
(
ip
==
0
)
{
...
...
stmhal/modnwwiznet5k.c
View file @
6ab55121
...
...
@@ -202,7 +202,7 @@ STATIC int wiznet5k_socket_accept(mod_network_socket_obj_t *socket, mod_network_
*
_errno
=
MP_ENOTCONN
;
// ??
return
-
1
;
}
HAL_D
elay
(
1
);
mp_hal_d
elay
_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_D
elay
(
1
);
// datasheet says 2us
mp_hal_d
elay
_ms
(
1
);
// datasheet says 2us
mp_hal_pin_high
(
wiznet5k_obj
.
rst
);
HAL_D
elay
(
160
);
// datasheet says 150ms
mp_hal_d
elay
_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_D
elay
(
250
);
mp_hal_d
elay
_ms
(
250
);
// register with network module
mod_network_register_nic
(
&
wiznet5k_obj
);
...
...
stmhal/sdcard.c
View file @
6ab55121
...
...
@@ -145,7 +145,7 @@ bool sdcard_power_on(void) {
if
(
retry
==
0
)
{
goto
error
;
}
HAL_D
elay
(
50
);
mp_hal_d
elay
_ms
(
50
);
}
// configure the SD bus width for wide operation
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment