Skip to content

Commit 23ccbcf

Browse files
committed
extmod/modmachine: Add MICROPY_PY_MACHINE_SIGNAL configuration option.
Enabled by default. Signed-off-by: Damien George <[email protected]>
1 parent c231c89 commit 23ccbcf

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

extmod/machine_signal.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#include "py/mpconfig.h"
28-
#if MICROPY_PY_MACHINE
29-
3027
#include <string.h>
31-
3228
#include "py/runtime.h"
29+
30+
#if MICROPY_PY_MACHINE_SIGNAL
31+
3332
#include "extmod/modmachine.h"
3433
#include "extmod/virtpin.h"
3534

@@ -181,4 +180,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
181180
locals_dict, &signal_locals_dict
182181
);
183182

184-
#endif // MICROPY_PY_MACHINE
183+
#endif // MICROPY_PY_MACHINE_SIGNAL

extmod/modmachine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ static const mp_rom_map_elem_t machine_module_globals_table[] = {
186186
#if MICROPY_PY_MACHINE_PIN_BASE
187187
{ MP_ROM_QSTR(MP_QSTR_PinBase), MP_ROM_PTR(&machine_pinbase_type) },
188188
#endif
189+
#if MICROPY_PY_MACHINE_SIGNAL
189190
{ MP_ROM_QSTR(MP_QSTR_Signal), MP_ROM_PTR(&machine_signal_type) },
191+
#endif
190192

191193
// Classes for software bus protocols.
192194
#if MICROPY_PY_MACHINE_SOFTI2C

py/mpconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,11 @@ typedef double mp_float_t;
17021702
#define MICROPY_PY_MACHINE_PULSE (0)
17031703
#endif
17041704

1705+
// Whether to provide the "machine.Signal" class
1706+
#ifndef MICROPY_PY_MACHINE_SIGNAL
1707+
#define MICROPY_PY_MACHINE_SIGNAL (MICROPY_PY_MACHINE)
1708+
#endif
1709+
17051710
#ifndef MICROPY_PY_MACHINE_I2C
17061711
#define MICROPY_PY_MACHINE_I2C (0)
17071712
#endif

0 commit comments

Comments
 (0)