diff --git a/Documentation/pycardium-guide.rst b/Documentation/pycardium-guide.rst index 707a86ed2b78d18977520ee235622dac5d5096e7..3a8fcaba87314aa2b4b4350f6a34578431914765 100644 --- a/Documentation/pycardium-guide.rst +++ b/Documentation/pycardium-guide.rst @@ -82,8 +82,15 @@ looks like this: }; /* This is a special macro that will make MicroPython aware of this module */ + /* clang-format off */ MP_REGISTER_MODULE(MP_QSTR_example, example_module, MODULE_EXAMPLE_ENABLED); +.. note:: + + Please keep the ``/* clang-format off */``. It ensures that *clang-format* + won't touch the following line. This is necessary because MicroPython's + codegen scripts can'd deal with newlines in the ``MP_REGISTER_MODULE`` macro. + Build Integration ~~~~~~~~~~~~~~~~~ Next, you need to add your module to ``pycardium/meson.build``. There is a list diff --git a/pycardium/modules/leds.c b/pycardium/modules/leds.c index efce3e08f9191c572bbb33007ec01ae0986d7ab5..a1dc47e850c15876b91531bd5363e044110db0c0 100644 --- a/pycardium/modules/leds.c +++ b/pycardium/modules/leds.c @@ -44,4 +44,5 @@ const mp_obj_module_t leds_module = { }; /* Register the module to make it available in Python */ +/* clang-format off */ MP_REGISTER_MODULE(MP_QSTR_leds, leds_module, MODULE_LEDS_ENABLED); diff --git a/pycardium/modules/utime.c b/pycardium/modules/utime.c index 107202dce74494606b824dcd31be2ccd0cf7d847..39972df4c97ccdf868374f9b16f3698389b37c9e 100644 --- a/pycardium/modules/utime.c +++ b/pycardium/modules/utime.c @@ -25,4 +25,5 @@ const mp_obj_module_t mp_module_utime = { }; /* Register the module to make it available in Python */ +/* clang-format off */ MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_utime, MODULE_UTIME_ENABLED); diff --git a/pycardium/modules/vibra.c b/pycardium/modules/vibra.c index 50bd07210ebb0cbda3ae37963bd7245e4989b316..96249846fa10eb6be8c21553a577654146f1c0d6 100644 --- a/pycardium/modules/vibra.c +++ b/pycardium/modules/vibra.c @@ -37,5 +37,6 @@ const mp_obj_module_t vibra_module = { .globals = (mp_obj_dict_t *)&vibra_module_globals, }; -// Register the module to make it available in Python +/* Register the module to make it available in Python */ +/* clang-format off */ MP_REGISTER_MODULE(MP_QSTR_vibra, vibra_module, MODULE_VIBRA_ENABLED);