extmod: Add and reorganise compilation guards and includes.
To reduce dependencies on header files when extmod components are disabled. Signed-off-by: Damien George <damien.p.george@gmail.com>
This commit is contained in:
parent
2f05653673
commit
a513558e3a
|
@ -28,6 +28,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
|
#if MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_SOFTSPI
|
||||||
|
|
||||||
#include "extmod/machine_spi.h"
|
#include "extmod/machine_spi.h"
|
||||||
|
|
||||||
// if a port didn't define MSB/LSB constants then provide them
|
// if a port didn't define MSB/LSB constants then provide them
|
||||||
|
@ -39,8 +42,6 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// MicroPython bindings for generic machine.SPI
|
// MicroPython bindings for generic machine.SPI
|
||||||
|
|
||||||
#if MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_SOFTSPI
|
|
||||||
|
|
||||||
STATIC mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
STATIC mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||||
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
|
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
|
||||||
mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
|
mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "shared/runtime/softtimer.h"
|
|
||||||
|
|
||||||
#if MICROPY_PY_MACHINE_TIMER
|
#if MICROPY_PY_MACHINE_TIMER
|
||||||
|
|
||||||
|
#include "shared/runtime/softtimer.h"
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -31,11 +31,12 @@
|
||||||
#include "py/objlist.h"
|
#include "py/objlist.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "shared/netutils/netutils.h"
|
|
||||||
#include "modnetwork.h"
|
|
||||||
|
|
||||||
#if MICROPY_PY_NETWORK
|
#if MICROPY_PY_NETWORK
|
||||||
|
|
||||||
|
#include "shared/netutils/netutils.h"
|
||||||
|
#include "modnetwork.h"
|
||||||
|
|
||||||
#if MICROPY_PY_LWIP
|
#if MICROPY_PY_LWIP
|
||||||
#include "lwip/netif.h"
|
#include "lwip/netif.h"
|
||||||
#include "lwip/timeouts.h"
|
#include "lwip/timeouts.h"
|
||||||
|
|
|
@ -32,11 +32,12 @@
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "shared/netutils/netutils.h"
|
|
||||||
#include "modnetwork.h"
|
|
||||||
|
|
||||||
#if MICROPY_PY_NETWORK && MICROPY_PY_USOCKET && !MICROPY_PY_LWIP
|
#if MICROPY_PY_NETWORK && MICROPY_PY_USOCKET && !MICROPY_PY_LWIP
|
||||||
|
|
||||||
|
#include "shared/netutils/netutils.h"
|
||||||
|
#include "modnetwork.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// socket class
|
// socket class
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,11 @@
|
||||||
#include "py/objarray.h"
|
#include "py/objarray.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
#include "extmod/misc.h"
|
#include "extmod/misc.h"
|
||||||
#include "shared/runtime/interrupt_char.h"
|
|
||||||
|
|
||||||
#if MICROPY_PY_OS_DUPTERM
|
#if MICROPY_PY_OS_DUPTERM
|
||||||
|
|
||||||
|
#include "shared/runtime/interrupt_char.h"
|
||||||
|
|
||||||
void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) {
|
void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) {
|
||||||
mp_obj_t term = MP_STATE_VM(dupterm_objs[dupterm_idx]);
|
mp_obj_t term = MP_STATE_VM(dupterm_objs[dupterm_idx]);
|
||||||
MP_STATE_VM(dupterm_objs[dupterm_idx]) = MP_OBJ_NULL;
|
MP_STATE_VM(dupterm_objs[dupterm_idx]) = MP_OBJ_NULL;
|
||||||
|
|
|
@ -26,12 +26,13 @@
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
|
|
||||||
|
#if MICROPY_VFS && (MICROPY_VFS_LFS1 || MICROPY_VFS_LFS2)
|
||||||
|
|
||||||
#include "shared/timeutils/timeutils.h"
|
#include "shared/timeutils/timeutils.h"
|
||||||
#include "extmod/vfs.h"
|
#include "extmod/vfs.h"
|
||||||
#include "extmod/vfs_lfs.h"
|
#include "extmod/vfs_lfs.h"
|
||||||
|
|
||||||
#if MICROPY_VFS && (MICROPY_VFS_LFS1 || MICROPY_VFS_LFS2)
|
|
||||||
|
|
||||||
enum { LFS_MAKE_ARG_bdev, LFS_MAKE_ARG_readsize, LFS_MAKE_ARG_progsize, LFS_MAKE_ARG_lookahead, LFS_MAKE_ARG_mtime };
|
enum { LFS_MAKE_ARG_bdev, LFS_MAKE_ARG_readsize, LFS_MAKE_ARG_progsize, LFS_MAKE_ARG_lookahead, LFS_MAKE_ARG_mtime };
|
||||||
|
|
||||||
static const mp_arg_t lfs_make_allowed_args[] = {
|
static const mp_arg_t lfs_make_allowed_args[] = {
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// This file should be compiled when included from vfs_lfs.c.
|
||||||
|
#if defined(LFS_BUILD_VERSION)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -518,3 +521,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||||
);
|
);
|
||||||
|
|
||||||
#undef VFS_LFSx_QSTR
|
#undef VFS_LFSx_QSTR
|
||||||
|
|
||||||
|
#endif // defined(LFS_BUILD_VERSION)
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// This file should be compiled when included from vfs_lfs.c.
|
||||||
|
#if defined(LFS_BUILD_VERSION)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -244,3 +247,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||||
protocol, &MP_VFS_LFSx(textio_stream_p),
|
protocol, &MP_VFS_LFSx(textio_stream_p),
|
||||||
locals_dict, &MP_VFS_LFSx(file_locals_dict)
|
locals_dict, &MP_VFS_LFSx(file_locals_dict)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif // defined(LFS_BUILD_VERSION)
|
||||||
|
|
Loading…
Reference in New Issue