kopia lustrzana https://github.com/micropython/micropython
stm32/spi: Allow disabling MICROPY_PY_MACHINE_SPI.
This requires that MICROPY_PY_PYB is also disabled. Signed-off-by: Damien George <damien@micropython.org>pull/13524/head
rodzic
2158da213e
commit
4e6436d4cf
|
@ -28,6 +28,8 @@
|
||||||
#include "extmod/modmachine.h"
|
#include "extmod/modmachine.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
|
#if MICROPY_PY_MACHINE_SPI
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// Implementation of hard SPI for machine module
|
// Implementation of hard SPI for machine module
|
||||||
|
|
||||||
|
@ -150,3 +152,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||||
protocol, &machine_hard_spi_p,
|
protocol, &machine_hard_spi_p,
|
||||||
locals_dict, &mp_machine_spi_locals_dict
|
locals_dict, &mp_machine_spi_locals_dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif // MICROPY_PY_MACHINE_SPI
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include "bufhelper.h"
|
#include "bufhelper.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
|
#if MICROPY_PY_PYB
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// MicroPython bindings for legacy pyb API
|
// MicroPython bindings for legacy pyb API
|
||||||
|
|
||||||
|
@ -362,3 +364,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||||
protocol, &pyb_spi_p,
|
protocol, &pyb_spi_p,
|
||||||
locals_dict, &pyb_spi_locals_dict
|
locals_dict, &pyb_spi_locals_dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#endif // MICROPY_PY_PYB
|
||||||
|
|
|
@ -735,6 +735,8 @@ void spi_print(const mp_print_t *print, const spi_t *spi_obj, bool legacy) {
|
||||||
mp_print_str(print, ")");
|
mp_print_str(print, ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MICROPY_PY_MACHINE_SPI
|
||||||
|
|
||||||
const spi_t *spi_from_mp_obj(mp_obj_t o) {
|
const spi_t *spi_from_mp_obj(mp_obj_t o) {
|
||||||
if (mp_obj_is_type(o, &pyb_spi_type)) {
|
if (mp_obj_is_type(o, &pyb_spi_type)) {
|
||||||
pyb_spi_obj_t *self = MP_OBJ_TO_PTR(o);
|
pyb_spi_obj_t *self = MP_OBJ_TO_PTR(o);
|
||||||
|
@ -761,6 +763,8 @@ mp_obj_base_t *mp_hal_get_spi_obj(mp_obj_t o) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// Implementation of low-level SPI C protocol
|
// Implementation of low-level SPI C protocol
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue