Skip to content

Commit d0caaad

Browse files
committed
stmhal: Allow network, uselect, usocket mods to be used by other ports.
Remove include of stm32f4xx_hal.h, replace by include of MICROPY_HAL_H where needed, and make it compile without float support. This makes these 3 modules much more generic and usable by other ports.
1 parent 1f8a2f6 commit d0caaad

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

stmhal/modnetwork.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#include <string.h>
3030
#include <errno.h>
3131

32-
#include "stm32f4xx_hal.h"
33-
3432
#include "mpconfig.h"
3533
#include "nlr.h"
3634
#include "misc.h"

stmhal/moduselect.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
#include <stdio.h>
2929
#include <errno.h>
3030

31-
#include "stm32f4xx_hal.h"
32-
3331
#include "mpconfig.h"
3432
#include "misc.h"
3533
#include "nlr.h"
3634
#include "qstr.h"
3735
#include "obj.h"
3836
#include "objlist.h"
3937
#include "pybioctl.h"
38+
#include MICROPY_HAL_H
4039

4140
/// \module select - Provides select function to wait for events on a stream
4241
///

stmhal/modusocket.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#include <string.h>
3030
#include <errno.h>
3131

32-
#include "stm32f4xx_hal.h"
33-
3432
#include "mpconfig.h"
3533
#include "nlr.h"
3634
#include "misc.h"
@@ -321,7 +319,11 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
321319
if (timeout_in == mp_const_none) {
322320
timeout = -1;
323321
} else {
322+
#if MICROPY_PY_BUILTIN_FLOAT
324323
timeout = 1000 * mp_obj_get_float(timeout_in);
324+
#else
325+
timeout = 1000 * mp_obj_get_int(timeout_in);
326+
#endif
325327
}
326328
int _errno;
327329
if (self->nic_type->settimeout(self, timeout, &_errno) != 0) {

0 commit comments

Comments
 (0)