extmod/machine_timer: Move stm32's implementation of machine.Timer here.
So it can be reused by other ports. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
e8f5cfe0e1
commit
cd35b8a2a3
|
@ -10,6 +10,7 @@ SRC_EXTMOD_C += \
|
||||||
extmod/machine_pwm.c \
|
extmod/machine_pwm.c \
|
||||||
extmod/machine_signal.c \
|
extmod/machine_signal.c \
|
||||||
extmod/machine_spi.c \
|
extmod/machine_spi.c \
|
||||||
|
extmod/machine_timer.c \
|
||||||
extmod/modbluetooth.c \
|
extmod/modbluetooth.c \
|
||||||
extmod/modbtree.c \
|
extmod/modbtree.c \
|
||||||
extmod/modframebuf.c \
|
extmod/modframebuf.c \
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "shared/runtime/softtimer.h"
|
#include "shared/runtime/softtimer.h"
|
||||||
|
|
||||||
|
#if MICROPY_PY_MACHINE_TIMER
|
||||||
|
|
||||||
typedef soft_timer_entry_t machine_timer_obj_t;
|
typedef soft_timer_entry_t machine_timer_obj_t;
|
||||||
|
|
||||||
const mp_obj_type_t machine_timer_type;
|
const mp_obj_type_t machine_timer_type;
|
||||||
|
@ -144,3 +146,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||||
print, machine_timer_print,
|
print, machine_timer_print,
|
||||||
locals_dict, &machine_timer_locals_dict
|
locals_dict, &machine_timer_locals_dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif // MICROPY_PY_MACHINE_TIMER
|
|
@ -329,7 +329,6 @@ SRC_C += \
|
||||||
machine_i2c.c \
|
machine_i2c.c \
|
||||||
machine_i2s.c \
|
machine_i2s.c \
|
||||||
machine_spi.c \
|
machine_spi.c \
|
||||||
machine_timer.c \
|
|
||||||
machine_uart.c \
|
machine_uart.c \
|
||||||
modmachine.c \
|
modmachine.c \
|
||||||
modpyb.c \
|
modpyb.c \
|
||||||
|
|
|
@ -126,6 +126,7 @@
|
||||||
#define MICROPY_PY_MACHINE_SPI_MSB (SPI_FIRSTBIT_MSB)
|
#define MICROPY_PY_MACHINE_SPI_MSB (SPI_FIRSTBIT_MSB)
|
||||||
#define MICROPY_PY_MACHINE_SPI_LSB (SPI_FIRSTBIT_LSB)
|
#define MICROPY_PY_MACHINE_SPI_LSB (SPI_FIRSTBIT_LSB)
|
||||||
#define MICROPY_PY_MACHINE_SOFTSPI (1)
|
#define MICROPY_PY_MACHINE_SOFTSPI (1)
|
||||||
|
#define MICROPY_PY_MACHINE_TIMER (1)
|
||||||
#endif
|
#endif
|
||||||
#define MICROPY_HW_SOFTSPI_MIN_DELAY (0)
|
#define MICROPY_HW_SOFTSPI_MIN_DELAY (0)
|
||||||
#define MICROPY_HW_SOFTSPI_MAX_BAUDRATE (HAL_RCC_GetSysClockFreq() / 48)
|
#define MICROPY_HW_SOFTSPI_MAX_BAUDRATE (HAL_RCC_GetSysClockFreq() / 48)
|
||||||
|
|
|
@ -1631,6 +1631,11 @@ typedef double mp_float_t;
|
||||||
#define MICROPY_PY_MACHINE_SOFTSPI (0)
|
#define MICROPY_PY_MACHINE_SOFTSPI (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Whether to provide the "machine.Timer" class
|
||||||
|
#ifndef MICROPY_PY_MACHINE_TIMER
|
||||||
|
#define MICROPY_PY_MACHINE_TIMER (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
// The default backlog value for socket.listen(backlog)
|
// The default backlog value for socket.listen(backlog)
|
||||||
#ifndef MICROPY_PY_USOCKET_LISTEN_BACKLOG_DEFAULT
|
#ifndef MICROPY_PY_USOCKET_LISTEN_BACKLOG_DEFAULT
|
||||||
#define MICROPY_PY_USOCKET_LISTEN_BACKLOG_DEFAULT (2)
|
#define MICROPY_PY_USOCKET_LISTEN_BACKLOG_DEFAULT (2)
|
||||||
|
|
Loading…
Reference in New Issue