From 47e3aed88f2db45cd3dfb5d951e44df9f64c7fc8 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 27 Feb 2024 10:59:29 +0000 Subject: [PATCH 1/8] MicroPython: Switch to mp_obj_malloc_with_finaliser. --- micropython/modules/adcfft/adcfft.cpp | 3 +-- micropython/modules/badger2040/badger2040.cpp | 3 +-- .../modules/breakout_mlx90640/mlx90640.cpp | 3 +-- .../breakout_pmw3901/breakout_pmw3901.cpp | 6 ++---- .../modules/breakout_vl53l5cx/vl53l5cx.cpp | 3 +-- .../modules/cosmic_unicorn/cosmic_unicorn.cpp | 6 ++---- micropython/modules/encoder/encoder.cpp | 3 +-- .../galactic_unicorn/galactic_unicorn.cpp | 6 ++---- micropython/modules/hub75/hub75.cpp | 3 +-- micropython/modules/jpegdec/jpegdec.cpp | 3 +-- micropython/modules/motor/motor.cpp | 6 ++---- .../pico_rgb_keypad/pico_rgb_keypad.cpp | 3 +-- .../modules/pico_scroll/pico_scroll.cpp | 3 +-- .../modules/pico_unicorn/pico_unicorn.cpp | 3 +-- .../modules/picographics/picographics.cpp | 3 +-- micropython/modules/picovector/picovector.cpp | 9 +++------ micropython/modules/plasma/plasma.cpp | 6 ++---- micropython/modules/pngdec/pngdec.cpp | 3 +-- micropython/modules/servo/servo.cpp | 18 ++++++------------ .../stellar_unicorn/stellar_unicorn.cpp | 6 ++---- 20 files changed, 33 insertions(+), 66 deletions(-) diff --git a/micropython/modules/adcfft/adcfft.cpp b/micropython/modules/adcfft/adcfft.cpp index e1e28a9b..4211e8d8 100644 --- a/micropython/modules/adcfft/adcfft.cpp +++ b/micropython/modules/adcfft/adcfft.cpp @@ -21,8 +21,7 @@ mp_obj_t adcfft_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - adcfft_obj_t *self = m_new_obj_with_finaliser(adcfft_obj_t); - self->base.type = &adcfft_type; + adcfft_obj_t *self = mp_obj_malloc_with_finaliser(adcfft_obj_t, &adcfft_type); unsigned int adc_channel = args[ARG_adc_channel].u_int; unsigned int adc_gpio = args[ARG_adc_gpio].u_int; diff --git a/micropython/modules/badger2040/badger2040.cpp b/micropython/modules/badger2040/badger2040.cpp index f2a38a5d..f0e2c25a 100644 --- a/micropython/modules/badger2040/badger2040.cpp +++ b/micropython/modules/badger2040/badger2040.cpp @@ -98,8 +98,7 @@ mp_obj_t Badger2040_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_ buffer = m_new(uint8_t, width * height / 8); } - badger2040_obj = m_new_obj_with_finaliser(_Badger2040_obj_t); - badger2040_obj->base.type = &Badger2040_type; + badger2040_obj = mp_obj_malloc_with_finaliser(_Badger2040_obj_t, &Badger2040_type); badger2040_obj->buf = buffer; badger2040_obj->badger2040 = m_new_class(pimoroni::Badger2040, buffer); badger2040_obj->badger2040->init(); diff --git a/micropython/modules/breakout_mlx90640/mlx90640.cpp b/micropython/modules/breakout_mlx90640/mlx90640.cpp index 36937702..b48ba88a 100644 --- a/micropython/modules/breakout_mlx90640/mlx90640.cpp +++ b/micropython/modules/breakout_mlx90640/mlx90640.cpp @@ -51,8 +51,7 @@ mp_obj_t MLX90640_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - _ModMLX90640_obj_t *self = m_new_obj_with_finaliser(_ModMLX90640_obj_t); - self->base.type = &MLX90640_type; + _ModMLX90640_obj_t *self = mp_obj_malloc_with_finaliser(_ModMLX90640_obj_t, &MLX90640_type); self->i2c = PimoroniI2C_from_machine_i2c_or_native(args[ARG_i2c].u_obj); self->address = args[ARG_address].u_int; diff --git a/micropython/modules/breakout_pmw3901/breakout_pmw3901.cpp b/micropython/modules/breakout_pmw3901/breakout_pmw3901.cpp index 0bc86bc8..f970ec55 100644 --- a/micropython/modules/breakout_pmw3901/breakout_pmw3901.cpp +++ b/micropython/modules/breakout_pmw3901/breakout_pmw3901.cpp @@ -74,8 +74,7 @@ mp_obj_t make_new(enum ChipType chip, const mp_obj_type_t *type, size_t n_args, int slot = args[ARG_slot].u_int; if(slot == BG_SPI_FRONT || slot == BG_SPI_BACK) { - self = m_new_obj_with_finaliser(breakout_pmw3901_BreakoutPMW3901_obj_t); - self->base.type = &breakout_pmw3901_BreakoutPMW3901_type; + self = mp_obj_malloc_with_finaliser(breakout_pmw3901_BreakoutPMW3901_obj_t, &breakout_pmw3901_BreakoutPMW3901_type); if(chip == ChipType::PMW3901) { BreakoutPMW3901 *breakout = m_new_class(BreakoutPMW3901, (BG_SPI_SLOT)slot); @@ -137,8 +136,7 @@ mp_obj_t make_new(enum ChipType chip, const mp_obj_type_t *type, size_t n_args, mp_raise_ValueError(MP_ERROR_TEXT("bad MISO pin")); } - self = m_new_obj_with_finaliser(breakout_pmw3901_BreakoutPMW3901_obj_t); - self->base.type = &breakout_pmw3901_BreakoutPMW3901_type; + self = mp_obj_malloc_with_finaliser(breakout_pmw3901_BreakoutPMW3901_obj_t, &breakout_pmw3901_BreakoutPMW3901_type); spi_inst_t *spi = (spi_id == 0) ? spi0 : spi1; if(chip == ChipType::PMW3901) { diff --git a/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp b/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp index 1dabb104..c9233a69 100644 --- a/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp +++ b/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp @@ -60,8 +60,7 @@ mp_obj_t VL53L5CX_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw int addr = args[ARG_addr].u_int; - self = m_new_obj_with_finaliser(_VL53L5CX_obj_t); - self->base.type = &VL53L5CX_type; + self = mp_obj_malloc_with_finaliser(_VL53L5CX_obj_t, &VL53L5CX_type); self->i2c = PimoroniI2C_from_machine_i2c_or_native(args[ARG_i2c].u_obj); diff --git a/micropython/modules/cosmic_unicorn/cosmic_unicorn.cpp b/micropython/modules/cosmic_unicorn/cosmic_unicorn.cpp index 5fffb7be..9f06738f 100644 --- a/micropython/modules/cosmic_unicorn/cosmic_unicorn.cpp +++ b/micropython/modules/cosmic_unicorn/cosmic_unicorn.cpp @@ -391,8 +391,7 @@ mp_obj_t CosmicUnicorn_make_new(const mp_obj_type_t *type, size_t n_args, size_t CosmicUnicorn *cosmic = m_new_class(CosmicUnicorn); cosmic->init(); - self = m_new_obj_with_finaliser(_CosmicUnicorn_obj_t); - self->base.type = &CosmicUnicorn_type; + self = mp_obj_malloc_with_finaliser(_CosmicUnicorn_obj_t, &CosmicUnicorn_type); self->cosmic = cosmic; return MP_OBJ_FROM_PTR(self); @@ -507,8 +506,7 @@ extern mp_obj_t CosmicUnicorn_synth_channel(mp_obj_t self_in, mp_obj_t channel_i // NOTE This seems to work, in that it give MP access to the calibration object // Could very easily mess up in weird ways once object deletion is considered? - _Channel_obj_t *channel_obj = m_new_obj_with_finaliser(_Channel_obj_t); - channel_obj->base.type = &Channel_type; + _Channel_obj_t *channel_obj = mp_obj_malloc_with_finaliser(_Channel_obj_t, &Channel_type); channel_obj->channel = &self->cosmic->synth_channel(channel); return MP_OBJ_FROM_PTR(channel_obj); diff --git a/micropython/modules/encoder/encoder.cpp b/micropython/modules/encoder/encoder.cpp index f00af3f8..ae74c300 100644 --- a/micropython/modules/encoder/encoder.cpp +++ b/micropython/modules/encoder/encoder.cpp @@ -144,8 +144,7 @@ mp_obj_t Encoder_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, mp_raise_msg(&mp_type_RuntimeError, "unable to allocate the hardware resources needed to initialise this Encoder. Try running `import gc` followed by `gc.collect()` before creating it"); } - self = m_new_obj_with_finaliser(_Encoder_obj_t); - self->base.type = &Encoder_type; + self = mp_obj_malloc_with_finaliser(_Encoder_obj_t, &Encoder_type); self->encoder = encoder; return MP_OBJ_FROM_PTR(self); diff --git a/micropython/modules/galactic_unicorn/galactic_unicorn.cpp b/micropython/modules/galactic_unicorn/galactic_unicorn.cpp index 64790e16..85860dcf 100644 --- a/micropython/modules/galactic_unicorn/galactic_unicorn.cpp +++ b/micropython/modules/galactic_unicorn/galactic_unicorn.cpp @@ -391,8 +391,7 @@ mp_obj_t GalacticUnicorn_make_new(const mp_obj_type_t *type, size_t n_args, size GalacticUnicorn *galactic = m_new_class(GalacticUnicorn); galactic->init(); - self = m_new_obj_with_finaliser(_GalacticUnicorn_obj_t); - self->base.type = &GalacticUnicorn_type; + self = mp_obj_malloc_with_finaliser(_GalacticUnicorn_obj_t, &GalacticUnicorn_type); self->galactic = galactic; return MP_OBJ_FROM_PTR(self); @@ -507,8 +506,7 @@ extern mp_obj_t GalacticUnicorn_synth_channel(mp_obj_t self_in, mp_obj_t channel // NOTE This seems to work, in that it give MP access to the calibration object // Could very easily mess up in weird ways once object deletion is considered? - _Channel_obj_t *channel_obj = m_new_obj_with_finaliser(_Channel_obj_t); - channel_obj->base.type = &Channel_type; + _Channel_obj_t *channel_obj = mp_obj_malloc_with_finaliser(_Channel_obj_t, &Channel_type); channel_obj->channel = &self->galactic->synth_channel(channel); return MP_OBJ_FROM_PTR(channel_obj); diff --git a/micropython/modules/hub75/hub75.cpp b/micropython/modules/hub75/hub75.cpp index 8a8c7624..6e586c7f 100644 --- a/micropython/modules/hub75/hub75.cpp +++ b/micropython/modules/hub75/hub75.cpp @@ -120,8 +120,7 @@ mp_obj_t Hub75_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c buffer = m_new(Pixel, width * height); } - hub75_obj = m_new_obj_with_finaliser(_Hub75_obj_t); - hub75_obj->base.type = &Hub75_type; + hub75_obj = mp_obj_malloc_with_finaliser(_Hub75_obj_t, &Hub75_type); hub75_obj->buf = buffer; hub75_obj->hub75 = m_new_class(Hub75, width, height, buffer, paneltype, stb_invert, color_order); diff --git a/micropython/modules/jpegdec/jpegdec.cpp b/micropython/modules/jpegdec/jpegdec.cpp index cdaec159..d90ad4ec 100644 --- a/micropython/modules/jpegdec/jpegdec.cpp +++ b/micropython/modules/jpegdec/jpegdec.cpp @@ -212,8 +212,7 @@ mp_obj_t _JPEG_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c if(!MP_OBJ_IS_TYPE(args[ARG_picographics].u_obj, &ModPicoGraphics_type)) mp_raise_ValueError(MP_ERROR_TEXT("PicoGraphics Object Required")); - _JPEG_obj_t *self = m_new_obj_with_finaliser(_JPEG_obj_t); - self->base.type = &JPEG_type; + _JPEG_obj_t *self = mp_obj_malloc_with_finaliser(_JPEG_obj_t, &JPEG_type); self->jpeg = m_new_class(JPEGDEC); self->graphics = (ModPicoGraphics_obj_t *)MP_OBJ_TO_PTR(args[ARG_picographics].u_obj); diff --git a/micropython/modules/motor/motor.cpp b/micropython/modules/motor/motor.cpp index bef55d85..5e83178e 100644 --- a/micropython/modules/motor/motor.cpp +++ b/micropython/modules/motor/motor.cpp @@ -189,8 +189,7 @@ mp_obj_t Motor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c mp_raise_ValueError("mode out of range. Expected FAST_DECAY (0) or SLOW_DECAY (1)"); } - self = m_new_obj_with_finaliser(_Motor_obj_t); - self->base.type = &Motor_type; + self = mp_obj_malloc_with_finaliser(_Motor_obj_t, &Motor_type); self->motor = m_new_class(Motor, pins, (Direction)direction, speed_scale, zeropoint, deadzone, freq, (DecayMode)mode, args[ARG_ph_en_driver].u_bool); self->motor->init(); @@ -741,8 +740,7 @@ mp_obj_t MotorCluster_make_new(const mp_obj_type_t *type, size_t n_args, size_t mp_raise_msg(&mp_type_RuntimeError, "unable to allocate the hardware resources needed to initialise this MotorCluster. Try running `import gc` followed by `gc.collect()` before creating it"); } - self = m_new_obj_with_finaliser(_MotorCluster_obj_t); - self->base.type = &MotorCluster_type; + self = mp_obj_malloc_with_finaliser(_MotorCluster_obj_t, &MotorCluster_type); self->cluster = cluster; return MP_OBJ_FROM_PTR(self); diff --git a/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.cpp b/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.cpp index 7e95916f..a06cb812 100644 --- a/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.cpp +++ b/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.cpp @@ -18,8 +18,7 @@ typedef struct _PicoKeypad_obj_t { mp_obj_t picokeypad_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { _PicoKeypad_obj_t *self = nullptr; - self = m_new_obj_with_finaliser(PicoKeypad_obj_t); - self->base.type = &PicoKeypad_type; + self = mp_obj_malloc_with_finaliser(PicoKeypad_obj_t, &PicoKeypad_type); self->keypad = m_new_class(PicoRGBKeypad); self->keypad->init(); diff --git a/micropython/modules/pico_scroll/pico_scroll.cpp b/micropython/modules/pico_scroll/pico_scroll.cpp index e382788a..7f221ccd 100644 --- a/micropython/modules/pico_scroll/pico_scroll.cpp +++ b/micropython/modules/pico_scroll/pico_scroll.cpp @@ -40,8 +40,7 @@ typedef struct _ModPicoGraphics_obj_t { mp_obj_t picoscroll_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { _PicoScroll_obj_t *self = nullptr; - self = m_new_obj_with_finaliser(PicoScroll_obj_t); - self->base.type = &PicoScroll_type; + self = mp_obj_malloc_with_finaliser(PicoScroll_obj_t, &PicoScroll_type); self->scroll = m_new_class(PicoScroll); self->scroll->init(); diff --git a/micropython/modules/pico_unicorn/pico_unicorn.cpp b/micropython/modules/pico_unicorn/pico_unicorn.cpp index b5312344..cd1ce602 100644 --- a/micropython/modules/pico_unicorn/pico_unicorn.cpp +++ b/micropython/modules/pico_unicorn/pico_unicorn.cpp @@ -31,8 +31,7 @@ typedef struct _ModPicoGraphics_obj_t { } ModPicoGraphics_obj_t; mp_obj_t picounicorn_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - picounicorn_obj_t *self = m_new_obj_with_finaliser(picounicorn_obj_t); - self->base.type = &picounicorn_type; + picounicorn_obj_t *self = mp_obj_malloc_with_finaliser(picounicorn_obj_t, &picounicorn_type); self->unicorn = m_new_class(PicoUnicorn); return MP_OBJ_FROM_PTR(self); } diff --git a/micropython/modules/picographics/picographics.cpp b/micropython/modules/picographics/picographics.cpp index 0e94573c..4fe1e2d0 100644 --- a/micropython/modules/picographics/picographics.cpp +++ b/micropython/modules/picographics/picographics.cpp @@ -288,8 +288,7 @@ mp_obj_t ModPicoGraphics_make_new(const mp_obj_type_t *type, size_t n_args, size mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - self = m_new_obj_with_finaliser(ModPicoGraphics_obj_t); - self->base.type = &ModPicoGraphics_type; + self = mp_obj_malloc_with_finaliser(ModPicoGraphics_obj_t, &ModPicoGraphics_type); PicoGraphicsDisplay display = (PicoGraphicsDisplay)args[ARG_display].u_int; diff --git a/micropython/modules/picovector/picovector.cpp b/micropython/modules/picovector/picovector.cpp index ebe07431..f7bde227 100644 --- a/micropython/modules/picovector/picovector.cpp +++ b/micropython/modules/picovector/picovector.cpp @@ -122,8 +122,7 @@ mp_obj_t RECTANGLE_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_k mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - _POLYGON_obj_t *self = m_new_obj_with_finaliser(_POLYGON_obj_t); - self->base.type = &POLYGON_type; + _POLYGON_obj_t *self = mp_obj_malloc_with_finaliser(_POLYGON_obj_t, &POLYGON_type); int x = args[ARG_x].u_int; int y = args[ARG_y].u_int; @@ -154,8 +153,7 @@ mp_obj_t REGULAR_POLYGON_make_new(const mp_obj_type_t *type, size_t n_args, size mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - _POLYGON_obj_t *self = m_new_obj_with_finaliser(_POLYGON_obj_t); - self->base.type = &POLYGON_type; + _POLYGON_obj_t *self = mp_obj_malloc_with_finaliser(_POLYGON_obj_t, &POLYGON_type); Point origin(args[ARG_x].u_int, args[ARG_y].u_int); unsigned int sides = args[ARG_sides].u_int; @@ -185,8 +183,7 @@ mp_obj_t REGULAR_POLYGON_make_new(const mp_obj_type_t *type, size_t n_args, size } mp_obj_t POLYGON_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - _POLYGON_obj_t *self = m_new_obj_with_finaliser(_POLYGON_obj_t); - self->base.type = &POLYGON_type; + _POLYGON_obj_t *self = mp_obj_malloc_with_finaliser(_POLYGON_obj_t, &POLYGON_type); size_t num_points = n_args; const mp_obj_t *points = all_args; diff --git a/micropython/modules/plasma/plasma.cpp b/micropython/modules/plasma/plasma.cpp index 26c35c14..349a6755 100644 --- a/micropython/modules/plasma/plasma.cpp +++ b/micropython/modules/plasma/plasma.cpp @@ -96,8 +96,7 @@ mp_obj_t PlasmaWS2812_make_new(const mp_obj_type_t *type, size_t n_args, size_t buffer = m_new(WS2812::RGB, num_leds); } - self = m_new_obj_with_finaliser(_PlasmaWS2812_obj_t); - self->base.type = &PlasmaWS2812_type; + self = mp_obj_malloc_with_finaliser(_PlasmaWS2812_obj_t, &PlasmaWS2812_type); self->buf = buffer; self->ws2812 = m_new_class(WS2812, num_leds, pio, sm, dat, freq, rgbw, color_order, (WS2812::RGB *)buffer); @@ -307,8 +306,7 @@ mp_obj_t PlasmaAPA102_make_new(const mp_obj_type_t *type, size_t n_args, size_t buffer[i].brightness(15); } - self = m_new_obj_with_finaliser(_PlasmaAPA102_obj_t); - self->base.type = &PlasmaAPA102_type; + self = mp_obj_malloc_with_finaliser(_PlasmaAPA102_obj_t, &PlasmaAPA102_type); self->buf = buffer; self->apa102 = m_new_class(APA102, num_leds, pio, sm, dat, clk, freq, buffer); diff --git a/micropython/modules/pngdec/pngdec.cpp b/micropython/modules/pngdec/pngdec.cpp index 85f0cd2f..6e273d80 100644 --- a/micropython/modules/pngdec/pngdec.cpp +++ b/micropython/modules/pngdec/pngdec.cpp @@ -326,8 +326,7 @@ mp_obj_t _PNG_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, co if(!MP_OBJ_IS_TYPE(args[ARG_picographics].u_obj, &ModPicoGraphics_type)) mp_raise_ValueError(MP_ERROR_TEXT("PicoGraphics Object Required")); - _PNG_obj_t *self = m_new_obj_with_finaliser(_PNG_obj_t); - self->base.type = &PNG_type; + _PNG_obj_t *self = mp_obj_malloc_with_finaliser(_PNG_obj_t, &PNG_type); self->png = m_new_class(PNG); //mp_printf(&mp_plat_print, "PNG RAM %fK\n", sizeof(PNG) / 1024.0f); diff --git a/micropython/modules/servo/servo.cpp b/micropython/modules/servo/servo.cpp index b02e6eb7..584d53f8 100644 --- a/micropython/modules/servo/servo.cpp +++ b/micropython/modules/servo/servo.cpp @@ -73,8 +73,7 @@ mp_obj_t Calibration_make_new(const mp_obj_type_t *type, size_t n_args, size_t n } servo::CalibrationType calibration_type = (servo::CalibrationType)type; - self = m_new_obj_with_finaliser(_Calibtration_obj_t); - self->base.type = &Calibration_type; + self = mp_obj_malloc_with_finaliser(_Calibtration_obj_t, &Calibration_type); self->calibration = m_new_class(Calibration, calibration_type); } else { @@ -82,8 +81,7 @@ mp_obj_t Calibration_make_new(const mp_obj_type_t *type, size_t n_args, size_t n } } else { - self = m_new_obj_with_finaliser(_Calibtration_obj_t); - self->base.type = &Calibration_type; + self = mp_obj_malloc_with_finaliser(_Calibtration_obj_t, &Calibration_type); self->calibration = m_new_class(Calibration); } @@ -892,8 +890,7 @@ mp_obj_t Servo_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c freq = mp_obj_get_float(args[ARG_freq].u_obj); } - self = m_new_obj_with_finaliser(_Servo_obj_t); - self->base.type = &Servo_type; + self = mp_obj_malloc_with_finaliser(_Servo_obj_t, &Servo_type); void *servo_target = m_new(Servo, 1); @@ -1161,8 +1158,7 @@ extern mp_obj_t Servo_calibration(size_t n_args, const mp_obj_t *pos_args, mp_ma _Servo_obj_t *self = MP_OBJ_TO_PTR2(args[ARG_self].u_obj, _Servo_obj_t); // Create a new MP Calibration instance and assign a copy of the servo's calibration to it - _Calibration_obj_t *calib = m_new_obj_with_finaliser(_Calibration_obj_t); - calib->base.type = &Calibration_type; + _Calibration_obj_t *calib = mp_obj_malloc_with_finaliser(_Calibration_obj_t, &Calibration_type); calib->calibration = m_new_class(Calibration, self->servo->calibration()); return MP_OBJ_FROM_PTR(calib); @@ -1355,8 +1351,7 @@ mp_obj_t ServoCluster_make_new(const mp_obj_type_t *type, size_t n_args, size_t mp_raise_msg(&mp_type_RuntimeError, "unable to allocate the hardware resources needed to initialise this ServoCluster. Try running `import gc` followed by `gc.collect()` before creating it"); } - self = m_new_obj_with_finaliser(_ServoCluster_obj_t); - self->base.type = &ServoCluster_type; + self = mp_obj_malloc_with_finaliser(_ServoCluster_obj_t, &ServoCluster_type); self->cluster = cluster; return MP_OBJ_FROM_PTR(self); @@ -2655,8 +2650,7 @@ extern mp_obj_t ServoCluster_calibration(size_t n_args, const mp_obj_t *pos_args mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("servo out of range. Expected 0 to %d"), servo_count - 1); else { // Create a new MP Calibration instance and assign a copy of the servo's calibration to it - _Calibration_obj_t *calib = m_new_obj_with_finaliser(_Calibration_obj_t); - calib->base.type = &Calibration_type; + _Calibration_obj_t *calib = mp_obj_malloc_with_finaliser(_Calibration_obj_t, &Calibration_type); calib->calibration = m_new_class(Calibration, self->cluster->calibration((uint)servo)); return MP_OBJ_FROM_PTR(calib); diff --git a/micropython/modules/stellar_unicorn/stellar_unicorn.cpp b/micropython/modules/stellar_unicorn/stellar_unicorn.cpp index a6b19daa..52df9cdb 100644 --- a/micropython/modules/stellar_unicorn/stellar_unicorn.cpp +++ b/micropython/modules/stellar_unicorn/stellar_unicorn.cpp @@ -391,8 +391,7 @@ mp_obj_t StellarUnicorn_make_new(const mp_obj_type_t *type, size_t n_args, size_ StellarUnicorn *stellar = m_new_class(StellarUnicorn); stellar->init(); - self = m_new_obj_with_finaliser(_StellarUnicorn_obj_t); - self->base.type = &StellarUnicorn_type; + self = mp_obj_malloc_with_finaliser(_StellarUnicorn_obj_t, &StellarUnicorn_type); self->stellar = stellar; return MP_OBJ_FROM_PTR(self); @@ -507,8 +506,7 @@ extern mp_obj_t StellarUnicorn_synth_channel(mp_obj_t self_in, mp_obj_t channel_ // NOTE This seems to work, in that it give MP access to the calibration object // Could very easily mess up in weird ways once object deletion is considered? - _Channel_obj_t *channel_obj = m_new_obj_with_finaliser(_Channel_obj_t); - channel_obj->base.type = &Channel_type; + _Channel_obj_t *channel_obj = mp_obj_malloc_with_finaliser(_Channel_obj_t, &Channel_type); channel_obj->channel = &self->stellar->synth_channel(channel); return MP_OBJ_FROM_PTR(channel_obj); From 64e26dc6f48a88a931fee7ac94f5eef02b1e024f Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 27 Feb 2024 11:14:05 +0000 Subject: [PATCH 2/8] CI: Bump MicroPython to master. CI will always run against the latest MicroPython commit. --- .github/workflows/micropython.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 6ed0b195..f6e633ba 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -7,7 +7,7 @@ on: types: [created] env: - MICROPYTHON_VERSION: v1.22.2 + MICROPYTHON_VERSION: master jobs: build: From 84cabe077d331b6dce12b7eb9efcb558e456cd1f Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 27 Feb 2024 11:26:46 +0000 Subject: [PATCH 3/8] MicroPython: Switch QRCode to micropython/edge branch. Includes fixes for: * "mp_obj_malloc_with_finaliser" replacing "m_new_obj_with_finaliser" * "STATIC" macro dropped in favour of "static" --- micropython/modules/qrcode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/modules/qrcode b/micropython/modules/qrcode index 9371aca7..1a7c2d67 160000 --- a/micropython/modules/qrcode +++ b/micropython/modules/qrcode @@ -1 +1 @@ -Subproject commit 9371aca7abdf4e17526dcb3893168ca5900dc79f +Subproject commit 1a7c2d67a8cf24848b92acb6379328ad6842ab77 From 517f8ae1cd781c933f137495507f00fc3eaf4a68 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 29 Feb 2024 12:12:24 +0000 Subject: [PATCH 4/8] global: Remove the STATIC macro. Reflect the changes proposed in micropython/micropython#13763. --- micropython/modules/adcfft/adcfft.c | 8 +- micropython/modules/badger2040/badger2040.c | 8 +- .../modules/breakout_as7262/breakout_as7262.c | 8 +- .../modules/breakout_as7343/breakout_as7343.c | 8 +- .../modules/breakout_bh1745/breakout_bh1745.c | 8 +- .../modules/breakout_bme280/breakout_bme280.c | 8 +- .../modules/breakout_bme68x/breakout_bme68x.c | 8 +- .../modules/breakout_bmp280/breakout_bmp280.c | 8 +- .../breakout_dotmatrix/breakout_dotmatrix.c | 8 +- .../breakout_encoder/breakout_encoder.c | 8 +- .../breakout_encoder_wheel.c | 8 +- .../breakout_icp10125/breakout_icp10125.c | 8 +- .../breakout_ioexpander/breakout_ioexpander.c | 8 +- .../modules/breakout_ltr559/breakout_ltr559.c | 8 +- .../breakout_matrix11x7/breakout_matrix11x7.c | 8 +- .../breakout_mics6814/breakout_mics6814.c | 8 +- .../modules/breakout_mlx90640/mlx90640.c | 8 +- .../modules/breakout_msa301/breakout_msa301.c | 8 +- .../breakout_pmw3901/breakout_paa5100.c | 8 +- .../breakout_pmw3901/breakout_pmw3901.c | 8 +- .../breakout_potentiometer.c | 8 +- .../breakout_rgbmatrix5x5.c | 8 +- .../modules/breakout_rtc/breakout_rtc.c | 8 +- .../modules/breakout_scd41/breakout_scd41.c | 22 +-- .../modules/breakout_sgp30/breakout_sgp30.c | 8 +- .../breakout_trackball/breakout_trackball.c | 8 +- .../modules/breakout_vl53l5cx/vl53l5cx.c | 8 +- .../modules/breakout_vl53l5cx/vl53l5cx.cpp | 6 +- .../modules/cosmic_unicorn/cosmic_unicorn.c | 12 +- micropython/modules/cppmem/cppmem.c | 14 +- micropython/modules/encoder/encoder.c | 8 +- micropython/modules/encoder/encoder.cpp | 2 +- .../galactic_unicorn/galactic_unicorn.c | 12 +- micropython/modules/hub75/hub75.c | 8 +- micropython/modules/jpegdec/jpegdec.c | 20 +-- micropython/modules/jpegdec/jpegdec.cpp | 2 +- micropython/modules/motor/motor.c | 20 +-- micropython/modules/pcf85063a/pcf85063a.c | 8 +- .../modules/pico_explorer/pico_explorer.c | 4 +- .../modules/pico_rgb_keypad/pico_rgb_keypad.c | 28 ++-- micropython/modules/pico_scroll/pico_scroll.c | 32 ++--- .../modules/pico_unicorn/pico_unicorn.c | 24 ++-- .../modules/pico_wireless/pico_wireless.c | 128 +++++++++--------- .../modules/picographics/picographics.c | 18 +-- micropython/modules/picovector/picovector.c | 32 ++--- micropython/modules/picovector/picovector.cpp | 4 +- .../modules/pimoroni_bus/pimoroni_bus.c | 4 +- .../modules/pimoroni_i2c/pimoroni_i2c.c | 10 +- micropython/modules/plasma/plasma.c | 20 +-- micropython/modules/pngdec/pngdec.c | 22 +-- micropython/modules/pngdec/pngdec.cpp | 2 +- micropython/modules/servo/servo.c | 20 +-- .../modules/stellar_unicorn/stellar_unicorn.c | 12 +- micropython/modules/wakeup/wakeup.c | 12 +- 54 files changed, 357 insertions(+), 357 deletions(-) diff --git a/micropython/modules/adcfft/adcfft.c b/micropython/modules/adcfft/adcfft.c index 619da0d2..bb6c2f74 100644 --- a/micropython/modules/adcfft/adcfft.c +++ b/micropython/modules/adcfft/adcfft.c @@ -5,13 +5,13 @@ MP_DEFINE_CONST_FUN_OBJ_1(adcfft_update_obj, adcfft_update); MP_DEFINE_CONST_FUN_OBJ_3(adcfft_get_scaled_obj, adcfft_get_scaled); MP_DEFINE_CONST_FUN_OBJ_1(adcfft__del__obj, adcfft__del__); -STATIC const mp_rom_map_elem_t adcfft_locals_dict_table[] = { +static const mp_rom_map_elem_t adcfft_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&adcfft__del__obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&adcfft_update_obj) }, { MP_ROM_QSTR(MP_QSTR_get_scaled), MP_ROM_PTR(&adcfft_get_scaled_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(adcfft_locals_dict, adcfft_locals_dict_table); +static MP_DEFINE_CONST_DICT(adcfft_locals_dict, adcfft_locals_dict_table); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -31,11 +31,11 @@ const mp_obj_type_t adcfft_type = { #endif // Module -STATIC const mp_map_elem_t adcfft_globals_table[] = { +static const mp_map_elem_t adcfft_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_adcfft) }, // Module name { MP_OBJ_NEW_QSTR(MP_QSTR_ADCFFT), (mp_obj_t)&adcfft_type }, // Class name & type }; -STATIC MP_DEFINE_CONST_DICT(mp_module_adcfft_globals, adcfft_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_adcfft_globals, adcfft_globals_table); const mp_obj_module_t adcfft_user_cmodule = { diff --git a/micropython/modules/badger2040/badger2040.c b/micropython/modules/badger2040/badger2040.c index 8112ffe6..44a1160e 100644 --- a/micropython/modules/badger2040/badger2040.c +++ b/micropython/modules/badger2040/badger2040.c @@ -38,7 +38,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(Badger2040_woken_by_button_obj, Badger2040_woken_by_bu MP_DEFINE_CONST_FUN_OBJ_1(Badger2040_system_speed_obj, Badger2040_system_speed); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Badger2040_locals_dict_table[] = { +static const mp_rom_map_elem_t Badger2040_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Badger2040___del___obj) }, { MP_ROM_QSTR(MP_QSTR_is_busy), MP_ROM_PTR(&Badger2040_is_busy_obj) }, { MP_ROM_QSTR(MP_QSTR_update_speed), MP_ROM_PTR(&Badger2040_update_speed_obj) }, @@ -72,7 +72,7 @@ STATIC const mp_rom_map_elem_t Badger2040_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_command), MP_ROM_PTR(&Badger2040_command_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(Badger2040_locals_dict, Badger2040_locals_dict_table); +static MP_DEFINE_CONST_DICT(Badger2040_locals_dict, Badger2040_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -94,7 +94,7 @@ const mp_obj_type_t Badger2040_type = { /***** Globals Table *****/ -STATIC const mp_rom_map_elem_t badger2040_globals_table[] = { +static const mp_rom_map_elem_t badger2040_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_badger2040) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Badger2040), (mp_obj_t)&Badger2040_type }, @@ -140,7 +140,7 @@ STATIC const mp_rom_map_elem_t badger2040_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_PIN_BATTERY), MP_ROM_INT(29) }, { MP_ROM_QSTR(MP_QSTR_PIN_ENABLE_3V3), MP_ROM_INT(10) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_badger2040_globals, badger2040_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_badger2040_globals, badger2040_globals_table); /***** Module Definition *****/ const mp_obj_module_t badger2040_user_cmodule = { diff --git a/micropython/modules/breakout_as7262/breakout_as7262.c b/micropython/modules/breakout_as7262/breakout_as7262.c index 808ef085..cebfa560 100644 --- a/micropython/modules/breakout_as7262/breakout_as7262.c +++ b/micropython/modules/breakout_as7262/breakout_as7262.c @@ -19,7 +19,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(BreakoutAS7262_set_integration_time_obj, BreakoutAS726 MP_DEFINE_CONST_FUN_OBJ_3(BreakoutAS7262_set_leds_obj, BreakoutAS7262_set_leds); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutAS7262_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutAS7262_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&BreakoutAS7262_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_device_type), MP_ROM_PTR(&BreakoutAS7262_device_type_obj) }, { MP_ROM_QSTR(MP_QSTR_hardware_version), MP_ROM_PTR(&BreakoutAS7262_hardware_version_obj) }, @@ -54,7 +54,7 @@ STATIC const mp_rom_map_elem_t BreakoutAS7262_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_CONT_ROYGBR), MP_ROM_INT(MP_CONT_ROYGBR) }, { MP_ROM_QSTR(MP_QSTR_ONESHOT), MP_ROM_INT(MP_ONESHOT) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutAS7262_locals_dict, BreakoutAS7262_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutAS7262_locals_dict, BreakoutAS7262_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -80,11 +80,11 @@ const mp_obj_type_t breakout_as7262_BreakoutAS7262_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_as7262_globals_table[] = { +static const mp_map_elem_t breakout_as7262_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_as7262) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutAS7262), (mp_obj_t)&breakout_as7262_BreakoutAS7262_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_as7262_globals, breakout_as7262_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_as7262_globals, breakout_as7262_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_as7262_user_cmodule = { diff --git a/micropython/modules/breakout_as7343/breakout_as7343.c b/micropython/modules/breakout_as7343/breakout_as7343.c index 541faadf..35e134b1 100644 --- a/micropython/modules/breakout_as7343/breakout_as7343.c +++ b/micropython/modules/breakout_as7343/breakout_as7343.c @@ -19,7 +19,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(BreakoutAS7343_set_illumination_led_obj, BreakoutAS734 MP_DEFINE_CONST_FUN_OBJ_2(BreakoutAS7343_set_channels_obj, BreakoutAS7343_set_channels); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutAS7343_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutAS7343_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&BreakoutAS7343_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_version), MP_ROM_PTR(&BreakoutAS7343_version_obj) }, { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&BreakoutAS7343_read_obj) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t BreakoutAS7343_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_illumination_led), MP_ROM_PTR(&BreakoutAS7343_set_illumination_led_obj) }, { MP_ROM_QSTR(MP_QSTR_set_channels), MP_ROM_PTR(&BreakoutAS7343_set_channels_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutAS7343_locals_dict, BreakoutAS7343_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutAS7343_locals_dict, BreakoutAS7343_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -57,11 +57,11 @@ const mp_obj_type_t breakout_as7343_BreakoutAS7343_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_as7343_globals_table[] = { +static const mp_map_elem_t breakout_as7343_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_as7343) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutAS7343), (mp_obj_t)&breakout_as7343_BreakoutAS7343_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_as7343_globals, breakout_as7343_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_as7343_globals, breakout_as7343_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_as7343_user_cmodule = { diff --git a/micropython/modules/breakout_bh1745/breakout_bh1745.c b/micropython/modules/breakout_bh1745/breakout_bh1745.c index a90b1a4a..8a88acd9 100644 --- a/micropython/modules/breakout_bh1745/breakout_bh1745.c +++ b/micropython/modules/breakout_bh1745/breakout_bh1745.c @@ -15,7 +15,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutBH1745_threshold_obj, 3, BreakoutBH1745_thres MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutBH1745_measurement_time_ms_obj, 2, BreakoutBH1745_measurement_time_ms); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutBH1745_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutBH1745_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_chip_id), MP_ROM_PTR(&BreakoutBH1745_chip_id_obj) }, { MP_ROM_QSTR(MP_QSTR_manufacturer_id), MP_ROM_PTR(&BreakoutBH1745_manufacturer_id_obj) }, { MP_ROM_QSTR(MP_QSTR_rgbc_raw), MP_ROM_PTR(&BreakoutBH1745_rgbc_raw_obj) }, @@ -25,7 +25,7 @@ STATIC const mp_rom_map_elem_t BreakoutBH1745_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_measurement_time_ms), MP_ROM_PTR(&BreakoutBH1745_measurement_time_ms_obj) }, { MP_ROM_QSTR(MP_QSTR_leds), MP_ROM_PTR(&BreakoutBH1745_leds_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutBH1745_locals_dict, BreakoutBH1745_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutBH1745_locals_dict, BreakoutBH1745_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -51,14 +51,14 @@ const mp_obj_type_t breakout_bh1745_BreakoutBH1745_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_bh1745_globals_table[] = { +static const mp_map_elem_t breakout_bh1745_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_bh1745) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutBH1745), (mp_obj_t)&breakout_bh1745_BreakoutBH1745_type }, { MP_ROM_QSTR(MP_QSTR_I2C_ADDRESS_DEFAULT), MP_ROM_INT(BH1745_I2C_ADDRESS_DEFAULT) }, { MP_ROM_QSTR(MP_QSTR_I2C_ADDRESS_ALT), MP_ROM_INT(BH1745_I2C_ADDRESS_ALTERNATE) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_bh1745_globals, breakout_bh1745_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_bh1745_globals, breakout_bh1745_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_bh1745_user_cmodule = { diff --git a/micropython/modules/breakout_bme280/breakout_bme280.c b/micropython/modules/breakout_bme280/breakout_bme280.c index 23886372..583e6414 100644 --- a/micropython/modules/breakout_bme280/breakout_bme280.c +++ b/micropython/modules/breakout_bme280/breakout_bme280.c @@ -9,11 +9,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutBME280_read_obj, BreakoutBME280_read); MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutBME280_configure_obj, 1, BreakoutBME280_configure); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutBME280_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutBME280_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&BreakoutBME280_read_obj) }, { MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&BreakoutBME280_configure_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutBME280_locals_dict, BreakoutBME280_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutBME280_locals_dict, BreakoutBME280_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -39,7 +39,7 @@ const mp_obj_type_t breakout_bme280_BreakoutBME280_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_bme280_globals_table[] = { +static const mp_map_elem_t breakout_bme280_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_bme280) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutBME280), (mp_obj_t)&breakout_bme280_BreakoutBME280_type }, @@ -69,7 +69,7 @@ STATIC const mp_map_elem_t breakout_bme280_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_STANDBY_TIME_10_MS), MP_ROM_INT(BME280_STANDBY_TIME_10_MS) }, { MP_ROM_QSTR(MP_QSTR_STANDBY_TIME_20_MS), MP_ROM_INT(BME280_STANDBY_TIME_20_MS) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_bme280_globals, breakout_bme280_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_bme280_globals, breakout_bme280_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_bme280_user_cmodule = { diff --git a/micropython/modules/breakout_bme68x/breakout_bme68x.c b/micropython/modules/breakout_bme68x/breakout_bme68x.c index de1d958a..873c0e11 100644 --- a/micropython/modules/breakout_bme68x/breakout_bme68x.c +++ b/micropython/modules/breakout_bme68x/breakout_bme68x.c @@ -9,11 +9,11 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutBME68X_read_obj, 1, BreakoutBME68X_read); MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutBME68X_configure_obj, 1, BreakoutBME68X_configure); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutBME68X_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutBME68X_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&BreakoutBME68X_read_obj) }, { MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&BreakoutBME68X_configure_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutBME68X_locals_dict, BreakoutBME68X_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutBME68X_locals_dict, BreakoutBME68X_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -38,7 +38,7 @@ const mp_obj_type_t breakout_bme68x_BreakoutBME68X_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_bme68x_globals_table[] = { +static const mp_map_elem_t breakout_bme68x_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_bme68x) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutBME68X), (mp_obj_t)&breakout_bme68x_BreakoutBME68X_type }, @@ -81,7 +81,7 @@ STATIC const mp_map_elem_t breakout_bme68x_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C_ADDRESS_DEFAULT), MP_ROM_INT(BME68X_I2C_ADDR_LOW) }, { MP_ROM_QSTR(MP_QSTR_I2C_ADDRESS_ALT), MP_ROM_INT(BME68X_I2C_ADDR_HIGH) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_bme68x_globals, breakout_bme68x_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_bme68x_globals, breakout_bme68x_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_bme68x_user_cmodule = { diff --git a/micropython/modules/breakout_bmp280/breakout_bmp280.c b/micropython/modules/breakout_bmp280/breakout_bmp280.c index a3e0f115..fe905d16 100644 --- a/micropython/modules/breakout_bmp280/breakout_bmp280.c +++ b/micropython/modules/breakout_bmp280/breakout_bmp280.c @@ -9,11 +9,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutBMP280_read_obj, BreakoutBMP280_read); MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutBMP280_configure_obj, 1, BreakoutBMP280_configure); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutBMP280_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutBMP280_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&BreakoutBMP280_read_obj) }, { MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&BreakoutBMP280_configure_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutBMP280_locals_dict, BreakoutBMP280_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutBMP280_locals_dict, BreakoutBMP280_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -39,7 +39,7 @@ const mp_obj_type_t breakout_bmp280_BreakoutBMP280_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_bmp280_globals_table[] = { +static const mp_map_elem_t breakout_bmp280_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_bmp280) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutBMP280), (mp_obj_t)&breakout_bmp280_BreakoutBMP280_type }, @@ -69,7 +69,7 @@ STATIC const mp_map_elem_t breakout_bmp280_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_STANDBY_TIME_2000_MS), MP_ROM_INT(BMP280_ODR_2000_MS) }, { MP_ROM_QSTR(MP_QSTR_STANDBY_TIME_4000_MS), MP_ROM_INT(BMP280_ODR_4000_MS) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_bmp280_globals, breakout_bmp280_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_bmp280_globals, breakout_bmp280_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_bmp280_user_cmodule = { diff --git a/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.c b/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.c index 748864da..0f4a224d 100644 --- a/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.c +++ b/micropython/modules/breakout_dotmatrix/breakout_dotmatrix.c @@ -14,7 +14,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutDotMatrix_clear_obj, BreakoutDotMatrix_clear); MP_DEFINE_CONST_FUN_OBJ_1(BreakoutDotMatrix_show_obj, BreakoutDotMatrix_show); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutDotMatrix_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutDotMatrix_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_brightness), MP_ROM_PTR(&BreakoutDotMatrix_set_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_set_decimal), MP_ROM_PTR(&BreakoutDotMatrix_set_decimal_obj) }, { MP_ROM_QSTR(MP_QSTR_set_pixel), MP_ROM_PTR(&BreakoutDotMatrix_set_pixel_obj) }, @@ -25,7 +25,7 @@ STATIC const mp_rom_map_elem_t BreakoutDotMatrix_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(WIDTH) }, { MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_ROM_INT(HEIGHT) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutDotMatrix_locals_dict, BreakoutDotMatrix_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutDotMatrix_locals_dict, BreakoutDotMatrix_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -51,11 +51,11 @@ const mp_obj_type_t breakout_dotmatrix_BreakoutDotMatrix_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_dotmatrix_globals_table[] = { +static const mp_map_elem_t breakout_dotmatrix_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_dotmatrix) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutDotMatrix), (mp_obj_t)&breakout_dotmatrix_BreakoutDotMatrix_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_dotmatrix_globals, breakout_dotmatrix_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_dotmatrix_globals, breakout_dotmatrix_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_dotmatrix_user_cmodule = { diff --git a/micropython/modules/breakout_encoder/breakout_encoder.c b/micropython/modules/breakout_encoder/breakout_encoder.c index 806efdc6..820694d1 100644 --- a/micropython/modules/breakout_encoder/breakout_encoder.c +++ b/micropython/modules/breakout_encoder/breakout_encoder.c @@ -17,7 +17,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutEncoder_read_obj, BreakoutEncoder_read); MP_DEFINE_CONST_FUN_OBJ_1(BreakoutEncoder_clear_obj, BreakoutEncoder_clear); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutEncoder_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutEncoder_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_address), MP_ROM_PTR(&BreakoutEncoder_set_address_obj) }, { MP_ROM_QSTR(MP_QSTR_get_interrupt_flag), MP_ROM_PTR(&BreakoutEncoder_get_interrupt_flag_obj) }, { MP_ROM_QSTR(MP_QSTR_clear_interrupt_flag), MP_ROM_PTR(&BreakoutEncoder_clear_interrupt_flag_obj) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t BreakoutEncoder_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_DIRECTION_CW), MP_ROM_INT(1) }, { MP_ROM_QSTR(MP_QSTR_DIRECTION_CCW), MP_ROM_INT(0) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutEncoder_locals_dict, BreakoutEncoder_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutEncoder_locals_dict, BreakoutEncoder_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -57,11 +57,11 @@ const mp_obj_type_t breakout_encoder_BreakoutEncoder_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_encoder_globals_table[] = { +static const mp_map_elem_t breakout_encoder_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_encoder) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutEncoder), (mp_obj_t)&breakout_encoder_BreakoutEncoder_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_encoder_globals, breakout_encoder_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_encoder_globals, breakout_encoder_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_encoder_user_cmodule = { diff --git a/micropython/modules/breakout_encoder_wheel/breakout_encoder_wheel.c b/micropython/modules/breakout_encoder_wheel/breakout_encoder_wheel.c index 06e1de3c..5ce1ad39 100644 --- a/micropython/modules/breakout_encoder_wheel/breakout_encoder_wheel.c +++ b/micropython/modules/breakout_encoder_wheel/breakout_encoder_wheel.c @@ -31,7 +31,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutEncoderWheel_gpio_pwm_load_obj, 1, BreakoutEn MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutEncoderWheel_gpio_pwm_frequency_obj, 2, BreakoutEncoderWheel_gpio_pwm_frequency); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutEncoderWheel_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutEncoderWheel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_ioe_address), MP_ROM_PTR(&BreakoutEncoderWheel_set_ioe_address_obj) }, { MP_ROM_QSTR(MP_QSTR_get_interrupt_flag), MP_ROM_PTR(&BreakoutEncoderWheel_get_interrupt_flag_obj) }, { MP_ROM_QSTR(MP_QSTR_clear_interrupt_flag), MP_ROM_PTR(&BreakoutEncoderWheel_clear_interrupt_flag_obj) }, @@ -57,7 +57,7 @@ STATIC const mp_rom_map_elem_t BreakoutEncoderWheel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_gpio_pwm_load), MP_ROM_PTR(&BreakoutEncoderWheel_gpio_pwm_load_obj) }, { MP_ROM_QSTR(MP_QSTR_gpio_pwm_frequency), MP_ROM_PTR(&BreakoutEncoderWheel_gpio_pwm_frequency_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutEncoderWheel_locals_dict, BreakoutEncoderWheel_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutEncoderWheel_locals_dict, BreakoutEncoderWheel_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -88,7 +88,7 @@ const mp_rom_obj_tuple_t breakout_encoder_wheel_gpio_pins = { }; /***** Globals Table *****/ -STATIC const mp_rom_map_elem_t breakout_encoder_wheel_globals_table[] = { +static const mp_rom_map_elem_t breakout_encoder_wheel_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_encoder_wheel) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutEncoderWheel), (mp_obj_t)&breakout_encoder_wheel_BreakoutEncoderWheel_type }, @@ -111,7 +111,7 @@ STATIC const mp_rom_map_elem_t breakout_encoder_wheel_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_INT(9) }, { MP_ROM_QSTR(MP_QSTR_GPIOS), MP_ROM_PTR(&breakout_encoder_wheel_gpio_pins) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_encoder_wheel_globals, breakout_encoder_wheel_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_encoder_wheel_globals, breakout_encoder_wheel_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_encoder_wheel_user_cmodule = { diff --git a/micropython/modules/breakout_icp10125/breakout_icp10125.c b/micropython/modules/breakout_icp10125/breakout_icp10125.c index c3e10a96..b7936c07 100644 --- a/micropython/modules/breakout_icp10125/breakout_icp10125.c +++ b/micropython/modules/breakout_icp10125/breakout_icp10125.c @@ -9,7 +9,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutICP10125_measure_obj, 1, BreakoutICP10125_mea MP_DEFINE_CONST_FUN_OBJ_1(BreakoutICP10125_soft_reset_obj, BreakoutICP10125_soft_reset); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutICP10125_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutICP10125_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_measure), MP_ROM_PTR(&BreakoutICP10125_measure_obj) }, { MP_ROM_QSTR(MP_QSTR_soft_reset), MP_ROM_PTR(&BreakoutICP10125_soft_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_NORMAL), MP_ROM_INT(NORMAL) }, @@ -19,7 +19,7 @@ STATIC const mp_rom_map_elem_t BreakoutICP10125_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_STATUS_OK), MP_ROM_INT(OK) }, { MP_ROM_QSTR(MP_QSTR_STATUS_CRC_FAIL), MP_ROM_INT(CRC_FAIL) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutICP10125_locals_dict, BreakoutICP10125_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutICP10125_locals_dict, BreakoutICP10125_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -45,11 +45,11 @@ const mp_obj_type_t breakout_icp10125_BreakoutICP10125_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_icp10125_globals_table[] = { +static const mp_map_elem_t breakout_icp10125_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_breakout_icp10125) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutICP10125), (mp_obj_t)&breakout_icp10125_BreakoutICP10125_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_icp10125_globals, breakout_icp10125_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_icp10125_globals, breakout_icp10125_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_icp10125_user_cmodule = { diff --git a/micropython/modules/breakout_ioexpander/breakout_ioexpander.c b/micropython/modules/breakout_ioexpander/breakout_ioexpander.c index f43032fe..62abf9b3 100644 --- a/micropython/modules/breakout_ioexpander/breakout_ioexpander.c +++ b/micropython/modules/breakout_ioexpander/breakout_ioexpander.c @@ -28,7 +28,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutIOExpander_setup_rotary_encoder_obj, 4, Break MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutIOExpander_read_rotary_encoder_obj, 2, BreakoutIOExpander_read_rotary_encoder); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutIOExpander_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutIOExpander_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_get_chip_id), MP_ROM_PTR(&BreakoutIOExpander_get_chip_id_obj) }, { MP_ROM_QSTR(MP_QSTR_set_address), MP_ROM_PTR(&BreakoutIOExpander_set_address_obj) }, { MP_ROM_QSTR(MP_QSTR_get_adc_vref), MP_ROM_PTR(&BreakoutIOExpander_get_adc_vref_obj) }, @@ -60,7 +60,7 @@ STATIC const mp_rom_map_elem_t BreakoutIOExpander_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_LOW), MP_ROM_INT(IOE_LOW) }, { MP_ROM_QSTR(MP_QSTR_HIGH), MP_ROM_INT(IOE_HIGH) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutIOExpander_locals_dict, BreakoutIOExpander_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutIOExpander_locals_dict, BreakoutIOExpander_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -85,7 +85,7 @@ const mp_obj_type_t breakout_ioexpander_BreakoutIOExpander_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_ioexpander_globals_table[] = { +static const mp_map_elem_t breakout_ioexpander_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_ioexpander) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutIOExpander), (mp_obj_t)&breakout_ioexpander_BreakoutIOExpander_type }, { MP_ROM_QSTR(MP_QSTR_IN), MP_ROM_INT(IOE_PIN_IN) }, @@ -94,7 +94,7 @@ STATIC const mp_map_elem_t breakout_ioexpander_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_INT(IOE_PIN_PWM) }, { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_INT(IOE_PIN_ADC) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_ioexpander_globals, breakout_ioexpander_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_ioexpander_globals, breakout_ioexpander_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_ioexpander_user_cmodule = { diff --git a/micropython/modules/breakout_ltr559/breakout_ltr559.c b/micropython/modules/breakout_ltr559/breakout_ltr559.c index a02c56b1..a5678da3 100644 --- a/micropython/modules/breakout_ltr559/breakout_ltr559.c +++ b/micropython/modules/breakout_ltr559/breakout_ltr559.c @@ -20,7 +20,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutLTR559_proximity_measurement_rate_obj, 2, Bre MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutLTR559_proximity_offset_obj, 2, BreakoutLTR559_proximity_offset); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutLTR559_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutLTR559_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_part_id), MP_ROM_PTR(&BreakoutLTR559_part_id_obj) }, { MP_ROM_QSTR(MP_QSTR_revision_id), MP_ROM_PTR(&BreakoutLTR559_revision_id_obj) }, { MP_ROM_QSTR(MP_QSTR_manufacturer_id), MP_ROM_PTR(&BreakoutLTR559_manufacturer_id_obj) }, @@ -42,7 +42,7 @@ STATIC const mp_rom_map_elem_t BreakoutLTR559_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_RATIO), MP_ROM_INT(RATIO) }, { MP_ROM_QSTR(MP_QSTR_LUX), MP_ROM_INT(LUX) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutLTR559_locals_dict, BreakoutLTR559_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutLTR559_locals_dict, BreakoutLTR559_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -68,11 +68,11 @@ const mp_obj_type_t breakout_ltr559_BreakoutLTR559_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_ltr559_globals_table[] = { +static const mp_map_elem_t breakout_ltr559_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_ltr559) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutLTR559), (mp_obj_t)&breakout_ltr559_BreakoutLTR559_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_ltr559_globals, breakout_ltr559_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_ltr559_globals, breakout_ltr559_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_ltr559_user_cmodule = { diff --git a/micropython/modules/breakout_matrix11x7/breakout_matrix11x7.c b/micropython/modules/breakout_matrix11x7/breakout_matrix11x7.c index 85e5ba55..334bef32 100644 --- a/micropython/modules/breakout_matrix11x7/breakout_matrix11x7.c +++ b/micropython/modules/breakout_matrix11x7/breakout_matrix11x7.c @@ -10,14 +10,14 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutMatrix11x7_update_obj, BreakoutMatrix11x7_upda MP_DEFINE_CONST_FUN_OBJ_1(BreakoutMatrix11x7_clear_obj, BreakoutMatrix11x7_clear); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutMatrix11x7_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutMatrix11x7_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_pixel), MP_ROM_PTR(&BreakoutMatrix11x7_set_pixel_obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&BreakoutMatrix11x7_update_obj) }, { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&BreakoutMatrix11x7_clear_obj) }, { MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(WIDTH) }, { MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_ROM_INT(HEIGHT) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutMatrix11x7_locals_dict, BreakoutMatrix11x7_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutMatrix11x7_locals_dict, BreakoutMatrix11x7_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -43,11 +43,11 @@ const mp_obj_type_t breakout_matrix11x7_BreakoutMatrix11x7_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_matrix11x7_globals_table[] = { +static const mp_map_elem_t breakout_matrix11x7_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_matrix11x7) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutMatrix11x7), (mp_obj_t)&breakout_matrix11x7_BreakoutMatrix11x7_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_matrix11x7_globals, breakout_matrix11x7_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_matrix11x7_globals, breakout_matrix11x7_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_matrix11x7_user_cmodule = { diff --git a/micropython/modules/breakout_mics6814/breakout_mics6814.c b/micropython/modules/breakout_mics6814/breakout_mics6814.c index e127cb71..30d52137 100644 --- a/micropython/modules/breakout_mics6814/breakout_mics6814.c +++ b/micropython/modules/breakout_mics6814/breakout_mics6814.c @@ -23,7 +23,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutMICS6814_read_nh3_obj, BreakoutMICS6814_read_n MP_DEFINE_CONST_FUN_OBJ_1(BreakoutMICS6814_read_oxidising_obj, BreakoutMICS6814_read_oxidising); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutMICS6814_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutMICS6814_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_address), MP_ROM_PTR(&BreakoutMICS6814_set_address_obj) }, { MP_ROM_QSTR(MP_QSTR_get_adc_vref), MP_ROM_PTR(&BreakoutMICS6814_get_adc_vref_obj) }, { MP_ROM_QSTR(MP_QSTR_set_adc_vref), MP_ROM_PTR(&BreakoutMICS6814_set_adc_vref_obj) }, @@ -45,7 +45,7 @@ STATIC const mp_rom_map_elem_t BreakoutMICS6814_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_NH3), MP_ROM_INT(NH3) }, { MP_ROM_QSTR(MP_QSTR_OXIDISING), MP_ROM_INT(OXIDISING) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutMICS6814_locals_dict, BreakoutMICS6814_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutMICS6814_locals_dict, BreakoutMICS6814_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -71,11 +71,11 @@ const mp_obj_type_t breakout_mics6814_BreakoutMICS6814_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_mics6814_globals_table[] = { +static const mp_map_elem_t breakout_mics6814_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_mics6814) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutMICS6814), (mp_obj_t)&breakout_mics6814_BreakoutMICS6814_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_mics6814_globals, breakout_mics6814_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_mics6814_globals, breakout_mics6814_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_mics6814_user_cmodule = { diff --git a/micropython/modules/breakout_mlx90640/mlx90640.c b/micropython/modules/breakout_mlx90640/mlx90640.c index 5877b4f7..4094d915 100644 --- a/micropython/modules/breakout_mlx90640/mlx90640.c +++ b/micropython/modules/breakout_mlx90640/mlx90640.c @@ -4,11 +4,11 @@ MP_DEFINE_CONST_FUN_OBJ_2(MLX90640_setup_obj, MLX90640_setup); MP_DEFINE_CONST_FUN_OBJ_1(MLX90640_get_frame_obj, MLX90640_get_frame); -STATIC const mp_rom_map_elem_t MLX90640_locals_dict_table[] = { +static const mp_rom_map_elem_t MLX90640_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_setup), MP_ROM_PTR(&MLX90640_setup_obj) }, { MP_ROM_QSTR(MP_QSTR_get_frame), MP_ROM_PTR(&MLX90640_get_frame_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(MLX90640_locals_dict, MLX90640_locals_dict_table); +static MP_DEFINE_CONST_DICT(MLX90640_locals_dict, MLX90640_locals_dict_table); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -27,11 +27,11 @@ const mp_obj_type_t MLX90640_MLX90640_type = { }; #endif -STATIC const mp_map_elem_t MLX90640_globals_table[] = { +static const mp_map_elem_t MLX90640_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_msa301) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MLX90640), (mp_obj_t)&MLX90640_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_MLX90640_globals, MLX90640_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_MLX90640_globals, MLX90640_globals_table); const mp_obj_module_t MLX90640_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/breakout_msa301/breakout_msa301.c b/micropython/modules/breakout_msa301/breakout_msa301.c index afbfcea2..da1beead 100644 --- a/micropython/modules/breakout_msa301/breakout_msa301.c +++ b/micropython/modules/breakout_msa301/breakout_msa301.c @@ -20,7 +20,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutMSA301_set_interrupt_latch_obj, 3, BreakoutMS MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutMSA301_read_interrupt_obj, 2, BreakoutMSA301_read_interrupt); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutMSA301_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutMSA301_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_part_id), MP_ROM_PTR(&BreakoutMSA301_part_id_obj) }, { MP_ROM_QSTR(MP_QSTR_get_axis), MP_ROM_PTR(&BreakoutMSA301_get_axis_obj) }, { MP_ROM_QSTR(MP_QSTR_get_x_axis), MP_ROM_PTR(&BreakoutMSA301_get_x_axis_obj) }, @@ -78,7 +78,7 @@ STATIC const mp_rom_map_elem_t BreakoutMSA301_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_LATCH_4S), MP_ROM_INT(MSA_LATCH_4S) }, { MP_ROM_QSTR(MP_QSTR_LATCH_8S), MP_ROM_INT(MSA_LATCH_8S) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutMSA301_locals_dict, BreakoutMSA301_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutMSA301_locals_dict, BreakoutMSA301_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -104,11 +104,11 @@ const mp_obj_type_t breakout_msa301_BreakoutMSA301_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_msa301_globals_table[] = { +static const mp_map_elem_t breakout_msa301_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_msa301) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutMSA301), (mp_obj_t)&breakout_msa301_BreakoutMSA301_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_msa301_globals, breakout_msa301_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_msa301_globals, breakout_msa301_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_msa301_user_cmodule = { diff --git a/micropython/modules/breakout_pmw3901/breakout_paa5100.c b/micropython/modules/breakout_pmw3901/breakout_paa5100.c index 2589ee81..047c802c 100644 --- a/micropython/modules/breakout_pmw3901/breakout_paa5100.c +++ b/micropython/modules/breakout_pmw3901/breakout_paa5100.c @@ -14,7 +14,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutPAA5100_get_motion_slow_obj, 1, BreakoutPMW39 MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutPAA5100_frame_capture_obj, 2, BreakoutPMW3901_frame_capture); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutPAA5100_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutPAA5100_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_get_id), MP_ROM_PTR(&BreakoutPAA5100_get_id_obj) }, { MP_ROM_QSTR(MP_QSTR_get_revision), MP_ROM_PTR(&BreakoutPAA5100_get_revision_obj) }, { MP_ROM_QSTR(MP_QSTR_set_rotation), MP_ROM_PTR(&BreakoutPAA5100_set_rotation_obj) }, @@ -29,7 +29,7 @@ STATIC const mp_rom_map_elem_t BreakoutPAA5100_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_FRAME_SIZE), MP_ROM_INT(35) }, { MP_ROM_QSTR(MP_QSTR_FRAME_BYTES), MP_ROM_INT(1225) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutPAA5100_locals_dict, BreakoutPAA5100_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutPAA5100_locals_dict, BreakoutPAA5100_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -56,11 +56,11 @@ const mp_obj_type_t breakout_paa5100_BreakoutPAA5100_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_paa5100_globals_table[] = { +static const mp_map_elem_t breakout_paa5100_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_paa5100) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutPAA5100), (mp_obj_t)&breakout_paa5100_BreakoutPAA5100_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_paa5100_globals, breakout_paa5100_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_paa5100_globals, breakout_paa5100_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_paa5100_user_cmodule = { diff --git a/micropython/modules/breakout_pmw3901/breakout_pmw3901.c b/micropython/modules/breakout_pmw3901/breakout_pmw3901.c index 92cf4eec..3ba9dd23 100644 --- a/micropython/modules/breakout_pmw3901/breakout_pmw3901.c +++ b/micropython/modules/breakout_pmw3901/breakout_pmw3901.c @@ -14,7 +14,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutPMW3901_get_motion_slow_obj, 1, BreakoutPMW39 MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutPMW3901_frame_capture_obj, 2, BreakoutPMW3901_frame_capture); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutPMW3901_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutPMW3901_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_get_id), MP_ROM_PTR(&BreakoutPMW3901_get_id_obj) }, { MP_ROM_QSTR(MP_QSTR_get_revision), MP_ROM_PTR(&BreakoutPMW3901_get_revision_obj) }, { MP_ROM_QSTR(MP_QSTR_set_rotation), MP_ROM_PTR(&BreakoutPMW3901_set_rotation_obj) }, @@ -29,7 +29,7 @@ STATIC const mp_rom_map_elem_t BreakoutPMW3901_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_FRAME_SIZE), MP_ROM_INT(35) }, { MP_ROM_QSTR(MP_QSTR_FRAME_BYTES), MP_ROM_INT(1225) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutPMW3901_locals_dict, BreakoutPMW3901_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutPMW3901_locals_dict, BreakoutPMW3901_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -56,11 +56,11 @@ const mp_obj_type_t breakout_pmw3901_BreakoutPMW3901_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_pmw3901_globals_table[] = { +static const mp_map_elem_t breakout_pmw3901_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_pmw3901) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutPMW3901), (mp_obj_t)&breakout_pmw3901_BreakoutPMW3901_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_pmw3901_globals, breakout_pmw3901_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_pmw3901_globals, breakout_pmw3901_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_pmw3901_user_cmodule = { diff --git a/micropython/modules/breakout_potentiometer/breakout_potentiometer.c b/micropython/modules/breakout_potentiometer/breakout_potentiometer.c index 1ce3b918..7bf20c29 100644 --- a/micropython/modules/breakout_potentiometer/breakout_potentiometer.c +++ b/micropython/modules/breakout_potentiometer/breakout_potentiometer.c @@ -16,7 +16,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutPotentiometer_read_obj, BreakoutPotentiometer_ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutPotentiometer_read_raw_obj, BreakoutPotentiometer_read_raw); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutPotentiometer_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutPotentiometer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_address), MP_ROM_PTR(&BreakoutPotentiometer_set_address_obj) }, { MP_ROM_QSTR(MP_QSTR_get_adc_vref), MP_ROM_PTR(&BreakoutPotentiometer_get_adc_vref_obj) }, { MP_ROM_QSTR(MP_QSTR_set_adc_vref), MP_ROM_PTR(&BreakoutPotentiometer_set_adc_vref_obj) }, @@ -29,7 +29,7 @@ STATIC const mp_rom_map_elem_t BreakoutPotentiometer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_DIRECTION_CW), MP_ROM_INT(1) }, { MP_ROM_QSTR(MP_QSTR_DIRECTION_CCW), MP_ROM_INT(0) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutPotentiometer_locals_dict, BreakoutPotentiometer_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutPotentiometer_locals_dict, BreakoutPotentiometer_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -55,11 +55,11 @@ const mp_obj_type_t breakout_potentiometer_BreakoutPotentiometer_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_potentiometer_globals_table[] = { +static const mp_map_elem_t breakout_potentiometer_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_potentiometer) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutPotentiometer), (mp_obj_t)&breakout_potentiometer_BreakoutPotentiometer_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_potentiometer_globals, breakout_potentiometer_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_potentiometer_globals, breakout_potentiometer_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_potentiometer_user_cmodule = { diff --git a/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.c b/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.c index 652bb883..e8e685b6 100644 --- a/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.c +++ b/micropython/modules/breakout_rgbmatrix5x5/breakout_rgbmatrix5x5.c @@ -10,14 +10,14 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutRGBMatrix5x5_update_obj, BreakoutRGBMatrix5x5_ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutRGBMatrix5x5_clear_obj, BreakoutRGBMatrix5x5_clear); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutRGBMatrix5x5_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutRGBMatrix5x5_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_pixel), MP_ROM_PTR(&BreakoutRGBMatrix5x5_set_pixel_obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&BreakoutRGBMatrix5x5_update_obj) }, { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&BreakoutRGBMatrix5x5_clear_obj) }, { MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(WIDTH) }, { MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_ROM_INT(HEIGHT) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutRGBMatrix5x5_locals_dict, BreakoutRGBMatrix5x5_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutRGBMatrix5x5_locals_dict, BreakoutRGBMatrix5x5_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -43,11 +43,11 @@ const mp_obj_type_t breakout_rgbmatrix5x5_BreakoutRGBMatrix5x5_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_rgbmatrix5x5_globals_table[] = { +static const mp_map_elem_t breakout_rgbmatrix5x5_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_rgbmatrix5x5) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutRGBMatrix5x5), (mp_obj_t)&breakout_rgbmatrix5x5_BreakoutRGBMatrix5x5_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_rgbmatrix5x5_globals, breakout_rgbmatrix5x5_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_rgbmatrix5x5_globals, breakout_rgbmatrix5x5_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_rgbmatrix5x5_user_cmodule = { diff --git a/micropython/modules/breakout_rtc/breakout_rtc.c b/micropython/modules/breakout_rtc/breakout_rtc.c index 33dedf67..dea7454d 100644 --- a/micropython/modules/breakout_rtc/breakout_rtc.c +++ b/micropython/modules/breakout_rtc/breakout_rtc.c @@ -72,7 +72,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(BreakoutRTC_status_obj, BreakoutRTC_status); MP_DEFINE_CONST_FUN_OBJ_1(BreakoutRTC_clear_interrupts_obj, BreakoutRTC_clear_interrupts); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutRTC_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutRTC_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&BreakoutRTC_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_setup), MP_ROM_PTR(&BreakoutRTC_setup_obj) }, { MP_ROM_QSTR(MP_QSTR_set_time), MP_ROM_PTR(&BreakoutRTC_set_time_obj) }, @@ -133,7 +133,7 @@ STATIC const mp_rom_map_elem_t BreakoutRTC_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_TCR_9K), MP_ROM_INT(MP_TCR_9K) }, { MP_ROM_QSTR(MP_QSTR_TCR_15K), MP_ROM_INT(MP_TCR_15K) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutRTC_locals_dict, BreakoutRTC_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutRTC_locals_dict, BreakoutRTC_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -158,11 +158,11 @@ const mp_obj_type_t breakout_rtc_BreakoutRTC_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_rtc_globals_table[] = { +static const mp_map_elem_t breakout_rtc_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_rtc) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutRTC), (mp_obj_t)&breakout_rtc_BreakoutRTC_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_rtc_globals, breakout_rtc_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_rtc_globals, breakout_rtc_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_rtc_user_cmodule = { diff --git a/micropython/modules/breakout_scd41/breakout_scd41.c b/micropython/modules/breakout_scd41/breakout_scd41.c index 61a0d8b9..1ef15d87 100755 --- a/micropython/modules/breakout_scd41/breakout_scd41.c +++ b/micropython/modules/breakout_scd41/breakout_scd41.c @@ -9,24 +9,24 @@ /***** Module Functions *****/ // Init, optionally (though you really should supply it) accepts a PimoroniI2C instance -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(scd41_init_obj, 0, scd41_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(scd41_init_obj, 0, scd41_init); // Start/Stop measurement, no args (module-level, so no "self") -STATIC MP_DEFINE_CONST_FUN_OBJ_0(scd41_start_periodic_measurement_obj, scd41_start_periodic_measurement); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(scd41_stop_periodic_measurement_obj, scd41_stop_periodic_measurement); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(scd41_get_data_ready_obj, scd41_get_data_ready); +static MP_DEFINE_CONST_FUN_OBJ_0(scd41_start_periodic_measurement_obj, scd41_start_periodic_measurement); +static MP_DEFINE_CONST_FUN_OBJ_0(scd41_stop_periodic_measurement_obj, scd41_stop_periodic_measurement); +static MP_DEFINE_CONST_FUN_OBJ_0(scd41_get_data_ready_obj, scd41_get_data_ready); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(scd41_set_temperature_offset_obj, scd41_set_temperature_offset); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(scd41_get_temperature_offset_obj, scd41_get_temperature_offset); +static MP_DEFINE_CONST_FUN_OBJ_1(scd41_set_temperature_offset_obj, scd41_set_temperature_offset); +static MP_DEFINE_CONST_FUN_OBJ_0(scd41_get_temperature_offset_obj, scd41_get_temperature_offset); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(scd41_set_sensor_altitude_obj, scd41_set_sensor_altitude); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(scd41_set_ambient_pressure_obj, scd41_set_ambient_pressure); +static MP_DEFINE_CONST_FUN_OBJ_1(scd41_set_sensor_altitude_obj, scd41_set_sensor_altitude); +static MP_DEFINE_CONST_FUN_OBJ_1(scd41_set_ambient_pressure_obj, scd41_set_ambient_pressure); // No args here, either, we're home free! -STATIC MP_DEFINE_CONST_FUN_OBJ_0(scd41_read_measurement_obj, scd41_read_measurement); +static MP_DEFINE_CONST_FUN_OBJ_0(scd41_read_measurement_obj, scd41_read_measurement); /***** Globals Table *****/ -STATIC const mp_map_elem_t scd41_globals_table[] = { +static const mp_map_elem_t scd41_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_breakout_scd41) }, { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&scd41_init_obj) }, { MP_ROM_QSTR(MP_QSTR_start), MP_ROM_PTR(&scd41_start_periodic_measurement_obj) }, @@ -40,7 +40,7 @@ STATIC const mp_map_elem_t scd41_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_set_sensor_altitude), MP_ROM_PTR(&scd41_set_sensor_altitude_obj) }, { MP_ROM_QSTR(MP_QSTR_set_ambient_pressure), MP_ROM_PTR(&scd41_set_ambient_pressure_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_scd41_globals, scd41_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_scd41_globals, scd41_globals_table); /***** Module Definition *****/ const mp_obj_module_t scd41_user_cmodule = { diff --git a/micropython/modules/breakout_sgp30/breakout_sgp30.c b/micropython/modules/breakout_sgp30/breakout_sgp30.c index 805db368..98344996 100644 --- a/micropython/modules/breakout_sgp30/breakout_sgp30.c +++ b/micropython/modules/breakout_sgp30/breakout_sgp30.c @@ -16,7 +16,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutSGP30_set_baseline_obj, 3,BreakoutSGP30_set_b MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutSGP30_set_humidity_obj, 2, BreakoutSGP30_set_humidity); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutSGP30_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutSGP30_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_retrieve_unique_id), MP_ROM_PTR(&BreakoutSGP30_retrieve_unique_id_obj) }, { MP_ROM_QSTR(MP_QSTR_get_unique_id), MP_ROM_PTR(&BreakoutSGP30_get_unique_id_obj) }, { MP_ROM_QSTR(MP_QSTR_start_measurement), MP_ROM_PTR(&BreakoutSGP30_start_measurement_obj) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t BreakoutSGP30_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_H2), MP_ROM_INT(H2) }, { MP_ROM_QSTR(MP_QSTR_ETHANOL), MP_ROM_INT(ETHANOL) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutSGP30_locals_dict, BreakoutSGP30_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutSGP30_locals_dict, BreakoutSGP30_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -57,11 +57,11 @@ const mp_obj_type_t breakout_sgp30_BreakoutSGP30_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_sgp30_globals_table[] = { +static const mp_map_elem_t breakout_sgp30_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_breakout_sgp30) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutSGP30), (mp_obj_t)&breakout_sgp30_BreakoutSGP30_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_sgp30_globals, breakout_sgp30_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_sgp30_globals, breakout_sgp30_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_sgp30_user_cmodule = { diff --git a/micropython/modules/breakout_trackball/breakout_trackball.c b/micropython/modules/breakout_trackball/breakout_trackball.c index 32ba5d52..d5e36c3a 100644 --- a/micropython/modules/breakout_trackball/breakout_trackball.c +++ b/micropython/modules/breakout_trackball/breakout_trackball.c @@ -16,7 +16,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(BreakoutTrackball_set_white_obj, 1, BreakoutTrackball MP_DEFINE_CONST_FUN_OBJ_1(BreakoutTrackball_read_obj, BreakoutTrackball_read); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t BreakoutTrackball_locals_dict_table[] = { +static const mp_rom_map_elem_t BreakoutTrackball_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_change_address), MP_ROM_PTR(&BreakoutTrackball_change_address_obj) }, { MP_ROM_QSTR(MP_QSTR_enable_interrupt), MP_ROM_PTR(&BreakoutTrackball_enable_interrupt_obj) }, { MP_ROM_QSTR(MP_QSTR_get_interrupt), MP_ROM_PTR(&BreakoutTrackball_get_interrupt_obj) }, @@ -33,7 +33,7 @@ STATIC const mp_rom_map_elem_t BreakoutTrackball_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SW_CHANGED), MP_ROM_INT(SW_CHANGED) }, { MP_ROM_QSTR(MP_QSTR_SW_PRESSED), MP_ROM_INT(SW_PRESSED) }, }; -STATIC MP_DEFINE_CONST_DICT(BreakoutTrackball_locals_dict, BreakoutTrackball_locals_dict_table); +static MP_DEFINE_CONST_DICT(BreakoutTrackball_locals_dict, BreakoutTrackball_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -59,11 +59,11 @@ const mp_obj_type_t breakout_trackball_BreakoutTrackball_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t breakout_trackball_globals_table[] = { +static const mp_map_elem_t breakout_trackball_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_trackball) }, { MP_OBJ_NEW_QSTR(MP_QSTR_BreakoutTrackball), (mp_obj_t)&breakout_trackball_BreakoutTrackball_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_breakout_trackball_globals, breakout_trackball_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_breakout_trackball_globals, breakout_trackball_globals_table); /***** Module Definition *****/ const mp_obj_module_t breakout_trackball_user_cmodule = { diff --git a/micropython/modules/breakout_vl53l5cx/vl53l5cx.c b/micropython/modules/breakout_vl53l5cx/vl53l5cx.c index 5515725f..ff3bf80a 100644 --- a/micropython/modules/breakout_vl53l5cx/vl53l5cx.c +++ b/micropython/modules/breakout_vl53l5cx/vl53l5cx.c @@ -23,7 +23,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(VL53L5CX_get_data_obj, VL53L5CX_get_data); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t VL53L5CX_locals_dict_table[] = { +static const mp_rom_map_elem_t VL53L5CX_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&VL53L5CX___del___obj) }, { MP_ROM_QSTR(MP_QSTR_start_ranging), MP_ROM_PTR(&VL53L5CX_start_ranging_obj) }, @@ -44,7 +44,7 @@ STATIC const mp_rom_map_elem_t VL53L5CX_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_data_ready), MP_ROM_PTR(&VL53L5CX_data_ready_obj) }, { MP_ROM_QSTR(MP_QSTR_get_data), MP_ROM_PTR(&VL53L5CX_get_data_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(VL53L5CX_locals_dict, VL53L5CX_locals_dict_table); +static MP_DEFINE_CONST_DICT(VL53L5CX_locals_dict, VL53L5CX_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -65,7 +65,7 @@ const mp_obj_type_t VL53L5CX_type = { #endif /***** Module Globals *****/ -STATIC const mp_map_elem_t vl53l5cx_globals_table[] = { +static const mp_map_elem_t vl53l5cx_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_breakout_vl53l5cx) }, { MP_OBJ_NEW_QSTR(MP_QSTR_VL53L5CX), (mp_obj_t)&VL53L5CX_type }, @@ -81,7 +81,7 @@ STATIC const mp_map_elem_t vl53l5cx_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_POWER_MODE_SLEEP), MP_ROM_INT(VL53L5CX_POWER_MODE_SLEEP) }, { MP_ROM_QSTR(MP_QSTR_POWER_MODE_WAKEUP), MP_ROM_INT(VL53L5CX_POWER_MODE_WAKEUP) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_vl53l5cx_globals, vl53l5cx_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_vl53l5cx_globals, vl53l5cx_globals_table); /***** Module Definition *****/ const mp_obj_module_t vl53l5cx_user_cmodule = { diff --git a/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp b/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp index c9233a69..18f9b4c5 100644 --- a/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp +++ b/micropython/modules/breakout_vl53l5cx/vl53l5cx.cpp @@ -256,7 +256,7 @@ mp_obj_t VL53L5CX_get_data(mp_obj_t self_in) { tuple_motion_data[i] = mp_obj_new_int(results->motion_indicator.motion[i]); } - STATIC const qstr tuple_motion_fields[] = {MP_QSTR_global_indicator_1, MP_QSTR_global_indicator_2, MP_QSTR_motion}; + static const qstr tuple_motion_fields[] = {MP_QSTR_global_indicator_1, MP_QSTR_global_indicator_2, MP_QSTR_motion}; mp_obj_t tuple_motion[] = { mp_obj_new_int(results->motion_indicator.global_indicator_1), @@ -273,9 +273,9 @@ mp_obj_t VL53L5CX_get_data(mp_obj_t self_in) { mp_obj_new_tuple(tuple_size, tuple_reflectance) // Full reflectange results }; - STATIC const qstr tuple_fields[] = {MP_QSTR_distance_avg, MP_QSTR_reflectance_avg, MP_QSTR_motion_indicator, MP_QSTR_results, MP_QSTR_distance, MP_QSTR_reflectance}; + static const qstr tuple_fields[] = {MP_QSTR_distance_avg, MP_QSTR_reflectance_avg, MP_QSTR_motion_indicator, MP_QSTR_results, MP_QSTR_distance, MP_QSTR_reflectance}; return mp_obj_new_attrtuple(tuple_fields, sizeof(tuple) / sizeof(mp_obj_t), tuple); } -} \ No newline at end of file +} diff --git a/micropython/modules/cosmic_unicorn/cosmic_unicorn.c b/micropython/modules/cosmic_unicorn/cosmic_unicorn.c index 94e5401d..f644ccab 100644 --- a/micropython/modules/cosmic_unicorn/cosmic_unicorn.c +++ b/micropython/modules/cosmic_unicorn/cosmic_unicorn.c @@ -35,7 +35,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(CosmicUnicorn_stop_playing_obj, CosmicUnicorn_stop_pla MP_DEFINE_CONST_FUN_OBJ_2(CosmicUnicorn_synth_channel_obj, CosmicUnicorn_synth_channel); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Channel_locals_dict_table[] = { +static const mp_rom_map_elem_t Channel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Channel___del___obj) }, { MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&Channel_configure_obj) }, { MP_ROM_QSTR(MP_QSTR_restore), MP_ROM_PTR(&Channel_restore_obj) }, @@ -59,7 +59,7 @@ STATIC const mp_rom_map_elem_t Channel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_WAVE), MP_ROM_INT(1) }, }; -STATIC const mp_rom_map_elem_t CosmicUnicorn_locals_dict_table[] = { +static const mp_rom_map_elem_t CosmicUnicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&CosmicUnicorn___del___obj) }, { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&CosmicUnicorn_clear_obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&CosmicUnicorn_update_obj) }, @@ -90,8 +90,8 @@ STATIC const mp_rom_map_elem_t CosmicUnicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SWITCH_BRIGHTNESS_DOWN), MP_ROM_INT(26) }, }; -STATIC MP_DEFINE_CONST_DICT(Channel_locals_dict, Channel_locals_dict_table); -STATIC MP_DEFINE_CONST_DICT(CosmicUnicorn_locals_dict, CosmicUnicorn_locals_dict_table); +static MP_DEFINE_CONST_DICT(Channel_locals_dict, Channel_locals_dict_table); +static MP_DEFINE_CONST_DICT(CosmicUnicorn_locals_dict, CosmicUnicorn_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -131,12 +131,12 @@ const mp_obj_type_t CosmicUnicorn_type = { #endif /***** Globals Table *****/ -STATIC const mp_map_elem_t cosmic_globals_table[] = { +static const mp_map_elem_t cosmic_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_cosmic) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Channel), (mp_obj_t)&Channel_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_CosmicUnicorn), (mp_obj_t)&CosmicUnicorn_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_cosmic_globals, cosmic_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_cosmic_globals, cosmic_globals_table); /***** Module Definition *****/ const mp_obj_module_t cosmic_user_cmodule = { diff --git a/micropython/modules/cppmem/cppmem.c b/micropython/modules/cppmem/cppmem.c index d2d43cf6..4bb6c6b2 100644 --- a/micropython/modules/cppmem/cppmem.c +++ b/micropython/modules/cppmem/cppmem.c @@ -1,12 +1,12 @@ #include "cppmem.h" -STATIC MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_alloc_bytes_obj, cpp_mem_get_alloc_bytes); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_alloc_count_obj, cpp_mem_get_alloc_count); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_free_count_obj, cpp_mem_get_free_count); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(cpp_mem_set_allocator_mode_obj, cpp_mem_set_allocator_mode); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_allocator_mode_obj, cpp_mem_get_allocator_mode); +static MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_alloc_bytes_obj, cpp_mem_get_alloc_bytes); +static MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_alloc_count_obj, cpp_mem_get_alloc_count); +static MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_free_count_obj, cpp_mem_get_free_count); +static MP_DEFINE_CONST_FUN_OBJ_1(cpp_mem_set_allocator_mode_obj, cpp_mem_set_allocator_mode); +static MP_DEFINE_CONST_FUN_OBJ_0(cpp_mem_get_allocator_mode_obj, cpp_mem_get_allocator_mode); -STATIC const mp_map_elem_t cppmem_globals_table[] = { +static const mp_map_elem_t cppmem_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cppmem) }, { MP_ROM_QSTR(MP_QSTR_alloc_bytes), MP_ROM_PTR(&cpp_mem_get_alloc_bytes_obj) }, { MP_ROM_QSTR(MP_QSTR_alloc_count), MP_ROM_PTR(&cpp_mem_get_alloc_count_obj) }, @@ -16,7 +16,7 @@ STATIC const mp_map_elem_t cppmem_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_FIXED_HEAP), MP_ROM_INT(0) }, { MP_ROM_QSTR(MP_QSTR_MICROPYTHON), MP_ROM_INT(1) } }; -STATIC MP_DEFINE_CONST_DICT(mp_module_cppmem_globals, cppmem_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_cppmem_globals, cppmem_globals_table); const mp_obj_module_t cppmem_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/encoder/encoder.c b/micropython/modules/encoder/encoder.c index 4756d128..e0bd2328 100644 --- a/micropython/modules/encoder/encoder.c +++ b/micropython/modules/encoder/encoder.c @@ -19,7 +19,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(Encoder_counts_per_rev_obj, 1, Encoder_counts_per_rev MP_DEFINE_CONST_FUN_OBJ_1(Encoder_capture_obj, Encoder_capture); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Encoder_locals_dict_table[] = { +static const mp_rom_map_elem_t Encoder_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Encoder___del___obj) }, { MP_ROM_QSTR(MP_QSTR_pins), MP_ROM_PTR(&Encoder_pins_obj) }, { MP_ROM_QSTR(MP_QSTR_common_pin), MP_ROM_PTR(&Encoder_common_pin_obj) }, @@ -37,7 +37,7 @@ STATIC const mp_rom_map_elem_t Encoder_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_capture), MP_ROM_PTR(&Encoder_capture_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(Encoder_locals_dict, Encoder_locals_dict_table); +static MP_DEFINE_CONST_DICT(Encoder_locals_dict, Encoder_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -60,14 +60,14 @@ const mp_obj_type_t Encoder_type = { #endif /***** Globals Table *****/ -STATIC const mp_map_elem_t encoder_globals_table[] = { +static const mp_map_elem_t encoder_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_encoder) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Encoder), (mp_obj_t)&Encoder_type }, { MP_ROM_QSTR(MP_QSTR_MMME_CPR), MP_ROM_INT(12) }, { MP_ROM_QSTR(MP_QSTR_ROTARY_CPR), MP_ROM_INT(24) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_encoder_globals, encoder_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_encoder_globals, encoder_globals_table); /***** Module Definition *****/ const mp_obj_module_t encoder_user_cmodule = { diff --git a/micropython/modules/encoder/encoder.cpp b/micropython/modules/encoder/encoder.cpp index ae74c300..4505d133 100644 --- a/micropython/modules/encoder/encoder.cpp +++ b/micropython/modules/encoder/encoder.cpp @@ -299,7 +299,7 @@ extern mp_obj_t Encoder_capture(mp_obj_t self_in) { mp_obj_new_float(capture.radians_per_second()), }; - STATIC const qstr tuple_fields[] = { + static const qstr tuple_fields[] = { MP_QSTR_count, MP_QSTR_delta, MP_QSTR_frequency, diff --git a/micropython/modules/galactic_unicorn/galactic_unicorn.c b/micropython/modules/galactic_unicorn/galactic_unicorn.c index ec028417..dad5bdea 100644 --- a/micropython/modules/galactic_unicorn/galactic_unicorn.c +++ b/micropython/modules/galactic_unicorn/galactic_unicorn.c @@ -35,7 +35,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(GalacticUnicorn_stop_playing_obj, GalacticUnicorn_stop MP_DEFINE_CONST_FUN_OBJ_2(GalacticUnicorn_synth_channel_obj, GalacticUnicorn_synth_channel); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Channel_locals_dict_table[] = { +static const mp_rom_map_elem_t Channel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Channel___del___obj) }, { MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&Channel_configure_obj) }, { MP_ROM_QSTR(MP_QSTR_restore), MP_ROM_PTR(&Channel_restore_obj) }, @@ -59,7 +59,7 @@ STATIC const mp_rom_map_elem_t Channel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_WAVE), MP_ROM_INT(1) }, }; -STATIC const mp_rom_map_elem_t GalacticUnicorn_locals_dict_table[] = { +static const mp_rom_map_elem_t GalacticUnicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&GalacticUnicorn___del___obj) }, { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&GalacticUnicorn_clear_obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&GalacticUnicorn_update_obj) }, @@ -90,8 +90,8 @@ STATIC const mp_rom_map_elem_t GalacticUnicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SWITCH_BRIGHTNESS_DOWN), MP_ROM_INT(26) }, }; -STATIC MP_DEFINE_CONST_DICT(Channel_locals_dict, Channel_locals_dict_table); -STATIC MP_DEFINE_CONST_DICT(GalacticUnicorn_locals_dict, GalacticUnicorn_locals_dict_table); +static MP_DEFINE_CONST_DICT(Channel_locals_dict, Channel_locals_dict_table); +static MP_DEFINE_CONST_DICT(GalacticUnicorn_locals_dict, GalacticUnicorn_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -131,12 +131,12 @@ const mp_obj_type_t GalacticUnicorn_type = { #endif /***** Globals Table *****/ -STATIC const mp_map_elem_t galactic_globals_table[] = { +static const mp_map_elem_t galactic_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_galactic) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Channel), (mp_obj_t)&Channel_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_GalacticUnicorn), (mp_obj_t)&GalacticUnicorn_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_galactic_globals, galactic_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_galactic_globals, galactic_globals_table); /***** Module Definition *****/ const mp_obj_module_t galactic_user_cmodule = { diff --git a/micropython/modules/hub75/hub75.c b/micropython/modules/hub75/hub75.c index 855dc366..50781df8 100644 --- a/micropython/modules/hub75/hub75.c +++ b/micropython/modules/hub75/hub75.c @@ -11,7 +11,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(Hub75_update_obj, Hub75_update); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Hub75_locals_dict_table[] = { +static const mp_rom_map_elem_t Hub75_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Hub75___del___obj) }, { MP_ROM_QSTR(MP_QSTR_set_pixel), MP_ROM_PTR(&Hub75_set_pixel_obj) }, { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&Hub75_clear_obj) }, @@ -20,7 +20,7 @@ STATIC const mp_rom_map_elem_t Hub75_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&Hub75_update_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(Hub75_locals_dict, Hub75_locals_dict_table); +static MP_DEFINE_CONST_DICT(Hub75_locals_dict, Hub75_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -44,7 +44,7 @@ const mp_obj_type_t Hub75_type = { /***** Globals Table *****/ -STATIC const mp_map_elem_t hub75_globals_table[] = { +static const mp_map_elem_t hub75_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_hub75) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Hub75), (mp_obj_t)&Hub75_type }, { MP_ROM_QSTR(MP_QSTR_PANEL_GENERIC), MP_ROM_INT(0) }, @@ -69,7 +69,7 @@ STATIC const mp_map_elem_t hub75_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_BRG), MP_ROM_INT(0x04) }, { MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_BGR), MP_ROM_INT(0x05) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_hub75_globals, hub75_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_hub75_globals, hub75_globals_table); /***** Module Definition *****/ const mp_obj_module_t hub75_user_cmodule = { diff --git a/micropython/modules/jpegdec/jpegdec.c b/micropython/modules/jpegdec/jpegdec.c index 85dfade9..41825260 100644 --- a/micropython/modules/jpegdec/jpegdec.c +++ b/micropython/modules/jpegdec/jpegdec.c @@ -1,14 +1,14 @@ #include "jpegdec.h" -STATIC MP_DEFINE_CONST_FUN_OBJ_1(JPEG_del_obj, _JPEG_del); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(JPEG_openRAM_obj, _JPEG_openRAM); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(JPEG_openFILE_obj, _JPEG_openFILE); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(JPEG_decode_obj, 1, _JPEG_decode); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(JPEG_getWidth_obj, _JPEG_getWidth); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(JPEG_getHeight_obj, _JPEG_getHeight); +static MP_DEFINE_CONST_FUN_OBJ_1(JPEG_del_obj, _JPEG_del); +static MP_DEFINE_CONST_FUN_OBJ_2(JPEG_openRAM_obj, _JPEG_openRAM); +static MP_DEFINE_CONST_FUN_OBJ_2(JPEG_openFILE_obj, _JPEG_openFILE); +static MP_DEFINE_CONST_FUN_OBJ_KW(JPEG_decode_obj, 1, _JPEG_decode); +static MP_DEFINE_CONST_FUN_OBJ_1(JPEG_getWidth_obj, _JPEG_getWidth); +static MP_DEFINE_CONST_FUN_OBJ_1(JPEG_getHeight_obj, _JPEG_getHeight); // class -STATIC const mp_rom_map_elem_t JPEG_locals_dict_table[] = { +static const mp_rom_map_elem_t JPEG_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&JPEG_del_obj) }, { MP_ROM_QSTR(MP_QSTR_open_RAM), MP_ROM_PTR(&JPEG_openRAM_obj) }, { MP_ROM_QSTR(MP_QSTR_open_file), MP_ROM_PTR(&JPEG_openFILE_obj) }, @@ -18,7 +18,7 @@ STATIC const mp_rom_map_elem_t JPEG_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_get_height), MP_ROM_PTR(&JPEG_getHeight_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(JPEG_locals_dict, JPEG_locals_dict_table); +static MP_DEFINE_CONST_DICT(JPEG_locals_dict, JPEG_locals_dict_table); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -40,7 +40,7 @@ const mp_obj_type_t JPEG_type = { #endif // module -STATIC const mp_map_elem_t JPEG_globals_table[] = { +static const mp_map_elem_t JPEG_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_jpegdec) }, { MP_OBJ_NEW_QSTR(MP_QSTR_JPEG), (mp_obj_t)&JPEG_type }, @@ -50,7 +50,7 @@ STATIC const mp_map_elem_t JPEG_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_JPEG_SCALE_EIGHTH), MP_ROM_INT(8) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_JPEG_globals, JPEG_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_JPEG_globals, JPEG_globals_table); const mp_obj_module_t JPEG_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/jpegdec/jpegdec.cpp b/micropython/modules/jpegdec/jpegdec.cpp index d90ad4ec..75741421 100644 --- a/micropython/modules/jpegdec/jpegdec.cpp +++ b/micropython/modules/jpegdec/jpegdec.cpp @@ -67,7 +67,7 @@ int32_t jpegdec_read_callback(JPEGFILE *jpeg, uint8_t *p, int32_t c) { return mp_stream_read_exactly(fhandle, p, c, &error); } -// Re-implementation of stream.c/STATIC mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) +// Re-implementation of stream.c/static mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) int32_t jpegdec_seek_callback(JPEGFILE *jpeg, int32_t p) { mp_obj_t fhandle = jpeg->fHandle; struct mp_stream_seek_t seek_s; diff --git a/micropython/modules/motor/motor.c b/micropython/modules/motor/motor.c index 3bdb9e80..e231b44f 100644 --- a/micropython/modules/motor/motor.c +++ b/micropython/modules/motor/motor.c @@ -61,7 +61,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(MotorCluster_decay_mode_obj, 2, MotorCluster_decay_mo MP_DEFINE_CONST_FUN_OBJ_KW(MotorCluster_all_decay_modes_obj, 1, MotorCluster_all_decay_modes); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Motor_locals_dict_table[] = { +static const mp_rom_map_elem_t Motor_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Motor___del___obj) }, { MP_ROM_QSTR(MP_QSTR_pins), MP_ROM_PTR(&Motor_pins_obj) }, { MP_ROM_QSTR(MP_QSTR_enable), MP_ROM_PTR(&Motor_enable_obj) }, @@ -83,7 +83,7 @@ STATIC const mp_rom_map_elem_t Motor_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_decay_mode), MP_ROM_PTR(&Motor_decay_mode_obj) }, }; -STATIC const mp_rom_map_elem_t MotorCluster_locals_dict_table[] = { +static const mp_rom_map_elem_t MotorCluster_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&MotorCluster___del___obj) }, { MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&MotorCluster_count_obj) }, { MP_ROM_QSTR(MP_QSTR_pins), MP_ROM_PTR(&MotorCluster_pins_obj) }, @@ -124,8 +124,8 @@ STATIC const mp_rom_map_elem_t MotorCluster_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_all_decay_modes), MP_ROM_PTR(&MotorCluster_all_decay_modes_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(Motor_locals_dict, Motor_locals_dict_table); -STATIC MP_DEFINE_CONST_DICT(MotorCluster_locals_dict, MotorCluster_locals_dict_table); +static MP_DEFINE_CONST_DICT(Motor_locals_dict, Motor_locals_dict_table); +static MP_DEFINE_CONST_DICT(MotorCluster_locals_dict, MotorCluster_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -210,7 +210,7 @@ mp_obj_float_t motor2040_current_offset = {{&mp_type_float}, -0.005f}; /***** Globals Table *****/ -STATIC const mp_rom_map_elem_t pico_motor_shim_globals_table[] = { +static const mp_rom_map_elem_t pico_motor_shim_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pico_motor_shim) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_INT(2) }, { MP_ROM_QSTR(MP_QSTR_MOTOR_1), MP_ROM_PTR(&pico_motor_shim_motor1_pins) }, @@ -220,7 +220,7 @@ STATIC const mp_rom_map_elem_t pico_motor_shim_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_INT(5) }, }; -STATIC const mp_rom_map_elem_t motor2040_globals_table[] = { +static const mp_rom_map_elem_t motor2040_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_motor2040) }, { MP_ROM_QSTR(MP_QSTR_MOTOR_A), MP_ROM_PTR(&motor2040_motorA_pins) }, { MP_ROM_QSTR(MP_QSTR_MOTOR_B), MP_ROM_PTR(&motor2040_motorB_pins) }, @@ -262,8 +262,8 @@ STATIC const mp_rom_map_elem_t motor2040_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_CURRENT_OFFSET), MP_ROM_PTR(&motor2040_current_offset) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_pico_motor_shim_globals, pico_motor_shim_globals_table); -STATIC MP_DEFINE_CONST_DICT(mp_module_motor2040_globals, motor2040_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_pico_motor_shim_globals, pico_motor_shim_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_motor2040_globals, motor2040_globals_table); const mp_obj_module_t pico_motor_shim_user_cmodule = { .base = { &mp_type_module }, @@ -275,7 +275,7 @@ const mp_obj_module_t motor2040_user_cmodule = { .globals = (mp_obj_dict_t*)&mp_module_motor2040_globals, }; -STATIC const mp_map_elem_t motor_globals_table[] = { +static const mp_map_elem_t motor_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_motor) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Motor), (mp_obj_t)&Motor_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_MotorCluster), (mp_obj_t)&MotorCluster_type }, @@ -285,7 +285,7 @@ STATIC const mp_map_elem_t motor_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_FAST_DECAY), MP_ROM_INT(0x00) }, { MP_ROM_QSTR(MP_QSTR_SLOW_DECAY), MP_ROM_INT(0x01) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_motor_globals, motor_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_motor_globals, motor_globals_table); /***** Module Definition *****/ const mp_obj_module_t motor_user_cmodule = { diff --git a/micropython/modules/pcf85063a/pcf85063a.c b/micropython/modules/pcf85063a/pcf85063a.c index a55e2912..dc297220 100644 --- a/micropython/modules/pcf85063a/pcf85063a.c +++ b/micropython/modules/pcf85063a/pcf85063a.c @@ -26,7 +26,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(PCF85063A_set_byte_obj, PCF85063A_set_byte); MP_DEFINE_CONST_FUN_OBJ_1(PCF85063A_get_byte_obj, PCF85063A_get_byte); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t PCF85063A_locals_dict_table[] = { +static const mp_rom_map_elem_t PCF85063A_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&PCF85063A_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&PCF85063A_datetime_obj) }, @@ -61,7 +61,7 @@ STATIC const mp_rom_map_elem_t PCF85063A_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_TIMER_TICK_1HZ), MP_ROM_INT(0b10) }, { MP_ROM_QSTR(MP_QSTR_TIMER_TICK_1_OVER_60HZ), MP_ROM_INT(0b11) }, }; -STATIC MP_DEFINE_CONST_DICT(PCF85063A_locals_dict, PCF85063A_locals_dict_table); +static MP_DEFINE_CONST_DICT(PCF85063A_locals_dict, PCF85063A_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -86,7 +86,7 @@ const mp_obj_type_t pcf85063a_PCF85063A_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t pcf85063a_globals_table[] = { +static const mp_map_elem_t pcf85063a_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pcf85063a) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCF85063A), (mp_obj_t)&pcf85063a_PCF85063A_type }, { MP_ROM_QSTR(MP_QSTR_MONDAY), MP_ROM_INT(0) }, @@ -97,7 +97,7 @@ STATIC const mp_map_elem_t pcf85063a_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SATURDAY), MP_ROM_INT(5) }, { MP_ROM_QSTR(MP_QSTR_SUNDAY), MP_ROM_INT(6) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_pcf85063a_globals, pcf85063a_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_pcf85063a_globals, pcf85063a_globals_table); /***** Module Definition *****/ const mp_obj_module_t pcf85063a_user_cmodule = { diff --git a/micropython/modules/pico_explorer/pico_explorer.c b/micropython/modules/pico_explorer/pico_explorer.c index 1db88642..d7ce19d5 100644 --- a/micropython/modules/pico_explorer/pico_explorer.c +++ b/micropython/modules/pico_explorer/pico_explorer.c @@ -8,7 +8,7 @@ const mp_rom_obj_tuple_t PicoExplorer_MOTOR2_pins = { {&mp_type_tuple}, 2, { MP_ROM_INT(11), MP_ROM_INT(10) }, }; -STATIC const mp_map_elem_t picoexplorer_globals_table[] = { +static const mp_map_elem_t picoexplorer_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_picoexplorer) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_INT(12) }, @@ -32,7 +32,7 @@ STATIC const mp_map_elem_t picoexplorer_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_INT(6) }, { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_INT(7) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picoexplorer_globals, picoexplorer_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_picoexplorer_globals, picoexplorer_globals_table); const mp_obj_module_t picoexplorer_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.c b/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.c index 4c14e79a..f0daee0b 100644 --- a/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.c +++ b/micropython/modules/pico_rgb_keypad/pico_rgb_keypad.c @@ -5,19 +5,19 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Module Functions *****/ -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picokeypad___del___obj, picokeypad___del__); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_width_obj, picokeypad_get_width); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_height_obj, picokeypad_get_height); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_num_pads_obj, picokeypad_get_num_pads); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_update_obj, picokeypad_update); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(picokeypad_set_brightness_obj, picokeypad_set_brightness); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picokeypad_illuminate_xy_obj, 6, 6, picokeypad_illuminate_xy); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picokeypad_illuminate_obj, 5, 5, picokeypad_illuminate); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_clear_obj, picokeypad_clear); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_button_states_obj, picokeypad_get_button_states); +static MP_DEFINE_CONST_FUN_OBJ_1(picokeypad___del___obj, picokeypad___del__); +static MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_width_obj, picokeypad_get_width); +static MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_height_obj, picokeypad_get_height); +static MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_num_pads_obj, picokeypad_get_num_pads); +static MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_update_obj, picokeypad_update); +static MP_DEFINE_CONST_FUN_OBJ_2(picokeypad_set_brightness_obj, picokeypad_set_brightness); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picokeypad_illuminate_xy_obj, 6, 6, picokeypad_illuminate_xy); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picokeypad_illuminate_obj, 5, 5, picokeypad_illuminate); +static MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_clear_obj, picokeypad_clear); +static MP_DEFINE_CONST_FUN_OBJ_1(picokeypad_get_button_states_obj, picokeypad_get_button_states); /* Class Methods */ -STATIC const mp_rom_map_elem_t picokeypad_locals[] = { +static const mp_rom_map_elem_t picokeypad_locals[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&picokeypad___del___obj) }, { MP_ROM_QSTR(MP_QSTR_get_width), MP_ROM_PTR(&picokeypad_get_width_obj) }, { MP_ROM_QSTR(MP_QSTR_get_height), MP_ROM_PTR(&picokeypad_get_height_obj) }, @@ -29,7 +29,7 @@ STATIC const mp_rom_map_elem_t picokeypad_locals[] = { { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&picokeypad_clear_obj) }, { MP_ROM_QSTR(MP_QSTR_get_button_states), MP_ROM_PTR(&picokeypad_get_button_states_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picokeypad_locals, picokeypad_locals); +static MP_DEFINE_CONST_DICT(mp_module_picokeypad_locals, picokeypad_locals); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -49,13 +49,13 @@ const mp_obj_type_t PicoKeypad_type = { #endif /* Module Globals */ -STATIC const mp_map_elem_t picokeypad_globals[] = { +static const mp_map_elem_t picokeypad_globals[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_picokeypad) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PicoKeypad), (mp_obj_t)&PicoKeypad_type }, { MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(4) }, { MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_ROM_INT(4) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picokeypad_globals, picokeypad_globals); +static MP_DEFINE_CONST_DICT(mp_module_picokeypad_globals, picokeypad_globals); const mp_obj_module_t picokeypad_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/pico_scroll/pico_scroll.c b/micropython/modules/pico_scroll/pico_scroll.c index 0660178c..3ca7adb5 100644 --- a/micropython/modules/pico_scroll/pico_scroll.c +++ b/micropython/modules/pico_scroll/pico_scroll.c @@ -15,21 +15,21 @@ enum buttons //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Module Functions *****/ -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoscroll___del___obj, picoscroll___del__); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_get_width_obj, picoscroll_get_width); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_get_height_obj, picoscroll_get_height); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_show_obj, picoscroll_show); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_set_pixel_obj, 4, 4, picoscroll_set_pixel); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(picoscroll_set_pixels_obj, picoscroll_set_pixels); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_show_text_obj, 4, 4, picoscroll_show_text); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_scroll_text_obj, 4, 4, picoscroll_scroll_text); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_show_bitmap_1d_obj, 4, 4, picoscroll_show_bitmap_1d); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_clear_obj, picoscroll_clear); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(picoscroll_is_pressed_obj, picoscroll_is_pressed); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(picoscroll_update_obj, picoscroll_update); +static MP_DEFINE_CONST_FUN_OBJ_1(picoscroll___del___obj, picoscroll___del__); +static MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_get_width_obj, picoscroll_get_width); +static MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_get_height_obj, picoscroll_get_height); +static MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_show_obj, picoscroll_show); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_set_pixel_obj, 4, 4, picoscroll_set_pixel); +static MP_DEFINE_CONST_FUN_OBJ_2(picoscroll_set_pixels_obj, picoscroll_set_pixels); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_show_text_obj, 4, 4, picoscroll_show_text); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_scroll_text_obj, 4, 4, picoscroll_scroll_text); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picoscroll_show_bitmap_1d_obj, 4, 4, picoscroll_show_bitmap_1d); +static MP_DEFINE_CONST_FUN_OBJ_1(picoscroll_clear_obj, picoscroll_clear); +static MP_DEFINE_CONST_FUN_OBJ_2(picoscroll_is_pressed_obj, picoscroll_is_pressed); +static MP_DEFINE_CONST_FUN_OBJ_2(picoscroll_update_obj, picoscroll_update); /* Class Methods */ -STATIC const mp_rom_map_elem_t picoscroll_locals[] = { +static const mp_rom_map_elem_t picoscroll_locals[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&picoscroll___del___obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&picoscroll_update_obj) }, { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&picoscroll_show_obj) }, @@ -49,7 +49,7 @@ STATIC const mp_rom_map_elem_t picoscroll_locals[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_X), MP_ROM_INT(BUTTON_X) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_Y), MP_ROM_INT(BUTTON_Y) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picoscroll_locals, picoscroll_locals); +static MP_DEFINE_CONST_DICT(mp_module_picoscroll_locals, picoscroll_locals); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -69,7 +69,7 @@ const mp_obj_type_t PicoScroll_type = { #endif /* Module Globals */ -STATIC const mp_map_elem_t picoscroll_globals[] = { +static const mp_map_elem_t picoscroll_globals[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_picoscroll) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PicoScroll), (mp_obj_t)&PicoScroll_type }, { MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(17) }, @@ -79,7 +79,7 @@ STATIC const mp_map_elem_t picoscroll_globals[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_X), MP_ROM_INT(BUTTON_X) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_Y), MP_ROM_INT(BUTTON_Y) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picoscroll_globals, picoscroll_globals); +static MP_DEFINE_CONST_DICT(mp_module_picoscroll_globals, picoscroll_globals); const mp_obj_module_t picoscroll_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/pico_unicorn/pico_unicorn.c b/micropython/modules/pico_unicorn/pico_unicorn.c index 06e5df48..f66a84df 100755 --- a/micropython/modules/pico_unicorn/pico_unicorn.c +++ b/micropython/modules/pico_unicorn/pico_unicorn.c @@ -16,16 +16,16 @@ enum buttons //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Module Functions *****/ -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picounicorn__del__obj, picounicorn__del__); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picounicorn_set_pixel_obj, 6, 6, picounicorn_set_pixel); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picounicorn_set_pixel_value_obj, 4, 4, picounicorn_set_pixel_value); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picounicorn_clear_obj, picounicorn_clear); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(picounicorn_is_pressed_obj, picounicorn_is_pressed); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picounicorn_get_width_obj, picounicorn_get_width); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(picounicorn_get_height_obj, picounicorn_get_height); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(picounicorn_update_obj, picounicorn_update); +static MP_DEFINE_CONST_FUN_OBJ_1(picounicorn__del__obj, picounicorn__del__); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picounicorn_set_pixel_obj, 6, 6, picounicorn_set_pixel); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(picounicorn_set_pixel_value_obj, 4, 4, picounicorn_set_pixel_value); +static MP_DEFINE_CONST_FUN_OBJ_1(picounicorn_clear_obj, picounicorn_clear); +static MP_DEFINE_CONST_FUN_OBJ_2(picounicorn_is_pressed_obj, picounicorn_is_pressed); +static MP_DEFINE_CONST_FUN_OBJ_1(picounicorn_get_width_obj, picounicorn_get_width); +static MP_DEFINE_CONST_FUN_OBJ_1(picounicorn_get_height_obj, picounicorn_get_height); +static MP_DEFINE_CONST_FUN_OBJ_2(picounicorn_update_obj, picounicorn_update); -STATIC const mp_rom_map_elem_t picounicorn_locals_dict_table[] = { +static const mp_rom_map_elem_t picounicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&picounicorn__del__obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&picounicorn_update_obj) }, { MP_ROM_QSTR(MP_QSTR_set_pixel), MP_ROM_PTR(&picounicorn_set_pixel_obj) }, @@ -42,7 +42,7 @@ STATIC const mp_rom_map_elem_t picounicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_Y), MP_ROM_INT(BUTTON_Y) }, }; -STATIC MP_DEFINE_CONST_DICT(picounicorn_locals_dict, picounicorn_locals_dict_table); +static MP_DEFINE_CONST_DICT(picounicorn_locals_dict, picounicorn_locals_dict_table); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -62,7 +62,7 @@ const mp_obj_type_t picounicorn_type = { #endif /***** Globals Table *****/ -STATIC const mp_rom_map_elem_t picounicorn_globals_table[] = { +static const mp_rom_map_elem_t picounicorn_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_picounicorn) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PicoUnicorn), (mp_obj_t)&picounicorn_type }, { MP_ROM_QSTR(MP_QSTR_WIDTH), MP_ROM_INT(16) }, @@ -72,7 +72,7 @@ STATIC const mp_rom_map_elem_t picounicorn_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_X), MP_ROM_INT(BUTTON_X) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_Y), MP_ROM_INT(BUTTON_Y) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picounicorn_globals, picounicorn_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_picounicorn_globals, picounicorn_globals_table); /***** Module Definition *****/ const mp_obj_module_t picounicorn_user_cmodule = { diff --git a/micropython/modules/pico_wireless/pico_wireless.c b/micropython/modules/pico_wireless/pico_wireless.c index 55d2e81d..ba9295d9 100644 --- a/micropython/modules/pico_wireless/pico_wireless.c +++ b/micropython/modules/pico_wireless/pico_wireless.c @@ -5,92 +5,92 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Module Functions *****/ -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_init_obj, picowireless_init); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_network_data_obj, picowireless_get_network_data); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_remote_data_obj, 1, picowireless_get_remote_data); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_init_obj, picowireless_init); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_network_data_obj, picowireless_get_network_data); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_remote_data_obj, 1, picowireless_get_remote_data); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_network_obj, 1, picowireless_wifi_set_network); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_passphrase_obj, 2, picowireless_wifi_set_passphrase); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_key_obj, 3, picowireless_wifi_set_key); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_network_obj, 1, picowireless_wifi_set_network); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_passphrase_obj, 2, picowireless_wifi_set_passphrase); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_key_obj, 3, picowireless_wifi_set_key); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_config_obj, 4, picowireless_config); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_config_obj, 4, picowireless_config); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_dns_obj, 1, picowireless_set_dns); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_hostname_obj, 1, picowireless_set_hostname); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_disconnect_obj, picowireless_disconnect); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_dns_obj, 1, picowireless_set_dns); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_hostname_obj, 1, picowireless_set_hostname); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_disconnect_obj, picowireless_disconnect); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_connection_status_obj, picowireless_get_connection_status); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_mac_address_obj, picowireless_get_mac_address); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_connection_status_obj, picowireless_get_connection_status); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_mac_address_obj, picowireless_get_mac_address); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_ip_address_obj, picowireless_get_ip_address); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_subnet_mask_obj, picowireless_get_subnet_mask); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_gateway_ip_obj, picowireless_get_gateway_ip); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_ip_address_obj, picowireless_get_ip_address); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_subnet_mask_obj, picowireless_get_subnet_mask); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_gateway_ip_obj, picowireless_get_gateway_ip); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_ssid_obj, picowireless_get_current_ssid); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_bssid_obj, picowireless_get_current_bssid); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_rssi_obj, picowireless_get_current_rssi); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_encryption_type_obj, picowireless_get_current_encryption_type); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_ssid_obj, picowireless_get_current_ssid); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_bssid_obj, picowireless_get_current_bssid); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_rssi_obj, picowireless_get_current_rssi); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_current_encryption_type_obj, picowireless_get_current_encryption_type); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_start_scan_networks_obj, picowireless_start_scan_networks); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_scan_networks_obj, picowireless_get_scan_networks); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_ssid_networks_obj, 1, picowireless_get_ssid_networks); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_start_scan_networks_obj, picowireless_start_scan_networks); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_scan_networks_obj, picowireless_get_scan_networks); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_ssid_networks_obj, 1, picowireless_get_ssid_networks); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_enc_type_networks_obj, 1, picowireless_get_enc_type_networks); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_bssid_networks_obj, 1, picowireless_get_bssid_networks); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_channel_networks_obj, 1, picowireless_get_channel_networks); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_rssi_networks_obj, 1, picowireless_get_rssi_networks); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_enc_type_networks_obj, 1, picowireless_get_enc_type_networks); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_bssid_networks_obj, 1, picowireless_get_bssid_networks); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_channel_networks_obj, 1, picowireless_get_channel_networks); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_rssi_networks_obj, 1, picowireless_get_rssi_networks); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_req_host_by_name_obj, 1, picowireless_req_host_by_name); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_host_by_name_obj, 0, picowireless_get_host_by_name); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_req_host_by_name_obj, 1, picowireless_req_host_by_name); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_host_by_name_obj, 0, picowireless_get_host_by_name); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_fw_version_obj, picowireless_get_fw_version); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_time_obj, picowireless_get_time); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_power_mode_obj, 1, picowireless_set_power_mode); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_fw_version_obj, picowireless_get_fw_version); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_time_obj, picowireless_get_time); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_power_mode_obj, 1, picowireless_set_power_mode); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ap_network_obj, 2, picowireless_wifi_set_ap_network); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ap_passphrase_obj, 3, picowireless_wifi_set_ap_passphrase); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ap_network_obj, 2, picowireless_wifi_set_ap_network); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ap_passphrase_obj, 3, picowireless_wifi_set_ap_passphrase); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_ping_obj, 2, picowireless_ping); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_ping_obj, 2, picowireless_ping); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_debug_obj, 1, picowireless_debug); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_temperature_obj, picowireless_get_temperature); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_pin_mode_obj, 2, picowireless_pin_mode); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_debug_obj, 1, picowireless_debug); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_temperature_obj, picowireless_get_temperature); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_pin_mode_obj, 2, picowireless_pin_mode); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_digital_write_obj, 2, picowireless_digital_write); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_analog_write_obj, 2, picowireless_analog_write); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_digital_read_obj, 1, picowireless_digital_read); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_analog_read_obj, 1, picowireless_analog_read); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_digital_write_obj, 2, picowireless_digital_write); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_analog_write_obj, 2, picowireless_analog_write); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_digital_read_obj, 1, picowireless_digital_read); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_analog_read_obj, 1, picowireless_analog_read); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_server_start_obj, 3, picowireless_server_start); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_client_start_obj, 4, picowireless_client_start); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_client_stop_obj, 1, picowireless_client_stop); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_server_start_obj, 3, picowireless_server_start); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_client_start_obj, 4, picowireless_client_start); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_client_stop_obj, 1, picowireless_client_stop); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_server_state_obj, 1, picowireless_get_server_state); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_client_state_obj, 1, picowireless_get_client_state); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_avail_data_obj, 1, picowireless_avail_data); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_avail_server_obj, 1, picowireless_avail_server); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_server_state_obj, 1, picowireless_get_server_state); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_client_state_obj, 1, picowireless_get_client_state); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_avail_data_obj, 1, picowireless_avail_data); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_avail_server_obj, 1, picowireless_avail_server); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_data_obj, 2, picowireless_get_data); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_data_buf_obj, 1, picowireless_get_data_buf); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_insert_data_buf_obj, 2, picowireless_insert_data_buf); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_send_udp_data_obj, 1, picowireless_send_udp_data); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_data_obj, 2, picowireless_get_data); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_get_data_buf_obj, 1, picowireless_get_data_buf); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_insert_data_buf_obj, 2, picowireless_insert_data_buf); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_send_udp_data_obj, 1, picowireless_send_udp_data); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_send_data_obj, 2, picowireless_send_data); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_check_data_sent_obj, 1, picowireless_check_data_sent); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_socket_obj, picowireless_get_socket); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_send_data_obj, 2, picowireless_send_data); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_check_data_sent_obj, 1, picowireless_check_data_sent); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_get_socket_obj, picowireless_get_socket); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ent_identity_obj, 1, picowireless_wifi_set_ent_identity); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ent_username_obj, 1, picowireless_wifi_set_ent_username); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ent_password_obj, 1, picowireless_wifi_set_ent_password); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_wifi_set_ent_enable_obj, picowireless_wifi_set_ent_enable); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ent_identity_obj, 1, picowireless_wifi_set_ent_identity); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ent_username_obj, 1, picowireless_wifi_set_ent_username); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_wifi_set_ent_password_obj, 1, picowireless_wifi_set_ent_password); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_wifi_set_ent_enable_obj, picowireless_wifi_set_ent_enable); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_led_obj, 3, picowireless_set_led); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_is_pressed_obj, picowireless_is_pressed); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(picowireless_is_sdcard_detected_obj, picowireless_is_sdcard_detected); +static MP_DEFINE_CONST_FUN_OBJ_KW(picowireless_set_led_obj, 3, picowireless_set_led); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_is_pressed_obj, picowireless_is_pressed); +static MP_DEFINE_CONST_FUN_OBJ_0(picowireless_is_sdcard_detected_obj, picowireless_is_sdcard_detected); /***** Globals Table *****/ -STATIC const mp_map_elem_t picowireless_globals_table[] = { +static const mp_map_elem_t picowireless_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_picowireless) }, { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&picowireless_init_obj) }, { MP_ROM_QSTR(MP_QSTR_get_network_data), MP_ROM_PTR(&picowireless_get_network_data_obj) }, @@ -168,7 +168,7 @@ STATIC const mp_map_elem_t picowireless_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_is_pressed), MP_ROM_PTR(&picowireless_is_pressed_obj) }, { MP_ROM_QSTR(MP_QSTR_is_sdcard_detected), MP_ROM_PTR(&picowireless_is_sdcard_detected_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picowireless_globals, picowireless_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_picowireless_globals, picowireless_globals_table); /***** Module Definition *****/ const mp_obj_module_t picowireless_user_cmodule = { diff --git a/micropython/modules/picographics/picographics.c b/micropython/modules/picographics/picographics.c index ce1db0ef..b1aeec19 100644 --- a/micropython/modules/picographics/picographics.c +++ b/micropython/modules/picographics/picographics.c @@ -1,11 +1,11 @@ #include "picographics.h" // Module functions -STATIC MP_DEFINE_CONST_FUN_OBJ_3(ModPicoGraphics_module_RGB_to_RGB332_obj, ModPicoGraphics_module_RGB_to_RGB332); -STATIC MP_DEFINE_CONST_FUN_OBJ_3(ModPicoGraphics_module_RGB_to_RGB565_obj, ModPicoGraphics_module_RGB_to_RGB565); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(ModPicoGraphics_module_RGB332_to_RGB_obj, ModPicoGraphics_module_RGB332_to_RGB); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(ModPicoGraphics_module_RGB565_to_RGB_obj, ModPicoGraphics_module_RGB565_to_RGB); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(ModPicoGraphics_get_required_buffer_size_obj, ModPicoGraphics_get_required_buffer_size); +static MP_DEFINE_CONST_FUN_OBJ_3(ModPicoGraphics_module_RGB_to_RGB332_obj, ModPicoGraphics_module_RGB_to_RGB332); +static MP_DEFINE_CONST_FUN_OBJ_3(ModPicoGraphics_module_RGB_to_RGB565_obj, ModPicoGraphics_module_RGB_to_RGB565); +static MP_DEFINE_CONST_FUN_OBJ_1(ModPicoGraphics_module_RGB332_to_RGB_obj, ModPicoGraphics_module_RGB332_to_RGB); +static MP_DEFINE_CONST_FUN_OBJ_1(ModPicoGraphics_module_RGB565_to_RGB_obj, ModPicoGraphics_module_RGB565_to_RGB); +static MP_DEFINE_CONST_FUN_OBJ_2(ModPicoGraphics_get_required_buffer_size_obj, ModPicoGraphics_get_required_buffer_size); // Class Methods MP_DEFINE_CONST_FUN_OBJ_1(ModPicoGraphics_update_obj, ModPicoGraphics_update); @@ -54,7 +54,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(ModPicoGraphics_set_framebuffer_obj, ModPicoGraphics_s MP_DEFINE_CONST_FUN_OBJ_1(ModPicoGraphics__del__obj, ModPicoGraphics__del__); -STATIC const mp_rom_map_elem_t ModPicoGraphics_locals_dict_table[] = { +static const mp_rom_map_elem_t ModPicoGraphics_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_pixel), MP_ROM_PTR(&ModPicoGraphics_pixel_obj) }, { MP_ROM_QSTR(MP_QSTR_set_pen), MP_ROM_PTR(&ModPicoGraphics_set_pen_obj) }, { MP_ROM_QSTR(MP_QSTR_set_thickness), MP_ROM_PTR(&ModPicoGraphics_set_thickness_obj) }, @@ -94,7 +94,7 @@ STATIC const mp_rom_map_elem_t ModPicoGraphics_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&ModPicoGraphics__del__obj) }, }; -STATIC MP_DEFINE_CONST_DICT(ModPicoGraphics_locals_dict, ModPicoGraphics_locals_dict_table); +static MP_DEFINE_CONST_DICT(ModPicoGraphics_locals_dict, ModPicoGraphics_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -117,7 +117,7 @@ const mp_obj_type_t ModPicoGraphics_type = { #endif /***** Module Globals *****/ -STATIC const mp_map_elem_t picographics_globals_table[] = { +static const mp_map_elem_t picographics_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_picographics) }, { MP_ROM_QSTR(MP_QSTR_PicoGraphics), (mp_obj_t)&ModPicoGraphics_type }, { MP_ROM_QSTR(MP_QSTR_get_buffer_size), MP_ROM_PTR(&ModPicoGraphics_get_required_buffer_size_obj) }, @@ -165,7 +165,7 @@ STATIC const mp_map_elem_t picographics_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_PEN_RGB565), MP_ROM_INT(PEN_RGB565) }, { MP_ROM_QSTR(MP_QSTR_PEN_RGB888), MP_ROM_INT(PEN_RGB888) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_picographics_globals, picographics_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_picographics_globals, picographics_globals_table); /***** Module Definition *****/ const mp_obj_module_t picographics_user_cmodule = { diff --git a/micropython/modules/picovector/picovector.c b/micropython/modules/picovector/picovector.c index d2a5a43d..a67a7072 100644 --- a/micropython/modules/picovector/picovector.c +++ b/micropython/modules/picovector/picovector.c @@ -2,18 +2,18 @@ /* Polygon */ -STATIC MP_DEFINE_CONST_FUN_OBJ_1(POLYGON__del__obj, POLYGON__del__); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(POLYGON_centroid_obj, POLYGON_centroid); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(POLYGON_bounds_obj, POLYGON_bounds); +static MP_DEFINE_CONST_FUN_OBJ_1(POLYGON__del__obj, POLYGON__del__); +static MP_DEFINE_CONST_FUN_OBJ_1(POLYGON_centroid_obj, POLYGON_centroid); +static MP_DEFINE_CONST_FUN_OBJ_1(POLYGON_bounds_obj, POLYGON_bounds); -STATIC const mp_rom_map_elem_t POLYGON_locals_dict_table[] = { +static const mp_rom_map_elem_t POLYGON_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&POLYGON__del__obj) }, { MP_ROM_QSTR(MP_QSTR_centroid), MP_ROM_PTR(&POLYGON_centroid_obj) }, { MP_ROM_QSTR(MP_QSTR_bounds), MP_ROM_PTR(&POLYGON_bounds_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(POLYGON_locals_dict, POLYGON_locals_dict_table); +static MP_DEFINE_CONST_DICT(POLYGON_locals_dict, POLYGON_locals_dict_table); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -64,16 +64,16 @@ const mp_obj_type_t RECTANGLE_type = { /* PicoVector */ -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_text_obj, 4, VECTOR_text); -STATIC MP_DEFINE_CONST_FUN_OBJ_3(VECTOR_set_font_obj, VECTOR_set_font); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(VECTOR_set_font_size_obj, VECTOR_set_font_size); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(VECTOR_set_antialiasing_obj, VECTOR_set_antialiasing); +static MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_text_obj, 4, VECTOR_text); +static MP_DEFINE_CONST_FUN_OBJ_3(VECTOR_set_font_obj, VECTOR_set_font); +static MP_DEFINE_CONST_FUN_OBJ_2(VECTOR_set_font_size_obj, VECTOR_set_font_size); +static MP_DEFINE_CONST_FUN_OBJ_2(VECTOR_set_antialiasing_obj, VECTOR_set_antialiasing); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_draw_obj, 2, VECTOR_draw); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_rotate_obj, 3, VECTOR_rotate); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_translate_obj, 4, VECTOR_translate); +static MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_draw_obj, 2, VECTOR_draw); +static MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_rotate_obj, 3, VECTOR_rotate); +static MP_DEFINE_CONST_FUN_OBJ_KW(VECTOR_translate_obj, 4, VECTOR_translate); -STATIC const mp_rom_map_elem_t VECTOR_locals_dict_table[] = { +static const mp_rom_map_elem_t VECTOR_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_set_font), MP_ROM_PTR(&VECTOR_set_font_obj) }, { MP_ROM_QSTR(MP_QSTR_set_font_size), MP_ROM_PTR(&VECTOR_set_font_size_obj) }, { MP_ROM_QSTR(MP_QSTR_set_antialiasing), MP_ROM_PTR(&VECTOR_set_antialiasing_obj) }, @@ -84,7 +84,7 @@ STATIC const mp_rom_map_elem_t VECTOR_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_translate), MP_ROM_PTR(&VECTOR_translate_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(VECTOR_locals_dict, VECTOR_locals_dict_table); +static MP_DEFINE_CONST_DICT(VECTOR_locals_dict, VECTOR_locals_dict_table); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -105,7 +105,7 @@ const mp_obj_type_t VECTOR_type = { /* Module */ -STATIC const mp_map_elem_t VECTOR_globals_table[] = { +static const mp_map_elem_t VECTOR_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_picovector) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PicoVector), (mp_obj_t)&VECTOR_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_Polygon), (mp_obj_t)&POLYGON_type }, @@ -116,7 +116,7 @@ STATIC const mp_map_elem_t VECTOR_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_ANTIALIAS_X16), MP_ROM_INT(2) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_VECTOR_globals, VECTOR_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_VECTOR_globals, VECTOR_globals_table); const mp_obj_module_t VECTOR_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/picovector/picovector.cpp b/micropython/modules/picovector/picovector.cpp index f7bde227..a77a38b2 100644 --- a/micropython/modules/picovector/picovector.cpp +++ b/micropython/modules/picovector/picovector.cpp @@ -82,7 +82,7 @@ bool pretty_poly::file_io::fail() { return false; } -// Re-implementation of stream.c/STATIC mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) +// Re-implementation of stream.c/static mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) size_t pretty_poly::file_io::seek(size_t pos) { mp_obj_t fhandle = this->state; struct mp_stream_seek_t seek_s; @@ -272,7 +272,7 @@ typedef struct _mp_obj_polygon_it_t { size_t cur; } mp_obj_polygon_it_t; -STATIC mp_obj_t py_image_it_iternext(mp_obj_t self_in) { +static mp_obj_t py_image_it_iternext(mp_obj_t self_in) { mp_obj_polygon_it_t *self = MP_OBJ_TO_PTR2(self_in, mp_obj_polygon_it_t); _POLYGON_obj_t *polygon = MP_OBJ_TO_PTR2(self->polygon, _POLYGON_obj_t); diff --git a/micropython/modules/pimoroni_bus/pimoroni_bus.c b/micropython/modules/pimoroni_bus/pimoroni_bus.c index 4f32952f..a837c441 100644 --- a/micropython/modules/pimoroni_bus/pimoroni_bus.c +++ b/micropython/modules/pimoroni_bus/pimoroni_bus.c @@ -36,13 +36,13 @@ const mp_obj_type_t ParallelPins_type = { }; #endif -STATIC const mp_map_elem_t pimoroni_bus_globals_table[] = { +static const mp_map_elem_t pimoroni_bus_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pimoroni_bus) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SPIBus), (mp_obj_t)&SPIPins_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_ParallelBus), (mp_obj_t)&ParallelPins_type }, { MP_ROM_QSTR(MP_QSTR_SPISlot), MP_ROM_PTR(&SPISlot_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_pimoroni_bus_globals, pimoroni_bus_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_pimoroni_bus_globals, pimoroni_bus_globals_table); const mp_obj_module_t pimoroni_bus_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/pimoroni_i2c/pimoroni_i2c.c b/micropython/modules/pimoroni_i2c/pimoroni_i2c.c index ca475974..54a2c3fb 100644 --- a/micropython/modules/pimoroni_i2c/pimoroni_i2c.c +++ b/micropython/modules/pimoroni_i2c/pimoroni_i2c.c @@ -8,14 +8,14 @@ /* MP_DEFINE_CONST_FUN_OBJ_1(PimoroniI2C___del___obj, PimoroniI2C___del__); -STATIC const mp_rom_map_elem_t PimoroniI2C_locals_dict_table[] = { +static const mp_rom_map_elem_t PimoroniI2C_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&PimoroniI2C___del___obj) }, }; -STATIC MP_DEFINE_CONST_DICT(PimoroniI2C_locals_dict, PimoroniI2C_locals_dict_table); +static MP_DEFINE_CONST_DICT(PimoroniI2C_locals_dict, PimoroniI2C_locals_dict_table); */ -STATIC const mp_machine_i2c_p_t machine_i2c_p = { +static const mp_machine_i2c_p_t machine_i2c_p = { .transfer = mp_machine_i2c_transfer_adaptor, .transfer_single = machine_i2c_transfer_single, }; @@ -47,11 +47,11 @@ const mp_obj_type_t PimoroniI2C_type = { //////////////////////////////////////////////////////////////////////////////////////////////////// /***** Globals Table *****/ -STATIC const mp_map_elem_t pimoroni_i2c_globals_table[] = { +static const mp_map_elem_t pimoroni_i2c_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pimoroni_i2c) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PimoroniI2C), (mp_obj_t)&PimoroniI2C_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_pimoroni_i2c_globals, pimoroni_i2c_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_pimoroni_i2c_globals, pimoroni_i2c_globals_table); /***** Module Definition *****/ const mp_obj_module_t pimoroni_i2c_user_cmodule = { diff --git a/micropython/modules/plasma/plasma.c b/micropython/modules/plasma/plasma.c index f52e11b7..6c7982c3 100644 --- a/micropython/modules/plasma/plasma.c +++ b/micropython/modules/plasma/plasma.c @@ -20,7 +20,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(PlasmaWS2812_clear_obj, PlasmaWS2812_clear); MP_DEFINE_CONST_FUN_OBJ_1(PlasmaWS2812_update_obj, PlasmaWS2812_update); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t PlasmaAPA102_locals_dict_table[] = { +static const mp_rom_map_elem_t PlasmaAPA102_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&PlasmaAPA102___del___obj) }, { MP_ROM_QSTR(MP_QSTR_set_rgb), MP_ROM_PTR(&PlasmaAPA102_set_rgb_obj) }, { MP_ROM_QSTR(MP_QSTR_set_hsv), MP_ROM_PTR(&PlasmaAPA102_set_hsv_obj) }, @@ -30,7 +30,7 @@ STATIC const mp_rom_map_elem_t PlasmaAPA102_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&PlasmaAPA102_clear_obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&PlasmaAPA102_update_obj) }, }; -STATIC const mp_rom_map_elem_t PlasmaWS2812_locals_dict_table[] = { +static const mp_rom_map_elem_t PlasmaWS2812_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&PlasmaWS2812___del___obj) }, { MP_ROM_QSTR(MP_QSTR_set_rgb), MP_ROM_PTR(&PlasmaWS2812_set_rgb_obj) }, { MP_ROM_QSTR(MP_QSTR_set_hsv), MP_ROM_PTR(&PlasmaWS2812_set_hsv_obj) }, @@ -40,8 +40,8 @@ STATIC const mp_rom_map_elem_t PlasmaWS2812_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&PlasmaWS2812_update_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(PlasmaAPA102_locals_dict, PlasmaAPA102_locals_dict_table); -STATIC MP_DEFINE_CONST_DICT(PlasmaWS2812_locals_dict, PlasmaWS2812_locals_dict_table); +static MP_DEFINE_CONST_DICT(PlasmaAPA102_locals_dict, PlasmaAPA102_locals_dict_table); +static MP_DEFINE_CONST_DICT(PlasmaWS2812_locals_dict, PlasmaWS2812_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -89,7 +89,7 @@ typedef struct _mp_obj_float_t { mp_obj_float_t shunt_resistor = {{&mp_type_float}, 0.015f}; /***** Globals Table *****/ -STATIC const mp_map_elem_t plasma2040_globals_table[] = { +static const mp_map_elem_t plasma2040_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_plasma2040) }, { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_INT(16) }, { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_INT(17) }, @@ -106,15 +106,15 @@ STATIC const mp_map_elem_t plasma2040_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SHUNT_RESISTOR), MP_ROM_PTR(&shunt_resistor) }, { MP_ROM_QSTR(MP_QSTR_ADC_GAIN), MP_ROM_INT(50) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_plasma2040_globals, plasma2040_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_plasma2040_globals, plasma2040_globals_table); -STATIC const mp_map_elem_t plasma_stick_globals_table[] = { +static const mp_map_elem_t plasma_stick_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_plasma_stick) }, { MP_ROM_QSTR(MP_QSTR_DAT), MP_ROM_INT(15) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_INT(4) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_INT(5) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_plasma_stick_globals, plasma_stick_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_plasma_stick_globals, plasma_stick_globals_table); const mp_obj_module_t plasma2040_user_cmodule = { .base = { &mp_type_module }, @@ -126,7 +126,7 @@ const mp_obj_module_t plasma_stick_user_cmodule = { .globals = (mp_obj_dict_t*)&mp_module_plasma_stick_globals, }; -STATIC const mp_map_elem_t plasma_globals_table[] = { +static const mp_map_elem_t plasma_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_plasma) }, { MP_OBJ_NEW_QSTR(MP_QSTR_APA102), (mp_obj_t)&PlasmaAPA102_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_WS2812), (mp_obj_t)&PlasmaWS2812_type }, @@ -140,7 +140,7 @@ STATIC const mp_map_elem_t plasma_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_BRG), MP_ROM_INT(0x04) }, { MP_ROM_QSTR(MP_QSTR_COLOR_ORDER_BGR), MP_ROM_INT(0x05) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_plasma_globals, plasma_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_plasma_globals, plasma_globals_table); /***** Module Definition *****/ const mp_obj_module_t plasma_user_cmodule = { diff --git a/micropython/modules/pngdec/pngdec.c b/micropython/modules/pngdec/pngdec.c index cdb9bf1d..5cbab577 100644 --- a/micropython/modules/pngdec/pngdec.c +++ b/micropython/modules/pngdec/pngdec.c @@ -1,15 +1,15 @@ #include "pngdec.h" -STATIC MP_DEFINE_CONST_FUN_OBJ_1(PNG_del_obj, _PNG_del); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(PNG_openRAM_obj, _PNG_openRAM); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(PNG_openFILE_obj, _PNG_openFILE); -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(PNG_decode_obj, 1, _PNG_decode); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(PNG_getWidth_obj, _PNG_getWidth); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(PNG_getHeight_obj, _PNG_getHeight); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(PNG_getPalette_obj, _PNG_getPalette); +static MP_DEFINE_CONST_FUN_OBJ_1(PNG_del_obj, _PNG_del); +static MP_DEFINE_CONST_FUN_OBJ_2(PNG_openRAM_obj, _PNG_openRAM); +static MP_DEFINE_CONST_FUN_OBJ_2(PNG_openFILE_obj, _PNG_openFILE); +static MP_DEFINE_CONST_FUN_OBJ_KW(PNG_decode_obj, 1, _PNG_decode); +static MP_DEFINE_CONST_FUN_OBJ_1(PNG_getWidth_obj, _PNG_getWidth); +static MP_DEFINE_CONST_FUN_OBJ_1(PNG_getHeight_obj, _PNG_getHeight); +static MP_DEFINE_CONST_FUN_OBJ_1(PNG_getPalette_obj, _PNG_getPalette); // class -STATIC const mp_rom_map_elem_t PNG_locals_dict_table[] = { +static const mp_rom_map_elem_t PNG_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&PNG_del_obj) }, { MP_ROM_QSTR(MP_QSTR_open_RAM), MP_ROM_PTR(&PNG_openRAM_obj) }, { MP_ROM_QSTR(MP_QSTR_open_file), MP_ROM_PTR(&PNG_openFILE_obj) }, @@ -19,7 +19,7 @@ STATIC const mp_rom_map_elem_t PNG_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_get_palette), MP_ROM_PTR(&PNG_getPalette_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(PNG_locals_dict, PNG_locals_dict_table); +static MP_DEFINE_CONST_DICT(PNG_locals_dict, PNG_locals_dict_table); #ifdef MP_DEFINE_CONST_OBJ_TYPE MP_DEFINE_CONST_OBJ_TYPE( @@ -41,7 +41,7 @@ const mp_obj_type_t PNG_type = { #endif // module -STATIC const mp_map_elem_t PNG_globals_table[] = { +static const mp_map_elem_t PNG_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pngdec) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PNG), (mp_obj_t)&PNG_type }, @@ -52,7 +52,7 @@ STATIC const mp_map_elem_t PNG_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_PNG_PEN), MP_ROM_INT(3) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_PNG_globals, PNG_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_PNG_globals, PNG_globals_table); const mp_obj_module_t PNG_user_cmodule = { .base = { &mp_type_module }, diff --git a/micropython/modules/pngdec/pngdec.cpp b/micropython/modules/pngdec/pngdec.cpp index 6e273d80..45dc9b70 100644 --- a/micropython/modules/pngdec/pngdec.cpp +++ b/micropython/modules/pngdec/pngdec.cpp @@ -77,7 +77,7 @@ int32_t pngdec_read_callback(PNGFILE *png, uint8_t *p, int32_t c) { return mp_stream_read_exactly(fhandle, p, c, &error); } -// Re-implementation of stream.c/STATIC mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) +// Re-implementation of stream.c/static mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) int32_t pngdec_seek_callback(PNGFILE *png, int32_t p) { mp_obj_t fhandle = png->fHandle; struct mp_stream_seek_t seek_s; diff --git a/micropython/modules/servo/servo.c b/micropython/modules/servo/servo.c index 524ea9d7..35aba992 100644 --- a/micropython/modules/servo/servo.c +++ b/micropython/modules/servo/servo.c @@ -71,7 +71,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(ServoCluster_calibration_obj, 2, ServoCluster_calibra MP_DEFINE_CONST_FUN_OBJ_1(ServoCluster_load_obj, ServoCluster_load); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Calibration_locals_dict_table[] = { +static const mp_rom_map_elem_t Calibration_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Calibration___del___obj) }, { MP_ROM_QSTR(MP_QSTR_apply_blank_pairs), MP_ROM_PTR(&Calibration_apply_blank_pairs_obj) }, { MP_ROM_QSTR(MP_QSTR_apply_two_pairs), MP_ROM_PTR(&Calibration_apply_two_pairs_obj) }, @@ -95,7 +95,7 @@ STATIC const mp_rom_map_elem_t Calibration_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_pulse_to_value), MP_ROM_PTR(&Calibration_pulse_to_value_obj) }, }; -STATIC const mp_rom_map_elem_t Servo_locals_dict_table[] = { +static const mp_rom_map_elem_t Servo_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Servo___del___obj) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&Servo_pin_obj) }, { MP_ROM_QSTR(MP_QSTR_enable), MP_ROM_PTR(&Servo_enable_obj) }, @@ -114,7 +114,7 @@ STATIC const mp_rom_map_elem_t Servo_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_calibration), MP_ROM_PTR(&Servo_calibration_obj) }, }; -STATIC const mp_rom_map_elem_t ServoCluster_locals_dict_table[] = { +static const mp_rom_map_elem_t ServoCluster_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&ServoCluster___del___obj) }, { MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&ServoCluster_count_obj) }, { MP_ROM_QSTR(MP_QSTR_pin), MP_ROM_PTR(&ServoCluster_pin_obj) }, @@ -145,9 +145,9 @@ STATIC const mp_rom_map_elem_t ServoCluster_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_load), MP_ROM_PTR(&ServoCluster_load_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(Calibration_locals_dict, Calibration_locals_dict_table); -STATIC MP_DEFINE_CONST_DICT(Servo_locals_dict, Servo_locals_dict_table); -STATIC MP_DEFINE_CONST_DICT(ServoCluster_locals_dict, ServoCluster_locals_dict_table); +static MP_DEFINE_CONST_DICT(Calibration_locals_dict, Calibration_locals_dict_table); +static MP_DEFINE_CONST_DICT(Servo_locals_dict, Servo_locals_dict_table); +static MP_DEFINE_CONST_DICT(ServoCluster_locals_dict, ServoCluster_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -216,7 +216,7 @@ mp_obj_float_t servo2040_voltage_gain = {{&mp_type_float}, 3.9f / 13.9f}; mp_obj_float_t servo2040_current_offset = {{&mp_type_float}, -0.02f}; /***** Globals Table *****/ -STATIC const mp_map_elem_t servo2040_globals_table[] = { +static const mp_map_elem_t servo2040_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_servo2040) }, { MP_ROM_QSTR(MP_QSTR_SERVO_1), MP_ROM_INT(0) }, { MP_ROM_QSTR(MP_QSTR_SERVO_2), MP_ROM_INT(1) }, @@ -264,14 +264,14 @@ STATIC const mp_map_elem_t servo2040_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_VOLTAGE_GAIN), MP_ROM_PTR(&servo2040_voltage_gain) }, { MP_ROM_QSTR(MP_QSTR_CURRENT_OFFSET), MP_ROM_PTR(&servo2040_current_offset) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_servo2040_globals, servo2040_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_servo2040_globals, servo2040_globals_table); const mp_obj_module_t servo2040_user_cmodule = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&mp_module_servo2040_globals, }; -STATIC const mp_map_elem_t servo_globals_table[] = { +static const mp_map_elem_t servo_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_servo) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Calibration), (mp_obj_t)&Calibration_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_Servo), (mp_obj_t)&Servo_type }, @@ -282,7 +282,7 @@ STATIC const mp_map_elem_t servo_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LINEAR), MP_ROM_INT(0x01) }, { MP_ROM_QSTR(MP_QSTR_CONTINUOUS), MP_ROM_INT(0x02) }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_servo_globals, servo_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_servo_globals, servo_globals_table); /***** Module Definition *****/ const mp_obj_module_t servo_user_cmodule = { diff --git a/micropython/modules/stellar_unicorn/stellar_unicorn.c b/micropython/modules/stellar_unicorn/stellar_unicorn.c index b62829cd..3dca5017 100644 --- a/micropython/modules/stellar_unicorn/stellar_unicorn.c +++ b/micropython/modules/stellar_unicorn/stellar_unicorn.c @@ -35,7 +35,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(StellarUnicorn_stop_playing_obj, StellarUnicorn_stop_p MP_DEFINE_CONST_FUN_OBJ_2(StellarUnicorn_synth_channel_obj, StellarUnicorn_synth_channel); /***** Binding of Methods *****/ -STATIC const mp_rom_map_elem_t Channel_locals_dict_table[] = { +static const mp_rom_map_elem_t Channel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&Channel___del___obj) }, { MP_ROM_QSTR(MP_QSTR_configure), MP_ROM_PTR(&Channel_configure_obj) }, { MP_ROM_QSTR(MP_QSTR_restore), MP_ROM_PTR(&Channel_restore_obj) }, @@ -59,7 +59,7 @@ STATIC const mp_rom_map_elem_t Channel_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_WAVE), MP_ROM_INT(1) }, }; -STATIC const mp_rom_map_elem_t StellarUnicorn_locals_dict_table[] = { +static const mp_rom_map_elem_t StellarUnicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&StellarUnicorn___del___obj) }, { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&StellarUnicorn_clear_obj) }, { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&StellarUnicorn_update_obj) }, @@ -90,8 +90,8 @@ STATIC const mp_rom_map_elem_t StellarUnicorn_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SWITCH_BRIGHTNESS_DOWN), MP_ROM_INT(26) }, }; -STATIC MP_DEFINE_CONST_DICT(Channel_locals_dict, Channel_locals_dict_table); -STATIC MP_DEFINE_CONST_DICT(StellarUnicorn_locals_dict, StellarUnicorn_locals_dict_table); +static MP_DEFINE_CONST_DICT(Channel_locals_dict, Channel_locals_dict_table); +static MP_DEFINE_CONST_DICT(StellarUnicorn_locals_dict, StellarUnicorn_locals_dict_table); /***** Class Definition *****/ #ifdef MP_DEFINE_CONST_OBJ_TYPE @@ -131,12 +131,12 @@ const mp_obj_type_t StellarUnicorn_type = { #endif /***** Globals Table *****/ -STATIC const mp_map_elem_t stellar_globals_table[] = { +static const mp_map_elem_t stellar_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_stellar) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Channel), (mp_obj_t)&Channel_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_StellarUnicorn), (mp_obj_t)&StellarUnicorn_type }, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_stellar_globals, stellar_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_stellar_globals, stellar_globals_table); /***** Module Definition *****/ const mp_obj_module_t stellar_user_cmodule = { diff --git a/micropython/modules/wakeup/wakeup.c b/micropython/modules/wakeup/wakeup.c index e5204112..69f2422c 100644 --- a/micropython/modules/wakeup/wakeup.c +++ b/micropython/modules/wakeup/wakeup.c @@ -1,18 +1,18 @@ #include "wakeup.h" -STATIC MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_get_gpio_state_obj, Wakeup_get_gpio_state); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_reset_gpio_state_obj, Wakeup_reset_gpio_state); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_get_shift_state_obj, Wakeup_get_shift_state); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_reset_shift_state_obj, Wakeup_reset_shift_state); +static MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_get_gpio_state_obj, Wakeup_get_gpio_state); +static MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_reset_gpio_state_obj, Wakeup_reset_gpio_state); +static MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_get_shift_state_obj, Wakeup_get_shift_state); +static MP_DEFINE_CONST_FUN_OBJ_0(Wakeup_reset_shift_state_obj, Wakeup_reset_shift_state); -STATIC const mp_map_elem_t wakeup_globals_table[] = { +static const mp_map_elem_t wakeup_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_wakeup) }, { MP_ROM_QSTR(MP_QSTR_get_gpio_state), MP_ROM_PTR(&Wakeup_get_gpio_state_obj) }, { MP_ROM_QSTR(MP_QSTR_reset_gpio_state), MP_ROM_PTR(&Wakeup_reset_gpio_state_obj) }, { MP_ROM_QSTR(MP_QSTR_get_shift_state), MP_ROM_PTR(&Wakeup_get_shift_state_obj) }, { MP_ROM_QSTR(MP_QSTR_reset_shift_state), MP_ROM_PTR(&Wakeup_reset_shift_state_obj) } }; -STATIC MP_DEFINE_CONST_DICT(mp_module_wakeup_globals, wakeup_globals_table); +static MP_DEFINE_CONST_DICT(mp_module_wakeup_globals, wakeup_globals_table); const mp_obj_module_t wakeup_user_cmodule = { .base = { &mp_type_module }, From ccd00f62894c64bf422984d7dfd78cedffb29507 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Fri, 8 Mar 2024 14:39:09 +0000 Subject: [PATCH 5/8] Ulab: Bump to 6.5.2 for MicroPython 1.23.0 compatibility. --- micropython/modules/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micropython/modules/ulab b/micropython/modules/ulab index e68bb707..65c941a8 160000 --- a/micropython/modules/ulab +++ b/micropython/modules/ulab @@ -1 +1 @@ -Subproject commit e68bb707b20ee326d84ab75fc9fb35f2e85b87e3 +Subproject commit 65c941a8059afe1cfd6f4c2b15d0ade798dc24f2 From 7b7d9fe383909f0cf63e1b8b0257c85242c268c4 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Sat, 30 Mar 2024 20:04:27 +0000 Subject: [PATCH 6/8] CI: Update MicroPython patch for > v1.22.2. --- micropython/micropython_nano_specs.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/micropython/micropython_nano_specs.patch b/micropython/micropython_nano_specs.patch index 9a2bc620..5ae938b3 100644 --- a/micropython/micropython_nano_specs.patch +++ b/micropython/micropython_nano_specs.patch @@ -1,9 +1,9 @@ diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index 281b0c3bc..7e04bb549 100644 +index fcc435b7b..efabcb3a3 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt -@@ -453,6 +453,16 @@ target_link_options(${MICROPY_TARGET} PRIVATE - -Wl,--wrap=dcd_event_handler +@@ -464,6 +464,16 @@ set_source_files_properties( + COMPILE_OPTIONS "-O2" ) +# Do not include stack unwinding & exception handling for C++ user modules From 392890e99b26c986786e6a89437e1fa96dbbda76 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 25 Mar 2024 10:26:21 +0000 Subject: [PATCH 7/8] RP_PICO_USB: New USB-enabled version of the stock Pico firmware. :warning: Warning: flash/firmware split is now 1Mb/1Mb to accomodate USB libs. BACK UP YOUR PICO before flashing this build. It *will* trash your filesystem. * Add new RP_PICO_USB board * Use commit 932f76c6ba64c5a3e68de3324556d9979f09303b for https://github.com/micropython/micropython/commit/932f76c6ba64c5a3e68de3324556d9979f09303b --- .github/workflows/micropython.yml | 4 ++- ci/micropython.sh | 3 +- micropython/board/RPI_PICO_USB/board.json | 20 +++++++++++++ micropython/board/RPI_PICO_USB/manifest.py | 10 +++++++ .../board/RPI_PICO_USB/mpconfigboard.cmake | 7 +++++ .../board/RPI_PICO_USB/mpconfigboard.h | 4 +++ micropython/board/RPI_PICO_USB/pins.csv | 28 +++++++++++++++++++ micropython/board/manifest_pico.py | 2 +- .../modules/micropython-pico_usb.cmake | 14 ++++++++++ 9 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 micropython/board/RPI_PICO_USB/board.json create mode 100644 micropython/board/RPI_PICO_USB/manifest.py create mode 100644 micropython/board/RPI_PICO_USB/mpconfigboard.cmake create mode 100644 micropython/board/RPI_PICO_USB/mpconfigboard.h create mode 100644 micropython/board/RPI_PICO_USB/pins.csv create mode 100644 micropython/modules/micropython-pico_usb.cmake diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index f6e633ba..070d5fb5 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -7,7 +7,7 @@ on: types: [created] env: - MICROPYTHON_VERSION: master + MICROPYTHON_VERSION: 932f76c6ba64c5a3e68de3324556d9979f09303b jobs: build: @@ -19,6 +19,8 @@ jobs: include: - name: pico board: RPI_PICO + - name: pico_usb + board: RPI_PICO_USB - name: picow board: RPI_PICO_W - name: tiny2040_8mb diff --git a/ci/micropython.sh b/ci/micropython.sh index a109a1df..787e2929 100644 --- a/ci/micropython.sh +++ b/ci/micropython.sh @@ -14,8 +14,9 @@ function log_warning { function micropython_clone { log_inform "Using MicroPython $MICROPYTHON_VERSION" - git clone https://github.com/micropython/micropython --depth=1 --branch=$MICROPYTHON_VERSION + git clone https://github.com/micropython/micropython cd micropython + git checkout $MICROPYTHON_VERSION git submodule update --init lib/pico-sdk git submodule update --init lib/cyw43-driver git submodule update --init lib/lwip diff --git a/micropython/board/RPI_PICO_USB/board.json b/micropython/board/RPI_PICO_USB/board.json new file mode 100644 index 00000000..5a67a25e --- /dev/null +++ b/micropython/board/RPI_PICO_USB/board.json @@ -0,0 +1,20 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [ + "Breadboard friendly", + "Castellated Pads", + "Micro USB" + ], + "id": "rp2-pico", + "images": [ + "rp2-pico.jpg" + ], + "mcu": "rp2040", + "product": "Pico", + "thumbnail": "", + "url": "https://www.raspberrypi.com/products/raspberry-pi-pico/", + "vendor": "Raspberry Pi" +} \ No newline at end of file diff --git a/micropython/board/RPI_PICO_USB/manifest.py b/micropython/board/RPI_PICO_USB/manifest.py new file mode 100644 index 00000000..a7bb1f9d --- /dev/null +++ b/micropython/board/RPI_PICO_USB/manifest.py @@ -0,0 +1,10 @@ +include("$(PORT_DIR)/boards/manifest.py") + +include("../manifest_pico.py") + +require("usb-device") +require("usb-device-hid") +require("usb-device-cdc") +require("usb-device-keyboard") +require("usb-device-mouse") +require("usb-device-midi") diff --git a/micropython/board/RPI_PICO_USB/mpconfigboard.cmake b/micropython/board/RPI_PICO_USB/mpconfigboard.cmake new file mode 100644 index 00000000..c89ff780 --- /dev/null +++ b/micropython/board/RPI_PICO_USB/mpconfigboard.cmake @@ -0,0 +1,7 @@ +# cmake file for Raspberry Pi Pico +set(PICO_BOARD "pico") + +# Board specific version of the frozen manifest +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) + +set(MICROPY_C_HEAP_SIZE 4096) \ No newline at end of file diff --git a/micropython/board/RPI_PICO_USB/mpconfigboard.h b/micropython/board/RPI_PICO_USB/mpconfigboard.h new file mode 100644 index 00000000..f63c81e6 --- /dev/null +++ b/micropython/board/RPI_PICO_USB/mpconfigboard.h @@ -0,0 +1,4 @@ +// Board and hardware specific configuration +#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" +#define MICROPY_HW_FLASH_STORAGE_BYTES (1024 * 1024) +#define MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE 1 diff --git a/micropython/board/RPI_PICO_USB/pins.csv b/micropython/board/RPI_PICO_USB/pins.csv new file mode 100644 index 00000000..9c40b41c --- /dev/null +++ b/micropython/board/RPI_PICO_USB/pins.csv @@ -0,0 +1,28 @@ +GP0,GPIO0 +GP1,GPIO1 +GP2,GPIO2 +GP3,GPIO3 +GP4,GPIO4 +GP5,GPIO5 +GP6,GPIO6 +GP7,GPIO7 +GP8,GPIO8 +GP9,GPIO9 +GP10,GPIO10 +GP11,GPIO11 +GP12,GPIO12 +GP13,GPIO13 +GP14,GPIO14 +GP15,GPIO15 +GP16,GPIO16 +GP17,GPIO17 +GP18,GPIO18 +GP19,GPIO19 +GP20,GPIO20 +GP21,GPIO21 +GP22,GPIO22 +GP25,GPIO25 +GP26,GPIO26 +GP27,GPIO27 +GP28,GPIO28 +LED,GPIO25 \ No newline at end of file diff --git a/micropython/board/manifest_pico.py b/micropython/board/manifest_pico.py index a01f7034..20f98e9e 100644 --- a/micropython/board/manifest_pico.py +++ b/micropython/board/manifest_pico.py @@ -2,4 +2,4 @@ freeze("../modules_py", "gfx_pack.py") freeze("../modules_py", "interstate75.py") freeze("../modules_py", "pimoroni.py") -freeze("../modules_py", "boot.py") \ No newline at end of file +freeze("../modules_py", "boot.py") diff --git a/micropython/modules/micropython-pico_usb.cmake b/micropython/modules/micropython-pico_usb.cmake new file mode 100644 index 00000000..60fad7c8 --- /dev/null +++ b/micropython/modules/micropython-pico_usb.cmake @@ -0,0 +1,14 @@ +include_directories(${CMAKE_CURRENT_LIST_DIR}/../../) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../") + +set(CMAKE_C_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) + +include(micropython-common) +include(pico_wireless/micropython) + +# C++ Magic Memory +include(cppmem/micropython) From 7d0bb04d6df3bab2157c2fa2953d4f44588b13c6 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 4 Jun 2024 17:16:28 +0100 Subject: [PATCH 8/8] Keybow2040: Basic-ish USB examples. --- micropython/examples/keybow2040/is31fl3731.py | 236 ++++++++++++++++++ micropython/examples/keybow2040/usb_keypad.py | 67 +++++ .../examples/keybow2040/usb_rgb_keypad.py | 116 +++++++++ 3 files changed, 419 insertions(+) create mode 100644 micropython/examples/keybow2040/is31fl3731.py create mode 100644 micropython/examples/keybow2040/usb_keypad.py create mode 100644 micropython/examples/keybow2040/usb_rgb_keypad.py diff --git a/micropython/examples/keybow2040/is31fl3731.py b/micropython/examples/keybow2040/is31fl3731.py new file mode 100644 index 00000000..d61cc971 --- /dev/null +++ b/micropython/examples/keybow2040/is31fl3731.py @@ -0,0 +1,236 @@ +# Borrows heavily from : https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731/blob/main/adafruit_is31fl3731/keybow2040.py +# and : https://github.com/adafruit/micropython-adafruit-is31fl3731/blob/master/is31fl3731.py +import math +import utime + + +_MODE_REGISTER = const(0x00) # noqa: F821 +_FRAME_REGISTER = const(0x01) # noqa: F821 +_AUTOPLAY1_REGISTER = const(0x02) # noqa: F821 +_AUTOPLAY2_REGISTER = const(0x03) # noqa: F821 +_BLINK_REGISTER = const(0x05) # noqa: F821 +_AUDIOSYNC_REGISTER = const(0x06) # noqa: F821 +_BREATH1_REGISTER = const(0x08) # noqa: F821 +_BREATH2_REGISTER = const(0x09) # noqa: F821 +_SHUTDOWN_REGISTER = const(0x0a) # noqa: F821 +_GAIN_REGISTER = const(0x0b) # noqa: F821 +_ADC_REGISTER = const(0x0c) # noqa: F821 + +_CONFIG_BANK = const(0x0b) # noqa: F821 +_BANK_ADDRESS = const(0xfd) # noqa: F821 + +_PICTURE_MODE = const(0x00) # noqa: F821 +_AUTOPLAY_MODE = const(0x08) # noqa: F821 +_AUDIOPLAY_MODE = const(0x18) # noqa: F821 + +_ENABLE_OFFSET = const(0x00) # noqa: F821 +_BLINK_OFFSET = const(0x12) # noqa: F821 +_COLOR_OFFSET = const(0x24) # noqa: F821 + + +class Matrix: + width = 16 + height = 9 + + def __init__(self, i2c, address=0x74): + self.i2c = i2c + self.address = address + self.reset() + self.init() + + def _bank(self, bank=None): + if bank is None: + return self.i2c.readfrom_mem(self.address, _BANK_ADDRESS, 1)[0] + self.i2c.writeto_mem(self.address, _BANK_ADDRESS, bytearray([bank])) + + def _register(self, bank, register, value=None): + self._bank(bank) + if value is None: + return self.i2c.readfrom_mem(self.address, register, 1)[0] + self.i2c.writeto_mem(self.address, register, bytearray([value])) + + def _mode(self, mode=None): + return self._register(_CONFIG_BANK, _MODE_REGISTER, mode) + + def init(self): + self._mode(_PICTURE_MODE) + self.frame(0) + for frame in range(8): + self.fill(0, False, frame=frame) + for col in range(18): + self._register(frame, _ENABLE_OFFSET + col, 0xff) + self.audio_sync(False) + + def reset(self): + self.sleep(True) + utime.sleep_us(10) + self.sleep(False) + + def sleep(self, value): + return self._register(_CONFIG_BANK, _SHUTDOWN_REGISTER, not value) + + def autoplay(self, delay=0, loops=0, frames=0): + if delay == 0: + self._mode(_PICTURE_MODE) + return + delay //= 11 + if not 0 <= loops <= 7: + raise ValueError("Loops out of range") + if not 0 <= frames <= 7: + raise ValueError("Frames out of range") + if not 1 <= delay <= 64: + raise ValueError("Delay out of range") + self._register(_CONFIG_BANK, _AUTOPLAY1_REGISTER, loops << 4 | frames) + self._register(_CONFIG_BANK, _AUTOPLAY2_REGISTER, delay % 64) + self._mode(_AUTOPLAY_MODE | self._frame) + + def fade(self, fade_in=None, fade_out=None, pause=0): + if fade_in is None and fade_out is None: + self._register(_CONFIG_BANK, _BREATH2_REGISTER, 0) + elif fade_in is None: + fade_in = fade_out + elif fade_out is None: + fade_out = fade_in + fade_in = int(math.log(fade_in / 26, 2)) + fade_out = int(math.log(fade_out / 26, 2)) + pause = int(math.log(pause / 26, 2)) + if not 0 <= fade_in <= 7: + raise ValueError("Fade in out of range") + if not 0 <= fade_out <= 7: + raise ValueError("Fade out out of range") + if not 0 <= pause <= 7: + raise ValueError("Pause out of range") + self._register(_CONFIG_BANK, _BREATH1_REGISTER, fade_out << 4 | fade_in) + self._register(_CONFIG_BANK, _BREATH2_REGISTER, 1 << 4 | pause) + + def frame(self, frame=None, show=True): + if frame is None: + return self._frame + if not 0 <= frame <= 8: + raise ValueError("Frame out of range") + self._frame = frame + if show: + self._register(_CONFIG_BANK, _FRAME_REGISTER, frame) + + def audio_sync(self, value=None): + return self._register(_CONFIG_BANK, _AUDIOSYNC_REGISTER, value) + + def audio_play(self, sample_rate, audio_gain=0, + agc_enable=False, agc_fast=False): + if sample_rate == 0: + self._mode(_PICTURE_MODE) + return + sample_rate //= 46 + if not 1 <= sample_rate <= 256: + raise ValueError("Sample rate out of range") + self._register(_CONFIG_BANK, _ADC_REGISTER, sample_rate % 256) + audio_gain //= 3 + if not 0 <= audio_gain <= 7: + raise ValueError("Audio gain out of range") + self._register(_CONFIG_BANK, _GAIN_REGISTER, + bool(agc_enable) << 3 | bool(agc_fast) << 4 | audio_gain) + self._mode(_AUDIOPLAY_MODE) + + def blink(self, rate=None): + if rate is None: + return (self._register(_CONFIG_BANK, _BLINK_REGISTER) & 0x07) * 270 + elif rate == 0: + self._register(_CONFIG_BANK, _BLINK_REGISTER, 0x00) + return + rate //= 270 + self._register(_CONFIG_BANK, _BLINK_REGISTER, rate & 0x07 | 0x08) + + def fill(self, color=None, blink=None, frame=None): + if frame is None: + frame = self._frame + self._bank(frame) + if color is not None: + if not 0 <= color <= 255: + raise ValueError("Color out of range") + data = bytearray([color] * 24) + for row in range(6): + self.i2c.writeto_mem(self.address, + _COLOR_OFFSET + row * 24, data) + if blink is not None: + data = bool(blink) * 0xff + for col in range(18): + self._register(frame, _BLINK_OFFSET + col, data) + + def write_frame(self, data, frame=None): + if len(data) > 144: + raise ValueError("Bytearray too large for frame") + if frame is None: + frame = self._frame + self._bank(frame) + self.i2c.writeto_mem(self.address, _COLOR_OFFSET, data) + + def _pixel_addr(self, x, y): + return x + y * 16 + + def pixel(self, x, y, color=None, blink=None, frame=None): + if not 0 <= x <= self.width: + return + if not 0 <= y <= self.height: + return + pixel = self._pixel_addr(x, y) + if color is None and blink is None: + return self._register(self._frame, pixel) + if frame is None: + frame = self._frame + if color is not None: + if not 0 <= color <= 255: + raise ValueError("Color out of range") + self._register(frame, _COLOR_OFFSET + pixel, color) + if blink is not None: + addr, bit = divmod(pixel, 8) + bits = self._register(frame, _BLINK_OFFSET + addr) + if blink: + bits |= 1 << bit + else: + bits &= ~(1 << bit) + self._register(frame, _BLINK_OFFSET + addr, bits) + + +class Matrix_Keybow2040(Matrix): + width = 16 + height = 3 + + def pixelrgb(self, x, y, r, g, b, blink=None, frame=None): + """ + Blink or brightness for x, y-pixel + + :param x: horizontal pixel position + :param y: vertical pixel position + :param r: red brightness value 0->255 + :param g: green brightness value 0->255 + :param b: blue brightness value 0->255 + :param blink: True to blink + :param frame: the frame to set the pixel + """ + x = (4 * (3 - x)) + y + + super().pixel(x, 0, r, blink, frame) + super().pixel(x, 1, g, blink, frame) + super().pixel(x, 2, b, blink, frame) + + def _pixel_addr(self, x, y): + lookup = [ + (120, 88, 104), # 0, 0 + (136, 40, 72), # 1, 0 + (112, 80, 96), # 2, 0 + (128, 32, 64), # 3, 0 + (121, 89, 105), # 0, 1 + (137, 41, 73), # 1, 1 + (113, 81, 97), # 2, 1 + (129, 33, 65), # 3, 1 + (122, 90, 106), # 0, 2 + (138, 25, 74), # 1, 2 + (114, 82, 98), # 2, 2 + (130, 17, 66), # 3, 2 + (123, 91, 107), # 0, 3 + (139, 26, 75), # 1, 3 + (115, 83, 99), # 2, 3 + (131, 18, 67), # 3, 3 + ] + + return lookup[x][y] diff --git a/micropython/examples/keybow2040/usb_keypad.py b/micropython/examples/keybow2040/usb_keypad.py new file mode 100644 index 00000000..23f3d498 --- /dev/null +++ b/micropython/examples/keybow2040/usb_keypad.py @@ -0,0 +1,67 @@ +import time +import usb.device +from usb.device.keyboard import KeyboardInterface, KeyCode +from pimoroni import Button + +# A very basic HID Keyboard example for Keybow 2040 +# Inspired by: https://github.com/micropython/micropython-lib/blob/master/micropython/usb/examples/device/keyboard_example.py + +# This example requires a Pico USB compatible firmware, eg: pico_usb-1.23.0-pimoroni-micropython.uf2 + +# The pin order for Keybow 2040 is weird, +# But the below is laid out to match the pad with USB up +# from top left to bottom right. +KEYS = { + 18: KeyCode.A, 14: KeyCode.B, 10: KeyCode.C, 6: KeyCode.D, + 19: KeyCode.E, 15: KeyCode.F, 11: KeyCode.G, 7: KeyCode.H, + 20: KeyCode.I, 16: KeyCode.J, 12: KeyCode.K, 8: KeyCode.L, + 21: KeyCode.M, 17: KeyCode.N, 13: KeyCode.O, 9: KeyCode.P, +} + +# We'll fill this with Button instances +BUTTONS = {} + + +class Keybow2040(KeyboardInterface): + def on_led_update(self, led_mask): + pass + + +def main(): + for pin, keycode in KEYS.items(): + BUTTONS[pin] = Button(pin) + + k = Keybow2040() + usb.device.get().init(k, builtin_driver=True) + + keys = [0, 0, 0, 0, 0, 0] + + while True: + changed = False + if k.is_open(): + for pin, code in KEYS.items(): + pressed = BUTTONS[pin].read() + + # If the key is pressed then try to insert + # it at the first zero. Otherwise (try to) replace + # its keycode with 0 to clear that press. + c = code if pressed else 0 + i = 0 if pressed else code + + try: + keys[keys.index(i)] = c + changed = True + except ValueError: + # Either our 6-key list is full + # or we're releasing a key that's not in it! + # Or handling a key that isn't pressed. + pass + + if changed: + k.send_keys(keys) + time.sleep_ms(1) + + +if __name__ == "__main__": + print("Starting Keybow 2040...") + main() diff --git a/micropython/examples/keybow2040/usb_rgb_keypad.py b/micropython/examples/keybow2040/usb_rgb_keypad.py new file mode 100644 index 00000000..483a2138 --- /dev/null +++ b/micropython/examples/keybow2040/usb_rgb_keypad.py @@ -0,0 +1,116 @@ +import machine +import usb.device +from usb.device.keyboard import KeyboardInterface, KeyCode +from pimoroni import Button +from is31fl3731 import Matrix_Keybow2040 + +# A very basic HID Keyboard example for Keybow 2040 +# Inspired by: https://github.com/micropython/micropython-lib/blob/master/micropython/usb/examples/device/keyboard_example.py + +# This example requires a Pico USB compatible firmware, eg: pico_usb-1.23.0-pimoroni-micropython.uf2 + +# Don't forget to copy over is31fl3731.py too! + +# The pin order for Keybow 2040 is weird, +# But the below is laid out to match the pad with USB up +# from top left to bottom right. +KEYS = { + 18: KeyCode.A, 14: KeyCode.B, 10: KeyCode.C, 6: KeyCode.D, + 19: KeyCode.E, 15: KeyCode.F, 11: KeyCode.G, 7: KeyCode.H, + 20: KeyCode.I, 16: KeyCode.J, 12: KeyCode.K, 8: KeyCode.L, + 21: KeyCode.M, 17: KeyCode.N, 13: KeyCode.O, 9: KeyCode.P, +} + +# Another look up table for the balmy LED positioning +PIXELS = { + 18: (3, 0), 14: (3, 1), 10: (3, 2), 6: (3, 3), + 19: (2, 0), 15: (2, 1), 11: (2, 2), 7: (2, 3), + 20: (1, 0), 16: (1, 1), 12: (1, 2), 8: (1, 3), + 21: (0, 0), 17: (0, 1), 13: (0, 2), 9: (0, 3), +} + +# We'll fill this with Button instances +BUTTONS = {} +VALUES = {} +MAX_ON_TIME = 20.0 + + +# From CPython Lib/colorsys.py +def hsv_to_rgb(h, s, v): + if s == 0.0: + return v, v, v + i = int(h * 6.0) + f = (h * 6.0) - i + p = v * (1.0 - s) + q = v * (1.0 - s * f) + t = v * (1.0 - s * (1.0 - f)) + i = i % 6 + if i == 0: + return v, t, p + if i == 1: + return q, v, p + if i == 2: + return p, v, t + if i == 3: + return p, q, v + if i == 4: + return t, p, v + if i == 5: + return v, p, q + + +class Keybow2040(KeyboardInterface): + def on_led_update(self, led_mask): + pass + + +def main(): + for pin, keycode in KEYS.items(): + BUTTONS[pin] = Button(pin, repeat_time=0) + VALUES[pin] = 0 + + m = Matrix_Keybow2040(machine.I2C(0, 400000)) + k = Keybow2040() + usb.device.get().init(k, builtin_driver=True) + + keys = [0, 0, 0, 0, 0, 0] + + while True: + changed = False + if k.is_open(): + for pin, code in KEYS.items(): + pressed = BUTTONS[pin].read() + + if pressed: + VALUES[pin] = MAX_ON_TIME + + # If the key is pressed then try to insert + # it at the first zero. Otherwise (try to) replace + # its keycode with 0 to clear that press. + c = code if pressed else 0 + i = 0 if pressed else code + + try: + keys[keys.index(i)] = c + changed = True + except ValueError: + # Either our 6-key list is full + # or we're releasing a key that's not in it! + # Or handling a key that isn't pressed. + pass + + if changed: + k.send_keys(keys) + + for pin, code in KEYS.items(): + x, y = PIXELS[pin] + v = VALUES[pin] / MAX_ON_TIME + r, g, b = [int(c * 255) for c in hsv_to_rgb(x / 4.0, 0.7, 1.0 - v)] + m.pixelrgb(x, y, r, g, b) + if VALUES[pin] > 0: + VALUES[pin] -= 1 + + +if __name__ == "__main__": + print("Starting Keybow 2040...") + main()