summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docs/develop/compiler.rst4
-rw-r--r--docs/develop/library.rst6
-rw-r--r--docs/develop/natmod.rst6
-rw-r--r--docs/develop/porting.rst8
-rw-r--r--drivers/bus/softqspi.c18
-rw-r--r--drivers/cyw43/cywbt.c16
-rw-r--r--drivers/dht/dht.c2
-rw-r--r--drivers/esp-hosted/esp_hosted_hal.c4
-rw-r--r--drivers/memory/spiflash.c28
-rw-r--r--examples/natmod/btree/btree_c.c6
-rw-r--r--examples/natmod/deflate/deflate.c4
-rw-r--r--examples/natmod/features0/features0.c6
-rw-r--r--examples/natmod/features1/features1.c18
-rw-r--r--examples/natmod/features2/main.c14
-rw-r--r--examples/natmod/features3/features3.c12
-rw-r--r--examples/natmod/features4/features4.c10
-rw-r--r--examples/natmod/framebuf/framebuf.c2
-rw-r--r--examples/natmod/re/re.c4
-rw-r--r--examples/usercmodule/cexample/examplemodule.c18
-rw-r--r--examples/usercmodule/cppexample/examplemodule.c6
-rw-r--r--examples/usercmodule/subpackage/modexamplepackage.c28
-rw-r--r--extmod/btstack/btstack_hci_uart.c40
-rw-r--r--extmod/btstack/modbluetooth_btstack.c64
-rw-r--r--extmod/machine_adc.c56
-rw-r--r--extmod/machine_adc_block.c26
-rw-r--r--extmod/machine_bitstream.c2
-rw-r--r--extmod/machine_i2c.c76
-rw-r--r--extmod/machine_i2s.c78
-rw-r--r--extmod/machine_mem.c6
-rw-r--r--extmod/machine_pinbase.c6
-rw-r--r--extmod/machine_pulse.c2
-rw-r--r--extmod/machine_pwm.c52
-rw-r--r--extmod/machine_signal.c24
-rw-r--r--extmod/machine_spi.c32
-rw-r--r--extmod/machine_timer.c18
-rw-r--r--extmod/machine_uart.c62
-rw-r--r--extmod/machine_wdt.c20
-rw-r--r--extmod/modasyncio.c62
-rw-r--r--extmod/modbinascii.c24
-rw-r--r--extmod/modbluetooth.c160
-rw-r--r--extmod/modbluetooth.h4
-rw-r--r--extmod/modbtree.c68
-rw-r--r--extmod/modcryptolib.c42
-rw-r--r--extmod/moddeflate.c28
-rw-r--r--extmod/modframebuf.c122
-rw-r--r--extmod/modhashlib.c76
-rw-r--r--extmod/modheapq.c22
-rw-r--r--extmod/modjson.c32
-rw-r--r--extmod/modlwip.c144
-rw-r--r--extmod/modmachine.c48
-rw-r--r--extmod/modnetwork.c12
-rw-r--r--extmod/modonewire.c34
-rw-r--r--extmod/modos.c28
-rw-r--r--extmod/modplatform.c26
-rw-r--r--extmod/modrandom.c50
-rw-r--r--extmod/modre.c48
-rw-r--r--extmod/modselect.c48
-rw-r--r--extmod/modsocket.c76
-rw-r--r--extmod/modtime.c30
-rw-r--r--extmod/modtls_axtls.c54
-rw-r--r--extmod/modtls_mbedtls.c90
-rw-r--r--extmod/moductypes.c44
-rw-r--r--extmod/modvfs.c4
-rw-r--r--extmod/modwebrepl.c48
-rw-r--r--extmod/modwebsocket.c26
-rw-r--r--extmod/network_cyw43.c56
-rw-r--r--extmod/network_esp_hosted.c40
-rw-r--r--extmod/network_ninaw10.c98
-rw-r--r--extmod/network_wiznet5k.c116
-rw-r--r--extmod/nimble/hal/hal_uart.c2
-rw-r--r--extmod/nimble/modbluetooth_nimble.c128
-rw-r--r--extmod/nimble/nimble/nimble_npl_os.c8
-rw-r--r--extmod/os_dupterm.c2
-rw-r--r--extmod/vfs.c8
-rw-r--r--extmod/vfs_fat.c70
-rw-r--r--extmod/vfs_fat_diskio.c2
-rw-r--r--extmod/vfs_fat_file.c18
-rw-r--r--extmod/vfs_lfs.c2
-rw-r--r--extmod/vfs_lfsx.c80
-rw-r--r--extmod/vfs_lfsx_file.c18
-rw-r--r--extmod/vfs_posix.c68
-rw-r--r--extmod/vfs_posix_file.c24
-rw-r--r--extmod/vfs_reader.c4
-rw-r--r--mpy-cross/main.c18
-rw-r--r--ports/cc3200/boards/make-pins.py2
-rw-r--r--ports/cc3200/ftp/ftp.c14
-rw-r--r--ports/cc3200/misc/mpirq.c22
-rw-r--r--ports/cc3200/mods/machine_wdt.c6
-rw-r--r--ports/cc3200/mods/modhashlib.c26
-rw-r--r--ports/cc3200/mods/modmachine.c26
-rw-r--r--ports/cc3200/mods/modnetwork.c36
-rw-r--r--ports/cc3200/mods/modos.c4
-rw-r--r--ports/cc3200/mods/modsocket.c104
-rw-r--r--ports/cc3200/mods/modssl.c14
-rw-r--r--ports/cc3200/mods/modtime.c4
-rw-r--r--ports/cc3200/mods/modwipy.c8
-rw-r--r--ports/cc3200/mods/modwlan.c170
-rw-r--r--ports/cc3200/mods/pybadc.c62
-rw-r--r--ports/cc3200/mods/pybflash.c20
-rw-r--r--ports/cc3200/mods/pybi2c.c80
-rw-r--r--ports/cc3200/mods/pybpin.c134
-rw-r--r--ports/cc3200/mods/pybrtc.c84
-rw-r--r--ports/cc3200/mods/pybsd.c40
-rw-r--r--ports/cc3200/mods/pybsleep.c42
-rw-r--r--ports/cc3200/mods/pybspi.c46
-rw-r--r--ports/cc3200/mods/pybtimer.c116
-rw-r--r--ports/cc3200/mods/pybuart.c90
-rw-r--r--ports/cc3200/mptask.c16
-rw-r--r--ports/cc3200/mpthreadport.c10
-rw-r--r--ports/cc3200/util/random.c6
-rw-r--r--ports/esp32/esp32_nvs.c34
-rw-r--r--ports/esp32/esp32_partition.c46
-rw-r--r--ports/esp32/esp32_rmt.c42
-rw-r--r--ports/esp32/esp32_ulp.c20
-rw-r--r--ports/esp32/machine_adc.c24
-rw-r--r--ports/esp32/machine_adc_block.c8
-rw-r--r--ports/esp32/machine_bitstream.c10
-rw-r--r--ports/esp32/machine_dac.c12
-rw-r--r--ports/esp32/machine_hw_spi.c22
-rwxr-xr-xports/esp32/machine_i2c.c8
-rw-r--r--ports/esp32/machine_i2s.c28
-rw-r--r--ports/esp32/machine_pin.c48
-rw-r--r--ports/esp32/machine_pwm.c70
-rw-r--r--ports/esp32/machine_rtc.c22
-rw-r--r--ports/esp32/machine_sdcard.c30
-rw-r--r--ports/esp32/machine_timer.c32
-rw-r--r--ports/esp32/machine_touchpad.c12
-rw-r--r--ports/esp32/machine_uart.c22
-rw-r--r--ports/esp32/machine_wdt.c6
-rw-r--r--ports/esp32/modesp.c36
-rw-r--r--ports/esp32/modesp32.c32
-rw-r--r--ports/esp32/modespnow.c86
-rwxr-xr-xports/esp32/modmachine.c24
-rw-r--r--ports/esp32/modos.c4
-rw-r--r--ports/esp32/modsocket.c100
-rw-r--r--ports/esp32/modtime.c4
-rw-r--r--ports/esp32/mphalport.c2
-rw-r--r--ports/esp32/mpnimbleport.c2
-rw-r--r--ports/esp32/mpthreadport.c10
-rw-r--r--ports/esp32/network_common.c6
-rw-r--r--ports/esp32/network_lan.c26
-rw-r--r--ports/esp32/network_ppp.c28
-rw-r--r--ports/esp32/network_wlan.c38
-rw-r--r--ports/esp32/uart.c4
-rw-r--r--ports/esp8266/esp_mphal.c2
-rw-r--r--ports/esp8266/esppwm.c32
-rw-r--r--ports/esp8266/lexerstr32.c4
-rw-r--r--ports/esp8266/machine_adc.c14
-rw-r--r--ports/esp8266/machine_pin.c56
-rw-r--r--ports/esp8266/machine_pwm.c30
-rw-r--r--ports/esp8266/machine_rtc.c30
-rw-r--r--ports/esp8266/machine_spi.c8
-rw-r--r--ports/esp8266/machine_uart.c20
-rw-r--r--ports/esp8266/machine_wdt.c6
-rw-r--r--ports/esp8266/main.c4
-rw-r--r--ports/esp8266/modesp.c82
-rw-r--r--ports/esp8266/modespnow.c52
-rw-r--r--ports/esp8266/modmachine.c40
-rw-r--r--ports/esp8266/modos.c6
-rw-r--r--ports/esp8266/modtime.c4
-rw-r--r--ports/esp8266/network_wlan.c48
-rw-r--r--ports/mimxrt/dma_manager.c2
-rw-r--r--ports/mimxrt/eth.c24
-rw-r--r--ports/mimxrt/machine_adc.c10
-rw-r--r--ports/mimxrt/machine_i2c.c10
-rw-r--r--ports/mimxrt/machine_i2s.c64
-rw-r--r--ports/mimxrt/machine_led.c20
-rw-r--r--ports/mimxrt/machine_pin.c64
-rw-r--r--ports/mimxrt/machine_pwm.c34
-rw-r--r--ports/mimxrt/machine_rtc.c52
-rw-r--r--ports/mimxrt/machine_sdcard.c38
-rw-r--r--ports/mimxrt/machine_spi.c12
-rw-r--r--ports/mimxrt/machine_uart.c30
-rw-r--r--ports/mimxrt/machine_wdt.c8
-rw-r--r--ports/mimxrt/mimxrt_flash.c20
-rw-r--r--ports/mimxrt/modmachine.c16
-rw-r--r--ports/mimxrt/modmimxrt.c4
-rw-r--r--ports/mimxrt/modos.c12
-rw-r--r--ports/mimxrt/modtime.c4
-rw-r--r--ports/mimxrt/mpbthciport.c10
-rw-r--r--ports/mimxrt/mphalport.c2
-rw-r--r--ports/mimxrt/mpnetworkport.c2
-rw-r--r--ports/mimxrt/network_lan.c30
-rw-r--r--ports/nrf/boards/MICROBIT/modules/microbitdisplay.c12
-rw-r--r--ports/nrf/boards/MICROBIT/modules/microbitimage.c30
-rw-r--r--ports/nrf/boards/MICROBIT/modules/modmicrobit.c14
-rw-r--r--ports/nrf/boards/make-pins.py2
-rw-r--r--ports/nrf/drivers/bluetooth/ble_uart.c4
-rw-r--r--ports/nrf/drivers/flash.c8
-rw-r--r--ports/nrf/modules/ble/modble.c12
-rw-r--r--ports/nrf/modules/board/led.c12
-rw-r--r--ports/nrf/modules/board/modboard.c4
-rw-r--r--ports/nrf/modules/machine/adc.c14
-rw-r--r--ports/nrf/modules/machine/i2c.c8
-rw-r--r--ports/nrf/modules/machine/modmachine.c26
-rw-r--r--ports/nrf/modules/machine/pin.c112
-rw-r--r--ports/nrf/modules/machine/pwm.c36
-rw-r--r--ports/nrf/modules/machine/rtcounter.c46
-rw-r--r--ports/nrf/modules/machine/soft_pwm.c28
-rw-r--r--ports/nrf/modules/machine/spi.c24
-rw-r--r--ports/nrf/modules/machine/temp.c12
-rw-r--r--ports/nrf/modules/machine/timer.c32
-rw-r--r--ports/nrf/modules/machine/uart.c30
-rw-r--r--ports/nrf/modules/music/modmusic.c26
-rw-r--r--ports/nrf/modules/nrf/flashbdev.c14
-rw-r--r--ports/nrf/modules/nrf/modnrf.c12
-rw-r--r--ports/nrf/modules/os/microbitfs.c92
-rw-r--r--ports/nrf/modules/os/modos.c4
-rw-r--r--ports/nrf/modules/ubluepy/modubluepy.c4
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_characteristic.c24
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_constants.c8
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_delegate.c16
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_descriptor.c8
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_peripheral.c50
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_scan_entry.c22
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_scanner.c14
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_service.c24
-rw-r--r--ports/nrf/modules/ubluepy/ubluepy_uuid.c12
-rw-r--r--ports/nrf/mphalport.c2
-rw-r--r--ports/nrf/pin_named_pins.c2
-rw-r--r--ports/pic16bit/modpyb.c16
-rw-r--r--ports/pic16bit/modpybled.c14
-rw-r--r--ports/pic16bit/modpybswitch.c10
-rw-r--r--ports/qemu-arm/modmachine.c2
-rw-r--r--ports/renesas-ra/boardctrl.c4
-rw-r--r--ports/renesas-ra/extint.c36
-rw-r--r--ports/renesas-ra/flashbdev.c2
-rw-r--r--ports/renesas-ra/irq.c6
-rw-r--r--ports/renesas-ra/led.c14
-rw-r--r--ports/renesas-ra/machine_adc.c8
-rw-r--r--ports/renesas-ra/machine_dac.c30
-rw-r--r--ports/renesas-ra/machine_i2c.c20
-rw-r--r--ports/renesas-ra/machine_pin.c32
-rw-r--r--ports/renesas-ra/machine_pwm.c26
-rw-r--r--ports/renesas-ra/machine_rtc.c16
-rw-r--r--ports/renesas-ra/machine_sdcard.c36
-rw-r--r--ports/renesas-ra/machine_spi.c14
-rw-r--r--ports/renesas-ra/machine_uart.c28
-rw-r--r--ports/renesas-ra/main.c10
-rw-r--r--ports/renesas-ra/modmachine.c20
-rw-r--r--ports/renesas-ra/modos.c4
-rw-r--r--ports/renesas-ra/modtime.c4
-rw-r--r--ports/renesas-ra/mpbthciport.c10
-rw-r--r--ports/renesas-ra/mphalport.c2
-rw-r--r--ports/renesas-ra/mpthreadport.c2
-rw-r--r--ports/renesas-ra/pybthread.c2
-rw-r--r--ports/renesas-ra/ra_it.c6
-rw-r--r--ports/renesas-ra/storage.c20
-rw-r--r--ports/renesas-ra/timer.c64
-rw-r--r--ports/renesas-ra/uart.c4
-rw-r--r--ports/renesas-ra/usrsw.c16
-rw-r--r--ports/rp2/machine_adc.c8
-rw-r--r--ports/rp2/machine_i2c.c8
-rw-r--r--ports/rp2/machine_i2s.c66
-rw-r--r--ports/rp2/machine_pin.c50
-rw-r--r--ports/rp2/machine_pwm.c32
-rw-r--r--ports/rp2/machine_rtc.c12
-rw-r--r--ports/rp2/machine_spi.c12
-rw-r--r--ports/rp2/machine_timer.c20
-rw-r--r--ports/rp2/machine_uart.c44
-rw-r--r--ports/rp2/machine_wdt.c6
-rw-r--r--ports/rp2/modmachine.c16
-rw-r--r--ports/rp2/modos.c4
-rw-r--r--ports/rp2/modrp2.c8
-rw-r--r--ports/rp2/modtime.c4
-rw-r--r--ports/rp2/mpbthciport.c4
-rw-r--r--ports/rp2/mphalport.c4
-rw-r--r--ports/rp2/mpthreadport.c12
-rw-r--r--ports/rp2/rp2_dma.c52
-rw-r--r--ports/rp2/rp2_flash.c20
-rw-r--r--ports/rp2/rp2_pio.c126
-rw-r--r--ports/samd/machine_adc.c8
-rw-r--r--ports/samd/machine_dac.c12
-rw-r--r--ports/samd/machine_i2c.c8
-rw-r--r--ports/samd/machine_pin.c44
-rw-r--r--ports/samd/machine_pwm.c36
-rw-r--r--ports/samd/machine_rtc.c22
-rw-r--r--ports/samd/machine_spi.c12
-rw-r--r--ports/samd/machine_uart.c26
-rw-r--r--ports/samd/machine_wdt.c10
-rw-r--r--ports/samd/modmachine.c16
-rw-r--r--ports/samd/modos.c6
-rw-r--r--ports/samd/modsamd.c8
-rw-r--r--ports/samd/modtime.c4
-rw-r--r--ports/samd/mphalport.c2
-rw-r--r--ports/samd/pin_af.c2
-rw-r--r--ports/samd/samd_flash.c30
-rw-r--r--ports/samd/samd_qspiflash.c24
-rw-r--r--ports/samd/samd_spiflash.c24
-rw-r--r--ports/stm32/accel.c36
-rw-r--r--ports/stm32/adc.c68
-rw-r--r--ports/stm32/boardctrl.c4
-rw-r--r--ports/stm32/boards/ADAFRUIT_F405_EXPRESS/bdev.c4
-rw-r--r--ports/stm32/boards/ARDUINO_GIGA/bdev.c2
-rw-r--r--ports/stm32/boards/ARDUINO_NICLA_VISION/bdev.c2
-rw-r--r--ports/stm32/boards/ARDUINO_PORTENTA_H7/bdev.c2
-rw-r--r--ports/stm32/boards/LEGO_HUB_NO6/bdev.c6
-rw-r--r--ports/stm32/boards/LEGO_HUB_NO6/cc2564.c2
-rw-r--r--ports/stm32/boards/MIKROE_QUAIL/bdev.c4
-rw-r--r--ports/stm32/boards/PYBD_SF2/bdev.c4
-rw-r--r--ports/stm32/boards/SPARKFUN_MICROMOD_STM32/bdev.c4
-rw-r--r--ports/stm32/boards/STM32F769DISC/board_init.c2
-rw-r--r--ports/stm32/boards/STM32L476DISC/bdev.c4
-rw-r--r--ports/stm32/boards/VCC_GND_F407VE/bdev.c4
-rw-r--r--ports/stm32/boards/VCC_GND_F407ZG/bdev.c4
-rw-r--r--ports/stm32/can.c4
-rw-r--r--ports/stm32/dac.c50
-rw-r--r--ports/stm32/eth.c30
-rw-r--r--ports/stm32/extint.c40
-rw-r--r--ports/stm32/fdcan.c2
-rw-r--r--ports/stm32/i2c.c16
-rw-r--r--ports/stm32/irq.c6
-rw-r--r--ports/stm32/lcd.c48
-rw-r--r--ports/stm32/led.c26
-rw-r--r--ports/stm32/machine_adc.c20
-rw-r--r--ports/stm32/machine_i2c.c12
-rw-r--r--ports/stm32/machine_i2s.c28
-rw-r--r--ports/stm32/machine_spi.c12
-rw-r--r--ports/stm32/machine_uart.c26
-rw-r--r--ports/stm32/machine_wdt.c6
-rw-r--r--ports/stm32/main.c12
-rw-r--r--ports/stm32/make-stmconst.py6
-rw-r--r--ports/stm32/mboot/main.c2
-rw-r--r--ports/stm32/modmachine.c20
-rw-r--r--ports/stm32/modos.c4
-rw-r--r--ports/stm32/modpyb.c28
-rw-r--r--ports/stm32/modstm.c4
-rw-r--r--ports/stm32/modtime.c4
-rw-r--r--ports/stm32/mpbthciport.c12
-rw-r--r--ports/stm32/mpbtstackport.c2
-rw-r--r--ports/stm32/mpnetworkport.c2
-rw-r--r--ports/stm32/mpthreadport.c2
-rw-r--r--ports/stm32/network_lan.c28
-rw-r--r--ports/stm32/octospi.c10
-rw-r--r--ports/stm32/pin.c108
-rw-r--r--ports/stm32/powerctrl.c14
-rw-r--r--ports/stm32/pyb_can.c64
-rw-r--r--ports/stm32/pyb_i2c.c56
-rw-r--r--ports/stm32/pyb_spi.c36
-rw-r--r--ports/stm32/pybthread.c2
-rw-r--r--ports/stm32/qspi.c10
-rw-r--r--ports/stm32/rfcore.c62
-rw-r--r--ports/stm32/rng.c4
-rw-r--r--ports/stm32/rtc.c34
-rw-r--r--ports/stm32/sdcard.c52
-rw-r--r--ports/stm32/servo.c32
-rw-r--r--ports/stm32/spi.c20
-rw-r--r--ports/stm32/stm32_it.c8
-rw-r--r--ports/stm32/storage.c20
-rw-r--r--ports/stm32/subghz.c8
-rw-r--r--ports/stm32/timer.c96
-rw-r--r--ports/stm32/uart.c8
-rw-r--r--ports/stm32/usb.c106
-rw-r--r--ports/stm32/usbd_cdc_interface.c2
-rw-r--r--ports/stm32/usbd_desc.c4
-rw-r--r--ports/stm32/usbd_msc_interface.c34
-rw-r--r--ports/stm32/usrsw.c16
-rw-r--r--ports/unix/coverage.c42
-rw-r--r--ports/unix/coveragecpp.cpp2
-rw-r--r--ports/unix/main.c30
-rw-r--r--ports/unix/modffi.c90
-rw-r--r--ports/unix/modjni.c76
-rw-r--r--ports/unix/modmachine.c2
-rw-r--r--ports/unix/modos.c24
-rw-r--r--ports/unix/modsocket.c90
-rw-r--r--ports/unix/modtermios.c16
-rw-r--r--ports/unix/modtime.c20
-rw-r--r--ports/unix/mpbthciport.c16
-rw-r--r--ports/unix/mpbtstackport_h4.c2
-rw-r--r--ports/unix/mpbtstackport_usb.c6
-rw-r--r--ports/unix/mpthreadport.c14
-rw-r--r--ports/unix/unix_mphal.c2
-rw-r--r--ports/webassembly/main.c2
-rw-r--r--ports/windows/fmode.c2
-rw-r--r--ports/windows/windows_mphal.c14
-rw-r--r--ports/zephyr/machine_i2c.c6
-rw-r--r--ports/zephyr/machine_pin.c42
-rw-r--r--ports/zephyr/machine_spi.c8
-rw-r--r--ports/zephyr/machine_uart.c26
-rw-r--r--ports/zephyr/main.c2
-rw-r--r--ports/zephyr/modbluetooth_zephyr.c18
-rw-r--r--ports/zephyr/modmachine.c6
-rw-r--r--ports/zephyr/modsocket.c70
-rw-r--r--ports/zephyr/modtime.c2
-rw-r--r--ports/zephyr/modzephyr.c20
-rw-r--r--ports/zephyr/modzsensor.c24
-rw-r--r--ports/zephyr/zephyr_storage.c40
-rw-r--r--py/asmarm.c30
-rw-r--r--py/asmthumb.c6
-rw-r--r--py/asmx64.c26
-rw-r--r--py/asmx86.c32
-rw-r--r--py/asmxtensa.c2
-rw-r--r--py/bc.c6
-rw-r--r--py/builtinevex.c14
-rw-r--r--py/builtinhelp.c12
-rw-r--r--py/builtinimport.c20
-rw-r--r--py/compile.c214
-rw-r--r--py/emitbc.c30
-rw-r--r--py/emitinlinethumb.c42
-rw-r--r--py/emitinlinextensa.c26
-rw-r--r--py/emitnative.c240
-rw-r--r--py/emitnx86.c2
-rw-r--r--py/gc.c14
-rw-r--r--py/lexer.c58
-rw-r--r--py/malloc.c4
-rw-r--r--py/map.c8
-rw-r--r--py/modarray.c4
-rw-r--r--py/modbuiltins.c68
-rw-r--r--py/modcmath.c40
-rw-r--r--py/modcollections.c4
-rw-r--r--py/moderrno.c8
-rw-r--r--py/modgc.c18
-rw-r--r--py/modio.c38
-rw-r--r--py/modmath.c64
-rw-r--r--py/modmicropython.c56
-rw-r--r--py/modstruct.c20
-rw-r--r--py/modsys.c38
-rw-r--r--py/modthread.c54
-rw-r--r--py/mpconfig.h6
-rw-r--r--py/mpprint.c4
-rw-r--r--py/mpz.c38
-rw-r--r--py/nativeglue.c20
-rw-r--r--py/objarray.c42
-rw-r--r--py/objattrtuple.c6
-rw-r--r--py/objbool.c8
-rw-r--r--py/objboundmeth.c10
-rw-r--r--py/objcell.c4
-rw-r--r--py/objclosure.c6
-rw-r--r--py/objcomplex.c10
-rw-r--r--py/objdeque.c20
-rw-r--r--py/objdict.c90
-rw-r--r--py/objenumerate.c6
-rw-r--r--py/objexcept.c6
-rw-r--r--py/objfilter.c4
-rw-r--r--py/objfloat.c10
-rw-r--r--py/objfun.c24
-rw-r--r--py/objgenerator.c30
-rw-r--r--py/objgetitemiter.c4
-rw-r--r--py/objint.c20
-rw-r--r--py/objint_mpz.c4
-rw-r--r--py/objlist.c70
-rw-r--r--py/objmap.c4
-rw-r--r--py/objmodule.c14
-rw-r--r--py/objnamedtuple.c12
-rw-r--r--py/objnone.c2
-rw-r--r--py/objobject.c24
-rw-r--r--py/objpolyiter.c10
-rw-r--r--py/objproperty.c18
-rw-r--r--py/objrange.c22
-rw-r--r--py/objreversed.c4
-rw-r--r--py/objset.c104
-rw-r--r--py/objsingleton.c2
-rw-r--r--py/objslice.c14
-rw-r--r--py/objstr.c120
-rw-r--r--py/objstringio.c28
-rw-r--r--py/objstrunicode.c14
-rw-r--r--py/objtuple.c18
-rw-r--r--py/objtype.c56
-rw-r--r--py/objzip.c4
-rw-r--r--py/opmethods.c8
-rw-r--r--py/parse.c58
-rw-r--r--py/parsenum.c2
-rw-r--r--py/persistentcode.c28
-rw-r--r--py/profile.c18
-rw-r--r--py/qstr.c8
-rw-r--r--py/reader.c8
-rw-r--r--py/repl.c8
-rw-r--r--py/runtime.c10
-rw-r--r--py/scope.c4
-rw-r--r--py/stream.c30
-rw-r--r--py/unicode.c2
-rw-r--r--py/vstr.c4
-rw-r--r--shared/libc/printf.c2
-rw-r--r--shared/readline/readline.c12
-rw-r--r--shared/runtime/gchelper_generic.c10
-rw-r--r--shared/runtime/mpirq.c14
-rw-r--r--shared/runtime/pyexec.c20
-rw-r--r--shared/runtime/softtimer.c4
-rw-r--r--shared/runtime/sys_stdio_mphal.c26
-rw-r--r--shared/timeutils/timeutils.c4
-rw-r--r--shared/tinyusb/mp_cdc_common.c2
-rw-r--r--tools/boardgen.py4
482 files changed, 6288 insertions, 6294 deletions
diff --git a/docs/develop/compiler.rst b/docs/develop/compiler.rst
index 00cc90f816..0c25ad3a01 100644
--- a/docs/develop/compiler.rst
+++ b/docs/develop/compiler.rst
@@ -98,7 +98,7 @@ Then also edit ``py/lexer.c`` to add the new keyword literal text:
.. code-block:: c
:emphasize-lines: 12
- STATIC const char *const tok_kw[] = {
+ static const char *const tok_kw[] = {
...
"or",
"pass",
@@ -301,7 +301,7 @@ code statement:
.. code-block:: c
- STATIC void emit_native_unary_op(emit_t *emit, mp_unary_op_t op) {
+ static void emit_native_unary_op(emit_t *emit, mp_unary_op_t op) {
vtype_kind_t vtype;
emit_pre_pop_reg(emit, &vtype, REG_ARG_2);
if (vtype == VTYPE_PYOBJ) {
diff --git a/docs/develop/library.rst b/docs/develop/library.rst
index c2a86ea169..830211d81c 100644
--- a/docs/develop/library.rst
+++ b/docs/develop/library.rst
@@ -48,16 +48,16 @@ hypothetical new module ``subsystem`` in the file ``modsubsystem.c``:
#if MICROPY_PY_SUBSYSTEM
// info()
- STATIC mp_obj_t py_subsystem_info(void) {
+ static mp_obj_t py_subsystem_info(void) {
return MP_OBJ_NEW_SMALL_INT(42);
}
MP_DEFINE_CONST_FUN_OBJ_0(subsystem_info_obj, py_subsystem_info);
- STATIC const mp_rom_map_elem_t mp_module_subsystem_globals_table[] = {
+ static const mp_rom_map_elem_t mp_module_subsystem_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_subsystem) },
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&subsystem_info_obj) },
};
- STATIC MP_DEFINE_CONST_DICT(mp_module_subsystem_globals, mp_module_subsystem_globals_table);
+ static MP_DEFINE_CONST_DICT(mp_module_subsystem_globals, mp_module_subsystem_globals_table);
const mp_obj_module_t mp_module_subsystem = {
.base = { &mp_type_module },
diff --git a/docs/develop/natmod.rst b/docs/develop/natmod.rst
index 6d15f867bc..502ea1c4c6 100644
--- a/docs/develop/natmod.rst
+++ b/docs/develop/natmod.rst
@@ -128,7 +128,7 @@ The file ``factorial.c`` contains:
#include "py/dynruntime.h"
// Helper function to compute factorial
- STATIC mp_int_t factorial_helper(mp_int_t x) {
+ static mp_int_t factorial_helper(mp_int_t x) {
if (x == 0) {
return 1;
}
@@ -136,7 +136,7 @@ The file ``factorial.c`` contains:
}
// This is the function which will be called from Python, as factorial(x)
- STATIC mp_obj_t factorial(mp_obj_t x_obj) {
+ static mp_obj_t factorial(mp_obj_t x_obj) {
// Extract the integer from the MicroPython input object
mp_int_t x = mp_obj_get_int(x_obj);
// Calculate the factorial
@@ -145,7 +145,7 @@ The file ``factorial.c`` contains:
return mp_obj_new_int(result);
}
// Define a Python reference to the function above
- STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial);
+ static MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial);
// This is the entry point and is called when the module is imported
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
diff --git a/docs/develop/porting.rst b/docs/develop/porting.rst
index 09e61d5d9b..99725e1000 100644
--- a/docs/develop/porting.rst
+++ b/docs/develop/porting.rst
@@ -262,17 +262,17 @@ To add a custom module like ``myport``, first add the module definition in a fil
#include "py/runtime.h"
- STATIC mp_obj_t myport_info(void) {
+ static mp_obj_t myport_info(void) {
mp_printf(&mp_plat_print, "info about my port\n");
return mp_const_none;
}
- STATIC MP_DEFINE_CONST_FUN_OBJ_0(myport_info_obj, myport_info);
+ static MP_DEFINE_CONST_FUN_OBJ_0(myport_info_obj, myport_info);
- STATIC const mp_rom_map_elem_t myport_module_globals_table[] = {
+ static const mp_rom_map_elem_t myport_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_myport) },
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&myport_info_obj) },
};
- STATIC MP_DEFINE_CONST_DICT(myport_module_globals, myport_module_globals_table);
+ static MP_DEFINE_CONST_DICT(myport_module_globals, myport_module_globals_table);
const mp_obj_module_t myport_module = {
.base = { &mp_type_module },
diff --git a/drivers/bus/softqspi.c b/drivers/bus/softqspi.c
index dc205da3a7..65a504a739 100644
--- a/drivers/bus/softqspi.c
+++ b/drivers/bus/softqspi.c
@@ -49,14 +49,14 @@
#endif
-STATIC void nibble_write(mp_soft_qspi_obj_t *self, uint8_t v) {
+static void nibble_write(mp_soft_qspi_obj_t *self, uint8_t v) {
mp_hal_pin_write(self->io0, v & 1);
mp_hal_pin_write(self->io1, (v >> 1) & 1);
mp_hal_pin_write(self->io2, (v >> 2) & 1);
mp_hal_pin_write(self->io3, (v >> 3) & 1);
}
-STATIC int mp_soft_qspi_ioctl(void *self_in, uint32_t cmd) {
+static int mp_soft_qspi_ioctl(void *self_in, uint32_t cmd) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
switch (cmd) {
@@ -80,7 +80,7 @@ STATIC int mp_soft_qspi_ioctl(void *self_in, uint32_t cmd) {
return 0; // success
}
-STATIC void mp_soft_qspi_transfer(mp_soft_qspi_obj_t *self, size_t len, const uint8_t *src, uint8_t *dest) {
+static void mp_soft_qspi_transfer(mp_soft_qspi_obj_t *self, size_t len, const uint8_t *src, uint8_t *dest) {
// Will run as fast as possible, limited only by CPU speed and GPIO time
mp_hal_pin_input(self->io1);
mp_hal_pin_output(self->io0);
@@ -119,7 +119,7 @@ STATIC void mp_soft_qspi_transfer(mp_soft_qspi_obj_t *self, size_t len, const ui
}
}
-STATIC void mp_soft_qspi_qread(mp_soft_qspi_obj_t *self, size_t len, uint8_t *buf) {
+static void mp_soft_qspi_qread(mp_soft_qspi_obj_t *self, size_t len, uint8_t *buf) {
// Make all IO lines input
mp_hal_pin_input(self->io2);
mp_hal_pin_input(self->io3);
@@ -137,7 +137,7 @@ STATIC void mp_soft_qspi_qread(mp_soft_qspi_obj_t *self, size_t len, uint8_t *bu
}
}
-STATIC void mp_soft_qspi_qwrite(mp_soft_qspi_obj_t *self, size_t len, const uint8_t *buf) {
+static void mp_soft_qspi_qwrite(mp_soft_qspi_obj_t *self, size_t len, const uint8_t *buf) {
// Make all IO lines output
mp_hal_pin_output(self->io2);
mp_hal_pin_output(self->io3);
@@ -158,7 +158,7 @@ STATIC void mp_soft_qspi_qwrite(mp_soft_qspi_obj_t *self, size_t len, const uint
//mp_hal_pin_input(self->io1);
}
-STATIC int mp_soft_qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t data) {
+static int mp_soft_qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t data) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
uint32_t cmd_buf = cmd | data << 8;
CS_LOW(self);
@@ -167,7 +167,7 @@ STATIC int mp_soft_qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, u
return 0;
}
-STATIC int mp_soft_qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src) {
+static int mp_soft_qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
uint8_t cmd_buf[5] = {cmd};
uint8_t addr_len = mp_spi_set_addr_buff(&cmd_buf[1], addr);
@@ -178,7 +178,7 @@ STATIC int mp_soft_qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t
return 0;
}
-STATIC int mp_soft_qspi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *dest) {
+static int mp_soft_qspi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *dest) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
uint32_t cmd_buf = cmd;
CS_LOW(self);
@@ -188,7 +188,7 @@ STATIC int mp_soft_qspi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_
return 0;
}
-STATIC int mp_soft_qspi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr, size_t len, uint8_t *dest) {
+static int mp_soft_qspi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr, size_t len, uint8_t *dest) {
mp_soft_qspi_obj_t *self = (mp_soft_qspi_obj_t*)self_in;
uint8_t cmd_buf[7] = {cmd};
uint8_t addr_len = mp_spi_set_addr_buff(&cmd_buf[1], addr);
diff --git a/drivers/cyw43/cywbt.c b/drivers/cyw43/cywbt.c
index 3f454485ab..0ee69a07ec 100644
--- a/drivers/cyw43/cywbt.c
+++ b/drivers/cyw43/cywbt.c
@@ -51,7 +51,7 @@ extern uint8_t mp_bluetooth_hci_cmd_buf[4 + 256];
// Provided by the port.
extern machine_uart_obj_t mp_bluetooth_hci_uart_obj;
-STATIC void cywbt_wait_cts_low(void) {
+static void cywbt_wait_cts_low(void) {
mp_hal_pin_config(CYW43_PIN_BT_CTS, MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_UP, 0);
for (int i = 0; i < 200; ++i) {
if (mp_hal_pin_read(CYW43_PIN_BT_CTS) == 0) {
@@ -64,7 +64,7 @@ STATIC void cywbt_wait_cts_low(void) {
}
#endif
-STATIC int cywbt_hci_cmd_raw(size_t len, uint8_t *buf) {
+static int cywbt_hci_cmd_raw(size_t len, uint8_t *buf) {
mp_bluetooth_hci_uart_write((void *)buf, len);
for (int c, i = 0; i < 6; ++i) {
while ((c = mp_bluetooth_hci_uart_readchar()) == -1) {
@@ -96,7 +96,7 @@ STATIC int cywbt_hci_cmd_raw(size_t len, uint8_t *buf) {
return 0;
}
-STATIC int cywbt_hci_cmd(int ogf, int ocf, size_t param_len, const uint8_t *param_buf) {
+static int cywbt_hci_cmd(int ogf, int ocf, size_t param_len, const uint8_t *param_buf) {
uint8_t *buf = mp_bluetooth_hci_cmd_buf;
buf[0] = 0x01;
buf[1] = ocf;
@@ -108,19 +108,19 @@ STATIC int cywbt_hci_cmd(int ogf, int ocf, size_t param_len, const uint8_t *para
return cywbt_hci_cmd_raw(4 + param_len, buf);
}
-STATIC void put_le16(uint8_t *buf, uint16_t val) {
+static void put_le16(uint8_t *buf, uint16_t val) {
buf[0] = val;
buf[1] = val >> 8;
}
-STATIC void put_le32(uint8_t *buf, uint32_t val) {
+static void put_le32(uint8_t *buf, uint32_t val) {
buf[0] = val;
buf[1] = val >> 8;
buf[2] = val >> 16;
buf[3] = val >> 24;
}
-STATIC int cywbt_set_baudrate(uint32_t baudrate) {
+static int cywbt_set_baudrate(uint32_t baudrate) {
uint8_t buf[6];
put_le16(buf, 0);
put_le32(buf + 2, baudrate);
@@ -128,7 +128,7 @@ STATIC int cywbt_set_baudrate(uint32_t baudrate) {
}
// download firmware
-STATIC int cywbt_download_firmware(const uint8_t *firmware) {
+static int cywbt_download_firmware(const uint8_t *firmware) {
cywbt_hci_cmd(0x3f, 0x2e, 0, NULL);
bool last_packet = false;
@@ -255,7 +255,7 @@ int mp_bluetooth_hci_controller_deinit(void) {
}
#ifdef CYW43_PIN_BT_DEV_WAKE
-STATIC uint32_t bt_sleep_ticks;
+static uint32_t bt_sleep_ticks;
#endif
int mp_bluetooth_hci_controller_sleep_maybe(void) {
diff --git a/drivers/dht/dht.c b/drivers/dht/dht.c
index 7e9b897825..e6b71542da 100644
--- a/drivers/dht/dht.c
+++ b/drivers/dht/dht.c
@@ -40,7 +40,7 @@
#define mp_hal_pin_od_high_dht mp_hal_pin_od_high
#endif
-STATIC mp_obj_t dht_readinto(mp_obj_t pin_in, mp_obj_t buf_in) {
+static mp_obj_t dht_readinto(mp_obj_t pin_in, mp_obj_t buf_in) {
mp_hal_pin_obj_t pin = mp_hal_get_pin_obj(pin_in);
mp_hal_pin_open_drain(pin);
diff --git a/drivers/esp-hosted/esp_hosted_hal.c b/drivers/esp-hosted/esp_hosted_hal.c
index bac8a89bd0..c98eb5031a 100644
--- a/drivers/esp-hosted/esp_hosted_hal.c
+++ b/drivers/esp-hosted/esp_hosted_hal.c
@@ -44,14 +44,14 @@
extern void mod_network_poll_events(void);
-STATIC mp_obj_t esp_hosted_pin_irq_callback(mp_obj_t self_in) {
+static mp_obj_t esp_hosted_pin_irq_callback(mp_obj_t self_in) {
#ifdef MICROPY_HW_WIFI_LED
led_toggle(MICROPY_HW_WIFI_LED);
#endif
mod_network_poll_events();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_hosted_pin_irq_callback_obj, esp_hosted_pin_irq_callback);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_hosted_pin_irq_callback_obj, esp_hosted_pin_irq_callback);
MP_WEAK int esp_hosted_hal_init(uint32_t mode) {
// Perform a hard reset and set pins to their defaults.
diff --git a/drivers/memory/spiflash.c b/drivers/memory/spiflash.c
index 52739b1d8b..e66153636b 100644
--- a/drivers/memory/spiflash.c
+++ b/drivers/memory/spiflash.c
@@ -56,21 +56,21 @@
#define PAGE_SIZE (256) // maximum bytes we can write in one SPI transfer
#define SECTOR_SIZE MP_SPIFLASH_ERASE_BLOCK_SIZE
-STATIC void mp_spiflash_acquire_bus(mp_spiflash_t *self) {
+static void mp_spiflash_acquire_bus(mp_spiflash_t *self) {
const mp_spiflash_config_t *c = self->config;
if (c->bus_kind == MP_SPIFLASH_BUS_QSPI) {
c->bus.u_qspi.proto->ioctl(c->bus.u_qspi.data, MP_QSPI_IOCTL_BUS_ACQUIRE);
}
}
-STATIC void mp_spiflash_release_bus(mp_spiflash_t *self) {
+static void mp_spiflash_release_bus(mp_spiflash_t *self) {
const mp_spiflash_config_t *c = self->config;
if (c->bus_kind == MP_SPIFLASH_BUS_QSPI) {
c->bus.u_qspi.proto->ioctl(c->bus.u_qspi.data, MP_QSPI_IOCTL_BUS_RELEASE);
}
}
-STATIC int mp_spiflash_write_cmd_data(mp_spiflash_t *self, uint8_t cmd, size_t len, uint32_t data) {
+static int mp_spiflash_write_cmd_data(mp_spiflash_t *self, uint8_t cmd, size_t len, uint32_t data) {
int ret = 0;
const mp_spiflash_config_t *c = self->config;
if (c->bus_kind == MP_SPIFLASH_BUS_SPI) {
@@ -84,7 +84,7 @@ STATIC int mp_spiflash_write_cmd_data(mp_spiflash_t *self, uint8_t cmd, size_t l
return ret;
}
-STATIC int mp_spiflash_transfer_cmd_addr_data(mp_spiflash_t *self, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src, uint8_t *dest) {
+static int mp_spiflash_transfer_cmd_addr_data(mp_spiflash_t *self, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src, uint8_t *dest) {
int ret = 0;
const mp_spiflash_config_t *c = self->config;
if (c->bus_kind == MP_SPIFLASH_BUS_SPI) {
@@ -109,7 +109,7 @@ STATIC int mp_spiflash_transfer_cmd_addr_data(mp_spiflash_t *self, uint8_t cmd,
return ret;
}
-STATIC int mp_spiflash_read_cmd(mp_spiflash_t *self, uint8_t cmd, size_t len, uint32_t *dest) {
+static int mp_spiflash_read_cmd(mp_spiflash_t *self, uint8_t cmd, size_t len, uint32_t *dest) {
const mp_spiflash_config_t *c = self->config;
if (c->bus_kind == MP_SPIFLASH_BUS_SPI) {
mp_hal_pin_write(c->bus.u_spi.cs, 0);
@@ -122,7 +122,7 @@ STATIC int mp_spiflash_read_cmd(mp_spiflash_t *self, uint8_t cmd, size_t len, ui
}
}
-STATIC int mp_spiflash_read_data(mp_spiflash_t *self, uint32_t addr, size_t len, uint8_t *dest) {
+static int mp_spiflash_read_data(mp_spiflash_t *self, uint32_t addr, size_t len, uint8_t *dest) {
const mp_spiflash_config_t *c = self->config;
uint8_t cmd;
if (c->bus_kind == MP_SPIFLASH_BUS_SPI) {
@@ -133,11 +133,11 @@ STATIC int mp_spiflash_read_data(mp_spiflash_t *self, uint32_t addr, size_t len,
return mp_spiflash_transfer_cmd_addr_data(self, cmd, addr, len, NULL, dest);
}
-STATIC int mp_spiflash_write_cmd(mp_spiflash_t *self, uint8_t cmd) {
+static int mp_spiflash_write_cmd(mp_spiflash_t *self, uint8_t cmd) {
return mp_spiflash_write_cmd_data(self, cmd, 0, 0);
}
-STATIC int mp_spiflash_wait_sr(mp_spiflash_t *self, uint8_t mask, uint8_t val, uint32_t timeout) {
+static int mp_spiflash_wait_sr(mp_spiflash_t *self, uint8_t mask, uint8_t val, uint32_t timeout) {
do {
uint32_t sr;
int ret = mp_spiflash_read_cmd(self, CMD_RDSR, 1, &sr);
@@ -152,11 +152,11 @@ STATIC int mp_spiflash_wait_sr(mp_spiflash_t *self, uint8_t mask, uint8_t val, u
return -MP_ETIMEDOUT;
}
-STATIC int mp_spiflash_wait_wel1(mp_spiflash_t *self) {
+static int mp_spiflash_wait_wel1(mp_spiflash_t *self) {
return mp_spiflash_wait_sr(self, 2, 2, WAIT_SR_TIMEOUT);
}
-STATIC int mp_spiflash_wait_wip0(mp_spiflash_t *self) {
+static int mp_spiflash_wait_wip0(mp_spiflash_t *self) {
return mp_spiflash_wait_sr(self, 1, 0, WAIT_SR_TIMEOUT);
}
@@ -219,7 +219,7 @@ void mp_spiflash_deepsleep(mp_spiflash_t *self, int value) {
}
}
-STATIC int mp_spiflash_erase_block_internal(mp_spiflash_t *self, uint32_t addr) {
+static int mp_spiflash_erase_block_internal(mp_spiflash_t *self, uint32_t addr) {
int ret = 0;
// enable writes
ret = mp_spiflash_write_cmd(self, CMD_WREN);
@@ -244,7 +244,7 @@ STATIC int mp_spiflash_erase_block_internal(mp_spiflash_t *self, uint32_t addr)
return mp_spiflash_wait_wip0(self);
}
-STATIC int mp_spiflash_write_page(mp_spiflash_t *self, uint32_t addr, size_t len, const uint8_t *src) {
+static int mp_spiflash_write_page(mp_spiflash_t *self, uint32_t addr, size_t len, const uint8_t *src) {
int ret = 0;
// enable writes
ret = mp_spiflash_write_cmd(self, CMD_WREN);
@@ -361,7 +361,7 @@ int mp_spiflash_cached_read(mp_spiflash_t *self, uint32_t addr, size_t len, uint
return ret;
}
-STATIC int mp_spiflash_cache_flush_internal(mp_spiflash_t *self) {
+static int mp_spiflash_cache_flush_internal(mp_spiflash_t *self) {
#if USE_WR_DELAY
if (!(self->flags & 1)) {
return 0;
@@ -396,7 +396,7 @@ int mp_spiflash_cache_flush(mp_spiflash_t *self) {
return ret;
}
-STATIC int mp_spiflash_cached_write_part(mp_spiflash_t *self, uint32_t addr, size_t len, const uint8_t *src) {
+static int mp_spiflash_cached_write_part(mp_spiflash_t *self, uint32_t addr, size_t len, const uint8_t *src) {
// Align to 4096 sector
uint32_t offset = addr & 0xfff;
uint32_t sec = addr >> 12;
diff --git a/examples/natmod/btree/btree_c.c b/examples/natmod/btree/btree_c.c
index c897f2e9a3..3c60e41b2d 100644
--- a/examples/natmod/btree/btree_c.c
+++ b/examples/natmod/btree/btree_c.c
@@ -100,9 +100,9 @@ mp_getiter_iternext_custom_t btree_getiter_iternext;
#include "extmod/modbtree.c"
mp_map_elem_t btree_locals_dict_table[8];
-STATIC MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table);
+static MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table);
-STATIC mp_obj_t btree_open(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t btree_open(size_t n_args, const mp_obj_t *args) {
// Make sure we got a stream object
mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
@@ -118,7 +118,7 @@ STATIC mp_obj_t btree_open(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(btree_new(db, args[0]));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_open_obj, 5, 5, btree_open);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_open_obj, 5, 5, btree_open);
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
MP_DYNRUNTIME_INIT_ENTRY
diff --git a/examples/natmod/deflate/deflate.c b/examples/natmod/deflate/deflate.c
index fa475bd067..9de7e101a7 100644
--- a/examples/natmod/deflate/deflate.c
+++ b/examples/natmod/deflate/deflate.c
@@ -29,7 +29,7 @@ mp_obj_t mp_stream_close(mp_obj_t stream) {
MP_DEFINE_CONST_FUN_OBJ_1(mp_stream_close_obj, mp_stream_close);
// Re-implemented from py/stream.c, not yet available in dynruntime.h.
-STATIC mp_obj_t mp_stream___exit__(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_stream___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return mp_stream_close(args[0]);
}
@@ -42,7 +42,7 @@ mp_obj_t mp_identity(mp_obj_t self) {
MP_DEFINE_CONST_FUN_OBJ_1(mp_identity_obj, mp_identity);
mp_map_elem_t deflateio_locals_dict_table[7];
-STATIC MP_DEFINE_CONST_DICT(deflateio_locals_dict, deflateio_locals_dict_table);
+static MP_DEFINE_CONST_DICT(deflateio_locals_dict, deflateio_locals_dict_table);
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
MP_DYNRUNTIME_INIT_ENTRY
diff --git a/examples/natmod/features0/features0.c b/examples/natmod/features0/features0.c
index 1b1867a3bc..c3d31afb79 100644
--- a/examples/natmod/features0/features0.c
+++ b/examples/natmod/features0/features0.c
@@ -8,7 +8,7 @@
#include "py/dynruntime.h"
// Helper function to compute factorial
-STATIC mp_int_t factorial_helper(mp_int_t x) {
+static mp_int_t factorial_helper(mp_int_t x) {
if (x == 0) {
return 1;
}
@@ -16,7 +16,7 @@ STATIC mp_int_t factorial_helper(mp_int_t x) {
}
// This is the function which will be called from Python, as factorial(x)
-STATIC mp_obj_t factorial(mp_obj_t x_obj) {
+static mp_obj_t factorial(mp_obj_t x_obj) {
// Extract the integer from the MicroPython input object
mp_int_t x = mp_obj_get_int(x_obj);
// Calculate the factorial
@@ -25,7 +25,7 @@ STATIC mp_obj_t factorial(mp_obj_t x_obj) {
return mp_obj_new_int(result);
}
// Define a Python reference to the function above
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial);
+static MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial);
// This is the entry point and is called when the module is imported
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
diff --git a/examples/natmod/features1/features1.c b/examples/natmod/features1/features1.c
index d2494b2138..92b96dbb18 100644
--- a/examples/natmod/features1/features1.c
+++ b/examples/natmod/features1/features1.c
@@ -25,15 +25,15 @@ uint16_t *const table_ptr16a[] = { &data16[0], &data16[1], &data16[2], &data16[3
const uint16_t *const table_ptr16b[] = { &table16[0], &table16[1] };
// A simple function that adds its 2 arguments (must be integers)
-STATIC mp_obj_t add(mp_obj_t x_in, mp_obj_t y_in) {
+static mp_obj_t add(mp_obj_t x_in, mp_obj_t y_in) {
mp_int_t x = mp_obj_get_int(x_in);
mp_int_t y = mp_obj_get_int(y_in);
return mp_obj_new_int(x + y);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add);
+static MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add);
// A local helper function (not exposed to Python)
-STATIC mp_int_t fibonacci_helper(mp_int_t x) {
+static mp_int_t fibonacci_helper(mp_int_t x) {
if (x < MP_ARRAY_SIZE(table8)) {
return table8[x];
} else {
@@ -42,17 +42,17 @@ STATIC mp_int_t fibonacci_helper(mp_int_t x) {
}
// A function which computes Fibonacci numbers
-STATIC mp_obj_t fibonacci(mp_obj_t x_in) {
+static mp_obj_t fibonacci(mp_obj_t x_in) {
mp_int_t x = mp_obj_get_int(x_in);
if (x < 0) {
mp_raise_ValueError(MP_ERROR_TEXT("can't compute negative Fibonacci number"));
}
return mp_obj_new_int(fibonacci_helper(x));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(fibonacci_obj, fibonacci);
+static MP_DEFINE_CONST_FUN_OBJ_1(fibonacci_obj, fibonacci);
// A function that accesses the BSS data
-STATIC mp_obj_t access(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t access(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
// Create a list holding all items from data16
mp_obj_list_t *lst = MP_OBJ_TO_PTR(mp_obj_new_list(MP_ARRAY_SIZE(data16), NULL));
@@ -71,17 +71,17 @@ STATIC mp_obj_t access(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(access_obj, 0, 2, access);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(access_obj, 0, 2, access);
// A function that allocates memory and creates a bytearray
-STATIC mp_obj_t make_array(void) {
+static mp_obj_t make_array(void) {
uint16_t *ptr = m_new(uint16_t, MP_ARRAY_SIZE(table_ptr16b));
for (int i = 0; i < MP_ARRAY_SIZE(table_ptr16b); ++i) {
ptr[i] = *table_ptr16b[i];
}
return mp_obj_new_bytearray_by_ref(sizeof(uint16_t) * MP_ARRAY_SIZE(table_ptr16b), ptr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(make_array_obj, make_array);
+static MP_DEFINE_CONST_FUN_OBJ_0(make_array_obj, make_array);
// This is the entry point and is called when the module is imported
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
diff --git a/examples/natmod/features2/main.c b/examples/natmod/features2/main.c
index 1a39700dc4..22961aa494 100644
--- a/examples/natmod/features2/main.c
+++ b/examples/natmod/features2/main.c
@@ -22,29 +22,29 @@
// A function that uses the default float type configured for the current target
// This default can be overridden by specifying MICROPY_FLOAT_IMPL at the make level
-STATIC mp_obj_t add(mp_obj_t x, mp_obj_t y) {
+static mp_obj_t add(mp_obj_t x, mp_obj_t y) {
return mp_obj_new_float(mp_obj_get_float(x) + mp_obj_get_float(y));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add);
+static MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add);
// A function that explicitly uses single precision floats
-STATIC mp_obj_t add_f(mp_obj_t x, mp_obj_t y) {
+static mp_obj_t add_f(mp_obj_t x, mp_obj_t y) {
return mp_obj_new_float_from_f(mp_obj_get_float_to_f(x) + mp_obj_get_float_to_f(y));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_f_obj, add_f);
+static MP_DEFINE_CONST_FUN_OBJ_2(add_f_obj, add_f);
#if USE_DOUBLE
// A function that explicitly uses double precision floats
-STATIC mp_obj_t add_d(mp_obj_t x, mp_obj_t y) {
+static mp_obj_t add_d(mp_obj_t x, mp_obj_t y) {
return mp_obj_new_float_from_d(mp_obj_get_float_to_d(x) + mp_obj_get_float_to_d(y));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_d_obj, add_d);
+static MP_DEFINE_CONST_FUN_OBJ_2(add_d_obj, add_d);
#endif
// A function that computes the product of floats in an array.
// This function uses the most general C argument interface, which is more difficult
// to use but has access to the globals dict of the module via self->globals.
-STATIC mp_obj_t productf(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
+static mp_obj_t productf(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
// Check number of arguments is valid
mp_arg_check_num(n_args, n_kw, 1, 1, false);
diff --git a/examples/natmod/features3/features3.c b/examples/natmod/features3/features3.c
index 20efd67cdc..1d3bc51e60 100644
--- a/examples/natmod/features3/features3.c
+++ b/examples/natmod/features3/features3.c
@@ -8,7 +8,7 @@
#include "py/dynruntime.h"
// A function that returns a tuple of object types.
-STATIC mp_obj_t get_types(void) {
+static mp_obj_t get_types(void) {
return mp_obj_new_tuple(9, ((mp_obj_t []) {
MP_OBJ_FROM_PTR(&mp_type_type),
MP_OBJ_FROM_PTR(&mp_type_NoneType),
@@ -21,10 +21,10 @@ STATIC mp_obj_t get_types(void) {
MP_OBJ_FROM_PTR(&mp_type_dict),
}));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_types_obj, get_types);
+static MP_DEFINE_CONST_FUN_OBJ_0(get_types_obj, get_types);
// A function that returns a tuple of constant objects.
-STATIC mp_obj_t get_const_objects(void) {
+static mp_obj_t get_const_objects(void) {
return mp_obj_new_tuple(5, ((mp_obj_t []) {
mp_const_none,
mp_const_false,
@@ -33,17 +33,17 @@ STATIC mp_obj_t get_const_objects(void) {
mp_const_empty_tuple,
}));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_const_objects_obj, get_const_objects);
+static MP_DEFINE_CONST_FUN_OBJ_0(get_const_objects_obj, get_const_objects);
// A function that creates a dictionary from the given arguments.
-STATIC mp_obj_t make_dict(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t make_dict(size_t n_args, const mp_obj_t *args) {
mp_obj_t dict = mp_obj_new_dict(n_args / 2);
for (; n_args >= 2; n_args -= 2, args += 2) {
mp_obj_dict_store(dict, args[0], args[1]);
}
return dict;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(make_dict_obj, 0, MP_OBJ_FUN_ARGS_MAX, make_dict);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(make_dict_obj, 0, MP_OBJ_FUN_ARGS_MAX, make_dict);
// This is the entry point and is called when the module is imported.
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
diff --git a/examples/natmod/features4/features4.c b/examples/natmod/features4/features4.c
index 336f4ecf64..a52e9e4566 100644
--- a/examples/natmod/features4/features4.c
+++ b/examples/natmod/features4/features4.c
@@ -24,7 +24,7 @@ typedef struct {
// Essentially Factorial.__new__ (but also kind of __init__).
// Takes a single argument (the number to find the factorial of)
-STATIC mp_obj_t factorial_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) {
+static mp_obj_t factorial_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
mp_obj_factorial_t *o = mp_obj_malloc(mp_obj_factorial_t, type);
@@ -33,7 +33,7 @@ STATIC mp_obj_t factorial_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_int_t factorial_helper(mp_int_t x) {
+static mp_int_t factorial_helper(mp_int_t x) {
if (x == 0) {
return 1;
}
@@ -41,16 +41,16 @@ STATIC mp_int_t factorial_helper(mp_int_t x) {
}
// Implements Factorial.calculate()
-STATIC mp_obj_t factorial_calculate(mp_obj_t self_in) {
+static mp_obj_t factorial_calculate(mp_obj_t self_in) {
mp_obj_factorial_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(factorial_helper(self->n));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_calculate_obj, factorial_calculate);
+static MP_DEFINE_CONST_FUN_OBJ_1(factorial_calculate_obj, factorial_calculate);
// Locals dict for the Factorial type (will have a single method, calculate,
// added in mpy_init).
mp_map_elem_t factorial_locals_dict_table[1];
-STATIC MP_DEFINE_CONST_DICT(factorial_locals_dict, factorial_locals_dict_table);
+static MP_DEFINE_CONST_DICT(factorial_locals_dict, factorial_locals_dict_table);
// This is the entry point and is called when the module is imported
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
diff --git a/examples/natmod/framebuf/framebuf.c b/examples/natmod/framebuf/framebuf.c
index badc7ab46d..e8f99b3b20 100644
--- a/examples/natmod/framebuf/framebuf.c
+++ b/examples/natmod/framebuf/framebuf.c
@@ -13,7 +13,7 @@ mp_obj_full_type_t mp_type_framebuf;
#include "extmod/modframebuf.c"
mp_map_elem_t framebuf_locals_dict_table[11];
-STATIC MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table);
+static MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table);
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
MP_DYNRUNTIME_INIT_ENTRY
diff --git a/examples/natmod/re/re.c b/examples/natmod/re/re.c
index df89ea8353..7ae72a578f 100644
--- a/examples/natmod/re/re.c
+++ b/examples/natmod/re/re.c
@@ -38,10 +38,10 @@ mp_obj_full_type_t re_type;
#include "extmod/modre.c"
mp_map_elem_t match_locals_dict_table[5];
-STATIC MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table);
+static MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table);
mp_map_elem_t re_locals_dict_table[3];
-STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
+static MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
MP_DYNRUNTIME_INIT_ENTRY
diff --git a/examples/usercmodule/cexample/examplemodule.c b/examples/usercmodule/cexample/examplemodule.c
index 9416613ba9..2988fbd565 100644
--- a/examples/usercmodule/cexample/examplemodule.c
+++ b/examples/usercmodule/cexample/examplemodule.c
@@ -5,7 +5,7 @@
#include "py/mphal.h"
// This is the function which will be called from Python as cexample.add_ints(a, b).
-STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
+static mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
// Extract the ints from the micropython input objects.
int a = mp_obj_get_int(a_obj);
int b = mp_obj_get_int(b_obj);
@@ -14,7 +14,7 @@ STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
return mp_obj_new_int(a + b);
}
// Define a Python reference to the function above.
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints);
+static MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints);
// This structure represents Timer instance objects.
typedef struct _example_Timer_obj_t {
@@ -28,7 +28,7 @@ typedef struct _example_Timer_obj_t {
// This is the Timer.time() method. After creating a Timer object, this
// can be called to get the time elapsed since creating the Timer.
-STATIC mp_obj_t example_Timer_time(mp_obj_t self_in) {
+static mp_obj_t example_Timer_time(mp_obj_t self_in) {
// The first argument is self. It is cast to the *example_Timer_obj_t
// type so we can read its attributes.
example_Timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -37,11 +37,11 @@ STATIC mp_obj_t example_Timer_time(mp_obj_t self_in) {
mp_uint_t elapsed = mp_hal_ticks_ms() - self->start_time;
return mp_obj_new_int_from_uint(elapsed);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(example_Timer_time_obj, example_Timer_time);
+static MP_DEFINE_CONST_FUN_OBJ_1(example_Timer_time_obj, example_Timer_time);
// This represents Timer.__new__ and Timer.__init__, which is called when
// the user instantiates a Timer object.
-STATIC mp_obj_t example_Timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t example_Timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// Allocates the new object and sets the type.
example_Timer_obj_t *self = mp_obj_malloc(example_Timer_obj_t, type);
@@ -54,10 +54,10 @@ STATIC mp_obj_t example_Timer_make_new(const mp_obj_type_t *type, size_t n_args,
// This collects all methods and other static class attributes of the Timer.
// The table structure is similar to the module table, as detailed below.
-STATIC const mp_rom_map_elem_t example_Timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t example_Timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&example_Timer_time_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(example_Timer_locals_dict, example_Timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(example_Timer_locals_dict, example_Timer_locals_dict_table);
// This defines the type(Timer) object.
MP_DEFINE_CONST_OBJ_TYPE(
@@ -73,12 +73,12 @@ MP_DEFINE_CONST_OBJ_TYPE(
// and the MicroPython object reference.
// All identifiers and strings are written as MP_QSTR_xxx and will be
// optimized to word-sized integers by the build system (interned strings).
-STATIC const mp_rom_map_elem_t example_module_globals_table[] = {
+static const mp_rom_map_elem_t example_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cexample) },
{ MP_ROM_QSTR(MP_QSTR_add_ints), MP_ROM_PTR(&example_add_ints_obj) },
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&example_type_Timer) },
};
-STATIC MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table);
+static MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table);
// Define module object.
const mp_obj_module_t example_user_cmodule = {
diff --git a/examples/usercmodule/cppexample/examplemodule.c b/examples/usercmodule/cppexample/examplemodule.c
index 96a1a74438..5d4637b897 100644
--- a/examples/usercmodule/cppexample/examplemodule.c
+++ b/examples/usercmodule/cppexample/examplemodule.c
@@ -2,18 +2,18 @@
// Define a Python reference to the function we'll make available.
// See example.cpp for the definition.
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(cppfunc_obj, cppfunc);
+static MP_DEFINE_CONST_FUN_OBJ_2(cppfunc_obj, cppfunc);
// Define all attributes of the module.
// Table entries are key/value pairs of the attribute name (a string)
// and the MicroPython object reference.
// All identifiers and strings are written as MP_QSTR_xxx and will be
// optimized to word-sized integers by the build system (interned strings).
-STATIC const mp_rom_map_elem_t cppexample_module_globals_table[] = {
+static const mp_rom_map_elem_t cppexample_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cppexample) },
{ MP_ROM_QSTR(MP_QSTR_cppfunc), MP_ROM_PTR(&cppfunc_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(cppexample_module_globals, cppexample_module_globals_table);
+static MP_DEFINE_CONST_DICT(cppexample_module_globals, cppexample_module_globals_table);
// Define module object.
const mp_obj_module_t cppexample_user_cmodule = {
diff --git a/examples/usercmodule/subpackage/modexamplepackage.c b/examples/usercmodule/subpackage/modexamplepackage.c
index 70e1e4005b..d68d052839 100644
--- a/examples/usercmodule/subpackage/modexamplepackage.c
+++ b/examples/usercmodule/subpackage/modexamplepackage.c
@@ -2,18 +2,18 @@
#include "py/runtime.h"
// Define example_package.foo.bar.f()
-STATIC mp_obj_t example_package_foo_bar_f(void) {
+static mp_obj_t example_package_foo_bar_f(void) {
mp_printf(&mp_plat_print, "example_package.foo.bar.f\n");
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_bar_f_obj, example_package_foo_bar_f);
+static MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_bar_f_obj, example_package_foo_bar_f);
// Define all attributes of the second-level sub-package (example_package.foo.bar).
-STATIC const mp_rom_map_elem_t example_package_foo_bar_globals_table[] = {
+static const mp_rom_map_elem_t example_package_foo_bar_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_example_package_dot_foo_dot_bar) },
{ MP_ROM_QSTR(MP_QSTR_f), MP_ROM_PTR(&example_package_foo_bar_f_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(example_package_foo_bar_globals, example_package_foo_bar_globals_table);
+static MP_DEFINE_CONST_DICT(example_package_foo_bar_globals, example_package_foo_bar_globals_table);
// Define example_package.foo.bar module object.
const mp_obj_module_t example_package_foo_bar_user_cmodule = {
@@ -22,19 +22,19 @@ const mp_obj_module_t example_package_foo_bar_user_cmodule = {
};
// Define example_package.foo.f()
-STATIC mp_obj_t example_package_foo_f(void) {
+static mp_obj_t example_package_foo_f(void) {
mp_printf(&mp_plat_print, "example_package.foo.f\n");
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_f_obj, example_package_foo_f);
+static MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_f_obj, example_package_foo_f);
// Define all attributes of the first-level sub-package (example_package.foo).
-STATIC const mp_rom_map_elem_t example_package_foo_globals_table[] = {
+static const mp_rom_map_elem_t example_package_foo_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_example_package_dot_foo) },
{ MP_ROM_QSTR(MP_QSTR_bar), MP_ROM_PTR(&example_package_foo_bar_user_cmodule) },
{ MP_ROM_QSTR(MP_QSTR_f), MP_ROM_PTR(&example_package_foo_f_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(example_package_foo_globals, example_package_foo_globals_table);
+static MP_DEFINE_CONST_DICT(example_package_foo_globals, example_package_foo_globals_table);
// Define example_package.foo module object.
const mp_obj_module_t example_package_foo_user_cmodule = {
@@ -43,13 +43,13 @@ const mp_obj_module_t example_package_foo_user_cmodule = {
};
// Define example_package.f()
-STATIC mp_obj_t example_package_f(void) {
+static mp_obj_t example_package_f(void) {
mp_printf(&mp_plat_print, "example_package.f\n");
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package_f_obj, example_package_f);
+static MP_DEFINE_CONST_FUN_OBJ_0(example_package_f_obj, example_package_f);
-STATIC mp_obj_t example_package___init__(void) {
+static mp_obj_t example_package___init__(void) {
if (!MP_STATE_VM(example_package_initialised)) {
// __init__ for builtins is called each time the module is imported,
// so ensure that initialisation only happens once.
@@ -58,20 +58,20 @@ STATIC mp_obj_t example_package___init__(void) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package___init___obj, example_package___init__);
+static MP_DEFINE_CONST_FUN_OBJ_0(example_package___init___obj, example_package___init__);
// The "initialised" state is stored on mp_state so that it is cleared on soft
// reset.
MP_REGISTER_ROOT_POINTER(int example_package_initialised);
// Define all attributes of the top-level package (example_package).
-STATIC const mp_rom_map_elem_t example_package_globals_table[] = {
+static const mp_rom_map_elem_t example_package_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_example_package) },
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&example_package___init___obj) },
{ MP_ROM_QSTR(MP_QSTR_foo), MP_ROM_PTR(&example_package_foo_user_cmodule) },
{ MP_ROM_QSTR(MP_QSTR_f), MP_ROM_PTR(&example_package_f_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(example_package_globals, example_package_globals_table);
+static MP_DEFINE_CONST_DICT(example_package_globals, example_package_globals_table);
// Define module object.
const mp_obj_module_t example_package_user_cmodule = {
diff --git a/extmod/btstack/btstack_hci_uart.c b/extmod/btstack/btstack_hci_uart.c
index 19cdfc4b9d..fb90f550cb 100644
--- a/extmod/btstack/btstack_hci_uart.c
+++ b/extmod/btstack/btstack_hci_uart.c
@@ -48,17 +48,17 @@
// interface to an HCI UART provided by the port.
// We pass the bytes directly to the UART during a send, but then notify btstack in the next poll.
-STATIC bool send_done;
-STATIC void (*send_handler)(void);
+static bool send_done;
+static void (*send_handler)(void);
// btstack issues a read of len bytes, and gives us a buffer to asynchronously fill up.
-STATIC uint8_t *recv_buf;
-STATIC size_t recv_len;
-STATIC size_t recv_idx;
-STATIC void (*recv_handler)(void);
-STATIC bool init_success = false;
+static uint8_t *recv_buf;
+static size_t recv_len;
+static size_t recv_idx;
+static void (*recv_handler)(void);
+static bool init_success = false;
-STATIC int btstack_uart_init(const btstack_uart_config_t *uart_config) {
+static int btstack_uart_init(const btstack_uart_config_t *uart_config) {
(void)uart_config;
send_done = false;
@@ -81,45 +81,45 @@ STATIC int btstack_uart_init(const btstack_uart_config_t *uart_config) {
return 0;
}
-STATIC int btstack_uart_open(void) {
+static int btstack_uart_open(void) {
return init_success ? 0 : 1;
}
-STATIC int btstack_uart_close(void) {
+static int btstack_uart_close(void) {
mp_bluetooth_hci_controller_deinit();
mp_bluetooth_hci_uart_deinit();
return 0;
}
-STATIC void btstack_uart_set_block_received(void (*block_handler)(void)) {
+static void btstack_uart_set_block_received(void (*block_handler)(void)) {
recv_handler = block_handler;
}
-STATIC void btstack_uart_set_block_sent(void (*block_handler)(void)) {
+static void btstack_uart_set_block_sent(void (*block_handler)(void)) {
send_handler = block_handler;
}
-STATIC int btstack_uart_set_baudrate(uint32_t baudrate) {
+static int btstack_uart_set_baudrate(uint32_t baudrate) {
mp_bluetooth_hci_uart_set_baudrate(baudrate);
return 0;
}
-STATIC int btstack_uart_set_parity(int parity) {
+static int btstack_uart_set_parity(int parity) {
(void)parity;
return 0;
}
-STATIC int btstack_uart_set_flowcontrol(int flowcontrol) {
+static int btstack_uart_set_flowcontrol(int flowcontrol) {
(void)flowcontrol;
return 0;
}
-STATIC void btstack_uart_receive_block(uint8_t *buf, uint16_t len) {
+static void btstack_uart_receive_block(uint8_t *buf, uint16_t len) {
recv_buf = buf;
recv_len = len;
}
-STATIC void btstack_uart_send_block(const uint8_t *buf, uint16_t len) {
+static void btstack_uart_send_block(const uint8_t *buf, uint16_t len) {
#if HCI_TRACE
printf(COL_GREEN "< [% 8d] %02x", (int)mp_hal_ticks_ms(), buf[0]);
for (size_t i = 1; i < len; ++i) {
@@ -136,16 +136,16 @@ STATIC void btstack_uart_send_block(const uint8_t *buf, uint16_t len) {
mp_bluetooth_hci_poll_now();
}
-STATIC int btstack_uart_get_supported_sleep_modes(void) {
+static int btstack_uart_get_supported_sleep_modes(void) {
return 0;
}
-STATIC void btstack_uart_set_sleep(btstack_uart_sleep_mode_t sleep_mode) {
+static void btstack_uart_set_sleep(btstack_uart_sleep_mode_t sleep_mode) {
(void)sleep_mode;
// printf("btstack_uart_set_sleep %u\n", sleep_mode);
}
-STATIC void btstack_uart_set_wakeup_handler(void (*wakeup_handler)(void)) {
+static void btstack_uart_set_wakeup_handler(void (*wakeup_handler)(void)) {
(void)wakeup_handler;
// printf("btstack_uart_set_wakeup_handler\n");
}
diff --git a/extmod/btstack/modbluetooth_btstack.c b/extmod/btstack/modbluetooth_btstack.c
index b3d349c2dc..b29970842c 100644
--- a/extmod/btstack/modbluetooth_btstack.c
+++ b/extmod/btstack/modbluetooth_btstack.c
@@ -43,24 +43,24 @@
// How long to wait for a controller to init/deinit.
// Some controllers can take up to 5-6 seconds in normal operation.
-STATIC const uint32_t BTSTACK_INIT_DEINIT_TIMEOUT_MS = 15000;
+static const uint32_t BTSTACK_INIT_DEINIT_TIMEOUT_MS = 15000;
// We need to know the attribute handle for the GAP device name (see GAP_DEVICE_NAME_UUID)
// so it can be put into the gatts_db before registering the services, and accessed
// efficiently when requesting an attribute in att_read_callback. Because this is the
// first characteristic of the first service, it always has a handle value of 3.
-STATIC const uint16_t BTSTACK_GAP_DEVICE_NAME_HANDLE = 3;
+static const uint16_t BTSTACK_GAP_DEVICE_NAME_HANDLE = 3;
volatile int mp_bluetooth_btstack_state = MP_BLUETOOTH_BTSTACK_STATE_OFF;
// sm_set_authentication_requirements is set-only, so cache current value.
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
-STATIC uint8_t mp_bluetooth_btstack_sm_auth_req = 0;
+static uint8_t mp_bluetooth_btstack_sm_auth_req = 0;
#endif
#define ERRNO_BLUETOOTH_NOT_ACTIVE MP_ENODEV
-STATIC int btstack_error_to_errno(int err) {
+static int btstack_error_to_errno(int err) {
DEBUG_printf(" --> btstack error: %d\n", err);
if (err == ERROR_CODE_SUCCESS) {
return 0;
@@ -78,7 +78,7 @@ STATIC int btstack_error_to_errno(int err) {
}
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(uint16_t uuid16, const uint8_t *uuid128) {
+static mp_obj_bluetooth_uuid_t create_mp_uuid(uint16_t uuid16, const uint8_t *uuid128) {
mp_obj_bluetooth_uuid_t result;
result.base.type = &mp_type_bluetooth_uuid;
if (uuid16 != 0) {
@@ -107,7 +107,7 @@ typedef struct _mp_btstack_active_connection_t {
size_t pending_write_value_len;
} mp_btstack_active_connection_t;
-STATIC mp_btstack_active_connection_t *create_active_connection(uint16_t conn_handle) {
+static mp_btstack_active_connection_t *create_active_connection(uint16_t conn_handle) {
DEBUG_printf("create_active_connection: conn_handle=%d\n", conn_handle);
mp_btstack_active_connection_t *conn = m_new(mp_btstack_active_connection_t, 1);
conn->conn_handle = conn_handle;
@@ -120,7 +120,7 @@ STATIC mp_btstack_active_connection_t *create_active_connection(uint16_t conn_ha
return conn;
}
-STATIC mp_btstack_active_connection_t *find_active_connection(uint16_t conn_handle) {
+static mp_btstack_active_connection_t *find_active_connection(uint16_t conn_handle) {
DEBUG_printf("find_active_connection: conn_handle=%d\n", conn_handle);
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &MP_STATE_PORT(bluetooth_btstack_root_pointers)->active_connections);
@@ -135,7 +135,7 @@ STATIC mp_btstack_active_connection_t *find_active_connection(uint16_t conn_hand
return conn;
}
-STATIC void remove_active_connection(uint16_t conn_handle) {
+static void remove_active_connection(uint16_t conn_handle) {
DEBUG_printf("remove_active_connection: conn_handle=%d\n", conn_handle);
mp_btstack_active_connection_t *conn = find_active_connection(conn_handle);
if (conn) {
@@ -149,7 +149,7 @@ STATIC void remove_active_connection(uint16_t conn_handle) {
// This needs to be separate to btstack_packet_handler otherwise we get
// dual-delivery of the HCI_EVENT_LE_META event.
-STATIC void btstack_packet_handler_att_server(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
+static void btstack_packet_handler_att_server(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
(void)channel;
(void)size;
DEBUG_printf("btstack_packet_handler_att_server(packet_type=%u, packet=%p)\n", packet_type, packet);
@@ -187,13 +187,13 @@ STATIC void btstack_packet_handler_att_server(uint8_t packet_type, uint16_t chan
#if MICROPY_BLUETOOTH_USE_ZEPHYR_STATIC_ADDRESS
// During startup, the controller (e.g. Zephyr) might give us a static address that we can use.
-STATIC uint8_t controller_static_addr[6] = {0};
-STATIC bool controller_static_addr_available = false;
+static uint8_t controller_static_addr[6] = {0};
+static bool controller_static_addr_available = false;
-STATIC const uint8_t read_static_address_command_complete_prefix[] = { 0x0e, 0x1b, 0x01, 0x09, 0xfc };
+static const uint8_t read_static_address_command_complete_prefix[] = { 0x0e, 0x1b, 0x01, 0x09, 0xfc };
#endif
-STATIC void btstack_packet_handler_generic(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
+static void btstack_packet_handler_generic(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
(void)channel;
(void)size;
DEBUG_printf("btstack_packet_handler_generic(packet_type=%u, packet=%p)\n", packet_type, packet);
@@ -372,13 +372,13 @@ STATIC void btstack_packet_handler_generic(uint8_t packet_type, uint16_t channel
}
}
-STATIC btstack_packet_callback_registration_t hci_event_callback_registration = {
+static btstack_packet_callback_registration_t hci_event_callback_registration = {
.callback = &btstack_packet_handler_generic
};
#if MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
// For when the handler is being used for service discovery.
-STATIC void btstack_packet_handler_discover_services(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
+static void btstack_packet_handler_discover_services(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
(void)channel;
(void)size;
if (packet_type != HCI_EVENT_PACKET) {
@@ -401,7 +401,7 @@ STATIC void btstack_packet_handler_discover_services(uint8_t packet_type, uint16
}
// For when the handler is being used for characteristic discovery.
-STATIC void btstack_packet_handler_discover_characteristics(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
+static void btstack_packet_handler_discover_characteristics(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
(void)channel;
(void)size;
if (packet_type != HCI_EVENT_PACKET) {
@@ -424,7 +424,7 @@ STATIC void btstack_packet_handler_discover_characteristics(uint8_t packet_type,
}
// For when the handler is being used for descriptor discovery.
-STATIC void btstack_packet_handler_discover_descriptors(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
+static void btstack_packet_handler_discover_descriptors(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
(void)channel;
(void)size;
if (packet_type != HCI_EVENT_PACKET) {
@@ -447,7 +447,7 @@ STATIC void btstack_packet_handler_discover_descriptors(uint8_t packet_type, uin
}
// For when the handler is being used for a read query.
-STATIC void btstack_packet_handler_read(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
+static void btstack_packet_handler_read(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
(void)channel;
(void)size;
if (packet_type != HCI_EVENT_PACKET) {
@@ -476,7 +476,7 @@ STATIC void btstack_packet_handler_read(uint8_t packet_type, uint16_t channel, u
}
// For when the handler is being used for write-with-response.
-STATIC void btstack_packet_handler_write_with_response(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
+static void btstack_packet_handler_write_with_response(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size) {
(void)channel;
(void)size;
if (packet_type != HCI_EVENT_PACKET) {
@@ -501,9 +501,9 @@ STATIC void btstack_packet_handler_write_with_response(uint8_t packet_type, uint
}
#endif // MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
-STATIC btstack_timer_source_t btstack_init_deinit_timeout;
+static btstack_timer_source_t btstack_init_deinit_timeout;
-STATIC void btstack_init_deinit_timeout_handler(btstack_timer_source_t *ds) {
+static void btstack_init_deinit_timeout_handler(btstack_timer_source_t *ds) {
(void)ds;
// Stop waiting for initialisation.
@@ -513,13 +513,13 @@ STATIC void btstack_init_deinit_timeout_handler(btstack_timer_source_t *ds) {
}
#if !MICROPY_BLUETOOTH_USE_MP_HAL_GET_MAC_STATIC_ADDRESS
-STATIC void btstack_static_address_ready(void *arg) {
+static void btstack_static_address_ready(void *arg) {
DEBUG_printf("btstack_static_address_ready.\n");
*(volatile bool *)arg = true;
}
#endif
-STATIC bool set_public_address(void) {
+static bool set_public_address(void) {
bd_addr_t local_addr;
gap_local_bd_addr(local_addr);
bd_addr_t null_addr = {0};
@@ -532,7 +532,7 @@ STATIC bool set_public_address(void) {
return true;
}
-STATIC void set_random_address(void) {
+static void set_random_address(void) {
#if MICROPY_BLUETOOTH_USE_ZEPHYR_STATIC_ADDRESS
if (controller_static_addr_available) {
DEBUG_printf("set_random_address: Using static address supplied by controller.\n");
@@ -581,7 +581,7 @@ STATIC void set_random_address(void) {
DEBUG_printf("set_random_address: Address loaded by controller\n");
}
-STATIC void deinit_stack(void) {
+static void deinit_stack(void) {
mp_bluetooth_btstack_state = MP_BLUETOOTH_BTSTACK_STATE_OFF;
// Deinitialise BTstack components.
@@ -901,7 +901,7 @@ int mp_bluetooth_gatts_register_service_begin(bool append) {
return 0;
}
-STATIC uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
+static uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
// Should return data length, 0 for error, or -1 for delayed response.
// For more details search "*att_read_callback*" in micropython/lib/btstack/doc/manual/docs/profiles.md
(void)connection_handle;
@@ -926,7 +926,7 @@ STATIC uint16_t att_read_callback(hci_con_handle_t connection_handle, uint16_t a
return ret;
}
-STATIC int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
+static int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size) {
(void)offset;
(void)transaction_mode;
DEBUG_printf("att_write_callback (handle: %u, mode: %u, offset: %u, buffer: %p, size: %u)\n", att_handle, transaction_mode, offset, buffer, buffer_size);
@@ -953,12 +953,12 @@ STATIC int att_write_callback(hci_con_handle_t connection_handle, uint16_t att_h
return 0;
}
-STATIC inline uint16_t get_uuid16(const mp_obj_bluetooth_uuid_t *uuid) {
+static inline uint16_t get_uuid16(const mp_obj_bluetooth_uuid_t *uuid) {
return (uuid->data[1] << 8) | uuid->data[0];
}
// Map MP_BLUETOOTH_CHARACTERISTIC_FLAG_ values to btstack read/write permission values.
-STATIC void get_characteristic_permissions(uint16_t flags, uint16_t *read_permission, uint16_t *write_permission) {
+static void get_characteristic_permissions(uint16_t flags, uint16_t *read_permission, uint16_t *write_permission) {
if (flags & MP_BLUETOOTH_CHARACTERISTIC_FLAG_READ_ENCRYPTED) {
*read_permission = ATT_SECURITY_ENCRYPTED;
} else if (flags & MP_BLUETOOTH_CHARACTERISTIC_FLAG_READ_AUTHENTICATED) {
@@ -1130,7 +1130,7 @@ typedef struct {
// Called in response to a gatts_notify/indicate being unable to complete, which then calls
// att_server_request_to_send_notification.
-STATIC void btstack_notify_indicate_ready_handler(void *context) {
+static void btstack_notify_indicate_ready_handler(void *context) {
MICROPY_PY_BLUETOOTH_ENTER
notify_indicate_pending_op_t *pending_op = (notify_indicate_pending_op_t *)context;
DEBUG_printf("btstack_notify_indicate_ready_handler gatts_op=%d conn_handle=%d value_handle=%d len=%lu\n", pending_op->gatts_op, pending_op->conn_handle, pending_op->value_handle, pending_op->value_len);
@@ -1270,9 +1270,9 @@ int mp_bluetooth_gap_passkey(uint16_t conn_handle, uint8_t action, mp_int_t pass
#endif // MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC btstack_timer_source_t scan_duration_timeout;
+static btstack_timer_source_t scan_duration_timeout;
-STATIC void scan_duration_timeout_handler(btstack_timer_source_t *ds) {
+static void scan_duration_timeout_handler(btstack_timer_source_t *ds) {
(void)ds;
mp_bluetooth_gap_scan_stop();
}
diff --git a/extmod/machine_adc.c b/extmod/machine_adc.c
index 9849163de8..11f1123dc7 100644
--- a/extmod/machine_adc.c
+++ b/extmod/machine_adc.c
@@ -32,33 +32,33 @@
// The port must provide implementations of these low-level ADC functions.
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self);
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self);
#if MICROPY_PY_MACHINE_ADC_INIT
-STATIC void mp_machine_adc_init_helper(machine_adc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static void mp_machine_adc_init_helper(machine_adc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
#endif
#if MICROPY_PY_MACHINE_ADC_DEINIT
-STATIC void mp_machine_adc_deinit(machine_adc_obj_t *self);
+static void mp_machine_adc_deinit(machine_adc_obj_t *self);
#endif
#if MICROPY_PY_MACHINE_ADC_BLOCK
-STATIC mp_obj_t mp_machine_adc_block(machine_adc_obj_t *self);
+static mp_obj_t mp_machine_adc_block(machine_adc_obj_t *self);
#endif
#if MICROPY_PY_MACHINE_ADC_READ_UV
-STATIC mp_int_t mp_machine_adc_read_uv(machine_adc_obj_t *self);
+static mp_int_t mp_machine_adc_read_uv(machine_adc_obj_t *self);
#endif
#if MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH
-STATIC void mp_machine_adc_atten_set(machine_adc_obj_t *self, mp_int_t atten);
-STATIC void mp_machine_adc_width_set(machine_adc_obj_t *self, mp_int_t width);
+static void mp_machine_adc_atten_set(machine_adc_obj_t *self, mp_int_t atten);
+static void mp_machine_adc_width_set(machine_adc_obj_t *self, mp_int_t width);
#endif
#if MICROPY_PY_MACHINE_ADC_READ
-STATIC mp_int_t mp_machine_adc_read(machine_adc_obj_t *self);
+static mp_int_t mp_machine_adc_read(machine_adc_obj_t *self);
#endif
// The port provides implementations of the above in this file.
@@ -66,81 +66,81 @@ STATIC mp_int_t mp_machine_adc_read(machine_adc_obj_t *self);
#if MICROPY_PY_MACHINE_ADC_INIT
// ADC.init(...)
-STATIC mp_obj_t machine_adc_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_adc_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_machine_adc_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_adc_init_obj, 1, machine_adc_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_adc_init_obj, 1, machine_adc_init);
#endif
#if MICROPY_PY_MACHINE_ADC_DEINIT
// ADC.deinit()
-STATIC mp_obj_t machine_adc_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_adc_deinit(mp_obj_t self_in) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_adc_deinit(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_deinit_obj, machine_adc_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_deinit_obj, machine_adc_deinit);
#endif
#if MICROPY_PY_MACHINE_ADC_BLOCK
// ADC.block()
-STATIC mp_obj_t machine_adc_block(mp_obj_t self_in) {
+static mp_obj_t machine_adc_block(mp_obj_t self_in) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_machine_adc_block(self);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_block_obj, machine_adc_block);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_block_obj, machine_adc_block);
#endif
// ADC.read_u16()
-STATIC mp_obj_t machine_adc_read_u16(mp_obj_t self_in) {
+static mp_obj_t machine_adc_read_u16(mp_obj_t self_in) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(mp_machine_adc_read_u16(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_u16_obj, machine_adc_read_u16);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_u16_obj, machine_adc_read_u16);
#if MICROPY_PY_MACHINE_ADC_READ_UV
// ADC.read_uv()
-STATIC mp_obj_t machine_adc_read_uv(mp_obj_t self_in) {
+static mp_obj_t machine_adc_read_uv(mp_obj_t self_in) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(mp_machine_adc_read_uv(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_uv_obj, machine_adc_read_uv);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_uv_obj, machine_adc_read_uv);
#endif
#if MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH
// ADC.atten(value) -- this is a legacy method.
-STATIC mp_obj_t machine_adc_atten(mp_obj_t self_in, mp_obj_t atten_in) {
+static mp_obj_t machine_adc_atten(mp_obj_t self_in, mp_obj_t atten_in) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t atten = mp_obj_get_int(atten_in);
mp_machine_adc_atten_set(self, atten);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_adc_atten_obj, machine_adc_atten);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_adc_atten_obj, machine_adc_atten);
// ADC.width(value) -- this is a legacy method.
-STATIC mp_obj_t machine_adc_width(mp_obj_t self_in, mp_obj_t width_in) {
+static mp_obj_t machine_adc_width(mp_obj_t self_in, mp_obj_t width_in) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t width = mp_obj_get_int(width_in);
mp_machine_adc_width_set(self, width);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_adc_width_obj, machine_adc_width);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_adc_width_obj, machine_adc_width);
#endif
#if MICROPY_PY_MACHINE_ADC_READ
// ADC.read() -- this is a legacy method.
-STATIC mp_obj_t machine_adc_read(mp_obj_t self_in) {
+static mp_obj_t machine_adc_read(mp_obj_t self_in) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(mp_machine_adc_read(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_obj, machine_adc_read);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_obj, machine_adc_read);
#endif
-STATIC const mp_rom_map_elem_t machine_adc_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_adc_locals_dict_table[] = {
#if MICROPY_PY_MACHINE_ADC_INIT
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_adc_init_obj) },
#endif
@@ -169,7 +169,7 @@ STATIC const mp_rom_map_elem_t machine_adc_locals_dict_table[] = {
// It can be defined to nothing if there are no constants.
MICROPY_PY_MACHINE_ADC_CLASS_CONSTANTS
};
-STATIC MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_type,
diff --git a/extmod/machine_adc_block.c b/extmod/machine_adc_block.c
index f80e2dae4c..b1e35a1eb6 100644
--- a/extmod/machine_adc_block.c
+++ b/extmod/machine_adc_block.c
@@ -33,20 +33,20 @@
#include "extmod/modmachine.h"
// The port must provide implementations of these low-level ADCBlock functions.
-STATIC void mp_machine_adc_block_print(const mp_print_t *print, machine_adc_block_obj_t *self);
-STATIC machine_adc_block_obj_t *mp_machine_adc_block_get(mp_int_t unit);
-STATIC void mp_machine_adc_block_bits_set(machine_adc_block_obj_t *self, mp_int_t bits);
-STATIC machine_adc_obj_t *mp_machine_adc_block_connect(machine_adc_block_obj_t *self, mp_int_t channel_id, mp_hal_pin_obj_t pin, mp_map_t *kw_args);
+static void mp_machine_adc_block_print(const mp_print_t *print, machine_adc_block_obj_t *self);
+static machine_adc_block_obj_t *mp_machine_adc_block_get(mp_int_t unit);
+static void mp_machine_adc_block_bits_set(machine_adc_block_obj_t *self, mp_int_t bits);
+static machine_adc_obj_t *mp_machine_adc_block_connect(machine_adc_block_obj_t *self, mp_int_t channel_id, mp_hal_pin_obj_t pin, mp_map_t *kw_args);
// The port provides implementations of the above in this file.
#include MICROPY_PY_MACHINE_ADC_BLOCK_INCLUDEFILE
-STATIC void machine_adc_block_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_adc_block_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_adc_block_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_adc_block_print(print, self);
}
-STATIC void machine_adc_block_init_helper(machine_adc_block_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_adc_block_init_helper(machine_adc_block_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {
ARG_bits,
};
@@ -62,7 +62,7 @@ STATIC void machine_adc_block_init_helper(machine_adc_block_obj_t *self, size_t
mp_machine_adc_block_bits_set(self, bits);
}
-STATIC mp_obj_t machine_adc_block_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) {
+static mp_obj_t machine_adc_block_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) {
mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true);
mp_int_t unit = mp_obj_get_int(args[0]);
machine_adc_block_obj_t *self = mp_machine_adc_block_get(unit);
@@ -77,14 +77,14 @@ STATIC mp_obj_t machine_adc_block_make_new(const mp_obj_type_t *type, size_t n_p
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t machine_adc_block_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_adc_block_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_adc_block_obj_t *self = pos_args[0];
machine_adc_block_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_adc_block_init_obj, 1, machine_adc_block_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_adc_block_init_obj, 1, machine_adc_block_init);
-STATIC mp_obj_t machine_adc_block_connect(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_adc_block_connect(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_adc_block_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_int_t channel_id = -1;
mp_hal_pin_obj_t pin = -1;
@@ -108,13 +108,13 @@ STATIC mp_obj_t machine_adc_block_connect(size_t n_pos_args, const mp_obj_t *pos
return MP_OBJ_FROM_PTR(adc);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_adc_block_connect_obj, 2, machine_adc_block_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_adc_block_connect_obj, 2, machine_adc_block_connect);
-STATIC const mp_rom_map_elem_t machine_adc_block_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_adc_block_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_adc_block_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&machine_adc_block_connect_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_adc_block_locals_dict, machine_adc_block_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_adc_block_locals_dict, machine_adc_block_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_adc_block_type,
diff --git a/extmod/machine_bitstream.c b/extmod/machine_bitstream.c
index af093a4b54..1349614274 100644
--- a/extmod/machine_bitstream.c
+++ b/extmod/machine_bitstream.c
@@ -36,7 +36,7 @@
#define MICROPY_MACHINE_BITSTREAM_TYPE_HIGH_LOW (0)
// machine.bitstream(pin, encoding, (timing), bytes)
-STATIC mp_obj_t machine_bitstream_(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_bitstream_(size_t n_args, const mp_obj_t *args) {
mp_hal_pin_obj_t pin = mp_hal_get_pin_obj(args[0]);
int encoding = mp_obj_get_int(args[1]);
diff --git a/extmod/machine_i2c.c b/extmod/machine_i2c.c
index 1964284ec8..bddf775299 100644
--- a/extmod/machine_i2c.c
+++ b/extmod/machine_i2c.c
@@ -39,17 +39,17 @@
typedef mp_machine_soft_i2c_obj_t machine_i2c_obj_t;
-STATIC void mp_hal_i2c_delay(machine_i2c_obj_t *self) {
+static void mp_hal_i2c_delay(machine_i2c_obj_t *self) {
// We need to use an accurate delay to get acceptable I2C
// speeds (eg 1us should be not much more than 1us).
mp_hal_delay_us_fast(self->us_delay);
}
-STATIC void mp_hal_i2c_scl_low(machine_i2c_obj_t *self) {
+static void mp_hal_i2c_scl_low(machine_i2c_obj_t *self) {
mp_hal_pin_od_low(self->scl);
}
-STATIC int mp_hal_i2c_scl_release(machine_i2c_obj_t *self) {
+static int mp_hal_i2c_scl_release(machine_i2c_obj_t *self) {
uint32_t count = self->us_timeout;
mp_hal_pin_od_high(self->scl);
@@ -64,19 +64,19 @@ STATIC int mp_hal_i2c_scl_release(machine_i2c_obj_t *self) {
return 0; // success
}
-STATIC void mp_hal_i2c_sda_low(machine_i2c_obj_t *self) {
+static void mp_hal_i2c_sda_low(machine_i2c_obj_t *self) {
mp_hal_pin_od_low(self->sda);
}
-STATIC void mp_hal_i2c_sda_release(machine_i2c_obj_t *self) {
+static void mp_hal_i2c_sda_release(machine_i2c_obj_t *self) {
mp_hal_pin_od_high(self->sda);
}
-STATIC int mp_hal_i2c_sda_read(machine_i2c_obj_t *self) {
+static int mp_hal_i2c_sda_read(machine_i2c_obj_t *self) {
return mp_hal_pin_read(self->sda);
}
-STATIC int mp_hal_i2c_start(machine_i2c_obj_t *self) {
+static int mp_hal_i2c_start(machine_i2c_obj_t *self) {
mp_hal_i2c_sda_release(self);
mp_hal_i2c_delay(self);
int ret = mp_hal_i2c_scl_release(self);
@@ -88,7 +88,7 @@ STATIC int mp_hal_i2c_start(machine_i2c_obj_t *self) {
return 0; // success
}
-STATIC int mp_hal_i2c_stop(machine_i2c_obj_t *self) {
+static int mp_hal_i2c_stop(machine_i2c_obj_t *self) {
mp_hal_i2c_delay(self);
mp_hal_i2c_sda_low(self);
mp_hal_i2c_delay(self);
@@ -98,7 +98,7 @@ STATIC int mp_hal_i2c_stop(machine_i2c_obj_t *self) {
return ret;
}
-STATIC void mp_hal_i2c_init(machine_i2c_obj_t *self, uint32_t freq) {
+static void mp_hal_i2c_init(machine_i2c_obj_t *self, uint32_t freq) {
self->us_delay = 500000 / freq;
if (self->us_delay == 0) {
self->us_delay = 1;
@@ -112,7 +112,7 @@ STATIC void mp_hal_i2c_init(machine_i2c_obj_t *self, uint32_t freq) {
// 0 - byte written and ack received
// 1 - byte written and nack received
// <0 - error, with errno being the negative of the return value
-STATIC int mp_hal_i2c_write_byte(machine_i2c_obj_t *self, uint8_t val) {
+static int mp_hal_i2c_write_byte(machine_i2c_obj_t *self, uint8_t val) {
mp_hal_i2c_delay(self);
mp_hal_i2c_scl_low(self);
@@ -148,7 +148,7 @@ STATIC int mp_hal_i2c_write_byte(machine_i2c_obj_t *self, uint8_t val) {
// return value:
// 0 - success
// <0 - error, with errno being the negative of the return value
-STATIC int mp_hal_i2c_read_byte(machine_i2c_obj_t *self, uint8_t *val, int nack) {
+static int mp_hal_i2c_read_byte(machine_i2c_obj_t *self, uint8_t *val, int nack) {
mp_hal_i2c_delay(self);
mp_hal_i2c_scl_low(self);
mp_hal_i2c_delay(self);
@@ -291,14 +291,14 @@ int mp_machine_i2c_transfer_adaptor(mp_obj_base_t *self, uint16_t addr, size_t n
return ret;
}
-STATIC int mp_machine_i2c_readfrom(mp_obj_base_t *self, uint16_t addr, uint8_t *dest, size_t len, bool stop) {
+static int mp_machine_i2c_readfrom(mp_obj_base_t *self, uint16_t addr, uint8_t *dest, size_t len, bool stop) {
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)MP_OBJ_TYPE_GET_SLOT(self->type, protocol);
mp_machine_i2c_buf_t buf = {.len = len, .buf = dest};
unsigned int flags = MP_MACHINE_I2C_FLAG_READ | (stop ? MP_MACHINE_I2C_FLAG_STOP : 0);
return i2c_p->transfer(self, addr, 1, &buf, flags);
}
-STATIC int mp_machine_i2c_writeto(mp_obj_base_t *self, uint16_t addr, const uint8_t *src, size_t len, bool stop) {
+static int mp_machine_i2c_writeto(mp_obj_base_t *self, uint16_t addr, const uint8_t *src, size_t len, bool stop) {
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)MP_OBJ_TYPE_GET_SLOT(self->type, protocol);
mp_machine_i2c_buf_t buf = {.len = len, .buf = (uint8_t *)src};
unsigned int flags = stop ? MP_MACHINE_I2C_FLAG_STOP : 0;
@@ -308,7 +308,7 @@ STATIC int mp_machine_i2c_writeto(mp_obj_base_t *self, uint16_t addr, const uint
/******************************************************************************/
// MicroPython bindings for generic machine.I2C
-STATIC mp_obj_t machine_i2c_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_i2c_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)MP_OBJ_TYPE_GET_SLOT(self->type, protocol);
if (i2c_p->init == NULL) {
@@ -319,7 +319,7 @@ STATIC mp_obj_t machine_i2c_init(size_t n_args, const mp_obj_t *args, mp_map_t *
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2c_init_obj, 1, machine_i2c_init);
-STATIC mp_obj_t machine_i2c_scan(mp_obj_t self_in) {
+static mp_obj_t machine_i2c_scan(mp_obj_t self_in) {
mp_obj_base_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t list = mp_obj_new_list(0, NULL);
// 7-bit addresses 0b0000xxx and 0b1111xxx are reserved
@@ -337,7 +337,7 @@ STATIC mp_obj_t machine_i2c_scan(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(machine_i2c_scan_obj, machine_i2c_scan);
-STATIC mp_obj_t machine_i2c_start(mp_obj_t self_in) {
+static mp_obj_t machine_i2c_start(mp_obj_t self_in) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)MP_OBJ_TYPE_GET_SLOT(self->type, protocol);
if (i2c_p->start == NULL) {
@@ -351,7 +351,7 @@ STATIC mp_obj_t machine_i2c_start(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(machine_i2c_start_obj, machine_i2c_start);
-STATIC mp_obj_t machine_i2c_stop(mp_obj_t self_in) {
+static mp_obj_t machine_i2c_stop(mp_obj_t self_in) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)MP_OBJ_TYPE_GET_SLOT(self->type, protocol);
if (i2c_p->stop == NULL) {
@@ -365,7 +365,7 @@ STATIC mp_obj_t machine_i2c_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(machine_i2c_stop_obj, machine_i2c_stop);
-STATIC mp_obj_t machine_i2c_readinto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_i2c_readinto(size_t n_args, const mp_obj_t *args) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)MP_OBJ_TYPE_GET_SLOT(self->type, protocol);
if (i2c_p->read == NULL) {
@@ -389,7 +389,7 @@ STATIC mp_obj_t machine_i2c_readinto(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_readinto_obj, 2, 3, machine_i2c_readinto);
-STATIC mp_obj_t machine_i2c_write(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t machine_i2c_write(mp_obj_t self_in, mp_obj_t buf_in) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)MP_OBJ_TYPE_GET_SLOT(self->type, protocol);
if (i2c_p->write == NULL) {
@@ -411,7 +411,7 @@ STATIC mp_obj_t machine_i2c_write(mp_obj_t self_in, mp_obj_t buf_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(machine_i2c_write_obj, machine_i2c_write);
-STATIC mp_obj_t machine_i2c_readfrom(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_i2c_readfrom(size_t n_args, const mp_obj_t *args) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_int_t addr = mp_obj_get_int(args[1]);
vstr_t vstr;
@@ -425,7 +425,7 @@ STATIC mp_obj_t machine_i2c_readfrom(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_readfrom_obj, 3, 4, machine_i2c_readfrom);
-STATIC mp_obj_t machine_i2c_readfrom_into(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_i2c_readfrom_into(size_t n_args, const mp_obj_t *args) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_int_t addr = mp_obj_get_int(args[1]);
mp_buffer_info_t bufinfo;
@@ -439,7 +439,7 @@ STATIC mp_obj_t machine_i2c_readfrom_into(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_readfrom_into_obj, 3, 4, machine_i2c_readfrom_into);
-STATIC mp_obj_t machine_i2c_writeto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_i2c_writeto(size_t n_args, const mp_obj_t *args) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_int_t addr = mp_obj_get_int(args[1]);
mp_buffer_info_t bufinfo;
@@ -452,9 +452,9 @@ STATIC mp_obj_t machine_i2c_writeto(size_t n_args, const mp_obj_t *args) {
// return number of acks received
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_writeto_obj, 3, 4, machine_i2c_writeto);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_writeto_obj, 3, 4, machine_i2c_writeto);
-STATIC mp_obj_t machine_i2c_writevto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_i2c_writevto(size_t n_args, const mp_obj_t *args) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_int_t addr = mp_obj_get_int(args[1]);
@@ -498,9 +498,9 @@ STATIC mp_obj_t machine_i2c_writevto(size_t n_args, const mp_obj_t *args) {
// Return number of acks received
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_writevto_obj, 3, 4, machine_i2c_writevto);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_writevto_obj, 3, 4, machine_i2c_writevto);
-STATIC size_t fill_memaddr_buf(uint8_t *memaddr_buf, uint32_t memaddr, uint8_t addrsize) {
+static size_t fill_memaddr_buf(uint8_t *memaddr_buf, uint32_t memaddr, uint8_t addrsize) {
size_t memaddr_len = 0;
if ((addrsize & 7) != 0 || addrsize > 32) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid addrsize"));
@@ -511,7 +511,7 @@ STATIC size_t fill_memaddr_buf(uint8_t *memaddr_buf, uint32_t memaddr, uint8_t a
return memaddr_len;
}
-STATIC int read_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t addrsize, uint8_t *buf, size_t len) {
+static int read_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t addrsize, uint8_t *buf, size_t len) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
// Create buffer with memory address
@@ -543,7 +543,7 @@ STATIC int read_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t a
return mp_machine_i2c_readfrom(self, addr, buf, len, true);
}
-STATIC int write_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t addrsize, const uint8_t *buf, size_t len) {
+static int write_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t addrsize, const uint8_t *buf, size_t len) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
// Create buffer with memory address
@@ -561,14 +561,14 @@ STATIC int write_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t
return i2c_p->transfer(self, addr, 2, bufs, MP_MACHINE_I2C_FLAG_STOP);
}
-STATIC const mp_arg_t machine_i2c_mem_allowed_args[] = {
+static const mp_arg_t machine_i2c_mem_allowed_args[] = {
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_memaddr, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_arg, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_addrsize, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 8} },
};
-STATIC mp_obj_t machine_i2c_readfrom_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_i2c_readfrom_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_addr, ARG_memaddr, ARG_n, ARG_addrsize };
mp_arg_val_t args[MP_ARRAY_SIZE(machine_i2c_mem_allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
@@ -590,7 +590,7 @@ STATIC mp_obj_t machine_i2c_readfrom_mem(size_t n_args, const mp_obj_t *pos_args
MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2c_readfrom_mem_obj, 1, machine_i2c_readfrom_mem);
-STATIC mp_obj_t machine_i2c_readfrom_mem_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_i2c_readfrom_mem_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_addr, ARG_memaddr, ARG_buf, ARG_addrsize };
mp_arg_val_t args[MP_ARRAY_SIZE(machine_i2c_mem_allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
@@ -610,7 +610,7 @@ STATIC mp_obj_t machine_i2c_readfrom_mem_into(size_t n_args, const mp_obj_t *pos
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2c_readfrom_mem_into_obj, 1, machine_i2c_readfrom_mem_into);
-STATIC mp_obj_t machine_i2c_writeto_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_i2c_writeto_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_addr, ARG_memaddr, ARG_buf, ARG_addrsize };
mp_arg_val_t args[MP_ARRAY_SIZE(machine_i2c_mem_allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
@@ -629,9 +629,9 @@ STATIC mp_obj_t machine_i2c_writeto_mem(size_t n_args, const mp_obj_t *pos_args,
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2c_writeto_mem_obj, 1, machine_i2c_writeto_mem);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2c_writeto_mem_obj, 1, machine_i2c_writeto_mem);
-STATIC const mp_rom_map_elem_t machine_i2c_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_i2c_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_i2c_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&machine_i2c_scan_obj) },
@@ -661,13 +661,13 @@ MP_DEFINE_CONST_DICT(mp_machine_i2c_locals_dict, machine_i2c_locals_dict_table);
#if MICROPY_PY_MACHINE_SOFTI2C
-STATIC void mp_machine_soft_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_soft_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_machine_soft_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "SoftI2C(scl=" MP_HAL_PIN_FMT ", sda=" MP_HAL_PIN_FMT ", freq=%u)",
mp_hal_pin_name(self->scl), mp_hal_pin_name(self->sda), 500000 / self->us_delay);
}
-STATIC void mp_machine_soft_i2c_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_soft_i2c_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_scl, ARG_sda, ARG_freq, ARG_timeout };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -686,7 +686,7 @@ STATIC void mp_machine_soft_i2c_init(mp_obj_base_t *self_in, size_t n_args, cons
mp_hal_i2c_init(self, args[ARG_freq].u_int);
}
-STATIC mp_obj_t mp_machine_soft_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_soft_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// create new soft I2C object
machine_i2c_obj_t *self = mp_obj_malloc(machine_i2c_obj_t, &mp_machine_soft_i2c_type);
mp_map_t kw_args;
@@ -722,7 +722,7 @@ int mp_machine_soft_i2c_write(mp_obj_base_t *self_in, const uint8_t *src, size_t
return num_acks;
}
-STATIC const mp_machine_i2c_p_t mp_machine_soft_i2c_p = {
+static const mp_machine_i2c_p_t mp_machine_soft_i2c_p = {
.init = mp_machine_soft_i2c_init,
.start = (int (*)(mp_obj_base_t *))mp_hal_i2c_start,
.stop = (int (*)(mp_obj_base_t *))mp_hal_i2c_stop,
diff --git a/extmod/machine_i2s.c b/extmod/machine_i2s.c
index cc97f011a6..7e069c5d76 100644
--- a/extmod/machine_i2s.c
+++ b/extmod/machine_i2s.c
@@ -108,21 +108,21 @@ typedef struct _non_blocking_descriptor_t {
bool copy_in_progress;
} non_blocking_descriptor_t;
-STATIC void ringbuf_init(ring_buf_t *rbuf, uint8_t *buffer, size_t size);
-STATIC bool ringbuf_push(ring_buf_t *rbuf, uint8_t data);
-STATIC bool ringbuf_pop(ring_buf_t *rbuf, uint8_t *data);
-STATIC size_t ringbuf_available_data(ring_buf_t *rbuf);
-STATIC size_t ringbuf_available_space(ring_buf_t *rbuf);
-STATIC void fill_appbuf_from_ringbuf_non_blocking(machine_i2s_obj_t *self);
-STATIC void copy_appbuf_to_ringbuf_non_blocking(machine_i2s_obj_t *self);
+static void ringbuf_init(ring_buf_t *rbuf, uint8_t *buffer, size_t size);
+static bool ringbuf_push(ring_buf_t *rbuf, uint8_t data);
+static bool ringbuf_pop(ring_buf_t *rbuf, uint8_t *data);
+static size_t ringbuf_available_data(ring_buf_t *rbuf);
+static size_t ringbuf_available_space(ring_buf_t *rbuf);
+static void fill_appbuf_from_ringbuf_non_blocking(machine_i2s_obj_t *self);
+static void copy_appbuf_to_ringbuf_non_blocking(machine_i2s_obj_t *self);
#endif // MICROPY_PY_MACHINE_I2S_RING_BUF
// The port must provide implementations of these low-level I2S functions.
-STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args);
-STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id);
-STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self);
-STATIC void mp_machine_i2s_irq_update(machine_i2s_obj_t *self);
+static void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args);
+static machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id);
+static void mp_machine_i2s_deinit(machine_i2s_obj_t *self);
+static void mp_machine_i2s_irq_update(machine_i2s_obj_t *self);
// The port provides implementations of the above in this file.
#include MICROPY_PY_MACHINE_I2S_INCLUDEFILE
@@ -135,14 +135,14 @@ STATIC void mp_machine_i2s_irq_update(machine_i2s_obj_t *self);
// - Sequential atomic operations
// One byte of capacity is used to detect buffer empty/full
-STATIC void ringbuf_init(ring_buf_t *rbuf, uint8_t *buffer, size_t size) {
+static void ringbuf_init(ring_buf_t *rbuf, uint8_t *buffer, size_t size) {
rbuf->buffer = buffer;
rbuf->size = size;
rbuf->head = 0;
rbuf->tail = 0;
}
-STATIC bool ringbuf_push(ring_buf_t *rbuf, uint8_t data) {
+static bool ringbuf_push(ring_buf_t *rbuf, uint8_t data) {
size_t next_tail = (rbuf->tail + 1) % rbuf->size;
if (next_tail != rbuf->head) {
@@ -155,7 +155,7 @@ STATIC bool ringbuf_push(ring_buf_t *rbuf, uint8_t data) {
return false;
}
-STATIC bool ringbuf_pop(ring_buf_t *rbuf, uint8_t *data) {
+static bool ringbuf_pop(ring_buf_t *rbuf, uint8_t *data) {
if (rbuf->head == rbuf->tail) {
// empty
return false;
@@ -166,23 +166,23 @@ STATIC bool ringbuf_pop(ring_buf_t *rbuf, uint8_t *data) {
return true;
}
-STATIC bool ringbuf_is_empty(ring_buf_t *rbuf) {
+static bool ringbuf_is_empty(ring_buf_t *rbuf) {
return rbuf->head == rbuf->tail;
}
-STATIC bool ringbuf_is_full(ring_buf_t *rbuf) {
+static bool ringbuf_is_full(ring_buf_t *rbuf) {
return ((rbuf->tail + 1) % rbuf->size) == rbuf->head;
}
-STATIC size_t ringbuf_available_data(ring_buf_t *rbuf) {
+static size_t ringbuf_available_data(ring_buf_t *rbuf) {
return (rbuf->tail - rbuf->head + rbuf->size) % rbuf->size;
}
-STATIC size_t ringbuf_available_space(ring_buf_t *rbuf) {
+static size_t ringbuf_available_space(ring_buf_t *rbuf) {
return rbuf->size - ringbuf_available_data(rbuf) - 1;
}
-STATIC uint32_t fill_appbuf_from_ringbuf(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
+static uint32_t fill_appbuf_from_ringbuf(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
// copy audio samples from the ring buffer to the app buffer
// loop, copying samples until the app buffer is filled
@@ -247,7 +247,7 @@ exit:
}
// function is used in IRQ context
-STATIC void fill_appbuf_from_ringbuf_non_blocking(machine_i2s_obj_t *self) {
+static void fill_appbuf_from_ringbuf_non_blocking(machine_i2s_obj_t *self) {
// attempt to copy a block of audio samples from the ring buffer to the supplied app buffer.
// audio samples will be formatted as part of the copy operation
@@ -288,7 +288,7 @@ STATIC void fill_appbuf_from_ringbuf_non_blocking(machine_i2s_obj_t *self) {
}
}
-STATIC uint32_t copy_appbuf_to_ringbuf(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
+static uint32_t copy_appbuf_to_ringbuf(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
// copy audio samples from the app buffer to the ring buffer
// loop, reading samples until the app buffer is emptied
@@ -319,7 +319,7 @@ STATIC uint32_t copy_appbuf_to_ringbuf(machine_i2s_obj_t *self, mp_buffer_info_t
}
// function is used in IRQ context
-STATIC void copy_appbuf_to_ringbuf_non_blocking(machine_i2s_obj_t *self) {
+static void copy_appbuf_to_ringbuf_non_blocking(machine_i2s_obj_t *self) {
// copy audio samples from app buffer into ring buffer
uint32_t num_bytes_remaining_to_copy = self->non_blocking_descriptor.appbuf.len - self->non_blocking_descriptor.index;
@@ -341,7 +341,7 @@ STATIC void copy_appbuf_to_ringbuf_non_blocking(machine_i2s_obj_t *self) {
#endif // MICROPY_PY_MACHINE_I2S_RING_BUF
-MP_NOINLINE STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+MP_NOINLINE static void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_sck, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_ws, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -362,7 +362,7 @@ MP_NOINLINE STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t
mp_machine_i2s_init_helper(self, args);
}
-STATIC void machine_i2s_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_i2s_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "I2S(id=%u,\n"
"sck="MP_HAL_PIN_FMT ",\n"
@@ -387,7 +387,7 @@ STATIC void machine_i2s_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
);
}
-STATIC mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) {
+static mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) {
mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true);
mp_int_t i2s_id = mp_obj_get_int(args[0]);
@@ -401,24 +401,24 @@ STATIC mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_arg
}
// I2S.init(...)
-STATIC mp_obj_t machine_i2s_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_i2s_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_machine_i2s_deinit(self);
machine_i2s_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_init_obj, 1, machine_i2s_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_init_obj, 1, machine_i2s_init);
// I2S.deinit()
-STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_i2s_deinit(mp_obj_t self_in) {
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_i2s_deinit(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_deinit_obj, machine_i2s_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_deinit_obj, machine_i2s_deinit);
// I2S.irq(handler)
-STATIC mp_obj_t machine_i2s_irq(mp_obj_t self_in, mp_obj_t handler) {
+static mp_obj_t machine_i2s_irq(mp_obj_t self_in, mp_obj_t handler) {
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (handler != mp_const_none && !mp_obj_is_callable(handler)) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid callback"));
@@ -436,11 +436,11 @@ STATIC mp_obj_t machine_i2s_irq(mp_obj_t self_in, mp_obj_t handler) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_i2s_irq_obj, machine_i2s_irq);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_i2s_irq_obj, machine_i2s_irq);
// Shift() is typically used as a volume control.
// shift=1 increases volume by 6dB, shift=-1 decreases volume by 6dB
-STATIC mp_obj_t machine_i2s_shift(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_i2s_shift(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_buf, ARG_bits, ARG_shift};
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -497,10 +497,10 @@ STATIC mp_obj_t machine_i2s_shift(size_t n_args, const mp_obj_t *pos_args, mp_ma
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_shift_fun_obj, 0, machine_i2s_shift);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(machine_i2s_shift_obj, MP_ROM_PTR(&machine_i2s_shift_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_shift_fun_obj, 0, machine_i2s_shift);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(machine_i2s_shift_obj, MP_ROM_PTR(&machine_i2s_shift_fun_obj));
-STATIC const mp_rom_map_elem_t machine_i2s_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_i2s_locals_dict_table[] = {
// Methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_i2s_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
@@ -522,7 +522,7 @@ STATIC const mp_rom_map_elem_t machine_i2s_locals_dict_table[] = {
};
MP_DEFINE_CONST_DICT(machine_i2s_locals_dict, machine_i2s_locals_dict_table);
-STATIC mp_uint_t machine_i2s_stream_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t machine_i2s_stream_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->mode != MICROPY_PY_MACHINE_I2S_CONSTANT_RX) {
@@ -570,7 +570,7 @@ STATIC mp_uint_t machine_i2s_stream_read(mp_obj_t self_in, void *buf_in, mp_uint
}
}
-STATIC mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->mode != MICROPY_PY_MACHINE_I2S_CONSTANT_TX) {
@@ -612,7 +612,7 @@ STATIC mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in,
}
}
-STATIC mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret;
uintptr_t flags = arg;
@@ -678,7 +678,7 @@ STATIC mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return ret;
}
-STATIC const mp_stream_p_t i2s_stream_p = {
+static const mp_stream_p_t i2s_stream_p = {
.read = machine_i2s_stream_read,
.write = machine_i2s_stream_write,
.ioctl = machine_i2s_ioctl,
diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c
index 217c7ca088..c8f0889b9a 100644
--- a/extmod/machine_mem.c
+++ b/extmod/machine_mem.c
@@ -39,7 +39,7 @@
// implementations, if the default implementation isn't used.
#if !defined(MICROPY_MACHINE_MEM_GET_READ_ADDR) || !defined(MICROPY_MACHINE_MEM_GET_WRITE_ADDR)
-STATIC uintptr_t machine_mem_get_addr(mp_obj_t addr_o, uint align) {
+static uintptr_t machine_mem_get_addr(mp_obj_t addr_o, uint align) {
uintptr_t addr = mp_obj_get_int_truncated(addr_o);
if ((addr & (align - 1)) != 0) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("address %08x is not aligned to %d bytes"), addr, align);
@@ -54,13 +54,13 @@ STATIC uintptr_t machine_mem_get_addr(mp_obj_t addr_o, uint align) {
#endif
#endif
-STATIC void machine_mem_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_mem_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
machine_mem_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<%u-bit memory>", 8 * self->elem_size);
}
-STATIC mp_obj_t machine_mem_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t machine_mem_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
// TODO support slice index to read/write multiple values at once
machine_mem_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (value == MP_OBJ_NULL) {
diff --git a/extmod/machine_pinbase.c b/extmod/machine_pinbase.c
index 981dadf0f5..6b3b362317 100644
--- a/extmod/machine_pinbase.c
+++ b/extmod/machine_pinbase.c
@@ -40,11 +40,11 @@ typedef struct _mp_pinbase_t {
mp_obj_base_t base;
} mp_pinbase_t;
-STATIC const mp_pinbase_t pinbase_singleton = {
+static const mp_pinbase_t pinbase_singleton = {
.base = { &machine_pinbase_type },
};
-STATIC mp_obj_t pinbase_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pinbase_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type;
(void)n_args;
(void)n_kw;
@@ -72,7 +72,7 @@ mp_uint_t pinbase_ioctl(mp_obj_t obj, mp_uint_t request, uintptr_t arg, int *err
return -1;
}
-STATIC const mp_pin_p_t pinbase_pin_p = {
+static const mp_pin_p_t pinbase_pin_p = {
.ioctl = pinbase_ioctl,
};
diff --git a/extmod/machine_pulse.c b/extmod/machine_pulse.c
index 157566d984..85dba86d9b 100644
--- a/extmod/machine_pulse.c
+++ b/extmod/machine_pulse.c
@@ -46,7 +46,7 @@ MP_WEAK mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, m
return mp_hal_ticks_us() - start;
}
-STATIC mp_obj_t machine_time_pulse_us_(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_time_pulse_us_(size_t n_args, const mp_obj_t *args) {
mp_hal_pin_obj_t pin = mp_hal_get_pin_obj(args[0]);
int level = 0;
if (mp_obj_is_true(args[1])) {
diff --git a/extmod/machine_pwm.c b/extmod/machine_pwm.c
index 13b96eb5d4..0c1834886c 100644
--- a/extmod/machine_pwm.c
+++ b/extmod/machine_pwm.c
@@ -31,40 +31,40 @@
#include "extmod/modmachine.h"
// The port must provide implementations of these low-level PWM functions.
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self);
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq);
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self);
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self);
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq);
#if MICROPY_PY_MACHINE_PWM_DUTY
-STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty);
+static mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self);
+static void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty);
#endif
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16);
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns);
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self);
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16);
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self);
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns);
// The port provides implementations of the above in this file.
#include MICROPY_PY_MACHINE_PWM_INCLUDEFILE
-STATIC mp_obj_t machine_pwm_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_pwm_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_machine_pwm_init_helper(args[0], n_args - 1, args + 1, kw_args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pwm_init_obj, 1, machine_pwm_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pwm_init_obj, 1, machine_pwm_init);
// PWM.deinit()
-STATIC mp_obj_t machine_pwm_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_pwm_deinit(mp_obj_t self_in) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_pwm_deinit(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pwm_deinit_obj, machine_pwm_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pwm_deinit_obj, machine_pwm_deinit);
// PWM.freq([value])
-STATIC mp_obj_t machine_pwm_freq(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pwm_freq(size_t n_args, const mp_obj_t *args) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// Get frequency.
@@ -76,11 +76,11 @@ STATIC mp_obj_t machine_pwm_freq(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_freq_obj, 1, 2, machine_pwm_freq);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_freq_obj, 1, 2, machine_pwm_freq);
#if MICROPY_PY_MACHINE_PWM_DUTY
// PWM.duty([duty])
-STATIC mp_obj_t machine_pwm_duty(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pwm_duty(size_t n_args, const mp_obj_t *args) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// Get duty cycle.
@@ -92,11 +92,11 @@ STATIC mp_obj_t machine_pwm_duty(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_obj, 1, 2, machine_pwm_duty);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_obj, 1, 2, machine_pwm_duty);
#endif
// PWM.duty_u16([value])
-STATIC mp_obj_t machine_pwm_duty_u16(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pwm_duty_u16(size_t n_args, const mp_obj_t *args) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// Get duty cycle.
@@ -108,10 +108,10 @@ STATIC mp_obj_t machine_pwm_duty_u16(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_u16_obj, 1, 2, machine_pwm_duty_u16);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_u16_obj, 1, 2, machine_pwm_duty_u16);
// PWM.duty_ns([value])
-STATIC mp_obj_t machine_pwm_duty_ns(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pwm_duty_ns(size_t n_args, const mp_obj_t *args) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// Get duty cycle.
@@ -123,9 +123,9 @@ STATIC mp_obj_t machine_pwm_duty_ns(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_ns_obj, 1, 2, machine_pwm_duty_ns);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_ns_obj, 1, 2, machine_pwm_duty_ns);
-STATIC const mp_rom_map_elem_t machine_pwm_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pwm_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pwm_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_pwm_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_pwm_freq_obj) },
@@ -135,7 +135,7 @@ STATIC const mp_rom_map_elem_t machine_pwm_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_duty_u16), MP_ROM_PTR(&machine_pwm_duty_u16_obj) },
{ MP_ROM_QSTR(MP_QSTR_duty_ns), MP_ROM_PTR(&machine_pwm_duty_ns_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_pwm_locals_dict, machine_pwm_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pwm_locals_dict, machine_pwm_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_pwm_type,
diff --git a/extmod/machine_signal.c b/extmod/machine_signal.c
index 63fd0fe479..6295a496b3 100644
--- a/extmod/machine_signal.c
+++ b/extmod/machine_signal.c
@@ -41,7 +41,7 @@ typedef struct _machine_signal_t {
bool invert;
} machine_signal_t;
-STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_obj_t pin;
bool invert = false;
@@ -113,7 +113,7 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_uint_t signal_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t signal_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_signal_t *self = MP_OBJ_TO_PTR(self_in);
@@ -130,7 +130,7 @@ STATIC mp_uint_t signal_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg
}
// fast method for getting/setting signal value
-STATIC mp_obj_t signal_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t signal_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
if (n_args == 0) {
// get pin
@@ -142,32 +142,32 @@ STATIC mp_obj_t signal_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
}
}
-STATIC mp_obj_t signal_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t signal_value(size_t n_args, const mp_obj_t *args) {
return signal_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(signal_value_obj, 1, 2, signal_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(signal_value_obj, 1, 2, signal_value);
-STATIC mp_obj_t signal_on(mp_obj_t self_in) {
+static mp_obj_t signal_on(mp_obj_t self_in) {
mp_virtual_pin_write(self_in, 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(signal_on_obj, signal_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(signal_on_obj, signal_on);
-STATIC mp_obj_t signal_off(mp_obj_t self_in) {
+static mp_obj_t signal_off(mp_obj_t self_in) {
mp_virtual_pin_write(self_in, 0);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(signal_off_obj, signal_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(signal_off_obj, signal_off);
-STATIC const mp_rom_map_elem_t signal_locals_dict_table[] = {
+static const mp_rom_map_elem_t signal_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&signal_value_obj) },
{ MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&signal_on_obj) },
{ MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&signal_off_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(signal_locals_dict, signal_locals_dict_table);
+static MP_DEFINE_CONST_DICT(signal_locals_dict, signal_locals_dict_table);
-STATIC const mp_pin_p_t signal_pin_p = {
+static const mp_pin_p_t signal_pin_p = {
.ioctl = signal_ioctl,
};
diff --git a/extmod/machine_spi.c b/extmod/machine_spi.c
index e35e8b7fcc..a1d18c9052 100644
--- a/extmod/machine_spi.c
+++ b/extmod/machine_spi.c
@@ -42,15 +42,15 @@
/******************************************************************************/
// MicroPython bindings for generic machine.SPI
-STATIC mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
spi_p->init(s, n_args - 1, args + 1, kw_args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_spi_init_obj, 1, machine_spi_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_spi_init_obj, 1, machine_spi_init);
-STATIC mp_obj_t machine_spi_deinit(mp_obj_t self) {
+static mp_obj_t machine_spi_deinit(mp_obj_t self) {
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(self);
mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
if (spi_p->deinit != NULL) {
@@ -58,15 +58,15 @@ STATIC mp_obj_t machine_spi_deinit(mp_obj_t self) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_spi_deinit_obj, machine_spi_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_spi_deinit_obj, machine_spi_deinit);
-STATIC void mp_machine_spi_transfer(mp_obj_t self, size_t len, const void *src, void *dest) {
+static void mp_machine_spi_transfer(mp_obj_t self, size_t len, const void *src, void *dest) {
mp_obj_base_t *s = (mp_obj_base_t *)MP_OBJ_TO_PTR(self);
mp_machine_spi_p_t *spi_p = (mp_machine_spi_p_t *)MP_OBJ_TYPE_GET_SLOT(s->type, protocol);
spi_p->transfer(s, len, src, dest);
}
-STATIC mp_obj_t mp_machine_spi_read(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_machine_spi_read(size_t n_args, const mp_obj_t *args) {
vstr_t vstr;
vstr_init_len(&vstr, mp_obj_get_int(args[1]));
memset(vstr.buf, n_args == 3 ? mp_obj_get_int(args[2]) : 0, vstr.len);
@@ -75,7 +75,7 @@ STATIC mp_obj_t mp_machine_spi_read(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_machine_spi_read_obj, 2, 3, mp_machine_spi_read);
-STATIC mp_obj_t mp_machine_spi_readinto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_machine_spi_readinto(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE);
memset(bufinfo.buf, n_args == 3 ? mp_obj_get_int(args[2]) : 0, bufinfo.len);
@@ -84,7 +84,7 @@ STATIC mp_obj_t mp_machine_spi_readinto(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_machine_spi_readinto_obj, 2, 3, mp_machine_spi_readinto);
-STATIC mp_obj_t mp_machine_spi_write(mp_obj_t self, mp_obj_t wr_buf) {
+static mp_obj_t mp_machine_spi_write(mp_obj_t self, mp_obj_t wr_buf) {
mp_buffer_info_t src;
mp_get_buffer_raise(wr_buf, &src, MP_BUFFER_READ);
mp_machine_spi_transfer(self, src.len, (const uint8_t *)src.buf, NULL);
@@ -92,7 +92,7 @@ STATIC mp_obj_t mp_machine_spi_write(mp_obj_t self, mp_obj_t wr_buf) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_machine_spi_write_obj, mp_machine_spi_write);
-STATIC mp_obj_t mp_machine_spi_write_readinto(mp_obj_t self, mp_obj_t wr_buf, mp_obj_t rd_buf) {
+static mp_obj_t mp_machine_spi_write_readinto(mp_obj_t self, mp_obj_t wr_buf, mp_obj_t rd_buf) {
mp_buffer_info_t src;
mp_get_buffer_raise(wr_buf, &src, MP_BUFFER_READ);
mp_buffer_info_t dest;
@@ -105,7 +105,7 @@ STATIC mp_obj_t mp_machine_spi_write_readinto(mp_obj_t self, mp_obj_t wr_buf, mp
}
MP_DEFINE_CONST_FUN_OBJ_3(mp_machine_spi_write_readinto_obj, mp_machine_spi_write_readinto);
-STATIC const mp_rom_map_elem_t machine_spi_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_spi_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_spi_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_spi_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_machine_spi_read_obj) },
@@ -125,7 +125,7 @@ MP_DEFINE_CONST_DICT(mp_machine_spi_locals_dict, machine_spi_locals_dict_table);
#if MICROPY_PY_MACHINE_SOFTSPI
-STATIC uint32_t baudrate_from_delay_half(uint32_t delay_half) {
+static uint32_t baudrate_from_delay_half(uint32_t delay_half) {
#ifdef MICROPY_HW_SOFTSPI_MIN_DELAY
if (delay_half == MICROPY_HW_SOFTSPI_MIN_DELAY) {
return MICROPY_HW_SOFTSPI_MAX_BAUDRATE;
@@ -136,7 +136,7 @@ STATIC uint32_t baudrate_from_delay_half(uint32_t delay_half) {
}
}
-STATIC uint32_t baudrate_to_delay_half(uint32_t baudrate) {
+static uint32_t baudrate_to_delay_half(uint32_t baudrate) {
#ifdef MICROPY_HW_SOFTSPI_MIN_DELAY
if (baudrate >= MICROPY_HW_SOFTSPI_MAX_BAUDRATE) {
return MICROPY_HW_SOFTSPI_MIN_DELAY;
@@ -152,7 +152,7 @@ STATIC uint32_t baudrate_to_delay_half(uint32_t baudrate) {
}
}
-STATIC void mp_machine_soft_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_soft_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_machine_soft_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "SoftSPI(baudrate=%u, polarity=%u, phase=%u,"
" sck=" MP_HAL_PIN_FMT ", mosi=" MP_HAL_PIN_FMT ", miso=" MP_HAL_PIN_FMT ")",
@@ -160,7 +160,7 @@ STATIC void mp_machine_soft_spi_print(const mp_print_t *print, mp_obj_t self_in,
mp_hal_pin_name(self->spi.sck), mp_hal_pin_name(self->spi.mosi), mp_hal_pin_name(self->spi.miso));
}
-STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_sck, ARG_mosi, ARG_miso };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 500000} },
@@ -203,7 +203,7 @@ STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_soft_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_soft_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_machine_soft_spi_obj_t *self = (mp_machine_soft_spi_obj_t *)self_in;
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_sck, ARG_mosi, ARG_miso };
@@ -241,7 +241,7 @@ STATIC void mp_machine_soft_spi_init(mp_obj_base_t *self_in, size_t n_args, cons
mp_soft_spi_ioctl(&self->spi, MP_SPI_IOCTL_INIT);
}
-STATIC void mp_machine_soft_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void mp_machine_soft_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
mp_machine_soft_spi_obj_t *self = (mp_machine_soft_spi_obj_t *)self_in;
mp_soft_spi_transfer(&self->spi, len, src, dest);
}
diff --git a/extmod/machine_timer.c b/extmod/machine_timer.c
index 68702cb74f..665be82ce1 100644
--- a/extmod/machine_timer.c
+++ b/extmod/machine_timer.c
@@ -35,13 +35,13 @@ typedef soft_timer_entry_t machine_timer_obj_t;
const mp_obj_type_t machine_timer_type;
-STATIC void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
qstr mode = self->mode == SOFT_TIMER_MODE_ONE_SHOT ? MP_QSTR_ONE_SHOT : MP_QSTR_PERIODIC;
mp_printf(print, "Timer(mode=%q, period=%u)", mode, self->delta_ms);
}
-STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_callback, ARG_period, ARG_tick_hz, ARG_freq, };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = SOFT_TIMER_MODE_PERIODIC} },
@@ -88,7 +88,7 @@ STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_ar
return mp_const_none;
}
-STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
machine_timer_obj_t *self = m_new_obj(machine_timer_obj_t);
self->pairheap.base.type = &machine_timer_type;
self->flags = SOFT_TIMER_FLAG_PY_CALLBACK | SOFT_TIMER_FLAG_GC_ALLOCATED;
@@ -116,28 +116,28 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
machine_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
soft_timer_remove(self);
return machine_timer_init_helper(self, n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
-STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
machine_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
soft_timer_remove(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
-STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_timer_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_timer_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(SOFT_TIMER_MODE_ONE_SHOT) },
{ MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(SOFT_TIMER_MODE_PERIODIC) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
diff --git a/extmod/machine_uart.c b/extmod/machine_uart.c
index dd556bbbbf..b62f5a49c4 100644
--- a/extmod/machine_uart.c
+++ b/extmod/machine_uart.c
@@ -34,108 +34,108 @@
// The port must provide implementations of these low-level UART functions.
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self);
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self);
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self);
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
+static void mp_machine_uart_deinit(machine_uart_obj_t *self);
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self);
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self);
#if MICROPY_PY_MACHINE_UART_SENDBREAK
-STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self);
+static void mp_machine_uart_sendbreak(machine_uart_obj_t *self);
#endif
#if MICROPY_PY_MACHINE_UART_READCHAR_WRITECHAR
-STATIC mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self);
-STATIC void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data);
+static mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self);
+static void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data);
#endif
#if MICROPY_PY_MACHINE_UART_IRQ
-STATIC mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args, mp_arg_val_t *args);
+static mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args, mp_arg_val_t *args);
#endif
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode);
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode);
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode);
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode);
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode);
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode);
// The port provides implementations of the above in this file.
#include MICROPY_PY_MACHINE_UART_INCLUDEFILE
// UART.init(...)
-STATIC mp_obj_t machine_uart_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_uart_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_machine_uart_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_uart_init_obj, 1, machine_uart_init);
// UART.deinit()
-STATIC mp_obj_t machine_uart_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_uart_deinit(mp_obj_t self_in) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_uart_deinit(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_deinit_obj, machine_uart_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_deinit_obj, machine_uart_deinit);
// UART.any()
-STATIC mp_obj_t machine_uart_any(mp_obj_t self_in) {
+static mp_obj_t machine_uart_any(mp_obj_t self_in) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(mp_machine_uart_any(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_any_obj, machine_uart_any);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_any_obj, machine_uart_any);
// UART.txdone()
-STATIC mp_obj_t machine_uart_txdone(mp_obj_t self_in) {
+static mp_obj_t machine_uart_txdone(mp_obj_t self_in) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(mp_machine_uart_txdone(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_txdone_obj, machine_uart_txdone);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_txdone_obj, machine_uart_txdone);
#if MICROPY_PY_MACHINE_UART_SENDBREAK
// UART.sendbreak()
-STATIC mp_obj_t machine_uart_sendbreak(mp_obj_t self_in) {
+static mp_obj_t machine_uart_sendbreak(mp_obj_t self_in) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_uart_sendbreak(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_sendbreak_obj, machine_uart_sendbreak);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_sendbreak_obj, machine_uart_sendbreak);
#endif
#if MICROPY_PY_MACHINE_UART_READCHAR_WRITECHAR
// UART.readchar()
-STATIC mp_obj_t machine_uart_readchar(mp_obj_t self_in) {
+static mp_obj_t machine_uart_readchar(mp_obj_t self_in) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(mp_machine_uart_readchar(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_readchar_obj, machine_uart_readchar);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_readchar_obj, machine_uart_readchar);
// UART.writechar(char)
-STATIC mp_obj_t machine_uart_writechar(mp_obj_t self_in, mp_obj_t char_in) {
+static mp_obj_t machine_uart_writechar(mp_obj_t self_in, mp_obj_t char_in) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_uart_writechar(self, mp_obj_get_int(char_in));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_uart_writechar_obj, machine_uart_writechar);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_uart_writechar_obj, machine_uart_writechar);
#endif
#if MICROPY_PY_MACHINE_UART_IRQ
// UART.irq(handler, trigger, hard)
-STATIC mp_obj_t machine_uart_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_uart_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_val_t args[MP_IRQ_ARG_INIT_NUM_ARGS];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_IRQ_ARG_INIT_NUM_ARGS, mp_irq_init_args, args);
machine_uart_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
bool any_args = n_args > 1 || kw_args->used != 0;
return MP_OBJ_FROM_PTR(mp_machine_uart_irq(self, any_args, args));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_uart_irq_obj, 1, machine_uart_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_uart_irq_obj, 1, machine_uart_irq);
#endif
-STATIC const mp_rom_map_elem_t machine_uart_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_uart_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_uart_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_uart_deinit_obj) },
@@ -165,9 +165,9 @@ STATIC const mp_rom_map_elem_t machine_uart_locals_dict_table[] = {
// It can be defined to nothing if there are no constants.
MICROPY_PY_MACHINE_UART_CLASS_CONSTANTS
};
-STATIC MP_DEFINE_CONST_DICT(machine_uart_locals_dict, machine_uart_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_uart_locals_dict, machine_uart_locals_dict_table);
-STATIC const mp_stream_p_t uart_stream_p = {
+static const mp_stream_p_t uart_stream_p = {
.read = mp_machine_uart_read,
.write = mp_machine_uart_write,
.ioctl = mp_machine_uart_ioctl,
diff --git a/extmod/machine_wdt.c b/extmod/machine_wdt.c
index a49484ed80..fcef1bda25 100644
--- a/extmod/machine_wdt.c
+++ b/extmod/machine_wdt.c
@@ -31,16 +31,16 @@
#include "extmod/modmachine.h"
// The port must provide implementations of these low-level WDT functions.
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms);
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self);
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms);
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self);
#if MICROPY_PY_MACHINE_WDT_TIMEOUT_MS
-STATIC void mp_machine_wdt_timeout_ms_set(machine_wdt_obj_t *self_in, mp_int_t timeout_ms);
+static void mp_machine_wdt_timeout_ms_set(machine_wdt_obj_t *self_in, mp_int_t timeout_ms);
#endif
// The port provides implementations of the above in this file.
#include MICROPY_PY_MACHINE_WDT_INCLUDEFILE
-STATIC mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_id, ARG_timeout };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
@@ -58,31 +58,31 @@ STATIC mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type, size_t n_args, s
}
// WDT.feed()
-STATIC mp_obj_t machine_wdt_feed(mp_obj_t self_in) {
+static mp_obj_t machine_wdt_feed(mp_obj_t self_in) {
machine_wdt_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_machine_wdt_feed(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_wdt_feed_obj, machine_wdt_feed);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_wdt_feed_obj, machine_wdt_feed);
#if MICROPY_PY_MACHINE_WDT_TIMEOUT_MS
// WDT.timeout_ms(timeout)
-STATIC mp_obj_t machine_wdt_timeout_ms(mp_obj_t self_in, mp_obj_t timeout_in) {
+static mp_obj_t machine_wdt_timeout_ms(mp_obj_t self_in, mp_obj_t timeout_in) {
machine_wdt_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t timeout_ms = mp_obj_get_int(timeout_in);
mp_machine_wdt_timeout_ms_set(self, timeout_ms);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_wdt_timeout_ms_obj, machine_wdt_timeout_ms);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_wdt_timeout_ms_obj, machine_wdt_timeout_ms);
#endif
-STATIC const mp_rom_map_elem_t machine_wdt_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_wdt_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_feed), MP_ROM_PTR(&machine_wdt_feed_obj) },
#if MICROPY_PY_MACHINE_WDT_TIMEOUT_MS
{ MP_ROM_QSTR(MP_QSTR_timeout_ms), MP_ROM_PTR(&machine_wdt_timeout_ms_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_wdt_type,
diff --git a/extmod/modasyncio.c b/extmod/modasyncio.c
index a6a54eba87..61dd707223 100644
--- a/extmod/modasyncio.c
+++ b/extmod/modasyncio.c
@@ -55,19 +55,19 @@ typedef struct _mp_obj_task_queue_t {
mp_obj_task_t *heap;
} mp_obj_task_queue_t;
-STATIC const mp_obj_type_t task_queue_type;
-STATIC const mp_obj_type_t task_type;
+static const mp_obj_type_t task_queue_type;
+static const mp_obj_type_t task_type;
-STATIC mp_obj_t task_queue_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
+static mp_obj_t task_queue_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
/******************************************************************************/
// Ticks for task ordering in pairing heap
-STATIC mp_obj_t ticks(void) {
+static mp_obj_t ticks(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms() & (MICROPY_PY_TIME_TICKS_PERIOD - 1));
}
-STATIC mp_int_t ticks_diff(mp_obj_t t1_in, mp_obj_t t0_in) {
+static mp_int_t ticks_diff(mp_obj_t t1_in, mp_obj_t t0_in) {
mp_uint_t t0 = MP_OBJ_SMALL_INT_VALUE(t0_in);
mp_uint_t t1 = MP_OBJ_SMALL_INT_VALUE(t1_in);
mp_int_t diff = ((t1 - t0 + MICROPY_PY_TIME_TICKS_PERIOD / 2) & (MICROPY_PY_TIME_TICKS_PERIOD - 1))
@@ -75,7 +75,7 @@ STATIC mp_int_t ticks_diff(mp_obj_t t1_in, mp_obj_t t0_in) {
return diff;
}
-STATIC int task_lt(mp_pairheap_t *n1, mp_pairheap_t *n2) {
+static int task_lt(mp_pairheap_t *n1, mp_pairheap_t *n2) {
mp_obj_task_t *t1 = (mp_obj_task_t *)n1;
mp_obj_task_t *t2 = (mp_obj_task_t *)n2;
return MP_OBJ_SMALL_INT_VALUE(ticks_diff(t1->ph_key, t2->ph_key)) < 0;
@@ -84,7 +84,7 @@ STATIC int task_lt(mp_pairheap_t *n1, mp_pairheap_t *n2) {
/******************************************************************************/
// TaskQueue class
-STATIC mp_obj_t task_queue_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t task_queue_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)args;
mp_arg_check_num(n_args, n_kw, 0, 0, false);
mp_obj_task_queue_t *self = mp_obj_malloc(mp_obj_task_queue_t, type);
@@ -92,7 +92,7 @@ STATIC mp_obj_t task_queue_make_new(const mp_obj_type_t *type, size_t n_args, si
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t task_queue_peek(mp_obj_t self_in) {
+static mp_obj_t task_queue_peek(mp_obj_t self_in) {
mp_obj_task_queue_t *self = MP_OBJ_TO_PTR(self_in);
if (self->heap == NULL) {
return mp_const_none;
@@ -100,9 +100,9 @@ STATIC mp_obj_t task_queue_peek(mp_obj_t self_in) {
return MP_OBJ_FROM_PTR(self->heap);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(task_queue_peek_obj, task_queue_peek);
+static MP_DEFINE_CONST_FUN_OBJ_1(task_queue_peek_obj, task_queue_peek);
-STATIC mp_obj_t task_queue_push(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t task_queue_push(size_t n_args, const mp_obj_t *args) {
mp_obj_task_queue_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_task_t *task = MP_OBJ_TO_PTR(args[1]);
task->data = mp_const_none;
@@ -115,9 +115,9 @@ STATIC mp_obj_t task_queue_push(size_t n_args, const mp_obj_t *args) {
self->heap = (mp_obj_task_t *)mp_pairheap_push(task_lt, TASK_PAIRHEAP(self->heap), TASK_PAIRHEAP(task));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(task_queue_push_obj, 2, 3, task_queue_push);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(task_queue_push_obj, 2, 3, task_queue_push);
-STATIC mp_obj_t task_queue_pop(mp_obj_t self_in) {
+static mp_obj_t task_queue_pop(mp_obj_t self_in) {
mp_obj_task_queue_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_task_t *head = (mp_obj_task_t *)mp_pairheap_peek(task_lt, &self->heap->pairheap);
if (head == NULL) {
@@ -126,25 +126,25 @@ STATIC mp_obj_t task_queue_pop(mp_obj_t self_in) {
self->heap = (mp_obj_task_t *)mp_pairheap_pop(task_lt, &self->heap->pairheap);
return MP_OBJ_FROM_PTR(head);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(task_queue_pop_obj, task_queue_pop);
+static MP_DEFINE_CONST_FUN_OBJ_1(task_queue_pop_obj, task_queue_pop);
-STATIC mp_obj_t task_queue_remove(mp_obj_t self_in, mp_obj_t task_in) {
+static mp_obj_t task_queue_remove(mp_obj_t self_in, mp_obj_t task_in) {
mp_obj_task_queue_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_task_t *task = MP_OBJ_TO_PTR(task_in);
self->heap = (mp_obj_task_t *)mp_pairheap_delete(task_lt, &self->heap->pairheap, &task->pairheap);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(task_queue_remove_obj, task_queue_remove);
+static MP_DEFINE_CONST_FUN_OBJ_2(task_queue_remove_obj, task_queue_remove);
-STATIC const mp_rom_map_elem_t task_queue_locals_dict_table[] = {
+static const mp_rom_map_elem_t task_queue_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_peek), MP_ROM_PTR(&task_queue_peek_obj) },
{ MP_ROM_QSTR(MP_QSTR_push), MP_ROM_PTR(&task_queue_push_obj) },
{ MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&task_queue_pop_obj) },
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&task_queue_remove_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(task_queue_locals_dict, task_queue_locals_dict_table);
+static MP_DEFINE_CONST_DICT(task_queue_locals_dict, task_queue_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
task_queue_type,
MP_QSTR_TaskQueue,
MP_TYPE_FLAG_NONE,
@@ -156,9 +156,9 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
// Task class
// This is the core asyncio context with cur_task, _task_queue and CancelledError.
-STATIC mp_obj_t asyncio_context = MP_OBJ_NULL;
+static mp_obj_t asyncio_context = MP_OBJ_NULL;
-STATIC mp_obj_t task_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t task_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 2, false);
mp_obj_task_t *self = m_new_obj(mp_obj_task_t);
self->pairheap.base.type = type;
@@ -173,13 +173,13 @@ STATIC mp_obj_t task_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t task_done(mp_obj_t self_in) {
+static mp_obj_t task_done(mp_obj_t self_in) {
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(TASK_IS_DONE(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(task_done_obj, task_done);
+static MP_DEFINE_CONST_FUN_OBJ_1(task_done_obj, task_done);
-STATIC mp_obj_t task_cancel(mp_obj_t self_in) {
+static mp_obj_t task_cancel(mp_obj_t self_in) {
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
// Check if task is already finished.
if (TASK_IS_DONE(self)) {
@@ -222,9 +222,9 @@ STATIC mp_obj_t task_cancel(mp_obj_t self_in) {
return mp_const_true;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(task_cancel_obj, task_cancel);
+static MP_DEFINE_CONST_FUN_OBJ_1(task_cancel_obj, task_cancel);
-STATIC void task_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void task_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
if (dest[0] == MP_OBJ_NULL) {
// Load
@@ -255,7 +255,7 @@ STATIC void task_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
}
-STATIC mp_obj_t task_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t task_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
(void)iter_buf;
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
if (TASK_IS_DONE(self)) {
@@ -271,7 +271,7 @@ STATIC mp_obj_t task_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
return self_in;
}
-STATIC mp_obj_t task_iternext(mp_obj_t self_in) {
+static mp_obj_t task_iternext(mp_obj_t self_in) {
mp_obj_task_t *self = MP_OBJ_TO_PTR(self_in);
if (TASK_IS_DONE(self)) {
// Task finished, raise return value to caller so it can continue.
@@ -287,12 +287,12 @@ STATIC mp_obj_t task_iternext(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC const mp_getiter_iternext_custom_t task_getiter_iternext = {
+static const mp_getiter_iternext_custom_t task_getiter_iternext = {
.getiter = task_getiter,
.iternext = task_iternext,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
task_type,
MP_QSTR_Task,
MP_TYPE_FLAG_ITER_IS_CUSTOM,
@@ -304,12 +304,12 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
// C-level asyncio module
-STATIC const mp_rom_map_elem_t mp_module_asyncio_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_asyncio_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__asyncio) },
{ MP_ROM_QSTR(MP_QSTR_TaskQueue), MP_ROM_PTR(&task_queue_type) },
{ MP_ROM_QSTR(MP_QSTR_Task), MP_ROM_PTR(&task_type) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_asyncio_globals, mp_module_asyncio_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_asyncio_globals, mp_module_asyncio_globals_table);
const mp_obj_module_t mp_module_asyncio = {
.base = { &mp_type_module },
diff --git a/extmod/modbinascii.c b/extmod/modbinascii.c
index ed39960180..786226ebc0 100644
--- a/extmod/modbinascii.c
+++ b/extmod/modbinascii.c
@@ -35,15 +35,15 @@
#if MICROPY_PY_BINASCII
#if MICROPY_PY_BUILTINS_BYTES_HEX
-STATIC mp_obj_t bytes_hex_as_bytes(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bytes_hex_as_bytes(size_t n_args, const mp_obj_t *args) {
return mp_obj_bytes_hex(n_args, args, &mp_type_bytes);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_hex_as_bytes_obj, 1, 2, bytes_hex_as_bytes);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_hex_as_bytes_obj, 1, 2, bytes_hex_as_bytes);
-STATIC mp_obj_t bytes_fromhex_bytes(mp_obj_t data) {
+static mp_obj_t bytes_fromhex_bytes(mp_obj_t data) {
return mp_obj_bytes_fromhex(MP_OBJ_FROM_PTR(&mp_type_bytes), data);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(bytes_fromhex_obj, bytes_fromhex_bytes);
+static MP_DEFINE_CONST_FUN_OBJ_1(bytes_fromhex_obj, bytes_fromhex_bytes);
#endif
// If ch is a character in the base64 alphabet, and is not a pad character, then
@@ -65,7 +65,7 @@ static int mod_binascii_sextet(byte ch) {
}
}
-STATIC mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) {
+static mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
byte *in = bufinfo.buf;
@@ -106,9 +106,9 @@ STATIC mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) {
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_a2b_base64_obj, mod_binascii_a2b_base64);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_a2b_base64_obj, mod_binascii_a2b_base64);
-STATIC mp_obj_t mod_binascii_b2a_base64(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mod_binascii_b2a_base64(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_newline };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_newline, MP_ARG_BOOL, {.u_bool = true} },
@@ -168,22 +168,22 @@ STATIC mp_obj_t mod_binascii_b2a_base64(size_t n_args, const mp_obj_t *pos_args,
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_binascii_b2a_base64_obj, 1, mod_binascii_b2a_base64);
+static MP_DEFINE_CONST_FUN_OBJ_KW(mod_binascii_b2a_base64_obj, 1, mod_binascii_b2a_base64);
#if MICROPY_PY_BINASCII_CRC32 && MICROPY_PY_DEFLATE
#include "lib/uzlib/uzlib.h"
-STATIC mp_obj_t mod_binascii_crc32(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_binascii_crc32(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);
uint32_t crc = (n_args > 1) ? mp_obj_get_int_truncated(args[1]) : 0;
crc = uzlib_crc32(bufinfo.buf, bufinfo.len, crc ^ 0xffffffff);
return mp_obj_new_int_from_uint(crc ^ 0xffffffff);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_binascii_crc32_obj, 1, 2, mod_binascii_crc32);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_binascii_crc32_obj, 1, 2, mod_binascii_crc32);
#endif
-STATIC const mp_rom_map_elem_t mp_module_binascii_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_binascii_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_binascii) },
#if MICROPY_PY_BUILTINS_BYTES_HEX
{ MP_ROM_QSTR(MP_QSTR_hexlify), MP_ROM_PTR(&bytes_hex_as_bytes_obj) },
@@ -196,7 +196,7 @@ STATIC const mp_rom_map_elem_t mp_module_binascii_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_binascii_globals, mp_module_binascii_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_binascii_globals, mp_module_binascii_globals_table);
const mp_obj_module_t mp_module_binascii = {
.base = { &mp_type_module },
diff --git a/extmod/modbluetooth.c b/extmod/modbluetooth.c
index 91e4e62213..7049c35dfd 100644
--- a/extmod/modbluetooth.c
+++ b/extmod/modbluetooth.c
@@ -81,10 +81,10 @@ typedef struct {
#endif
} mp_obj_bluetooth_ble_t;
-STATIC const mp_obj_type_t mp_type_bluetooth_ble;
+static const mp_obj_type_t mp_type_bluetooth_ble;
// TODO: this seems like it could be generic?
-STATIC mp_obj_t bluetooth_handle_errno(int err) {
+static mp_obj_t bluetooth_handle_errno(int err) {
if (err != 0) {
mp_raise_OSError(err);
}
@@ -95,7 +95,7 @@ STATIC mp_obj_t bluetooth_handle_errno(int err) {
// UUID object
// ----------------------------------------------------------------------------
-STATIC mp_obj_t bluetooth_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t bluetooth_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
(void)type;
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -151,7 +151,7 @@ STATIC mp_obj_t bluetooth_uuid_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t bluetooth_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t bluetooth_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_bluetooth_uuid_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_HASH: {
@@ -163,7 +163,7 @@ STATIC mp_obj_t bluetooth_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_obj_t bluetooth_uuid_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t bluetooth_uuid_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
if (!mp_obj_is_type(rhs_in, &mp_type_bluetooth_uuid)) {
return MP_OBJ_NULL;
}
@@ -187,7 +187,7 @@ STATIC mp_obj_t bluetooth_uuid_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_
}
}
-STATIC void bluetooth_uuid_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void bluetooth_uuid_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_bluetooth_uuid_t *self = MP_OBJ_TO_PTR(self_in);
@@ -204,7 +204,7 @@ STATIC void bluetooth_uuid_print(const mp_print_t *print, mp_obj_t self_in, mp_p
mp_printf(print, ")");
}
-STATIC mp_int_t bluetooth_uuid_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+static mp_int_t bluetooth_uuid_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
mp_obj_bluetooth_uuid_t *self = MP_OBJ_TO_PTR(self_in);
if (flags != MP_BUFFER_READ) {
@@ -220,7 +220,7 @@ STATIC mp_int_t bluetooth_uuid_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bu
#if !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
#if MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
-STATIC void ringbuf_put_uuid(ringbuf_t *ringbuf, mp_obj_bluetooth_uuid_t *uuid) {
+static void ringbuf_put_uuid(ringbuf_t *ringbuf, mp_obj_bluetooth_uuid_t *uuid) {
assert(ringbuf_free(ringbuf) >= (size_t)uuid->type + 1);
ringbuf_put(ringbuf, uuid->type);
for (int i = 0; i < uuid->type; ++i) {
@@ -230,7 +230,7 @@ STATIC void ringbuf_put_uuid(ringbuf_t *ringbuf, mp_obj_bluetooth_uuid_t *uuid)
#endif
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC void ringbuf_get_uuid(ringbuf_t *ringbuf, mp_obj_bluetooth_uuid_t *uuid) {
+static void ringbuf_get_uuid(ringbuf_t *ringbuf, mp_obj_bluetooth_uuid_t *uuid) {
assert(ringbuf_avail(ringbuf) >= 1);
uuid->type = ringbuf_get(ringbuf);
assert(ringbuf_avail(ringbuf) >= uuid->type);
@@ -257,7 +257,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
// Bluetooth object: General
// ----------------------------------------------------------------------------
-STATIC mp_obj_t bluetooth_ble_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t bluetooth_ble_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
(void)type;
(void)n_args;
(void)n_kw;
@@ -287,7 +287,7 @@ STATIC mp_obj_t bluetooth_ble_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_STATE_VM(bluetooth);
}
-STATIC mp_obj_t bluetooth_ble_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_active(size_t n_args, const mp_obj_t *args) {
if (n_args == 2) {
// Boolean enable/disable argument supplied, set current state.
if (mp_obj_is_true(args[1])) {
@@ -300,9 +300,9 @@ STATIC mp_obj_t bluetooth_ble_active(size_t n_args, const mp_obj_t *args) {
// Return current state.
return mp_obj_new_bool(mp_bluetooth_is_active());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_active_obj, 1, 2, bluetooth_ble_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_active_obj, 1, 2, bluetooth_ble_active);
-STATIC mp_obj_t bluetooth_ble_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t bluetooth_ble_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
if (kwargs->used == 0) {
// Get config value
if (n_args != 2) {
@@ -426,9 +426,9 @@ STATIC mp_obj_t bluetooth_ble_config(size_t n_args, const mp_obj_t *args, mp_map
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bluetooth_ble_config_obj, 1, bluetooth_ble_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(bluetooth_ble_config_obj, 1, bluetooth_ble_config);
-STATIC mp_obj_t bluetooth_ble_irq(mp_obj_t self_in, mp_obj_t handler_in) {
+static mp_obj_t bluetooth_ble_irq(mp_obj_t self_in, mp_obj_t handler_in) {
(void)self_in;
if (handler_in != mp_const_none && !mp_obj_is_callable(handler_in)) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid handler"));
@@ -442,13 +442,13 @@ STATIC mp_obj_t bluetooth_ble_irq(mp_obj_t self_in, mp_obj_t handler_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_irq_obj, bluetooth_ble_irq);
+static MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_irq_obj, bluetooth_ble_irq);
// ----------------------------------------------------------------------------
// Bluetooth object: GAP
// ----------------------------------------------------------------------------
-STATIC mp_obj_t bluetooth_ble_gap_advertise(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t bluetooth_ble_gap_advertise(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_interval_us, ARG_adv_data, ARG_resp_data, ARG_connectable };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_interval_us, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(500000)} },
@@ -479,9 +479,9 @@ STATIC mp_obj_t bluetooth_ble_gap_advertise(size_t n_args, const mp_obj_t *pos_a
return bluetooth_handle_errno(mp_bluetooth_gap_advertise_start(connectable, interval_us, adv_bufinfo.buf, adv_bufinfo.len, resp_bufinfo.buf, resp_bufinfo.len));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bluetooth_ble_gap_advertise_obj, 1, bluetooth_ble_gap_advertise);
+static MP_DEFINE_CONST_FUN_OBJ_KW(bluetooth_ble_gap_advertise_obj, 1, bluetooth_ble_gap_advertise);
-STATIC int bluetooth_gatts_register_service(mp_obj_t uuid_in, mp_obj_t characteristics_in, uint16_t **handles, size_t *num_handles) {
+static int bluetooth_gatts_register_service(mp_obj_t uuid_in, mp_obj_t characteristics_in, uint16_t **handles, size_t *num_handles) {
if (!mp_obj_is_type(uuid_in, &mp_type_bluetooth_uuid)) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid service UUID"));
}
@@ -577,7 +577,7 @@ STATIC int bluetooth_gatts_register_service(mp_obj_t uuid_in, mp_obj_t character
return mp_bluetooth_gatts_register_service(service_uuid, characteristic_uuids, characteristic_flags, descriptor_uuids, descriptor_flags, num_descriptors, *handles, len);
}
-STATIC mp_obj_t bluetooth_ble_gatts_register_services(mp_obj_t self_in, mp_obj_t services_in) {
+static mp_obj_t bluetooth_ble_gatts_register_services(mp_obj_t self_in, mp_obj_t services_in) {
(void)self_in;
mp_obj_t len_in = mp_obj_len(services_in);
size_t len = mp_obj_get_int(len_in);
@@ -632,10 +632,10 @@ STATIC mp_obj_t bluetooth_ble_gatts_register_services(mp_obj_t self_in, mp_obj_t
return MP_OBJ_FROM_PTR(result);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gatts_register_services_obj, bluetooth_ble_gatts_register_services);
+static MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gatts_register_services_obj, bluetooth_ble_gatts_register_services);
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC mp_obj_t bluetooth_ble_gap_connect(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gap_connect(size_t n_args, const mp_obj_t *args) {
if (n_args == 2) {
if (args[1] == mp_const_none) {
int err = mp_bluetooth_gap_peripheral_connect_cancel();
@@ -665,9 +665,9 @@ STATIC mp_obj_t bluetooth_ble_gap_connect(size_t n_args, const mp_obj_t *args) {
int err = mp_bluetooth_gap_peripheral_connect(addr_type, bufinfo.buf, scan_duration_ms, min_conn_interval_us, max_conn_interval_us);
return bluetooth_handle_errno(err);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_connect_obj, 2, 6, bluetooth_ble_gap_connect);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_connect_obj, 2, 6, bluetooth_ble_gap_connect);
-STATIC mp_obj_t bluetooth_ble_gap_scan(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gap_scan(size_t n_args, const mp_obj_t *args) {
// Default is indefinite scan, with the NimBLE "background scan" interval and window.
mp_int_t duration_ms = 0;
mp_int_t interval_us = 1280000;
@@ -691,10 +691,10 @@ STATIC mp_obj_t bluetooth_ble_gap_scan(size_t n_args, const mp_obj_t *args) {
}
return bluetooth_handle_errno(mp_bluetooth_gap_scan_start(duration_ms, interval_us, window_us, active_scan));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_scan_obj, 1, 5, bluetooth_ble_gap_scan);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_scan_obj, 1, 5, bluetooth_ble_gap_scan);
#endif // MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC mp_obj_t bluetooth_ble_gap_disconnect(mp_obj_t self_in, mp_obj_t conn_handle_in) {
+static mp_obj_t bluetooth_ble_gap_disconnect(mp_obj_t self_in, mp_obj_t conn_handle_in) {
(void)self_in;
uint16_t conn_handle = mp_obj_get_int(conn_handle_in);
int err = mp_bluetooth_gap_disconnect(conn_handle);
@@ -706,39 +706,39 @@ STATIC mp_obj_t bluetooth_ble_gap_disconnect(mp_obj_t self_in, mp_obj_t conn_han
return bluetooth_handle_errno(err);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gap_disconnect_obj, bluetooth_ble_gap_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gap_disconnect_obj, bluetooth_ble_gap_disconnect);
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
-STATIC mp_obj_t bluetooth_ble_gap_pair(mp_obj_t self_in, mp_obj_t conn_handle_in) {
+static mp_obj_t bluetooth_ble_gap_pair(mp_obj_t self_in, mp_obj_t conn_handle_in) {
(void)self_in;
uint16_t conn_handle = mp_obj_get_int(conn_handle_in);
return bluetooth_handle_errno(mp_bluetooth_gap_pair(conn_handle));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gap_pair_obj, bluetooth_ble_gap_pair);
+static MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gap_pair_obj, bluetooth_ble_gap_pair);
-STATIC mp_obj_t bluetooth_ble_gap_passkey(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gap_passkey(size_t n_args, const mp_obj_t *args) {
uint16_t conn_handle = mp_obj_get_int(args[1]);
uint8_t action = mp_obj_get_int(args[2]);
mp_int_t passkey = mp_obj_get_int(args[3]);
return bluetooth_handle_errno(mp_bluetooth_gap_passkey(conn_handle, action, passkey));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_passkey_obj, 4, 4, bluetooth_ble_gap_passkey);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gap_passkey_obj, 4, 4, bluetooth_ble_gap_passkey);
#endif // MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
// ----------------------------------------------------------------------------
// Bluetooth object: GATTS (Peripheral/Advertiser role)
// ----------------------------------------------------------------------------
-STATIC mp_obj_t bluetooth_ble_gatts_read(mp_obj_t self_in, mp_obj_t value_handle_in) {
+static mp_obj_t bluetooth_ble_gatts_read(mp_obj_t self_in, mp_obj_t value_handle_in) {
(void)self_in;
size_t len = 0;
const uint8_t *buf;
mp_bluetooth_gatts_read(mp_obj_get_int(value_handle_in), &buf, &len);
return mp_obj_new_bytes(buf, len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gatts_read_obj, bluetooth_ble_gatts_read);
+static MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gatts_read_obj, bluetooth_ble_gatts_read);
-STATIC mp_obj_t bluetooth_ble_gatts_write(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gatts_write(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo = {0};
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ);
bool send_update = false;
@@ -748,9 +748,9 @@ STATIC mp_obj_t bluetooth_ble_gatts_write(size_t n_args, const mp_obj_t *args) {
bluetooth_handle_errno(mp_bluetooth_gatts_write(mp_obj_get_int(args[1]), bufinfo.buf, bufinfo.len, send_update));
return MP_OBJ_NEW_SMALL_INT(bufinfo.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_write_obj, 3, 4, bluetooth_ble_gatts_write);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_write_obj, 3, 4, bluetooth_ble_gatts_write);
-STATIC mp_obj_t bluetooth_ble_gatts_notify_indicate(size_t n_args, const mp_obj_t *args, int gatts_op) {
+static mp_obj_t bluetooth_ble_gatts_notify_indicate(size_t n_args, const mp_obj_t *args, int gatts_op) {
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_int_t value_handle = mp_obj_get_int(args[2]);
@@ -765,23 +765,23 @@ STATIC mp_obj_t bluetooth_ble_gatts_notify_indicate(size_t n_args, const mp_obj_
return bluetooth_handle_errno(mp_bluetooth_gatts_notify_indicate(conn_handle, value_handle, gatts_op, value, value_len));
}
-STATIC mp_obj_t bluetooth_ble_gatts_notify(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gatts_notify(size_t n_args, const mp_obj_t *args) {
return bluetooth_ble_gatts_notify_indicate(n_args, args, MP_BLUETOOTH_GATTS_OP_NOTIFY);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_notify_obj, 3, 4, bluetooth_ble_gatts_notify);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_notify_obj, 3, 4, bluetooth_ble_gatts_notify);
-STATIC mp_obj_t bluetooth_ble_gatts_indicate(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gatts_indicate(size_t n_args, const mp_obj_t *args) {
return bluetooth_ble_gatts_notify_indicate(n_args, args, MP_BLUETOOTH_GATTS_OP_INDICATE);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_indicate_obj, 3, 4, bluetooth_ble_gatts_indicate);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_indicate_obj, 3, 4, bluetooth_ble_gatts_indicate);
-STATIC mp_obj_t bluetooth_ble_gatts_set_buffer(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gatts_set_buffer(size_t n_args, const mp_obj_t *args) {
mp_int_t value_handle = mp_obj_get_int(args[1]);
mp_int_t len = mp_obj_get_int(args[2]);
bool append = n_args >= 4 && mp_obj_is_true(args[3]);
return bluetooth_handle_errno(mp_bluetooth_gatts_set_buffer(value_handle, len, append));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_set_buffer_obj, 3, 4, bluetooth_ble_gatts_set_buffer);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_set_buffer_obj, 3, 4, bluetooth_ble_gatts_set_buffer);
// ----------------------------------------------------------------------------
// Bluetooth object: GATTC (Central/Scanner role)
@@ -789,7 +789,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gatts_set_buffer_obj, 3
#if MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
-STATIC mp_obj_t bluetooth_ble_gattc_discover_services(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gattc_discover_services(size_t n_args, const mp_obj_t *args) {
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_obj_bluetooth_uuid_t *uuid = NULL;
if (n_args == 3 && args[2] != mp_const_none) {
@@ -800,9 +800,9 @@ STATIC mp_obj_t bluetooth_ble_gattc_discover_services(size_t n_args, const mp_ob
}
return bluetooth_handle_errno(mp_bluetooth_gattc_discover_primary_services(conn_handle, uuid));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_discover_services_obj, 2, 3, bluetooth_ble_gattc_discover_services);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_discover_services_obj, 2, 3, bluetooth_ble_gattc_discover_services);
-STATIC mp_obj_t bluetooth_ble_gattc_discover_characteristics(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gattc_discover_characteristics(size_t n_args, const mp_obj_t *args) {
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_int_t start_handle = mp_obj_get_int(args[2]);
mp_int_t end_handle = mp_obj_get_int(args[3]);
@@ -815,26 +815,26 @@ STATIC mp_obj_t bluetooth_ble_gattc_discover_characteristics(size_t n_args, cons
}
return bluetooth_handle_errno(mp_bluetooth_gattc_discover_characteristics(conn_handle, start_handle, end_handle, uuid));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_discover_characteristics_obj, 4, 5, bluetooth_ble_gattc_discover_characteristics);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_discover_characteristics_obj, 4, 5, bluetooth_ble_gattc_discover_characteristics);
-STATIC mp_obj_t bluetooth_ble_gattc_discover_descriptors(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gattc_discover_descriptors(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_int_t start_handle = mp_obj_get_int(args[2]);
mp_int_t end_handle = mp_obj_get_int(args[3]);
return bluetooth_handle_errno(mp_bluetooth_gattc_discover_descriptors(conn_handle, start_handle, end_handle));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_discover_descriptors_obj, 4, 4, bluetooth_ble_gattc_discover_descriptors);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_discover_descriptors_obj, 4, 4, bluetooth_ble_gattc_discover_descriptors);
-STATIC mp_obj_t bluetooth_ble_gattc_read(mp_obj_t self_in, mp_obj_t conn_handle_in, mp_obj_t value_handle_in) {
+static mp_obj_t bluetooth_ble_gattc_read(mp_obj_t self_in, mp_obj_t conn_handle_in, mp_obj_t value_handle_in) {
(void)self_in;
mp_int_t conn_handle = mp_obj_get_int(conn_handle_in);
mp_int_t value_handle = mp_obj_get_int(value_handle_in);
return bluetooth_handle_errno(mp_bluetooth_gattc_read(conn_handle, value_handle));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(bluetooth_ble_gattc_read_obj, bluetooth_ble_gattc_read);
+static MP_DEFINE_CONST_FUN_OBJ_3(bluetooth_ble_gattc_read_obj, bluetooth_ble_gattc_read);
-STATIC mp_obj_t bluetooth_ble_gattc_write(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_gattc_write(size_t n_args, const mp_obj_t *args) {
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_int_t value_handle = mp_obj_get_int(args[2]);
mp_obj_t data = args[3];
@@ -846,44 +846,44 @@ STATIC mp_obj_t bluetooth_ble_gattc_write(size_t n_args, const mp_obj_t *args) {
}
return bluetooth_handle_errno(mp_bluetooth_gattc_write(conn_handle, value_handle, bufinfo.buf, bufinfo.len, mode));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_write_obj, 4, 5, bluetooth_ble_gattc_write);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_gattc_write_obj, 4, 5, bluetooth_ble_gattc_write);
-STATIC mp_obj_t bluetooth_ble_gattc_exchange_mtu(mp_obj_t self_in, mp_obj_t conn_handle_in) {
+static mp_obj_t bluetooth_ble_gattc_exchange_mtu(mp_obj_t self_in, mp_obj_t conn_handle_in) {
(void)self_in;
uint16_t conn_handle = mp_obj_get_int(conn_handle_in);
return bluetooth_handle_errno(mp_bluetooth_gattc_exchange_mtu(conn_handle));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gattc_exchange_mtu_obj, bluetooth_ble_gattc_exchange_mtu);
+static MP_DEFINE_CONST_FUN_OBJ_2(bluetooth_ble_gattc_exchange_mtu_obj, bluetooth_ble_gattc_exchange_mtu);
#endif // MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
#if MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
-STATIC mp_obj_t bluetooth_ble_l2cap_listen(mp_obj_t self_in, mp_obj_t psm_in, mp_obj_t mtu_in) {
+static mp_obj_t bluetooth_ble_l2cap_listen(mp_obj_t self_in, mp_obj_t psm_in, mp_obj_t mtu_in) {
(void)self_in;
mp_int_t psm = mp_obj_get_int(psm_in);
mp_int_t mtu = MAX(32, MIN(UINT16_MAX, mp_obj_get_int(mtu_in)));
return bluetooth_handle_errno(mp_bluetooth_l2cap_listen(psm, mtu));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(bluetooth_ble_l2cap_listen_obj, bluetooth_ble_l2cap_listen);
+static MP_DEFINE_CONST_FUN_OBJ_3(bluetooth_ble_l2cap_listen_obj, bluetooth_ble_l2cap_listen);
-STATIC mp_obj_t bluetooth_ble_l2cap_connect(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_l2cap_connect(size_t n_args, const mp_obj_t *args) {
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_int_t psm = mp_obj_get_int(args[2]);
mp_int_t mtu = MAX(32, MIN(UINT16_MAX, mp_obj_get_int(args[3])));
return bluetooth_handle_errno(mp_bluetooth_l2cap_connect(conn_handle, psm, mtu));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_l2cap_connect_obj, 4, 4, bluetooth_ble_l2cap_connect);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_l2cap_connect_obj, 4, 4, bluetooth_ble_l2cap_connect);
-STATIC mp_obj_t bluetooth_ble_l2cap_disconnect(mp_obj_t self_in, mp_obj_t conn_handle_in, mp_obj_t cid_in) {
+static mp_obj_t bluetooth_ble_l2cap_disconnect(mp_obj_t self_in, mp_obj_t conn_handle_in, mp_obj_t cid_in) {
(void)self_in;
mp_int_t conn_handle = mp_obj_get_int(conn_handle_in);
mp_int_t cid = mp_obj_get_int(cid_in);
return bluetooth_handle_errno(mp_bluetooth_l2cap_disconnect(conn_handle, cid));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(bluetooth_ble_l2cap_disconnect_obj, bluetooth_ble_l2cap_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_3(bluetooth_ble_l2cap_disconnect_obj, bluetooth_ble_l2cap_disconnect);
-STATIC mp_obj_t bluetooth_ble_l2cap_send(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_l2cap_send(size_t n_args, const mp_obj_t *args) {
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_int_t cid = mp_obj_get_int(args[2]);
mp_buffer_info_t bufinfo;
@@ -893,9 +893,9 @@ STATIC mp_obj_t bluetooth_ble_l2cap_send(size_t n_args, const mp_obj_t *args) {
// Return True if the channel is still ready to send.
return mp_obj_new_bool(!stalled);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_l2cap_send_obj, 4, 4, bluetooth_ble_l2cap_send);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_l2cap_send_obj, 4, 4, bluetooth_ble_l2cap_send);
-STATIC mp_obj_t bluetooth_ble_l2cap_recvinto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_l2cap_recvinto(size_t n_args, const mp_obj_t *args) {
mp_int_t conn_handle = mp_obj_get_int(args[1]);
mp_int_t cid = mp_obj_get_int(args[2]);
mp_buffer_info_t bufinfo = {0};
@@ -905,13 +905,13 @@ STATIC mp_obj_t bluetooth_ble_l2cap_recvinto(size_t n_args, const mp_obj_t *args
bluetooth_handle_errno(mp_bluetooth_l2cap_recvinto(conn_handle, cid, bufinfo.buf, &bufinfo.len));
return MP_OBJ_NEW_SMALL_INT(bufinfo.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_l2cap_recvinto_obj, 4, 4, bluetooth_ble_l2cap_recvinto);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_l2cap_recvinto_obj, 4, 4, bluetooth_ble_l2cap_recvinto);
#endif // MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
#if MICROPY_PY_BLUETOOTH_ENABLE_HCI_CMD
-STATIC mp_obj_t bluetooth_ble_hci_cmd(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bluetooth_ble_hci_cmd(size_t n_args, const mp_obj_t *args) {
mp_int_t ogf = mp_obj_get_int(args[1]);
mp_int_t ocf = mp_obj_get_int(args[2]);
mp_buffer_info_t bufinfo_request = {0};
@@ -922,7 +922,7 @@ STATIC mp_obj_t bluetooth_ble_hci_cmd(size_t n_args, const mp_obj_t *args) {
bluetooth_handle_errno(mp_bluetooth_hci_cmd(ogf, ocf, bufinfo_request.buf, bufinfo_request.len, bufinfo_response.buf, bufinfo_response.len, &status));
return MP_OBJ_NEW_SMALL_INT(status);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_hci_cmd_obj, 5, 5, bluetooth_ble_hci_cmd);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_hci_cmd_obj, 5, 5, bluetooth_ble_hci_cmd);
#endif // MICROPY_PY_BLUETOOTH_ENABLE_HCI_CMD
@@ -930,7 +930,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bluetooth_ble_hci_cmd_obj, 5, 5, blue
// Bluetooth object: Definition
// ----------------------------------------------------------------------------
-STATIC const mp_rom_map_elem_t bluetooth_ble_locals_dict_table[] = {
+static const mp_rom_map_elem_t bluetooth_ble_locals_dict_table[] = {
// General
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&bluetooth_ble_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&bluetooth_ble_config_obj) },
@@ -973,9 +973,9 @@ STATIC const mp_rom_map_elem_t bluetooth_ble_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_hci_cmd), MP_ROM_PTR(&bluetooth_ble_hci_cmd_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(bluetooth_ble_locals_dict, bluetooth_ble_locals_dict_table);
+static MP_DEFINE_CONST_DICT(bluetooth_ble_locals_dict, bluetooth_ble_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bluetooth_ble,
MP_QSTR_BLE,
MP_TYPE_FLAG_NONE,
@@ -983,7 +983,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &bluetooth_ble_locals_dict
);
-STATIC const mp_rom_map_elem_t mp_module_bluetooth_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_bluetooth_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bluetooth) },
{ MP_ROM_QSTR(MP_QSTR_BLE), MP_ROM_PTR(&mp_type_bluetooth_ble) },
{ MP_ROM_QSTR(MP_QSTR_UUID), MP_ROM_PTR(&mp_type_bluetooth_uuid) },
@@ -996,7 +996,7 @@ STATIC const mp_rom_map_elem_t mp_module_bluetooth_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_FLAG_WRITE_NO_RESPONSE), MP_ROM_INT(MP_BLUETOOTH_CHARACTERISTIC_FLAG_WRITE_NO_RESPONSE) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_bluetooth_globals, mp_module_bluetooth_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_bluetooth_globals, mp_module_bluetooth_globals_table);
const mp_obj_module_t mp_module_bluetooth = {
.base = { &mp_type_module },
@@ -1012,7 +1012,7 @@ MP_REGISTER_EXTENSIBLE_MODULE(MP_QSTR_bluetooth, mp_module_bluetooth);
// Helpers
#if !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
-STATIC void ringbuf_extract(ringbuf_t *ringbuf, mp_obj_tuple_t *data_tuple, size_t n_u16, size_t n_u8, mp_obj_array_t *bytes_addr, size_t n_i8, mp_obj_bluetooth_uuid_t *uuid, mp_obj_array_t *bytes_data) {
+static void ringbuf_extract(ringbuf_t *ringbuf, mp_obj_tuple_t *data_tuple, size_t n_u16, size_t n_u8, mp_obj_array_t *bytes_addr, size_t n_i8, mp_obj_bluetooth_uuid_t *uuid, mp_obj_array_t *bytes_data) {
assert(ringbuf_avail(ringbuf) >= n_u16 * 2 + n_u8 + (bytes_addr ? 6 : 0) + n_i8 + (uuid ? 1 : 0) + (bytes_data ? 1 : 0));
size_t j = 0;
@@ -1053,7 +1053,7 @@ STATIC void ringbuf_extract(ringbuf_t *ringbuf, mp_obj_tuple_t *data_tuple, size
data_tuple->len = j;
}
-STATIC mp_obj_t bluetooth_ble_invoke_irq(mp_obj_t none_in) {
+static mp_obj_t bluetooth_ble_invoke_irq(mp_obj_t none_in) {
(void)none_in;
// This is always executing in schedule context.
@@ -1129,7 +1129,7 @@ STATIC mp_obj_t bluetooth_ble_invoke_irq(mp_obj_t none_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluetooth_ble_invoke_irq_obj, bluetooth_ble_invoke_irq);
+static MP_DEFINE_CONST_FUN_OBJ_1(bluetooth_ble_invoke_irq_obj, bluetooth_ble_invoke_irq);
#endif // !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
// ----------------------------------------------------------------------------
@@ -1138,7 +1138,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluetooth_ble_invoke_irq_obj, bluetooth_ble_inv
#if MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
-STATIC mp_obj_t invoke_irq_handler_run(uint16_t event,
+static mp_obj_t invoke_irq_handler_run(uint16_t event,
const mp_int_t *numeric, size_t n_unsigned, size_t n_signed,
const uint8_t *addr,
const mp_obj_bluetooth_uuid_t *uuid,
@@ -1220,7 +1220,7 @@ STATIC mp_obj_t invoke_irq_handler_run(uint16_t event,
return result;
}
-STATIC mp_obj_t invoke_irq_handler_run_protected(uint16_t event,
+static mp_obj_t invoke_irq_handler_run_protected(uint16_t event,
const mp_int_t *numeric, size_t n_unsigned, size_t n_signed,
const uint8_t *addr,
const mp_obj_bluetooth_uuid_t *uuid,
@@ -1258,7 +1258,7 @@ STATIC mp_obj_t invoke_irq_handler_run_protected(uint16_t event,
#error not supported
#endif
-STATIC mp_obj_t invoke_irq_handler(uint16_t event,
+static mp_obj_t invoke_irq_handler(uint16_t event,
const mp_int_t *numeric, size_t n_unsigned, size_t n_signed,
const uint8_t *addr,
const mp_obj_bluetooth_uuid_t *uuid,
@@ -1292,7 +1292,7 @@ STATIC mp_obj_t invoke_irq_handler(uint16_t event,
// BLE event callbacks are called directly from the MicroPython runtime, so additional
// synchronisation is not needed, and BLE event handlers can be called directly.
-STATIC mp_obj_t invoke_irq_handler(uint16_t event,
+static mp_obj_t invoke_irq_handler(uint16_t event,
const mp_int_t *numeric, size_t n_unsigned, size_t n_signed,
const uint8_t *addr,
const mp_obj_bluetooth_uuid_t *uuid,
@@ -1455,7 +1455,7 @@ void mp_bluetooth_gattc_on_read_write_status(uint8_t event, uint16_t conn_handle
// Callbacks are called in interrupt context (i.e. can't allocate), so we need to push the data
// into the ringbuf and schedule the callback via mp_sched_schedule.
-STATIC bool enqueue_irq(mp_obj_bluetooth_ble_t *o, size_t len, uint8_t event) {
+static bool enqueue_irq(mp_obj_bluetooth_ble_t *o, size_t len, uint8_t event) {
if (!o || o->irq_handler == mp_const_none) {
return false;
}
@@ -1489,7 +1489,7 @@ STATIC bool enqueue_irq(mp_obj_bluetooth_ble_t *o, size_t len, uint8_t event) {
}
// Must hold the atomic section before calling this (MICROPY_PY_BLUETOOTH_ENTER).
-STATIC void schedule_ringbuf(mp_uint_t atomic_state) {
+static void schedule_ringbuf(mp_uint_t atomic_state) {
mp_obj_bluetooth_ble_t *o = MP_OBJ_TO_PTR(MP_STATE_VM(bluetooth));
if (!o->irq_scheduled) {
o->irq_scheduled = true;
diff --git a/extmod/modbluetooth.h b/extmod/modbluetooth.h
index 630a270523..6a087c8e25 100644
--- a/extmod/modbluetooth.h
+++ b/extmod/modbluetooth.h
@@ -498,11 +498,11 @@ typedef struct {
typedef mp_map_t *mp_gatts_db_t;
-STATIC inline void mp_bluetooth_gatts_db_create(mp_gatts_db_t *db) {
+static inline void mp_bluetooth_gatts_db_create(mp_gatts_db_t *db) {
*db = m_new(mp_map_t, 1);
}
-STATIC inline void mp_bluetooth_gatts_db_reset(mp_gatts_db_t db) {
+static inline void mp_bluetooth_gatts_db_reset(mp_gatts_db_t db) {
mp_map_init(db, 0);
}
diff --git a/extmod/modbtree.c b/extmod/modbtree.c
index 9b2d184a1e..f8c38e0ad4 100644
--- a/extmod/modbtree.c
+++ b/extmod/modbtree.c
@@ -77,7 +77,7 @@ typedef struct _mp_obj_btree_t {
} mp_obj_btree_t;
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_obj_type_t btree_type;
+static const mp_obj_type_t btree_type;
#endif
#define CHECK_ERROR(res) \
@@ -89,7 +89,7 @@ void __dbpanic(DB *db) {
mp_printf(&mp_plat_print, "__dbpanic(%p)\n", db);
}
-STATIC mp_obj_btree_t *btree_new(DB *db, mp_obj_t stream) {
+static mp_obj_btree_t *btree_new(DB *db, mp_obj_t stream) {
mp_obj_btree_t *o = mp_obj_malloc(mp_obj_btree_t, (mp_obj_type_t *)&btree_type);
o->stream = stream;
o->db = db;
@@ -99,32 +99,32 @@ STATIC mp_obj_btree_t *btree_new(DB *db, mp_obj_t stream) {
return o;
}
-STATIC void buf_to_dbt(mp_obj_t obj, DBT *dbt) {
+static void buf_to_dbt(mp_obj_t obj, DBT *dbt) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(obj, &bufinfo, MP_BUFFER_READ);
dbt->data = bufinfo.buf;
dbt->size = bufinfo.len;
}
-STATIC void btree_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void btree_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<btree %p>", self->db);
}
-STATIC mp_obj_t btree_flush(mp_obj_t self_in) {
+static mp_obj_t btree_flush(mp_obj_t self_in) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(__bt_sync(self->db, 0));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(btree_flush_obj, btree_flush);
+static MP_DEFINE_CONST_FUN_OBJ_1(btree_flush_obj, btree_flush);
-STATIC mp_obj_t btree_close(mp_obj_t self_in) {
+static mp_obj_t btree_close(mp_obj_t self_in) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(__bt_close(self->db));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(btree_close_obj, btree_close);
+static MP_DEFINE_CONST_FUN_OBJ_1(btree_close_obj, btree_close);
-STATIC mp_obj_t btree_put(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t btree_put(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_btree_t *self = MP_OBJ_TO_PTR(args[0]);
DBT key, val;
@@ -132,9 +132,9 @@ STATIC mp_obj_t btree_put(size_t n_args, const mp_obj_t *args) {
buf_to_dbt(args[2], &val);
return MP_OBJ_NEW_SMALL_INT(__bt_put(self->db, &key, &val, 0));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_put_obj, 3, 4, btree_put);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_put_obj, 3, 4, btree_put);
-STATIC mp_obj_t btree_get(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t btree_get(size_t n_args, const mp_obj_t *args) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(args[0]);
DBT key, val;
buf_to_dbt(args[1], &key);
@@ -149,9 +149,9 @@ STATIC mp_obj_t btree_get(size_t n_args, const mp_obj_t *args) {
CHECK_ERROR(res);
return mp_obj_new_bytes(val.data, val.size);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_get_obj, 2, 3, btree_get);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_get_obj, 2, 3, btree_get);
-STATIC mp_obj_t btree_seq(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t btree_seq(size_t n_args, const mp_obj_t *args) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(args[0]);
int flags = MP_OBJ_SMALL_INT_VALUE(args[1]);
DBT key, val;
@@ -171,9 +171,9 @@ STATIC mp_obj_t btree_seq(size_t n_args, const mp_obj_t *args) {
pair->items[1] = mp_obj_new_bytes(val.data, val.size);
return pair_o;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_seq_obj, 2, 4, btree_seq);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_seq_obj, 2, 4, btree_seq);
-STATIC mp_obj_t btree_init_iter(size_t n_args, const mp_obj_t *args, byte type) {
+static mp_obj_t btree_init_iter(size_t n_args, const mp_obj_t *args, byte type) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(args[0]);
self->next_flags = type;
self->start_key = mp_const_none;
@@ -190,22 +190,22 @@ STATIC mp_obj_t btree_init_iter(size_t n_args, const mp_obj_t *args, byte type)
return args[0];
}
-STATIC mp_obj_t btree_keys(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t btree_keys(size_t n_args, const mp_obj_t *args) {
return btree_init_iter(n_args, args, FLAG_ITER_KEYS);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_keys_obj, 1, 4, btree_keys);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_keys_obj, 1, 4, btree_keys);
-STATIC mp_obj_t btree_values(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t btree_values(size_t n_args, const mp_obj_t *args) {
return btree_init_iter(n_args, args, FLAG_ITER_VALUES);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_values_obj, 1, 4, btree_values);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_values_obj, 1, 4, btree_values);
-STATIC mp_obj_t btree_items(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t btree_items(size_t n_args, const mp_obj_t *args) {
return btree_init_iter(n_args, args, FLAG_ITER_ITEMS);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_items_obj, 1, 4, btree_items);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_items_obj, 1, 4, btree_items);
-STATIC mp_obj_t btree_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t btree_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
(void)iter_buf;
mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
if (self->next_flags != 0) {
@@ -223,7 +223,7 @@ STATIC mp_obj_t btree_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
return self_in;
}
-STATIC mp_obj_t btree_iternext(mp_obj_t self_in) {
+static mp_obj_t btree_iternext(mp_obj_t self_in) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
DBT key, val;
int res;
@@ -279,7 +279,7 @@ STATIC mp_obj_t btree_iternext(mp_obj_t self_in) {
}
}
-STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
if (value == MP_OBJ_NULL) {
// delete
@@ -312,7 +312,7 @@ STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
}
}
-STATIC mp_obj_t btree_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t btree_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(lhs_in);
switch (op) {
case MP_BINARY_OP_CONTAINS: {
@@ -329,7 +329,7 @@ STATIC mp_obj_t btree_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
}
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t btree_locals_dict_table[] = {
+static const mp_rom_map_elem_t btree_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&btree_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&btree_flush_obj) },
{ MP_ROM_QSTR(MP_QSTR_get), MP_ROM_PTR(&btree_get_obj) },
@@ -340,14 +340,14 @@ STATIC const mp_rom_map_elem_t btree_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_items), MP_ROM_PTR(&btree_items_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table);
+static MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table);
-STATIC const mp_getiter_iternext_custom_t btree_getiter_iternext = {
+static const mp_getiter_iternext_custom_t btree_getiter_iternext = {
.getiter = btree_getiter,
.iternext = btree_iternext,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
btree_type,
MP_QSTR_btree,
MP_TYPE_FLAG_ITER_IS_CUSTOM,
@@ -360,7 +360,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif
-STATIC const FILEVTABLE btree_stream_fvtable = {
+static const FILEVTABLE btree_stream_fvtable = {
mp_stream_posix_read,
mp_stream_posix_write,
mp_stream_posix_lseek,
@@ -368,7 +368,7 @@ STATIC const FILEVTABLE btree_stream_fvtable = {
};
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC mp_obj_t mod_btree_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mod_btree_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_flags, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_cachesize, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -399,16 +399,16 @@ STATIC mp_obj_t mod_btree_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t
}
return MP_OBJ_FROM_PTR(btree_new(db, pos_args[0]));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_btree_open_obj, 1, mod_btree_open);
+static MP_DEFINE_CONST_FUN_OBJ_KW(mod_btree_open_obj, 1, mod_btree_open);
-STATIC const mp_rom_map_elem_t mp_module_btree_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_btree_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_btree) },
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mod_btree_open_obj) },
{ MP_ROM_QSTR(MP_QSTR_INCL), MP_ROM_INT(FLAG_END_KEY_INCL) },
{ MP_ROM_QSTR(MP_QSTR_DESC), MP_ROM_INT(FLAG_DESC) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_btree_globals, mp_module_btree_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_btree_globals, mp_module_btree_globals_table);
const mp_obj_module_t mp_module_btree = {
.base = { &mp_type_module },
diff --git a/extmod/modcryptolib.c b/extmod/modcryptolib.c
index 66511b0f75..bf72f4f468 100644
--- a/extmod/modcryptolib.c
+++ b/extmod/modcryptolib.c
@@ -103,18 +103,18 @@ static inline struct ctr_params *ctr_params_from_aes(mp_obj_aes_t *o) {
}
#if MICROPY_SSL_AXTLS
-STATIC void aes_initial_set_key_impl(AES_CTX_IMPL *ctx, const uint8_t *key, size_t keysize, const uint8_t iv[16]) {
+static void aes_initial_set_key_impl(AES_CTX_IMPL *ctx, const uint8_t *key, size_t keysize, const uint8_t iv[16]) {
assert(16 == keysize || 32 == keysize);
AES_set_key(ctx, key, iv, (16 == keysize) ? AES_MODE_128 : AES_MODE_256);
}
-STATIC void aes_final_set_key_impl(AES_CTX_IMPL *ctx, bool encrypt) {
+static void aes_final_set_key_impl(AES_CTX_IMPL *ctx, bool encrypt) {
if (!encrypt) {
AES_convert_key(ctx);
}
}
-STATIC void aes_process_ecb_impl(AES_CTX_IMPL *ctx, const uint8_t in[16], uint8_t out[16], bool encrypt) {
+static void aes_process_ecb_impl(AES_CTX_IMPL *ctx, const uint8_t in[16], uint8_t out[16], bool encrypt) {
memcpy(out, in, 16);
// We assume that out (vstr.buf or given output buffer) is uint32_t aligned
uint32_t *p = (uint32_t *)out;
@@ -132,7 +132,7 @@ STATIC void aes_process_ecb_impl(AES_CTX_IMPL *ctx, const uint8_t in[16], uint8_
}
}
-STATIC void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, bool encrypt) {
+static void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, bool encrypt) {
if (encrypt) {
AES_cbc_encrypt(ctx, in, out, in_len);
} else {
@@ -142,7 +142,7 @@ STATIC void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *
#if MICROPY_PY_CRYPTOLIB_CTR
// axTLS doesn't have CTR support out of the box. This implements the counter part using the ECB primitive.
-STATIC void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
+static void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
size_t n = ctr_params->offset;
uint8_t *const counter = ctx->iv;
@@ -169,7 +169,7 @@ STATIC void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *
#endif
#if MICROPY_SSL_MBEDTLS
-STATIC void aes_initial_set_key_impl(AES_CTX_IMPL *ctx, const uint8_t *key, size_t keysize, const uint8_t iv[16]) {
+static void aes_initial_set_key_impl(AES_CTX_IMPL *ctx, const uint8_t *key, size_t keysize, const uint8_t iv[16]) {
ctx->u.init_data.keysize = keysize;
memcpy(ctx->u.init_data.key, key, keysize);
@@ -178,7 +178,7 @@ STATIC void aes_initial_set_key_impl(AES_CTX_IMPL *ctx, const uint8_t *key, size
}
}
-STATIC void aes_final_set_key_impl(AES_CTX_IMPL *ctx, bool encrypt) {
+static void aes_final_set_key_impl(AES_CTX_IMPL *ctx, bool encrypt) {
// first, copy key aside
uint8_t key[32];
uint8_t keysize = ctx->u.init_data.keysize;
@@ -195,23 +195,23 @@ STATIC void aes_final_set_key_impl(AES_CTX_IMPL *ctx, bool encrypt) {
}
}
-STATIC void aes_process_ecb_impl(AES_CTX_IMPL *ctx, const uint8_t in[16], uint8_t out[16], bool encrypt) {
+static void aes_process_ecb_impl(AES_CTX_IMPL *ctx, const uint8_t in[16], uint8_t out[16], bool encrypt) {
mbedtls_aes_crypt_ecb(&ctx->u.mbedtls_ctx, encrypt ? MBEDTLS_AES_ENCRYPT : MBEDTLS_AES_DECRYPT, in, out);
}
-STATIC void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, bool encrypt) {
+static void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, bool encrypt) {
mbedtls_aes_crypt_cbc(&ctx->u.mbedtls_ctx, encrypt ? MBEDTLS_AES_ENCRYPT : MBEDTLS_AES_DECRYPT, in_len, ctx->iv, in, out);
}
#if MICROPY_PY_CRYPTOLIB_CTR
-STATIC void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
+static void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
mbedtls_aes_crypt_ctr(&ctx->u.mbedtls_ctx, in_len, &ctr_params->offset, ctx->iv, ctr_params->encrypted_counter, in, out);
}
#endif
#endif
-STATIC mp_obj_t cryptolib_aes_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t cryptolib_aes_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, 3, false);
const mp_int_t block_mode = mp_obj_get_int(args[1]);
@@ -260,7 +260,7 @@ STATIC mp_obj_t cryptolib_aes_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t aes_process(size_t n_args, const mp_obj_t *args, bool encrypt) {
+static mp_obj_t aes_process(size_t n_args, const mp_obj_t *args, bool encrypt) {
mp_obj_aes_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_t in_buf = args[1];
@@ -332,23 +332,23 @@ STATIC mp_obj_t aes_process(size_t n_args, const mp_obj_t *args, bool encrypt) {
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC mp_obj_t cryptolib_aes_encrypt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t cryptolib_aes_encrypt(size_t n_args, const mp_obj_t *args) {
return aes_process(n_args, args, true);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(cryptolib_aes_encrypt_obj, 2, 3, cryptolib_aes_encrypt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(cryptolib_aes_encrypt_obj, 2, 3, cryptolib_aes_encrypt);
-STATIC mp_obj_t cryptolib_aes_decrypt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t cryptolib_aes_decrypt(size_t n_args, const mp_obj_t *args) {
return aes_process(n_args, args, false);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(cryptolib_aes_decrypt_obj, 2, 3, cryptolib_aes_decrypt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(cryptolib_aes_decrypt_obj, 2, 3, cryptolib_aes_decrypt);
-STATIC const mp_rom_map_elem_t cryptolib_aes_locals_dict_table[] = {
+static const mp_rom_map_elem_t cryptolib_aes_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_encrypt), MP_ROM_PTR(&cryptolib_aes_encrypt_obj) },
{ MP_ROM_QSTR(MP_QSTR_decrypt), MP_ROM_PTR(&cryptolib_aes_decrypt_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(cryptolib_aes_locals_dict, cryptolib_aes_locals_dict_table);
+static MP_DEFINE_CONST_DICT(cryptolib_aes_locals_dict, cryptolib_aes_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
cryptolib_aes_type,
MP_QSTR_aes,
MP_TYPE_FLAG_NONE,
@@ -356,7 +356,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &cryptolib_aes_locals_dict
);
-STATIC const mp_rom_map_elem_t mp_module_cryptolib_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_cryptolib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cryptolib) },
{ MP_ROM_QSTR(MP_QSTR_aes), MP_ROM_PTR(&cryptolib_aes_type) },
#if MICROPY_PY_CRYPTOLIB_CONSTS
@@ -368,7 +368,7 @@ STATIC const mp_rom_map_elem_t mp_module_cryptolib_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_cryptolib_globals, mp_module_cryptolib_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_cryptolib_globals, mp_module_cryptolib_globals_table);
const mp_obj_module_t mp_module_cryptolib = {
.base = { &mp_type_module },
diff --git a/extmod/moddeflate.c b/extmod/moddeflate.c
index 560ee3f0ab..c0c3bb26a8 100644
--- a/extmod/moddeflate.c
+++ b/extmod/moddeflate.c
@@ -85,7 +85,7 @@ typedef struct {
#endif
} mp_obj_deflateio_t;
-STATIC int deflateio_read_stream(void *data) {
+static int deflateio_read_stream(void *data) {
mp_obj_deflateio_t *self = data;
const mp_stream_p_t *stream = mp_get_stream(self->stream);
int err;
@@ -100,7 +100,7 @@ STATIC int deflateio_read_stream(void *data) {
return c;
}
-STATIC bool deflateio_init_read(mp_obj_deflateio_t *self) {
+static bool deflateio_init_read(mp_obj_deflateio_t *self) {
if (self->read) {
return true;
}
@@ -151,7 +151,7 @@ STATIC bool deflateio_init_read(mp_obj_deflateio_t *self) {
}
#if MICROPY_PY_DEFLATE_COMPRESS
-STATIC void deflateio_out_byte(void *data, uint8_t b) {
+static void deflateio_out_byte(void *data, uint8_t b) {
mp_obj_deflateio_t *self = data;
const mp_stream_p_t *stream = mp_get_stream(self->stream);
int err;
@@ -161,7 +161,7 @@ STATIC void deflateio_out_byte(void *data, uint8_t b) {
}
}
-STATIC bool deflateio_init_write(mp_obj_deflateio_t *self) {
+static bool deflateio_init_write(mp_obj_deflateio_t *self) {
if (self->write) {
return true;
}
@@ -214,7 +214,7 @@ STATIC bool deflateio_init_write(mp_obj_deflateio_t *self) {
}
#endif
-STATIC mp_obj_t deflateio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) {
+static mp_obj_t deflateio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) {
// args: stream, format=NONE, wbits=0, close=False
mp_arg_check_num(n_args, n_kw, 1, 4, false);
@@ -241,7 +241,7 @@ STATIC mp_obj_t deflateio_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_uint_t deflateio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t deflateio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_deflateio_t *self = MP_OBJ_TO_PTR(o_in);
if (self->stream == MP_OBJ_NULL || !deflateio_init_read(self)) {
@@ -268,7 +268,7 @@ STATIC mp_uint_t deflateio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *e
}
#if MICROPY_PY_DEFLATE_COMPRESS
-STATIC mp_uint_t deflateio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t deflateio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_deflateio_t *self = MP_OBJ_TO_PTR(self_in);
if (self->stream == MP_OBJ_NULL || !deflateio_init_write(self)) {
@@ -302,7 +302,7 @@ static inline void put_be32(char *buf, uint32_t value) {
}
#endif
-STATIC mp_uint_t deflateio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t deflateio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
if (request == MP_STREAM_CLOSE) {
mp_obj_deflateio_t *self = MP_OBJ_TO_PTR(self_in);
@@ -351,7 +351,7 @@ STATIC mp_uint_t deflateio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t
}
}
-STATIC const mp_stream_p_t deflateio_stream_p = {
+static const mp_stream_p_t deflateio_stream_p = {
.read = deflateio_read,
#if MICROPY_PY_DEFLATE_COMPRESS
.write = deflateio_write,
@@ -360,7 +360,7 @@ STATIC const mp_stream_p_t deflateio_stream_p = {
};
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t deflateio_locals_dict_table[] = {
+static const mp_rom_map_elem_t deflateio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
@@ -371,9 +371,9 @@ STATIC const mp_rom_map_elem_t deflateio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&mp_stream___exit___obj) },
};
-STATIC MP_DEFINE_CONST_DICT(deflateio_locals_dict, deflateio_locals_dict_table);
+static MP_DEFINE_CONST_DICT(deflateio_locals_dict, deflateio_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
deflateio_type,
MP_QSTR_DeflateIO,
MP_TYPE_FLAG_NONE,
@@ -382,7 +382,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &deflateio_locals_dict
);
-STATIC const mp_rom_map_elem_t mp_module_deflate_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_deflate_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_deflate) },
{ MP_ROM_QSTR(MP_QSTR_DeflateIO), MP_ROM_PTR(&deflateio_type) },
{ MP_ROM_QSTR(MP_QSTR_AUTO), MP_ROM_INT(DEFLATEIO_FORMAT_AUTO) },
@@ -390,7 +390,7 @@ STATIC const mp_rom_map_elem_t mp_module_deflate_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ZLIB), MP_ROM_INT(DEFLATEIO_FORMAT_ZLIB) },
{ MP_ROM_QSTR(MP_QSTR_GZIP), MP_ROM_INT(DEFLATEIO_FORMAT_GZIP) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_deflate_globals, mp_module_deflate_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_deflate_globals, mp_module_deflate_globals_table);
const mp_obj_module_t mp_module_deflate = {
.base = { &mp_type_module },
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index 92313bd4bb..693e837f78 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -43,7 +43,7 @@ typedef struct _mp_obj_framebuf_t {
} mp_obj_framebuf_t;
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_obj_type_t mp_type_framebuf;
+static const mp_obj_type_t mp_type_framebuf;
#endif
typedef void (*setpixel_t)(const mp_obj_framebuf_t *, unsigned int, unsigned int, uint32_t);
@@ -67,19 +67,19 @@ typedef struct _mp_framebuf_p_t {
// Functions for MHLSB and MHMSB
-STATIC void mono_horiz_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
+static void mono_horiz_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
size_t index = (x + y * fb->stride) >> 3;
unsigned int offset = fb->format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07);
((uint8_t *)fb->buf)[index] = (((uint8_t *)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
}
-STATIC uint32_t mono_horiz_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
+static uint32_t mono_horiz_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
size_t index = (x + y * fb->stride) >> 3;
unsigned int offset = fb->format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07);
return (((uint8_t *)fb->buf)[index] >> (offset)) & 0x01;
}
-STATIC void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
+static void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
unsigned int reverse = fb->format == FRAMEBUF_MHMSB;
unsigned int advance = fb->stride >> 3;
while (w--) {
@@ -95,17 +95,17 @@ STATIC void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, un
// Functions for MVLSB format
-STATIC void mvlsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
+static void mvlsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
size_t index = (y >> 3) * fb->stride + x;
uint8_t offset = y & 0x07;
((uint8_t *)fb->buf)[index] = (((uint8_t *)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
}
-STATIC uint32_t mvlsb_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
+static uint32_t mvlsb_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
return (((uint8_t *)fb->buf)[(y >> 3) * fb->stride + x] >> (y & 0x07)) & 0x01;
}
-STATIC void mvlsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
+static void mvlsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
while (h--) {
uint8_t *b = &((uint8_t *)fb->buf)[(y >> 3) * fb->stride + x];
uint8_t offset = y & 0x07;
@@ -119,15 +119,15 @@ STATIC void mvlsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigne
// Functions for RGB565 format
-STATIC void rgb565_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
+static void rgb565_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
((uint16_t *)fb->buf)[x + y * fb->stride] = col;
}
-STATIC uint32_t rgb565_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
+static uint32_t rgb565_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
return ((uint16_t *)fb->buf)[x + y * fb->stride];
}
-STATIC void rgb565_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
+static void rgb565_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
uint16_t *b = &((uint16_t *)fb->buf)[x + y * fb->stride];
while (h--) {
for (unsigned int ww = w; ww; --ww) {
@@ -139,7 +139,7 @@ STATIC void rgb565_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsign
// Functions for GS2_HMSB format
-STATIC void gs2_hmsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
+static void gs2_hmsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride) >> 2];
uint8_t shift = (x & 0x3) << 1;
uint8_t mask = 0x3 << shift;
@@ -147,13 +147,13 @@ STATIC void gs2_hmsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsig
*pixel = color | (*pixel & (~mask));
}
-STATIC uint32_t gs2_hmsb_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
+static uint32_t gs2_hmsb_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
uint8_t pixel = ((uint8_t *)fb->buf)[(x + y * fb->stride) >> 2];
uint8_t shift = (x & 0x3) << 1;
return (pixel >> shift) & 0x3;
}
-STATIC void gs2_hmsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
+static void gs2_hmsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
for (unsigned int xx = x; xx < x + w; xx++) {
for (unsigned int yy = y; yy < y + h; yy++) {
gs2_hmsb_setpixel(fb, xx, yy, col);
@@ -163,7 +163,7 @@ STATIC void gs2_hmsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsi
// Functions for GS4_HMSB format
-STATIC void gs4_hmsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
+static void gs4_hmsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1];
if (x % 2) {
@@ -173,7 +173,7 @@ STATIC void gs4_hmsb_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsig
}
}
-STATIC uint32_t gs4_hmsb_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
+static uint32_t gs4_hmsb_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
if (x % 2) {
return ((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1] & 0x0f;
}
@@ -181,7 +181,7 @@ STATIC uint32_t gs4_hmsb_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, u
return ((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1] >> 4;
}
-STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
+static void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
col &= 0x0f;
uint8_t *pixel_pair = &((uint8_t *)fb->buf)[(x + y * fb->stride) >> 1];
uint8_t col_shifted_left = col << 4;
@@ -214,16 +214,16 @@ STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsi
// Functions for GS8 format
-STATIC void gs8_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
+static void gs8_setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride)];
*pixel = col & 0xff;
}
-STATIC uint32_t gs8_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
+static uint32_t gs8_getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
return ((uint8_t *)fb->buf)[(x + y * fb->stride)];
}
-STATIC void gs8_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
+static void gs8_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, uint32_t col) {
uint8_t *pixel = &((uint8_t *)fb->buf)[(x + y * fb->stride)];
while (h--) {
memset(pixel, col, w);
@@ -231,7 +231,7 @@ STATIC void gs8_fill_rect(const mp_obj_framebuf_t *fb, unsigned int x, unsigned
}
}
-STATIC mp_framebuf_p_t formats[] = {
+static mp_framebuf_p_t formats[] = {
[FRAMEBUF_MVLSB] = {mvlsb_setpixel, mvlsb_getpixel, mvlsb_fill_rect},
[FRAMEBUF_RGB565] = {rgb565_setpixel, rgb565_getpixel, rgb565_fill_rect},
[FRAMEBUF_GS2_HMSB] = {gs2_hmsb_setpixel, gs2_hmsb_getpixel, gs2_hmsb_fill_rect},
@@ -241,21 +241,21 @@ STATIC mp_framebuf_p_t formats[] = {
[FRAMEBUF_MHMSB] = {mono_horiz_setpixel, mono_horiz_getpixel, mono_horiz_fill_rect},
};
-STATIC inline void setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
+static inline void setpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y, uint32_t col) {
formats[fb->format].setpixel(fb, x, y, col);
}
-STATIC void setpixel_checked(const mp_obj_framebuf_t *fb, mp_int_t x, mp_int_t y, mp_int_t col, mp_int_t mask) {
+static void setpixel_checked(const mp_obj_framebuf_t *fb, mp_int_t x, mp_int_t y, mp_int_t col, mp_int_t mask) {
if (mask && 0 <= x && x < fb->width && 0 <= y && y < fb->height) {
setpixel(fb, x, y, col);
}
}
-STATIC inline uint32_t getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
+static inline uint32_t getpixel(const mp_obj_framebuf_t *fb, unsigned int x, unsigned int y) {
return formats[fb->format].getpixel(fb, x, y);
}
-STATIC void fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
+static void fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
if (h < 1 || w < 1 || x + w <= 0 || y + h <= 0 || y >= fb->height || x >= fb->width) {
// No operation needed.
return;
@@ -270,7 +270,7 @@ STATIC void fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, u
formats[fb->format].fill_rect(fb, x, y, xend - x, yend - y, col);
}
-STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) {
mp_arg_check_num(n_args, n_kw, 4, 5, false);
mp_int_t width = mp_obj_get_int(args_in[1]);
@@ -329,35 +329,35 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size
return MP_OBJ_FROM_PTR(o);
}
-STATIC void framebuf_args(const mp_obj_t *args_in, mp_int_t *args_out, int n) {
+static void framebuf_args(const mp_obj_t *args_in, mp_int_t *args_out, int n) {
for (int i = 0; i < n; ++i) {
args_out[i] = mp_obj_get_int(args_in[i + 1]);
}
}
-STATIC mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+static mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
return mp_get_buffer(self->buf_obj, bufinfo, flags) ? 0 : 1;
}
-STATIC mp_obj_t framebuf_fill(mp_obj_t self_in, mp_obj_t col_in) {
+static mp_obj_t framebuf_fill(mp_obj_t self_in, mp_obj_t col_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t col = mp_obj_get_int(col_in);
formats[self->format].fill_rect(self, 0, 0, self->width, self->height, col);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(framebuf_fill_obj, framebuf_fill);
+static MP_DEFINE_CONST_FUN_OBJ_2(framebuf_fill_obj, framebuf_fill);
-STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
mp_int_t args[5]; // x, y, w, h, col
framebuf_args(args_in, args, 5);
fill_rect(self, args[0], args[1], args[2], args[3], args[4]);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_fill_rect_obj, 6, 6, framebuf_fill_rect);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_fill_rect_obj, 6, 6, framebuf_fill_rect);
-STATIC mp_obj_t framebuf_pixel(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_pixel(size_t n_args, const mp_obj_t *args_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
mp_int_t x = mp_obj_get_int(args_in[1]);
mp_int_t y = mp_obj_get_int(args_in[2]);
@@ -372,9 +372,9 @@ STATIC mp_obj_t framebuf_pixel(size_t n_args, const mp_obj_t *args_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_pixel_obj, 3, 4, framebuf_pixel);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_pixel_obj, 3, 4, framebuf_pixel);
-STATIC mp_obj_t framebuf_hline(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_hline(size_t n_args, const mp_obj_t *args_in) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
@@ -385,9 +385,9 @@ STATIC mp_obj_t framebuf_hline(size_t n_args, const mp_obj_t *args_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_hline_obj, 5, 5, framebuf_hline);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_hline_obj, 5, 5, framebuf_hline);
-STATIC mp_obj_t framebuf_vline(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_vline(size_t n_args, const mp_obj_t *args_in) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
@@ -398,9 +398,9 @@ STATIC mp_obj_t framebuf_vline(size_t n_args, const mp_obj_t *args_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_vline_obj, 5, 5, framebuf_vline);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_vline_obj, 5, 5, framebuf_vline);
-STATIC mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
mp_int_t args[5]; // x, y, w, h, col
framebuf_args(args_in, args, 5);
@@ -414,9 +414,9 @@ STATIC mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_rect_obj, 6, 7, framebuf_rect);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_rect_obj, 6, 7, framebuf_rect);
-STATIC void line(const mp_obj_framebuf_t *fb, mp_int_t x1, mp_int_t y1, mp_int_t x2, mp_int_t y2, mp_int_t col) {
+static void line(const mp_obj_framebuf_t *fb, mp_int_t x1, mp_int_t y1, mp_int_t x2, mp_int_t y2, mp_int_t col) {
mp_int_t dx = x2 - x1;
mp_int_t sx;
if (dx > 0) {
@@ -476,7 +476,7 @@ STATIC void line(const mp_obj_framebuf_t *fb, mp_int_t x1, mp_int_t y1, mp_int_t
}
}
-STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args_in) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
@@ -487,7 +487,7 @@ STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_line_obj, 6, 6, framebuf_line);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_line_obj, 6, 6, framebuf_line);
// Q2 Q1
// Q3 Q4
@@ -498,7 +498,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_line_obj, 6, 6, framebuf_lin
#define ELLIPSE_MASK_Q3 (0x04)
#define ELLIPSE_MASK_Q4 (0x08)
-STATIC void draw_ellipse_points(const mp_obj_framebuf_t *fb, mp_int_t cx, mp_int_t cy, mp_int_t x, mp_int_t y, mp_int_t col, mp_int_t mask) {
+static void draw_ellipse_points(const mp_obj_framebuf_t *fb, mp_int_t cx, mp_int_t cy, mp_int_t x, mp_int_t y, mp_int_t col, mp_int_t mask) {
if (mask & ELLIPSE_MASK_FILL) {
if (mask & ELLIPSE_MASK_Q1) {
fill_rect(fb, cx, cy - y, x + 1, 1, col);
@@ -520,7 +520,7 @@ STATIC void draw_ellipse_points(const mp_obj_framebuf_t *fb, mp_int_t cx, mp_int
}
}
-STATIC mp_obj_t framebuf_ellipse(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_ellipse(size_t n_args, const mp_obj_t *args_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
mp_int_t args[5];
framebuf_args(args_in, args, 5); // cx, cy, xradius, yradius, col
@@ -575,17 +575,17 @@ STATIC mp_obj_t framebuf_ellipse(size_t n_args, const mp_obj_t *args_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_ellipse_obj, 6, 8, framebuf_ellipse);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_ellipse_obj, 6, 8, framebuf_ellipse);
#if MICROPY_PY_ARRAY && !MICROPY_ENABLE_DYNRUNTIME
// TODO: poly needs mp_binary_get_size & mp_binary_get_val_array which aren't
// available in dynruntime.h yet.
-STATIC mp_int_t poly_int(mp_buffer_info_t *bufinfo, size_t index) {
+static mp_int_t poly_int(mp_buffer_info_t *bufinfo, size_t index) {
return mp_obj_get_int(mp_binary_get_val_array(bufinfo->typecode, bufinfo->buf, index));
}
-STATIC mp_obj_t framebuf_poly(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_poly(size_t n_args, const mp_obj_t *args_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
mp_int_t x = mp_obj_get_int(args_in[1]);
@@ -695,10 +695,10 @@ STATIC mp_obj_t framebuf_poly(size_t n_args, const mp_obj_t *args_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_poly_obj, 5, 6, framebuf_poly);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_poly_obj, 5, 6, framebuf_poly);
#endif // MICROPY_PY_ARRAY && !MICROPY_ENABLE_DYNRUNTIME
-STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
mp_obj_t source_in = mp_obj_cast_to_native_base(args_in[1], MP_OBJ_FROM_PTR(&mp_type_framebuf));
if (source_in == MP_OBJ_NULL) {
@@ -751,9 +751,9 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_blit_obj, 4, 6, framebuf_blit);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_blit_obj, 4, 6, framebuf_blit);
-STATIC mp_obj_t framebuf_scroll(mp_obj_t self_in, mp_obj_t xstep_in, mp_obj_t ystep_in) {
+static mp_obj_t framebuf_scroll(mp_obj_t self_in, mp_obj_t xstep_in, mp_obj_t ystep_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t xstep = mp_obj_get_int(xstep_in);
mp_int_t ystep = mp_obj_get_int(ystep_in);
@@ -795,9 +795,9 @@ STATIC mp_obj_t framebuf_scroll(mp_obj_t self_in, mp_obj_t xstep_in, mp_obj_t ys
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(framebuf_scroll_obj, framebuf_scroll);
+static MP_DEFINE_CONST_FUN_OBJ_3(framebuf_scroll_obj, framebuf_scroll);
-STATIC mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args_in) {
// extract arguments
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args_in[0]);
const char *str = mp_obj_str_get_str(args_in[1]);
@@ -833,10 +833,10 @@ STATIC mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_text_obj, 4, 5, framebuf_text);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_text_obj, 4, 5, framebuf_text);
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t framebuf_locals_dict_table[] = {
+static const mp_rom_map_elem_t framebuf_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&framebuf_fill_obj) },
{ MP_ROM_QSTR(MP_QSTR_fill_rect), MP_ROM_PTR(&framebuf_fill_rect_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel), MP_ROM_PTR(&framebuf_pixel_obj) },
@@ -852,9 +852,9 @@ STATIC const mp_rom_map_elem_t framebuf_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_scroll), MP_ROM_PTR(&framebuf_scroll_obj) },
{ MP_ROM_QSTR(MP_QSTR_text), MP_ROM_PTR(&framebuf_text_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table);
+static MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_framebuf,
MP_QSTR_FrameBuffer,
MP_TYPE_FLAG_NONE,
@@ -867,13 +867,13 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
#if !MICROPY_ENABLE_DYNRUNTIME
// This factory function is provided for backwards compatibility with the old
// FrameBuffer1 class which did not support a format argument.
-STATIC mp_obj_t legacy_framebuffer1(size_t n_args, const mp_obj_t *args_in) {
+static mp_obj_t legacy_framebuffer1(size_t n_args, const mp_obj_t *args_in) {
mp_obj_t args[] = {args_in[0], args_in[1], args_in[2], MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB), n_args >= 4 ? args_in[3] : args_in[1] };
return framebuf_make_new(&mp_type_framebuf, 5, 0, args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(legacy_framebuffer1_obj, 3, 4, legacy_framebuffer1);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(legacy_framebuffer1_obj, 3, 4, legacy_framebuffer1);
-STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = {
+static const mp_rom_map_elem_t framebuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_framebuf) },
{ MP_ROM_QSTR(MP_QSTR_FrameBuffer), MP_ROM_PTR(&mp_type_framebuf) },
{ MP_ROM_QSTR(MP_QSTR_FrameBuffer1), MP_ROM_PTR(&legacy_framebuffer1_obj) },
@@ -887,7 +887,7 @@ STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_MONO_HMSB), MP_ROM_INT(FRAMEBUF_MHMSB) },
};
-STATIC MP_DEFINE_CONST_DICT(framebuf_module_globals, framebuf_module_globals_table);
+static MP_DEFINE_CONST_DICT(framebuf_module_globals, framebuf_module_globals_table);
const mp_obj_module_t mp_module_framebuf = {
.base = { &mp_type_module },
diff --git a/extmod/modhashlib.c b/extmod/modhashlib.c
index dbebd78667..4754e44463 100644
--- a/extmod/modhashlib.c
+++ b/extmod/modhashlib.c
@@ -71,7 +71,7 @@ static void hashlib_ensure_not_final(mp_obj_hash_t *self) {
}
#if MICROPY_PY_HASHLIB_SHA256
-STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg);
+static mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg);
#if MICROPY_SSL_MBEDTLS
@@ -81,7 +81,7 @@ STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg);
#define mbedtls_sha256_finish_ret mbedtls_sha256_finish
#endif
-STATIC mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(mbedtls_sha256_context), type);
o->final = false;
@@ -93,7 +93,7 @@ STATIC mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
@@ -102,7 +102,7 @@ STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC mp_obj_t hashlib_sha256_digest(mp_obj_t self_in) {
+static mp_obj_t hashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
self->final = true;
@@ -116,7 +116,7 @@ STATIC mp_obj_t hashlib_sha256_digest(mp_obj_t self_in) {
#include "lib/crypto-algorithms/sha256.c"
-STATIC mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(CRYAL_SHA256_CTX), type);
o->final = false;
@@ -127,7 +127,7 @@ STATIC mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
@@ -136,7 +136,7 @@ STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC mp_obj_t hashlib_sha256_digest(mp_obj_t self_in) {
+static mp_obj_t hashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
self->final = true;
@@ -147,17 +147,17 @@ STATIC mp_obj_t hashlib_sha256_digest(mp_obj_t self_in) {
}
#endif
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(hashlib_sha256_update_obj, hashlib_sha256_update);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(hashlib_sha256_digest_obj, hashlib_sha256_digest);
+static MP_DEFINE_CONST_FUN_OBJ_2(hashlib_sha256_update_obj, hashlib_sha256_update);
+static MP_DEFINE_CONST_FUN_OBJ_1(hashlib_sha256_digest_obj, hashlib_sha256_digest);
-STATIC const mp_rom_map_elem_t hashlib_sha256_locals_dict_table[] = {
+static const mp_rom_map_elem_t hashlib_sha256_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&hashlib_sha256_update_obj) },
{ MP_ROM_QSTR(MP_QSTR_digest), MP_ROM_PTR(&hashlib_sha256_digest_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(hashlib_sha256_locals_dict, hashlib_sha256_locals_dict_table);
+static MP_DEFINE_CONST_DICT(hashlib_sha256_locals_dict, hashlib_sha256_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
hashlib_sha256_type,
MP_QSTR_sha256,
MP_TYPE_FLAG_NONE,
@@ -167,10 +167,10 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
#endif
#if MICROPY_PY_HASHLIB_SHA1
-STATIC mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg);
+static mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg);
#if MICROPY_SSL_AXTLS
-STATIC mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(SHA1_CTX), type);
o->final = false;
@@ -181,7 +181,7 @@ STATIC mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
@@ -190,7 +190,7 @@ STATIC mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC mp_obj_t hashlib_sha1_digest(mp_obj_t self_in) {
+static mp_obj_t hashlib_sha1_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
self->final = true;
@@ -209,7 +209,7 @@ STATIC mp_obj_t hashlib_sha1_digest(mp_obj_t self_in) {
#define mbedtls_sha1_finish_ret mbedtls_sha1_finish
#endif
-STATIC mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(mbedtls_sha1_context), type);
o->final = false;
@@ -221,7 +221,7 @@ STATIC mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
@@ -230,7 +230,7 @@ STATIC mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC mp_obj_t hashlib_sha1_digest(mp_obj_t self_in) {
+static mp_obj_t hashlib_sha1_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
self->final = true;
@@ -242,16 +242,16 @@ STATIC mp_obj_t hashlib_sha1_digest(mp_obj_t self_in) {
}
#endif
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(hashlib_sha1_update_obj, hashlib_sha1_update);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(hashlib_sha1_digest_obj, hashlib_sha1_digest);
+static MP_DEFINE_CONST_FUN_OBJ_2(hashlib_sha1_update_obj, hashlib_sha1_update);
+static MP_DEFINE_CONST_FUN_OBJ_1(hashlib_sha1_digest_obj, hashlib_sha1_digest);
-STATIC const mp_rom_map_elem_t hashlib_sha1_locals_dict_table[] = {
+static const mp_rom_map_elem_t hashlib_sha1_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&hashlib_sha1_update_obj) },
{ MP_ROM_QSTR(MP_QSTR_digest), MP_ROM_PTR(&hashlib_sha1_digest_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(hashlib_sha1_locals_dict, hashlib_sha1_locals_dict_table);
+static MP_DEFINE_CONST_DICT(hashlib_sha1_locals_dict, hashlib_sha1_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
hashlib_sha1_type,
MP_QSTR_sha1,
MP_TYPE_FLAG_NONE,
@@ -261,10 +261,10 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
#endif
#if MICROPY_PY_HASHLIB_MD5
-STATIC mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg);
+static mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg);
#if MICROPY_SSL_AXTLS
-STATIC mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(MD5_CTX), type);
o->final = false;
@@ -275,7 +275,7 @@ STATIC mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, s
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
@@ -284,7 +284,7 @@ STATIC mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC mp_obj_t hashlib_md5_digest(mp_obj_t self_in) {
+static mp_obj_t hashlib_md5_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
self->final = true;
@@ -303,7 +303,7 @@ STATIC mp_obj_t hashlib_md5_digest(mp_obj_t self_in) {
#define mbedtls_md5_finish_ret mbedtls_md5_finish
#endif
-STATIC mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(mbedtls_md5_context), type);
o->final = false;
@@ -315,7 +315,7 @@ STATIC mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, s
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
mp_buffer_info_t bufinfo;
@@ -324,7 +324,7 @@ STATIC mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC mp_obj_t hashlib_md5_digest(mp_obj_t self_in) {
+static mp_obj_t hashlib_md5_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
hashlib_ensure_not_final(self);
self->final = true;
@@ -336,16 +336,16 @@ STATIC mp_obj_t hashlib_md5_digest(mp_obj_t self_in) {
}
#endif // MICROPY_SSL_MBEDTLS
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(hashlib_md5_update_obj, hashlib_md5_update);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(hashlib_md5_digest_obj, hashlib_md5_digest);
+static MP_DEFINE_CONST_FUN_OBJ_2(hashlib_md5_update_obj, hashlib_md5_update);
+static MP_DEFINE_CONST_FUN_OBJ_1(hashlib_md5_digest_obj, hashlib_md5_digest);
-STATIC const mp_rom_map_elem_t hashlib_md5_locals_dict_table[] = {
+static const mp_rom_map_elem_t hashlib_md5_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&hashlib_md5_update_obj) },
{ MP_ROM_QSTR(MP_QSTR_digest), MP_ROM_PTR(&hashlib_md5_digest_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(hashlib_md5_locals_dict, hashlib_md5_locals_dict_table);
+static MP_DEFINE_CONST_DICT(hashlib_md5_locals_dict, hashlib_md5_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
hashlib_md5_type,
MP_QSTR_md5,
MP_TYPE_FLAG_NONE,
@@ -354,7 +354,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif // MICROPY_PY_HASHLIB_MD5
-STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hashlib) },
#if MICROPY_PY_HASHLIB_SHA256
{ MP_ROM_QSTR(MP_QSTR_sha256), MP_ROM_PTR(&hashlib_sha256_type) },
@@ -367,7 +367,7 @@ STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table);
const mp_obj_module_t mp_module_hashlib = {
.base = { &mp_type_module },
diff --git a/extmod/modheapq.c b/extmod/modheapq.c
index db1e35bac2..bb8c7d2bf1 100644
--- a/extmod/modheapq.c
+++ b/extmod/modheapq.c
@@ -31,14 +31,14 @@
// the algorithm here is modelled on CPython's heapq.py
-STATIC mp_obj_list_t *heapq_get_heap(mp_obj_t heap_in) {
+static mp_obj_list_t *heapq_get_heap(mp_obj_t heap_in) {
if (!mp_obj_is_type(heap_in, &mp_type_list)) {
mp_raise_TypeError(MP_ERROR_TEXT("heap must be a list"));
}
return MP_OBJ_TO_PTR(heap_in);
}
-STATIC void heapq_heap_siftdown(mp_obj_list_t *heap, mp_uint_t start_pos, mp_uint_t pos) {
+static void heapq_heap_siftdown(mp_obj_list_t *heap, mp_uint_t start_pos, mp_uint_t pos) {
mp_obj_t item = heap->items[pos];
while (pos > start_pos) {
mp_uint_t parent_pos = (pos - 1) >> 1;
@@ -53,7 +53,7 @@ STATIC void heapq_heap_siftdown(mp_obj_list_t *heap, mp_uint_t start_pos, mp_uin
heap->items[pos] = item;
}
-STATIC void heapq_heap_siftup(mp_obj_list_t *heap, mp_uint_t pos) {
+static void heapq_heap_siftup(mp_obj_list_t *heap, mp_uint_t pos) {
mp_uint_t start_pos = pos;
mp_uint_t end_pos = heap->len;
mp_obj_t item = heap->items[pos];
@@ -70,15 +70,15 @@ STATIC void heapq_heap_siftup(mp_obj_list_t *heap, mp_uint_t pos) {
heapq_heap_siftdown(heap, start_pos, pos);
}
-STATIC mp_obj_t mod_heapq_heappush(mp_obj_t heap_in, mp_obj_t item) {
+static mp_obj_t mod_heapq_heappush(mp_obj_t heap_in, mp_obj_t item) {
mp_obj_list_t *heap = heapq_get_heap(heap_in);
mp_obj_list_append(heap_in, item);
heapq_heap_siftdown(heap, 0, heap->len - 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_heapq_heappush_obj, mod_heapq_heappush);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_heapq_heappush_obj, mod_heapq_heappush);
-STATIC mp_obj_t mod_heapq_heappop(mp_obj_t heap_in) {
+static mp_obj_t mod_heapq_heappop(mp_obj_t heap_in) {
mp_obj_list_t *heap = heapq_get_heap(heap_in);
if (heap->len == 0) {
mp_raise_msg(&mp_type_IndexError, MP_ERROR_TEXT("empty heap"));
@@ -92,26 +92,26 @@ STATIC mp_obj_t mod_heapq_heappop(mp_obj_t heap_in) {
}
return item;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_heapq_heappop_obj, mod_heapq_heappop);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_heapq_heappop_obj, mod_heapq_heappop);
-STATIC mp_obj_t mod_heapq_heapify(mp_obj_t heap_in) {
+static mp_obj_t mod_heapq_heapify(mp_obj_t heap_in) {
mp_obj_list_t *heap = heapq_get_heap(heap_in);
for (mp_uint_t i = heap->len / 2; i > 0;) {
heapq_heap_siftup(heap, --i);
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_heapq_heapify_obj, mod_heapq_heapify);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_heapq_heapify_obj, mod_heapq_heapify);
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t mp_module_heapq_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_heapq_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_heapq) },
{ MP_ROM_QSTR(MP_QSTR_heappush), MP_ROM_PTR(&mod_heapq_heappush_obj) },
{ MP_ROM_QSTR(MP_QSTR_heappop), MP_ROM_PTR(&mod_heapq_heappop_obj) },
{ MP_ROM_QSTR(MP_QSTR_heapify), MP_ROM_PTR(&mod_heapq_heapify_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_heapq_globals, mp_module_heapq_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_heapq_globals, mp_module_heapq_globals_table);
const mp_obj_module_t mp_module_heapq = {
.base = { &mp_type_module },
diff --git a/extmod/modjson.c b/extmod/modjson.c
index 1772b72998..e655a02bc0 100644
--- a/extmod/modjson.c
+++ b/extmod/modjson.c
@@ -41,7 +41,7 @@ enum {
DUMP_MODE_TO_STREAM = 2,
};
-STATIC mp_obj_t mod_json_dump_helper(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args, unsigned int mode) {
+static mp_obj_t mod_json_dump_helper(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args, unsigned int mode) {
enum { ARG_separators };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_separators, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -78,34 +78,34 @@ STATIC mp_obj_t mod_json_dump_helper(size_t n_args, const mp_obj_t *pos_args, mp
}
}
-STATIC mp_obj_t mod_json_dump(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mod_json_dump(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return mod_json_dump_helper(n_args, pos_args, kw_args, DUMP_MODE_TO_STREAM);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_json_dump_obj, 2, mod_json_dump);
+static MP_DEFINE_CONST_FUN_OBJ_KW(mod_json_dump_obj, 2, mod_json_dump);
-STATIC mp_obj_t mod_json_dumps(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mod_json_dumps(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return mod_json_dump_helper(n_args, pos_args, kw_args, DUMP_MODE_TO_STRING);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_json_dumps_obj, 1, mod_json_dumps);
+static MP_DEFINE_CONST_FUN_OBJ_KW(mod_json_dumps_obj, 1, mod_json_dumps);
#else
-STATIC mp_obj_t mod_json_dump(mp_obj_t obj, mp_obj_t stream) {
+static mp_obj_t mod_json_dump(mp_obj_t obj, mp_obj_t stream) {
mp_get_stream_raise(stream, MP_STREAM_OP_WRITE);
mp_print_t print = {MP_OBJ_TO_PTR(stream), mp_stream_write_adaptor};
mp_obj_print_helper(&print, obj, PRINT_JSON);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_json_dump_obj, mod_json_dump);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_json_dump_obj, mod_json_dump);
-STATIC mp_obj_t mod_json_dumps(mp_obj_t obj) {
+static mp_obj_t mod_json_dumps(mp_obj_t obj) {
vstr_t vstr;
mp_print_t print;
vstr_init_print(&vstr, 8, &print);
mp_obj_print_helper(&print, obj, PRINT_JSON);
return mp_obj_new_str_from_utf8_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_json_dumps_obj, mod_json_dumps);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_json_dumps_obj, mod_json_dumps);
#endif
@@ -134,7 +134,7 @@ typedef struct _json_stream_t {
#define S_CUR(s) ((s).cur)
#define S_NEXT(s) (json_stream_next(&(s)))
-STATIC byte json_stream_next(json_stream_t *s) {
+static byte json_stream_next(json_stream_t *s) {
mp_uint_t ret = s->read(s->stream_obj, &s->cur, 1, &s->errcode);
if (s->errcode != 0) {
mp_raise_OSError(s->errcode);
@@ -145,7 +145,7 @@ STATIC byte json_stream_next(json_stream_t *s) {
return s->cur;
}
-STATIC mp_obj_t mod_json_load(mp_obj_t stream_obj) {
+static mp_obj_t mod_json_load(mp_obj_t stream_obj) {
const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, MP_STREAM_OP_READ);
json_stream_t s = {stream_obj, stream_p->read, 0, 0};
vstr_t vstr;
@@ -355,18 +355,18 @@ success:
fail:
mp_raise_ValueError(MP_ERROR_TEXT("syntax error in JSON"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_json_load_obj, mod_json_load);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_json_load_obj, mod_json_load);
-STATIC mp_obj_t mod_json_loads(mp_obj_t obj) {
+static mp_obj_t mod_json_loads(mp_obj_t obj) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(obj, &bufinfo, MP_BUFFER_READ);
vstr_t vstr = {bufinfo.len, bufinfo.len, (char *)bufinfo.buf, true};
mp_obj_stringio_t sio = {{&mp_type_stringio}, &vstr, 0, MP_OBJ_NULL};
return mod_json_load(MP_OBJ_FROM_PTR(&sio));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_json_loads_obj, mod_json_loads);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_json_loads_obj, mod_json_loads);
-STATIC const mp_rom_map_elem_t mp_module_json_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_json_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_json) },
{ MP_ROM_QSTR(MP_QSTR_dump), MP_ROM_PTR(&mod_json_dump_obj) },
{ MP_ROM_QSTR(MP_QSTR_dumps), MP_ROM_PTR(&mod_json_dumps_obj) },
@@ -374,7 +374,7 @@ STATIC const mp_rom_map_elem_t mp_module_json_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_loads), MP_ROM_PTR(&mod_json_loads_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_json_globals, mp_module_json_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_json_globals, mp_module_json_globals_table);
const mp_obj_module_t mp_module_json = {
.base = { &mp_type_module },
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index f1242b0461..607143bb7e 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -99,17 +99,17 @@ typedef struct _lwip_slip_obj_t {
} lwip_slip_obj_t;
// Slip object is unique for now. Possibly can fix this later. FIXME
-STATIC lwip_slip_obj_t lwip_slip_obj;
+static lwip_slip_obj_t lwip_slip_obj;
// Declare these early.
void mod_lwip_register_poll(void (*poll)(void *arg), void *poll_arg);
void mod_lwip_deregister_poll(void (*poll)(void *arg), void *poll_arg);
-STATIC void slip_lwip_poll(void *netif) {
+static void slip_lwip_poll(void *netif) {
slipif_poll((struct netif *)netif);
}
-STATIC const mp_obj_type_t lwip_slip_type;
+static const mp_obj_type_t lwip_slip_type;
// lwIP SLIP callback functions
sio_fd_t sio_open(u8_t dvnum) {
@@ -138,7 +138,7 @@ u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len) {
}
// constructor lwip.slip(device=integer, iplocal=string, ipremote=string)
-STATIC mp_obj_t lwip_slip_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t lwip_slip_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 3, 3, false);
lwip_slip_obj.base.type = &lwip_slip_type;
@@ -164,20 +164,20 @@ STATIC mp_obj_t lwip_slip_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw,
return (mp_obj_t)&lwip_slip_obj;
}
-STATIC mp_obj_t lwip_slip_status(mp_obj_t self_in) {
+static mp_obj_t lwip_slip_status(mp_obj_t self_in) {
// Null function for now.
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(lwip_slip_status_obj, lwip_slip_status);
+static MP_DEFINE_CONST_FUN_OBJ_1(lwip_slip_status_obj, lwip_slip_status);
-STATIC const mp_rom_map_elem_t lwip_slip_locals_dict_table[] = {
+static const mp_rom_map_elem_t lwip_slip_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_status), MP_ROM_PTR(&lwip_slip_status_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(lwip_slip_locals_dict, lwip_slip_locals_dict_table);
+static MP_DEFINE_CONST_DICT(lwip_slip_locals_dict, lwip_slip_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
lwip_slip_type,
MP_QSTR_slip,
MP_TYPE_FLAG_NONE,
@@ -321,7 +321,7 @@ static inline void poll_sockets(void) {
mp_event_wait_ms(1);
}
-STATIC struct tcp_pcb *volatile *lwip_socket_incoming_array(lwip_socket_obj_t *socket) {
+static struct tcp_pcb *volatile *lwip_socket_incoming_array(lwip_socket_obj_t *socket) {
if (socket->incoming.connection.alloc == 0) {
return &socket->incoming.connection.tcp.item;
} else {
@@ -329,7 +329,7 @@ STATIC struct tcp_pcb *volatile *lwip_socket_incoming_array(lwip_socket_obj_t *s
}
}
-STATIC void lwip_socket_free_incoming(lwip_socket_obj_t *socket) {
+static void lwip_socket_free_incoming(lwip_socket_obj_t *socket) {
bool socket_is_listener =
socket->type == MOD_NETWORK_SOCK_STREAM
&& socket->pcb.tcp->state == LISTEN;
@@ -394,9 +394,9 @@ static inline void exec_user_callback(lwip_socket_obj_t *socket) {
#if MICROPY_PY_LWIP_SOCK_RAW
// Callback for incoming raw packets.
#if LWIP_VERSION_MAJOR < 2
-STATIC u8_t _lwip_raw_incoming(void *arg, struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *addr)
+static u8_t _lwip_raw_incoming(void *arg, struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *addr)
#else
-STATIC u8_t _lwip_raw_incoming(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
+static u8_t _lwip_raw_incoming(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
#endif
{
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
@@ -414,9 +414,9 @@ STATIC u8_t _lwip_raw_incoming(void *arg, struct raw_pcb *pcb, struct pbuf *p, c
// Callback for incoming UDP packets. We simply stash the packet and the source address,
// in case we need it for recvfrom.
#if LWIP_VERSION_MAJOR < 2
-STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
+static void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
#else
-STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
+static void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
#endif
{
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
@@ -432,7 +432,7 @@ STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p,
}
// Callback for general tcp errors.
-STATIC void _lwip_tcp_error(void *arg, err_t err) {
+static void _lwip_tcp_error(void *arg, err_t err) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
// Free any incoming buffers or connections that are stored
@@ -444,7 +444,7 @@ STATIC void _lwip_tcp_error(void *arg, err_t err) {
}
// Callback for tcp connection requests. Error code err is unused. (See tcp.h)
-STATIC err_t _lwip_tcp_connected(void *arg, struct tcp_pcb *tpcb, err_t err) {
+static err_t _lwip_tcp_connected(void *arg, struct tcp_pcb *tpcb, err_t err) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
socket->state = STATE_CONNECTED;
@@ -453,7 +453,7 @@ STATIC err_t _lwip_tcp_connected(void *arg, struct tcp_pcb *tpcb, err_t err) {
// Handle errors (eg connection aborted) on TCP PCBs that have been put on the
// accept queue but are not yet actually accepted.
-STATIC void _lwip_tcp_err_unaccepted(void *arg, err_t err) {
+static void _lwip_tcp_err_unaccepted(void *arg, err_t err) {
struct tcp_pcb *pcb = (struct tcp_pcb *)arg;
// The ->connected entry is repurposed to store the parent socket; this is safe
@@ -493,12 +493,12 @@ STATIC void _lwip_tcp_err_unaccepted(void *arg, err_t err) {
// so set this handler which requests lwIP to keep pbuf's and deliver
// them later. We cannot cache pbufs in child socket on Python side,
// until it is created in accept().
-STATIC err_t _lwip_tcp_recv_unaccepted(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) {
+static err_t _lwip_tcp_recv_unaccepted(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) {
return ERR_BUF;
}
// Callback for incoming tcp connections.
-STATIC err_t _lwip_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err) {
+static err_t _lwip_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err) {
// err can be ERR_MEM to notify us that there was no memory for an incoming connection
if (err != ERR_OK) {
return ERR_OK;
@@ -535,7 +535,7 @@ STATIC err_t _lwip_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err) {
}
// Callback for inbound tcp packets.
-STATIC err_t _lwip_tcp_recv(void *arg, struct tcp_pcb *tcpb, struct pbuf *p, err_t err) {
+static err_t _lwip_tcp_recv(void *arg, struct tcp_pcb *tcpb, struct pbuf *p, err_t err) {
lwip_socket_obj_t *socket = (lwip_socket_obj_t *)arg;
if (p == NULL) {
@@ -566,7 +566,7 @@ STATIC err_t _lwip_tcp_recv(void *arg, struct tcp_pcb *tcpb, struct pbuf *p, err
// these to do the work.
// Helper function for send/sendto to handle raw/UDP packets.
-STATIC mp_uint_t lwip_raw_udp_send(lwip_socket_obj_t *socket, const byte *buf, mp_uint_t len, ip_addr_t *ip, mp_uint_t port, int *_errno) {
+static mp_uint_t lwip_raw_udp_send(lwip_socket_obj_t *socket, const byte *buf, mp_uint_t len, ip_addr_t *ip, mp_uint_t port, int *_errno) {
if (len > 0xffff) {
// Any packet that big is probably going to fail the pbuf_alloc anyway, but may as well try
len = 0xffff;
@@ -621,7 +621,7 @@ STATIC mp_uint_t lwip_raw_udp_send(lwip_socket_obj_t *socket, const byte *buf, m
}
// Helper function for recv/recvfrom to handle raw/UDP packets
-STATIC mp_uint_t lwip_raw_udp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
+static mp_uint_t lwip_raw_udp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
if (socket->incoming.pbuf == NULL) {
if (socket->timeout == 0) {
@@ -678,7 +678,7 @@ STATIC mp_uint_t lwip_raw_udp_receive(lwip_socket_obj_t *socket, byte *buf, mp_u
// Helper function for send/sendto to handle TCP packets
-STATIC mp_uint_t lwip_tcp_send(lwip_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) {
+static mp_uint_t lwip_tcp_send(lwip_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) {
// Check for any pending errors
STREAM_ERROR_CHECK(socket);
@@ -753,7 +753,7 @@ STATIC mp_uint_t lwip_tcp_send(lwip_socket_obj_t *socket, const byte *buf, mp_ui
}
// Helper function for recv/recvfrom to handle TCP packets
-STATIC mp_uint_t lwip_tcp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno) {
+static mp_uint_t lwip_tcp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno) {
// Check for any pending errors
STREAM_ERROR_CHECK(socket);
@@ -827,16 +827,16 @@ STATIC mp_uint_t lwip_tcp_receive(lwip_socket_obj_t *socket, byte *buf, mp_uint_
/*******************************************************************************/
// The socket functions provided by lwip.socket.
-STATIC const mp_obj_type_t lwip_socket_type;
+static const mp_obj_type_t lwip_socket_type;
-STATIC void lwip_socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void lwip_socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
lwip_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<socket state=%d timeout=%d incoming=%p off=%d>", self->state, self->timeout,
self->incoming.pbuf, self->recv_offset);
}
// FIXME: Only supports two arguments at present
-STATIC mp_obj_t lwip_socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t lwip_socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 4, false);
lwip_socket_obj_t *socket = mp_obj_malloc_with_finaliser(lwip_socket_obj_t, &lwip_socket_type);
@@ -907,7 +907,7 @@ STATIC mp_obj_t lwip_socket_make_new(const mp_obj_type_t *type, size_t n_args, s
return MP_OBJ_FROM_PTR(socket);
}
-STATIC mp_obj_t lwip_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t lwip_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
ip_addr_t bind_addr;
@@ -931,9 +931,9 @@ STATIC mp_obj_t lwip_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_bind_obj, lwip_socket_bind);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_bind_obj, lwip_socket_bind);
-STATIC mp_obj_t lwip_socket_listen(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t lwip_socket_listen(size_t n_args, const mp_obj_t *args) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(args[0]);
mp_int_t backlog = MICROPY_PY_SOCKET_LISTEN_BACKLOG_DEFAULT;
@@ -990,9 +990,9 @@ STATIC mp_obj_t lwip_socket_listen(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_listen_obj, 1, 2, lwip_socket_listen);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_listen_obj, 1, 2, lwip_socket_listen);
-STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
+static mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
if (socket->type != MOD_NETWORK_SOCK_STREAM) {
@@ -1077,9 +1077,9 @@ STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) {
return MP_OBJ_FROM_PTR(client);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(lwip_socket_accept_obj, lwip_socket_accept);
+static MP_DEFINE_CONST_FUN_OBJ_1(lwip_socket_accept_obj, lwip_socket_accept);
-STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
if (socket->pcb.tcp == NULL) {
@@ -1156,9 +1156,9 @@ STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_connect_obj, lwip_socket_connect);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_connect_obj, lwip_socket_connect);
-STATIC void lwip_socket_check_connected(lwip_socket_obj_t *socket) {
+static void lwip_socket_check_connected(lwip_socket_obj_t *socket) {
if (socket->pcb.tcp == NULL) {
// not connected
int _errno = error_lookup_table[-socket->state];
@@ -1167,7 +1167,7 @@ STATIC void lwip_socket_check_connected(lwip_socket_obj_t *socket) {
}
}
-STATIC mp_obj_t lwip_socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t lwip_socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
int _errno;
@@ -1195,9 +1195,9 @@ STATIC mp_obj_t lwip_socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
return mp_obj_new_int_from_uint(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_send_obj, lwip_socket_send);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_send_obj, lwip_socket_send);
-STATIC mp_obj_t lwip_socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t lwip_socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
int _errno;
@@ -1230,9 +1230,9 @@ STATIC mp_obj_t lwip_socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
vstr.len = ret;
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_recv_obj, lwip_socket_recv);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_recv_obj, lwip_socket_recv);
-STATIC mp_obj_t lwip_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
+static mp_obj_t lwip_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
int _errno;
@@ -1263,9 +1263,9 @@ STATIC mp_obj_t lwip_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t
return mp_obj_new_int_from_uint(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(lwip_socket_sendto_obj, lwip_socket_sendto);
+static MP_DEFINE_CONST_FUN_OBJ_3(lwip_socket_sendto_obj, lwip_socket_sendto);
-STATIC mp_obj_t lwip_socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t lwip_socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
int _errno;
@@ -1306,9 +1306,9 @@ STATIC mp_obj_t lwip_socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
tuple[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_recvfrom_obj, lwip_socket_recvfrom);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_recvfrom_obj, lwip_socket_recvfrom);
-STATIC mp_obj_t lwip_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t lwip_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
lwip_socket_check_connected(socket);
@@ -1348,9 +1348,9 @@ STATIC mp_obj_t lwip_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_sendall_obj, lwip_socket_sendall);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_sendall_obj, lwip_socket_sendall);
-STATIC mp_obj_t lwip_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
+static mp_obj_t lwip_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
mp_uint_t timeout;
if (timeout_in == mp_const_none) {
@@ -1365,9 +1365,9 @@ STATIC mp_obj_t lwip_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
socket->timeout = timeout;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_settimeout_obj, lwip_socket_settimeout);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_settimeout_obj, lwip_socket_settimeout);
-STATIC mp_obj_t lwip_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
+static mp_obj_t lwip_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
bool val = mp_obj_is_true(flag_in);
if (val) {
@@ -1377,7 +1377,7 @@ STATIC mp_obj_t lwip_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_setblocking_obj, lwip_socket_setblocking);
+static MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_setblocking_obj, lwip_socket_setblocking);
#if LWIP_VERSION_MAJOR < 2
#define MP_IGMP_IP_ADDR_TYPE ip_addr_t
@@ -1385,7 +1385,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_setblocking_obj, lwip_socket_setblo
#define MP_IGMP_IP_ADDR_TYPE ip4_addr_t
#endif
-STATIC mp_obj_t lwip_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t lwip_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
(void)n_args; // always 4
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(args[0]);
@@ -1443,15 +1443,15 @@ STATIC mp_obj_t lwip_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
#undef MP_IGMP_IP_ADDR_TYPE
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_setsockopt_obj, 4, 4, lwip_socket_setsockopt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_setsockopt_obj, 4, 4, lwip_socket_setsockopt);
-STATIC mp_obj_t lwip_socket_makefile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t lwip_socket_makefile(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return args[0];
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_makefile_obj, 1, 3, lwip_socket_makefile);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_makefile_obj, 1, 3, lwip_socket_makefile);
-STATIC mp_uint_t lwip_socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t lwip_socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
switch (socket->type) {
@@ -1467,7 +1467,7 @@ STATIC mp_uint_t lwip_socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, i
return MP_STREAM_ERROR;
}
-STATIC mp_uint_t lwip_socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t lwip_socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
switch (socket->type) {
@@ -1483,14 +1483,14 @@ STATIC mp_uint_t lwip_socket_write(mp_obj_t self_in, const void *buf, mp_uint_t
return MP_STREAM_ERROR;
}
-STATIC err_t _lwip_tcp_close_poll(void *arg, struct tcp_pcb *pcb) {
+static err_t _lwip_tcp_close_poll(void *arg, struct tcp_pcb *pcb) {
// Connection has not been cleanly closed so just abort it to free up memory
tcp_poll(pcb, NULL, 0);
tcp_abort(pcb);
return ERR_OK;
}
-STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret;
@@ -1604,7 +1604,7 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return ret;
}
-STATIC const mp_rom_map_elem_t lwip_socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t lwip_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&lwip_socket_bind_obj) },
@@ -1626,15 +1626,15 @@ STATIC const mp_rom_map_elem_t lwip_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(lwip_socket_locals_dict, lwip_socket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(lwip_socket_locals_dict, lwip_socket_locals_dict_table);
-STATIC const mp_stream_p_t lwip_socket_stream_p = {
+static const mp_stream_p_t lwip_socket_stream_p = {
.read = lwip_socket_read,
.write = lwip_socket_write,
.ioctl = lwip_socket_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
lwip_socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
@@ -1665,7 +1665,7 @@ typedef struct nic_poll {
void *poll_arg;
} nic_poll_t;
-STATIC nic_poll_t lwip_poll_list;
+static nic_poll_t lwip_poll_list;
void mod_lwip_register_poll(void (*poll)(void *arg), void *poll_arg) {
lwip_poll_list.poll = poll;
@@ -1679,14 +1679,14 @@ void mod_lwip_deregister_poll(void (*poll)(void *arg), void *poll_arg) {
/******************************************************************************/
// The lwip global functions.
-STATIC mp_obj_t mod_lwip_reset() {
+static mp_obj_t mod_lwip_reset() {
lwip_init();
lwip_poll_list.poll = NULL;
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(mod_lwip_reset_obj, mod_lwip_reset);
-STATIC mp_obj_t mod_lwip_callback() {
+static mp_obj_t mod_lwip_callback() {
if (lwip_poll_list.poll != NULL) {
lwip_poll_list.poll(lwip_poll_list.poll_arg);
}
@@ -1702,9 +1702,9 @@ typedef struct _getaddrinfo_state_t {
// Callback for incoming DNS requests.
#if LWIP_VERSION_MAJOR < 2
-STATIC void lwip_getaddrinfo_cb(const char *name, ip_addr_t *ipaddr, void *arg)
+static void lwip_getaddrinfo_cb(const char *name, ip_addr_t *ipaddr, void *arg)
#else
-STATIC void lwip_getaddrinfo_cb(const char *name, const ip_addr_t *ipaddr, void *arg)
+static void lwip_getaddrinfo_cb(const char *name, const ip_addr_t *ipaddr, void *arg)
#endif
{
getaddrinfo_state_t *state = arg;
@@ -1718,7 +1718,7 @@ STATIC void lwip_getaddrinfo_cb(const char *name, const ip_addr_t *ipaddr, void
}
// lwip.getaddrinfo
-STATIC mp_obj_t lwip_getaddrinfo(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t lwip_getaddrinfo(size_t n_args, const mp_obj_t *args) {
mp_obj_t host_in = args[0], port_in = args[1];
const char *host = mp_obj_str_get_str(host_in);
mp_int_t port = mp_obj_get_int(port_in);
@@ -1786,13 +1786,13 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_getaddrinfo_obj, 2, 6, lwip_getaddrinfo
// Debug functions
-STATIC mp_obj_t lwip_print_pcbs() {
+static mp_obj_t lwip_print_pcbs() {
tcp_debug_print_pcbs();
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(lwip_print_pcbs_obj, lwip_print_pcbs);
-STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_lwip) },
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mod_lwip_reset_obj) },
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&mod_lwip_callback_obj) },
@@ -1822,7 +1822,7 @@ STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IP_DROP_MEMBERSHIP), MP_ROM_INT(IP_DROP_MEMBERSHIP) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_lwip_globals, mp_module_lwip_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_lwip_globals, mp_module_lwip_globals_table);
const mp_obj_module_t mp_module_lwip = {
.base = { &mp_type_module },
diff --git a/extmod/modmachine.c b/extmod/modmachine.c
index a64b8ba79d..90e2a38a73 100644
--- a/extmod/modmachine.c
+++ b/extmod/modmachine.c
@@ -37,20 +37,20 @@
// The port must provide implementations of these low-level machine functions.
-STATIC void mp_machine_idle(void);
+static void mp_machine_idle(void);
#if MICROPY_PY_MACHINE_BOOTLOADER
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args);
#endif
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS
-STATIC mp_obj_t mp_machine_unique_id(void);
-NORETURN STATIC void mp_machine_reset(void);
-STATIC mp_int_t mp_machine_reset_cause(void);
-STATIC mp_obj_t mp_machine_get_freq(void);
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args);
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args);
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args);
+static mp_obj_t mp_machine_unique_id(void);
+NORETURN static void mp_machine_reset(void);
+static mp_int_t mp_machine_reset_cause(void);
+static mp_obj_t mp_machine_get_freq(void);
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args);
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args);
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args);
#endif
// The port can provide additional machine-module implementation in this file.
@@ -58,11 +58,11 @@ NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args);
#include MICROPY_PY_MACHINE_INCLUDEFILE
#endif
-STATIC mp_obj_t machine_soft_reset(void) {
+static mp_obj_t machine_soft_reset(void) {
pyexec_system_exit = PYEXEC_FORCED_EXIT;
mp_raise_type(&mp_type_SystemExit);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
+static MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
#if MICROPY_PY_MACHINE_BOOTLOADER
NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
@@ -71,30 +71,30 @@ NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_bootloader_obj, 0, 1, machine_bootloader);
#endif
-STATIC mp_obj_t machine_idle(void) {
+static mp_obj_t machine_idle(void) {
mp_machine_idle();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
+static MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
#if MICROPY_PY_MACHINE_BARE_METAL_FUNCS
-STATIC mp_obj_t machine_unique_id(void) {
+static mp_obj_t machine_unique_id(void) {
return mp_machine_unique_id();
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id);
-NORETURN STATIC mp_obj_t machine_reset(void) {
+NORETURN static mp_obj_t machine_reset(void) {
mp_machine_reset();
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
-STATIC mp_obj_t machine_reset_cause(void) {
+static mp_obj_t machine_reset_cause(void) {
return MP_OBJ_NEW_SMALL_INT(mp_machine_reset_cause());
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
-STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
return mp_machine_get_freq();
} else {
@@ -104,13 +104,13 @@ STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj, 0, 1, machine_freq);
-STATIC mp_obj_t machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_lightsleep(size_t n_args, const mp_obj_t *args) {
mp_machine_lightsleep(n_args, args);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_lightsleep_obj, 0, 1, machine_lightsleep);
-NORETURN STATIC mp_obj_t machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static mp_obj_t machine_deepsleep(size_t n_args, const mp_obj_t *args) {
mp_machine_deepsleep(n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_deepsleep_obj, 0, 1, machine_deepsleep);
@@ -119,22 +119,22 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_deepsleep_obj, 0, 1, machine_deepsle
#if MICROPY_PY_MACHINE_DISABLE_IRQ_ENABLE_IRQ
-STATIC mp_obj_t machine_disable_irq(void) {
+static mp_obj_t machine_disable_irq(void) {
uint32_t state = MICROPY_BEGIN_ATOMIC_SECTION();
return mp_obj_new_int(state);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
+static MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
-STATIC mp_obj_t machine_enable_irq(mp_obj_t state_in) {
+static mp_obj_t machine_enable_irq(mp_obj_t state_in) {
uint32_t state = mp_obj_get_int(state_in);
MICROPY_END_ATOMIC_SECTION(state);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_enable_irq_obj, machine_enable_irq);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_enable_irq_obj, machine_enable_irq);
#endif
-STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
+static const mp_rom_map_elem_t machine_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_machine) },
// Memory access objects.
@@ -230,7 +230,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
MICROPY_PY_MACHINE_EXTRA_GLOBALS
#endif
};
-STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);
+static MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);
const mp_obj_module_t mp_module_machine = {
.base = { &mp_type_module },
diff --git a/extmod/modnetwork.c b/extmod/modnetwork.c
index 527d1729e6..c8d2b9e3ff 100644
--- a/extmod/modnetwork.c
+++ b/extmod/modnetwork.c
@@ -99,16 +99,16 @@ mp_obj_t mod_network_find_nic(const uint8_t *ip) {
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("no available NIC"));
}
-STATIC mp_obj_t network_route(void) {
+static mp_obj_t network_route(void) {
return MP_OBJ_FROM_PTR(&MP_STATE_PORT(mod_network_nic_list));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(network_route_obj, network_route);
+static MP_DEFINE_CONST_FUN_OBJ_0(network_route_obj, network_route);
MP_REGISTER_ROOT_POINTER(mp_obj_list_t mod_network_nic_list);
#endif // MICROPY_PORT_NETWORK_INTERFACES
-STATIC mp_obj_t network_country(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_country(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
return mp_obj_new_str(mod_network_country_code, 2);
} else {
@@ -139,9 +139,9 @@ mp_obj_t mod_network_hostname(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_network_hostname_obj, 0, 1, mod_network_hostname);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_network_hostname_obj, 0, 1, mod_network_hostname);
-STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_network_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_network) },
{ MP_ROM_QSTR(MP_QSTR_country), MP_ROM_PTR(&mod_network_country_obj) },
{ MP_ROM_QSTR(MP_QSTR_hostname), MP_ROM_PTR(&mod_network_hostname_obj) },
@@ -162,7 +162,7 @@ STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_network_globals, mp_module_network_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_network_globals, mp_module_network_globals_table);
const mp_obj_module_t mp_module_network = {
.base = { &mp_type_module },
diff --git a/extmod/modonewire.c b/extmod/modonewire.c
index 8444181810..6bef83d03e 100644
--- a/extmod/modonewire.c
+++ b/extmod/modonewire.c
@@ -45,7 +45,7 @@
#define TIMING_WRITE2 (54)
#define TIMING_WRITE3 (10)
-STATIC int onewire_bus_reset(mp_hal_pin_obj_t pin) {
+static int onewire_bus_reset(mp_hal_pin_obj_t pin) {
mp_hal_pin_od_low(pin);
mp_hal_delay_us(TIMING_RESET1);
uint32_t i = mp_hal_quiet_timing_enter();
@@ -57,7 +57,7 @@ STATIC int onewire_bus_reset(mp_hal_pin_obj_t pin) {
return status;
}
-STATIC int onewire_bus_readbit(mp_hal_pin_obj_t pin) {
+static int onewire_bus_readbit(mp_hal_pin_obj_t pin) {
mp_hal_pin_od_high(pin);
uint32_t i = mp_hal_quiet_timing_enter();
mp_hal_pin_od_low(pin);
@@ -70,7 +70,7 @@ STATIC int onewire_bus_readbit(mp_hal_pin_obj_t pin) {
return value;
}
-STATIC void onewire_bus_writebit(mp_hal_pin_obj_t pin, int value) {
+static void onewire_bus_writebit(mp_hal_pin_obj_t pin, int value) {
uint32_t i = mp_hal_quiet_timing_enter();
mp_hal_pin_od_low(pin);
mp_hal_delay_us_fast(TIMING_WRITE1);
@@ -86,17 +86,17 @@ STATIC void onewire_bus_writebit(mp_hal_pin_obj_t pin, int value) {
/******************************************************************************/
// MicroPython bindings
-STATIC mp_obj_t onewire_reset(mp_obj_t pin_in) {
+static mp_obj_t onewire_reset(mp_obj_t pin_in) {
return mp_obj_new_bool(onewire_bus_reset(mp_hal_get_pin_obj(pin_in)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(onewire_reset_obj, onewire_reset);
+static MP_DEFINE_CONST_FUN_OBJ_1(onewire_reset_obj, onewire_reset);
-STATIC mp_obj_t onewire_readbit(mp_obj_t pin_in) {
+static mp_obj_t onewire_readbit(mp_obj_t pin_in) {
return MP_OBJ_NEW_SMALL_INT(onewire_bus_readbit(mp_hal_get_pin_obj(pin_in)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(onewire_readbit_obj, onewire_readbit);
+static MP_DEFINE_CONST_FUN_OBJ_1(onewire_readbit_obj, onewire_readbit);
-STATIC mp_obj_t onewire_readbyte(mp_obj_t pin_in) {
+static mp_obj_t onewire_readbyte(mp_obj_t pin_in) {
mp_hal_pin_obj_t pin = mp_hal_get_pin_obj(pin_in);
uint8_t value = 0;
for (int i = 0; i < 8; ++i) {
@@ -104,15 +104,15 @@ STATIC mp_obj_t onewire_readbyte(mp_obj_t pin_in) {
}
return MP_OBJ_NEW_SMALL_INT(value);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(onewire_readbyte_obj, onewire_readbyte);
+static MP_DEFINE_CONST_FUN_OBJ_1(onewire_readbyte_obj, onewire_readbyte);
-STATIC mp_obj_t onewire_writebit(mp_obj_t pin_in, mp_obj_t value_in) {
+static mp_obj_t onewire_writebit(mp_obj_t pin_in, mp_obj_t value_in) {
onewire_bus_writebit(mp_hal_get_pin_obj(pin_in), mp_obj_get_int(value_in));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(onewire_writebit_obj, onewire_writebit);
+static MP_DEFINE_CONST_FUN_OBJ_2(onewire_writebit_obj, onewire_writebit);
-STATIC mp_obj_t onewire_writebyte(mp_obj_t pin_in, mp_obj_t value_in) {
+static mp_obj_t onewire_writebyte(mp_obj_t pin_in, mp_obj_t value_in) {
mp_hal_pin_obj_t pin = mp_hal_get_pin_obj(pin_in);
int value = mp_obj_get_int(value_in);
for (int i = 0; i < 8; ++i) {
@@ -121,9 +121,9 @@ STATIC mp_obj_t onewire_writebyte(mp_obj_t pin_in, mp_obj_t value_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(onewire_writebyte_obj, onewire_writebyte);
+static MP_DEFINE_CONST_FUN_OBJ_2(onewire_writebyte_obj, onewire_writebyte);
-STATIC mp_obj_t onewire_crc8(mp_obj_t data) {
+static mp_obj_t onewire_crc8(mp_obj_t data) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
uint8_t crc = 0;
@@ -143,9 +143,9 @@ STATIC mp_obj_t onewire_crc8(mp_obj_t data) {
}
return MP_OBJ_NEW_SMALL_INT(crc);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(onewire_crc8_obj, onewire_crc8);
+static MP_DEFINE_CONST_FUN_OBJ_1(onewire_crc8_obj, onewire_crc8);
-STATIC const mp_rom_map_elem_t onewire_module_globals_table[] = {
+static const mp_rom_map_elem_t onewire_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_onewire) },
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&onewire_reset_obj) },
@@ -156,7 +156,7 @@ STATIC const mp_rom_map_elem_t onewire_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_crc8), MP_ROM_PTR(&onewire_crc8_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(onewire_module_globals, onewire_module_globals_table);
+static MP_DEFINE_CONST_DICT(onewire_module_globals, onewire_module_globals_table);
const mp_obj_module_t mp_module_onewire = {
.base = { &mp_type_module },
diff --git a/extmod/modos.c b/extmod/modos.c
index 24a36cb8ce..eda359b97b 100644
--- a/extmod/modos.c
+++ b/extmod/modos.c
@@ -73,7 +73,7 @@
#if MICROPY_PY_OS_SYNC
// sync()
// Sync all filesystems.
-STATIC mp_obj_t mp_os_sync(void) {
+static mp_obj_t mp_os_sync(void) {
#if MICROPY_VFS_FAT
for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) {
// this assumes that vfs->obj is fs_user_mount_t with block device functions
@@ -93,20 +93,20 @@ MP_DEFINE_CONST_FUN_OBJ_0(mp_os_sync_obj, mp_os_sync);
#define CONST_RELEASE const
#endif
-STATIC const qstr mp_os_uname_info_fields[] = {
+static const qstr mp_os_uname_info_fields[] = {
MP_QSTR_sysname,
MP_QSTR_nodename,
MP_QSTR_release,
MP_QSTR_version,
MP_QSTR_machine
};
-STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM);
-STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM);
-STATIC CONST_RELEASE MP_DEFINE_STR_OBJ(mp_os_uname_info_release_obj, MICROPY_VERSION_STRING);
-STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN);
-STATIC const MP_DEFINE_STR_OBJ(mp_os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
+static const MP_DEFINE_STR_OBJ(mp_os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM);
+static const MP_DEFINE_STR_OBJ(mp_os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM);
+static CONST_RELEASE MP_DEFINE_STR_OBJ(mp_os_uname_info_release_obj, MICROPY_VERSION_STRING);
+static const MP_DEFINE_STR_OBJ(mp_os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN);
+static const MP_DEFINE_STR_OBJ(mp_os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
-STATIC MP_DEFINE_ATTRTUPLE(
+static MP_DEFINE_ATTRTUPLE(
mp_os_uname_info_obj,
mp_os_uname_info_fields,
5,
@@ -117,7 +117,7 @@ STATIC MP_DEFINE_ATTRTUPLE(
MP_ROM_PTR(&mp_os_uname_info_machine_obj)
);
-STATIC mp_obj_t mp_os_uname(void) {
+static mp_obj_t mp_os_uname(void) {
#if MICROPY_PY_OS_UNAME_RELEASE_DYNAMIC
const char *release = mp_os_uname_release();
mp_os_uname_info_release_obj.len = strlen(release);
@@ -125,12 +125,12 @@ STATIC mp_obj_t mp_os_uname(void) {
#endif
return MP_OBJ_FROM_PTR(&mp_os_uname_info_obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_os_uname_obj, mp_os_uname);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_os_uname_obj, mp_os_uname);
#endif
#if MICROPY_PY_OS_DUPTERM_NOTIFY
-STATIC mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) {
+static mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) {
(void)obj_in;
for (;;) {
int c = mp_os_dupterm_rx_chr();
@@ -141,10 +141,10 @@ STATIC mp_obj_t mp_os_dupterm_notify(mp_obj_t obj_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_dupterm_notify_obj, mp_os_dupterm_notify);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_dupterm_notify_obj, mp_os_dupterm_notify);
#endif
-STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
+static const mp_rom_map_elem_t os_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_os) },
#if MICROPY_PY_OS_GETENV_PUTENV_UNSETENV
@@ -223,7 +223,7 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_mbfs_remove_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table);
+static MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table);
const mp_obj_module_t mp_module_os = {
.base = { &mp_type_module },
diff --git a/extmod/modplatform.c b/extmod/modplatform.c
index 73846f946d..c6d4d31b97 100644
--- a/extmod/modplatform.c
+++ b/extmod/modplatform.c
@@ -36,39 +36,39 @@
// platform - Access to underlying platform's identifying data
-STATIC const MP_DEFINE_STR_OBJ(info_platform_obj, MICROPY_PLATFORM_SYSTEM "-" \
+static const MP_DEFINE_STR_OBJ(info_platform_obj, MICROPY_PLATFORM_SYSTEM "-" \
MICROPY_VERSION_STRING "-" MICROPY_PLATFORM_ARCH "-" MICROPY_PLATFORM_VERSION "-with-" \
MICROPY_PLATFORM_LIBC_LIB "" MICROPY_PLATFORM_LIBC_VER);
-STATIC const MP_DEFINE_STR_OBJ(info_python_compiler_obj, MICROPY_PLATFORM_COMPILER);
-STATIC const MP_DEFINE_STR_OBJ(info_libc_lib_obj, MICROPY_PLATFORM_LIBC_LIB);
-STATIC const MP_DEFINE_STR_OBJ(info_libc_ver_obj, MICROPY_PLATFORM_LIBC_VER);
-STATIC const mp_rom_obj_tuple_t info_libc_tuple_obj = {
+static const MP_DEFINE_STR_OBJ(info_python_compiler_obj, MICROPY_PLATFORM_COMPILER);
+static const MP_DEFINE_STR_OBJ(info_libc_lib_obj, MICROPY_PLATFORM_LIBC_LIB);
+static const MP_DEFINE_STR_OBJ(info_libc_ver_obj, MICROPY_PLATFORM_LIBC_VER);
+static const mp_rom_obj_tuple_t info_libc_tuple_obj = {
{&mp_type_tuple}, 2, {MP_ROM_PTR(&info_libc_lib_obj), MP_ROM_PTR(&info_libc_ver_obj)}
};
-STATIC mp_obj_t platform_platform(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t platform_platform(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return MP_OBJ_FROM_PTR(&info_platform_obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(platform_platform_obj, 0, platform_platform);
+static MP_DEFINE_CONST_FUN_OBJ_KW(platform_platform_obj, 0, platform_platform);
-STATIC mp_obj_t platform_python_compiler(void) {
+static mp_obj_t platform_python_compiler(void) {
return MP_OBJ_FROM_PTR(&info_python_compiler_obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(platform_python_compiler_obj, platform_python_compiler);
+static MP_DEFINE_CONST_FUN_OBJ_0(platform_python_compiler_obj, platform_python_compiler);
-STATIC mp_obj_t platform_libc_ver(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t platform_libc_ver(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return MP_OBJ_FROM_PTR(&info_libc_tuple_obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(platform_libc_ver_obj, 0, platform_libc_ver);
+static MP_DEFINE_CONST_FUN_OBJ_KW(platform_libc_ver_obj, 0, platform_libc_ver);
-STATIC const mp_rom_map_elem_t modplatform_globals_table[] = {
+static const mp_rom_map_elem_t modplatform_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_platform) },
{ MP_ROM_QSTR(MP_QSTR_platform), MP_ROM_PTR(&platform_platform_obj) },
{ MP_ROM_QSTR(MP_QSTR_python_compiler), MP_ROM_PTR(&platform_python_compiler_obj) },
{ MP_ROM_QSTR(MP_QSTR_libc_ver), MP_ROM_PTR(&platform_libc_ver_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(modplatform_globals, modplatform_globals_table);
+static MP_DEFINE_CONST_DICT(modplatform_globals, modplatform_globals_table);
const mp_obj_module_t mp_module_platform = {
.base = { &mp_type_module },
diff --git a/extmod/modrandom.c b/extmod/modrandom.c
index d66f1c9c46..79a1b18baa 100644
--- a/extmod/modrandom.c
+++ b/extmod/modrandom.c
@@ -46,16 +46,16 @@
#if !MICROPY_ENABLE_DYNRUNTIME
#if SEED_ON_IMPORT
// If the state is seeded on import then keep these variables in the BSS.
-STATIC uint32_t yasmarang_pad, yasmarang_n, yasmarang_d;
-STATIC uint8_t yasmarang_dat;
+static uint32_t yasmarang_pad, yasmarang_n, yasmarang_d;
+static uint8_t yasmarang_dat;
#else
// Without seed-on-import these variables must be initialised via the data section.
-STATIC uint32_t yasmarang_pad = 0xeda4baba, yasmarang_n = 69, yasmarang_d = 233;
-STATIC uint8_t yasmarang_dat = 0;
+static uint32_t yasmarang_pad = 0xeda4baba, yasmarang_n = 69, yasmarang_d = 233;
+static uint8_t yasmarang_dat = 0;
#endif
#endif
-STATIC uint32_t yasmarang(void) {
+static uint32_t yasmarang(void) {
yasmarang_pad += yasmarang_dat + yasmarang_d * yasmarang_n;
yasmarang_pad = (yasmarang_pad << 3) + (yasmarang_pad >> 29);
yasmarang_n = yasmarang_pad | 2;
@@ -71,7 +71,7 @@ STATIC uint32_t yasmarang(void) {
// returns an unsigned integer below the given argument
// n must not be zero
-STATIC uint32_t yasmarang_randbelow(uint32_t n) {
+static uint32_t yasmarang_randbelow(uint32_t n) {
uint32_t mask = 1;
while ((n & mask) < n) {
mask = (mask << 1) | 1;
@@ -85,7 +85,7 @@ STATIC uint32_t yasmarang_randbelow(uint32_t n) {
#endif
-STATIC mp_obj_t mod_random_getrandbits(mp_obj_t num_in) {
+static mp_obj_t mod_random_getrandbits(mp_obj_t num_in) {
mp_int_t n = mp_obj_get_int(num_in);
if (n > 32 || n < 0) {
mp_raise_ValueError(MP_ERROR_TEXT("bits must be 32 or less"));
@@ -98,9 +98,9 @@ STATIC mp_obj_t mod_random_getrandbits(mp_obj_t num_in) {
mask >>= (32 - n);
return mp_obj_new_int_from_uint(yasmarang() & mask);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_random_getrandbits_obj, mod_random_getrandbits);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_random_getrandbits_obj, mod_random_getrandbits);
-STATIC mp_obj_t mod_random_seed(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_random_seed(size_t n_args, const mp_obj_t *args) {
mp_uint_t seed;
if (n_args == 0 || args[0] == mp_const_none) {
#ifdef MICROPY_PY_RANDOM_SEED_INIT_FUNC
@@ -117,11 +117,11 @@ STATIC mp_obj_t mod_random_seed(size_t n_args, const mp_obj_t *args) {
yasmarang_dat = 0;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_random_seed_obj, 0, 1, mod_random_seed);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_random_seed_obj, 0, 1, mod_random_seed);
#if MICROPY_PY_RANDOM_EXTRA_FUNCS
-STATIC mp_obj_t mod_random_randrange(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_random_randrange(size_t n_args, const mp_obj_t *args) {
mp_int_t start = mp_obj_get_int(args[0]);
if (n_args == 1) {
// range(stop)
@@ -161,9 +161,9 @@ STATIC mp_obj_t mod_random_randrange(size_t n_args, const mp_obj_t *args) {
error:
mp_raise_ValueError(NULL);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_random_randrange_obj, 1, 3, mod_random_randrange);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_random_randrange_obj, 1, 3, mod_random_randrange);
-STATIC mp_obj_t mod_random_randint(mp_obj_t a_in, mp_obj_t b_in) {
+static mp_obj_t mod_random_randint(mp_obj_t a_in, mp_obj_t b_in) {
mp_int_t a = mp_obj_get_int(a_in);
mp_int_t b = mp_obj_get_int(b_in);
if (a <= b) {
@@ -172,9 +172,9 @@ STATIC mp_obj_t mod_random_randint(mp_obj_t a_in, mp_obj_t b_in) {
mp_raise_ValueError(NULL);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_random_randint_obj, mod_random_randint);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_random_randint_obj, mod_random_randint);
-STATIC mp_obj_t mod_random_choice(mp_obj_t seq) {
+static mp_obj_t mod_random_choice(mp_obj_t seq) {
mp_int_t len = mp_obj_get_int(mp_obj_len(seq));
if (len > 0) {
return mp_obj_subscr(seq, mp_obj_new_int(yasmarang_randbelow((uint32_t)len)), MP_OBJ_SENTINEL);
@@ -182,12 +182,12 @@ STATIC mp_obj_t mod_random_choice(mp_obj_t seq) {
mp_raise_type(&mp_type_IndexError);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_random_choice_obj, mod_random_choice);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_random_choice_obj, mod_random_choice);
#if MICROPY_PY_BUILTINS_FLOAT
// returns a number in the range [0..1) using Yasmarang to fill in the fraction bits
-STATIC mp_float_t yasmarang_float(void) {
+static mp_float_t yasmarang_float(void) {
mp_float_union_t u;
u.p.sgn = 0;
u.p.exp = (1 << (MP_FLOAT_EXP_BITS - 1)) - 1;
@@ -199,24 +199,24 @@ STATIC mp_float_t yasmarang_float(void) {
return u.f - 1;
}
-STATIC mp_obj_t mod_random_random(void) {
+static mp_obj_t mod_random_random(void) {
return mp_obj_new_float(yasmarang_float());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_random_random_obj, mod_random_random);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_random_random_obj, mod_random_random);
-STATIC mp_obj_t mod_random_uniform(mp_obj_t a_in, mp_obj_t b_in) {
+static mp_obj_t mod_random_uniform(mp_obj_t a_in, mp_obj_t b_in) {
mp_float_t a = mp_obj_get_float(a_in);
mp_float_t b = mp_obj_get_float(b_in);
return mp_obj_new_float(a + (b - a) * yasmarang_float());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_random_uniform_obj, mod_random_uniform);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_random_uniform_obj, mod_random_uniform);
#endif
#endif // MICROPY_PY_RANDOM_EXTRA_FUNCS
#if SEED_ON_IMPORT
-STATIC mp_obj_t mod_random___init__(void) {
+static mp_obj_t mod_random___init__(void) {
// This module may be imported by more than one name so need to ensure
// that it's only ever seeded once.
static bool seeded = false;
@@ -226,11 +226,11 @@ STATIC mp_obj_t mod_random___init__(void) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_random___init___obj, mod_random___init__);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_random___init___obj, mod_random___init__);
#endif
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t mp_module_random_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_random_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_random) },
#if SEED_ON_IMPORT
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&mod_random___init___obj) },
@@ -248,7 +248,7 @@ STATIC const mp_rom_map_elem_t mp_module_random_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_random_globals, mp_module_random_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_random_globals, mp_module_random_globals_table);
const mp_obj_module_t mp_module_random = {
.base = { &mp_type_module },
diff --git a/extmod/modre.c b/extmod/modre.c
index 9d5d717872..2a3fdfd350 100644
--- a/extmod/modre.c
+++ b/extmod/modre.c
@@ -57,18 +57,18 @@ typedef struct _mp_obj_match_t {
const char *caps[0];
} mp_obj_match_t;
-STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args);
+static mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args);
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_obj_type_t re_type;
+static const mp_obj_type_t re_type;
#endif
-STATIC void match_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void match_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_match_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<match num=%d>", self->num_matches);
}
-STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) {
+static mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) {
mp_obj_match_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t no = mp_obj_get_int(no_in);
if (no < 0 || no >= self->num_matches) {
@@ -87,7 +87,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(match_group_obj, match_group);
#if MICROPY_PY_RE_MATCH_GROUPS
-STATIC mp_obj_t match_groups(mp_obj_t self_in) {
+static mp_obj_t match_groups(mp_obj_t self_in) {
mp_obj_match_t *self = MP_OBJ_TO_PTR(self_in);
if (self->num_matches <= 1) {
return mp_const_empty_tuple;
@@ -104,7 +104,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(match_groups_obj, match_groups);
#if MICROPY_PY_RE_MATCH_SPAN_START_END
-STATIC void match_span_helper(size_t n_args, const mp_obj_t *args, mp_obj_t span[2]) {
+static void match_span_helper(size_t n_args, const mp_obj_t *args, mp_obj_t span[2]) {
mp_obj_match_t *self = MP_OBJ_TO_PTR(args[0]);
mp_int_t no = 0;
@@ -141,21 +141,21 @@ STATIC void match_span_helper(size_t n_args, const mp_obj_t *args, mp_obj_t span
span[1] = mp_obj_new_int(e);
}
-STATIC mp_obj_t match_span(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t match_span(size_t n_args, const mp_obj_t *args) {
mp_obj_t span[2];
match_span_helper(n_args, args, span);
return mp_obj_new_tuple(2, span);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(match_span_obj, 1, 2, match_span);
-STATIC mp_obj_t match_start(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t match_start(size_t n_args, const mp_obj_t *args) {
mp_obj_t span[2];
match_span_helper(n_args, args, span);
return span[0];
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(match_start_obj, 1, 2, match_start);
-STATIC mp_obj_t match_end(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t match_end(size_t n_args, const mp_obj_t *args) {
mp_obj_t span[2];
match_span_helper(n_args, args, span);
return span[1];
@@ -165,7 +165,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(match_end_obj, 1, 2, match_end);
#endif
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t match_locals_dict_table[] = {
+static const mp_rom_map_elem_t match_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_group), MP_ROM_PTR(&match_group_obj) },
#if MICROPY_PY_RE_MATCH_GROUPS
{ MP_ROM_QSTR(MP_QSTR_groups), MP_ROM_PTR(&match_groups_obj) },
@@ -177,9 +177,9 @@ STATIC const mp_rom_map_elem_t match_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table);
+static MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
match_type,
MP_QSTR_match,
MP_TYPE_FLAG_NONE,
@@ -188,13 +188,13 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif
-STATIC void re_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void re_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_re_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<re %p>", self);
}
-STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
+static mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_re_t *self;
if (mp_obj_is_type(args[0], (mp_obj_type_t *)&re_type)) {
@@ -222,17 +222,17 @@ STATIC mp_obj_t re_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(match);
}
-STATIC mp_obj_t re_match(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t re_match(size_t n_args, const mp_obj_t *args) {
return re_exec(true, n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_match_obj, 2, 4, re_match);
-STATIC mp_obj_t re_search(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t re_search(size_t n_args, const mp_obj_t *args) {
return re_exec(false, n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_search_obj, 2, 4, re_search);
-STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
mp_obj_re_t *self = MP_OBJ_TO_PTR(args[0]);
Subject subj;
size_t len;
@@ -279,7 +279,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_split_obj, 2, 3, re_split);
#if MICROPY_PY_RE_SUB
-STATIC mp_obj_t re_sub_helper(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t re_sub_helper(size_t n_args, const mp_obj_t *args) {
mp_obj_re_t *self;
if (mp_obj_is_type(args[0], (mp_obj_type_t *)&re_type)) {
self = MP_OBJ_TO_PTR(args[0]);
@@ -401,7 +401,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_sub_obj, 3, 5, re_sub_helper);
#endif
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t re_locals_dict_table[] = {
+static const mp_rom_map_elem_t re_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_match), MP_ROM_PTR(&re_match_obj) },
{ MP_ROM_QSTR(MP_QSTR_search), MP_ROM_PTR(&re_search_obj) },
{ MP_ROM_QSTR(MP_QSTR_split), MP_ROM_PTR(&re_split_obj) },
@@ -410,9 +410,9 @@ STATIC const mp_rom_map_elem_t re_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
+static MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
re_type,
MP_QSTR_re,
MP_TYPE_FLAG_NONE,
@@ -421,7 +421,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif
-STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
(void)n_args;
const char *re_str = mp_obj_str_get_str(args[0]);
int size = re1_5_sizecode(re_str);
@@ -450,7 +450,7 @@ STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_compile_obj, 1, 2, mod_re_compile);
#if !MICROPY_ENABLE_DYNRUNTIME
-STATIC const mp_rom_map_elem_t mp_module_re_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_re_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_re) },
{ MP_ROM_QSTR(MP_QSTR_compile), MP_ROM_PTR(&mod_re_compile_obj) },
{ MP_ROM_QSTR(MP_QSTR_match), MP_ROM_PTR(&re_match_obj) },
@@ -463,7 +463,7 @@ STATIC const mp_rom_map_elem_t mp_module_re_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_re_globals, mp_module_re_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_re_globals, mp_module_re_globals_table);
const mp_obj_module_t mp_module_re = {
.base = { &mp_type_module },
diff --git a/extmod/modselect.c b/extmod/modselect.c
index 9b81ba509f..d06157e585 100644
--- a/extmod/modselect.c
+++ b/extmod/modselect.c
@@ -96,7 +96,7 @@ typedef struct _poll_set_t {
#endif
} poll_set_t;
-STATIC void poll_set_init(poll_set_t *poll_set, size_t n) {
+static void poll_set_init(poll_set_t *poll_set, size_t n) {
mp_map_init(&poll_set->map, n);
#if MICROPY_PY_SELECT_POSIX_OPTIMISATIONS
poll_set->alloc = 0;
@@ -107,19 +107,19 @@ STATIC void poll_set_init(poll_set_t *poll_set, size_t n) {
}
#if MICROPY_PY_SELECT_SELECT
-STATIC void poll_set_deinit(poll_set_t *poll_set) {
+static void poll_set_deinit(poll_set_t *poll_set) {
mp_map_deinit(&poll_set->map);
}
#endif
#if MICROPY_PY_SELECT_POSIX_OPTIMISATIONS
-STATIC mp_uint_t poll_obj_get_events(poll_obj_t *poll_obj) {
+static mp_uint_t poll_obj_get_events(poll_obj_t *poll_obj) {
assert(poll_obj->pollfd == NULL);
return poll_obj->nonfd_events;
}
-STATIC void poll_obj_set_events(poll_obj_t *poll_obj, mp_uint_t events) {
+static void poll_obj_set_events(poll_obj_t *poll_obj, mp_uint_t events) {
if (poll_obj->pollfd != NULL) {
poll_obj->pollfd->events = events;
} else {
@@ -127,7 +127,7 @@ STATIC void poll_obj_set_events(poll_obj_t *poll_obj, mp_uint_t events) {
}
}
-STATIC mp_uint_t poll_obj_get_revents(poll_obj_t *poll_obj) {
+static mp_uint_t poll_obj_get_revents(poll_obj_t *poll_obj) {
if (poll_obj->pollfd != NULL) {
return poll_obj->pollfd->revents;
} else {
@@ -135,7 +135,7 @@ STATIC mp_uint_t poll_obj_get_revents(poll_obj_t *poll_obj) {
}
}
-STATIC void poll_obj_set_revents(poll_obj_t *poll_obj, mp_uint_t revents) {
+static void poll_obj_set_revents(poll_obj_t *poll_obj, mp_uint_t revents) {
if (poll_obj->pollfd != NULL) {
poll_obj->pollfd->revents = revents;
} else {
@@ -146,7 +146,7 @@ STATIC void poll_obj_set_revents(poll_obj_t *poll_obj, mp_uint_t revents) {
// How much (in pollfds) to grow the allocation for poll_set->pollfds by.
#define POLL_SET_ALLOC_INCREMENT (4)
-STATIC struct pollfd *poll_set_add_fd(poll_set_t *poll_set, int fd) {
+static struct pollfd *poll_set_add_fd(poll_set_t *poll_set, int fd) {
struct pollfd *free_slot = NULL;
if (poll_set->used == poll_set->max_used) {
@@ -228,7 +228,7 @@ static inline void poll_obj_set_revents(poll_obj_t *poll_obj, mp_uint_t revents)
#endif
-STATIC void poll_set_add_obj(poll_set_t *poll_set, const mp_obj_t *obj, mp_uint_t obj_len, mp_uint_t events, bool or_events) {
+static void poll_set_add_obj(poll_set_t *poll_set, const mp_obj_t *obj, mp_uint_t obj_len, mp_uint_t events, bool or_events) {
for (mp_uint_t i = 0; i < obj_len; i++) {
mp_map_elem_t *elem = mp_map_lookup(&poll_set->map, mp_obj_id(obj[i]), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND);
if (elem->value == MP_OBJ_NULL) {
@@ -290,7 +290,7 @@ STATIC void poll_set_add_obj(poll_set_t *poll_set, const mp_obj_t *obj, mp_uint_
}
// For each object in the poll set, poll it once.
-STATIC mp_uint_t poll_set_poll_once(poll_set_t *poll_set, size_t *rwx_num) {
+static mp_uint_t poll_set_poll_once(poll_set_t *poll_set, size_t *rwx_num) {
mp_uint_t n_ready = 0;
for (mp_uint_t i = 0; i < poll_set->map.alloc; ++i) {
if (!mp_map_slot_is_filled(&poll_set->map, i)) {
@@ -338,7 +338,7 @@ STATIC mp_uint_t poll_set_poll_once(poll_set_t *poll_set, size_t *rwx_num) {
return n_ready;
}
-STATIC mp_uint_t poll_set_poll_until_ready_or_timeout(poll_set_t *poll_set, size_t *rwx_num, mp_uint_t timeout) {
+static mp_uint_t poll_set_poll_until_ready_or_timeout(poll_set_t *poll_set, size_t *rwx_num, mp_uint_t timeout) {
mp_uint_t start_ticks = mp_hal_ticks_ms();
bool has_timeout = timeout != (mp_uint_t)-1;
@@ -414,7 +414,7 @@ STATIC mp_uint_t poll_set_poll_until_ready_or_timeout(poll_set_t *poll_set, size
#if MICROPY_PY_SELECT_SELECT
// select(rlist, wlist, xlist[, timeout])
-STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
// get array data from tuple/list arguments
size_t rwx_len[3];
mp_obj_t *r_array, *w_array, *x_array;
@@ -486,7 +486,7 @@ typedef struct _mp_obj_poll_t {
} mp_obj_poll_t;
// register(obj[, eventmask])
-STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
mp_uint_t events;
if (n_args == 3) {
@@ -500,7 +500,7 @@ STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(poll_register_obj, 2, 3, poll_register);
// unregister(obj)
-STATIC mp_obj_t poll_unregister(mp_obj_t self_in, mp_obj_t obj_in) {
+static mp_obj_t poll_unregister(mp_obj_t self_in, mp_obj_t obj_in) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(self_in);
mp_map_elem_t *elem = mp_map_lookup(&self->poll_set.map, mp_obj_id(obj_in), MP_MAP_LOOKUP_REMOVE_IF_FOUND);
@@ -523,7 +523,7 @@ STATIC mp_obj_t poll_unregister(mp_obj_t self_in, mp_obj_t obj_in) {
MP_DEFINE_CONST_FUN_OBJ_2(poll_unregister_obj, poll_unregister);
// modify(obj, eventmask)
-STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmask_in) {
+static mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmask_in) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(self_in);
mp_map_elem_t *elem = mp_map_lookup(&self->poll_set.map, mp_obj_id(obj_in), MP_MAP_LOOKUP);
if (elem == NULL) {
@@ -534,7 +534,7 @@ STATIC mp_obj_t poll_modify(mp_obj_t self_in, mp_obj_t obj_in, mp_obj_t eventmas
}
MP_DEFINE_CONST_FUN_OBJ_3(poll_modify_obj, poll_modify);
-STATIC mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
+static mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
// work out timeout (its given already in ms)
@@ -557,7 +557,7 @@ STATIC mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
return poll_set_poll_until_ready_or_timeout(&self->poll_set, NULL, timeout);
}
-STATIC mp_obj_t poll_poll(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t poll_poll(size_t n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
mp_uint_t n_ready = poll_poll_internal(n_args, args);
@@ -578,7 +578,7 @@ STATIC mp_obj_t poll_poll(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(poll_poll_obj, 1, 2, poll_poll);
-STATIC mp_obj_t poll_ipoll(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t poll_ipoll(size_t n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
if (self->ret_tuple == MP_OBJ_NULL) {
@@ -593,7 +593,7 @@ STATIC mp_obj_t poll_ipoll(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(poll_ipoll_obj, 1, 3, poll_ipoll);
-STATIC mp_obj_t poll_iternext(mp_obj_t self_in) {
+static mp_obj_t poll_iternext(mp_obj_t self_in) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(self_in);
if (self->iter_cnt == 0) {
@@ -625,16 +625,16 @@ STATIC mp_obj_t poll_iternext(mp_obj_t self_in) {
return MP_OBJ_STOP_ITERATION;
}
-STATIC const mp_rom_map_elem_t poll_locals_dict_table[] = {
+static const mp_rom_map_elem_t poll_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_register), MP_ROM_PTR(&poll_register_obj) },
{ MP_ROM_QSTR(MP_QSTR_unregister), MP_ROM_PTR(&poll_unregister_obj) },
{ MP_ROM_QSTR(MP_QSTR_modify), MP_ROM_PTR(&poll_modify_obj) },
{ MP_ROM_QSTR(MP_QSTR_poll), MP_ROM_PTR(&poll_poll_obj) },
{ MP_ROM_QSTR(MP_QSTR_ipoll), MP_ROM_PTR(&poll_ipoll_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(poll_locals_dict, poll_locals_dict_table);
+static MP_DEFINE_CONST_DICT(poll_locals_dict, poll_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_poll,
MP_QSTR_poll,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
@@ -643,7 +643,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
// poll()
-STATIC mp_obj_t select_poll(void) {
+static mp_obj_t select_poll(void) {
mp_obj_poll_t *poll = mp_obj_malloc(mp_obj_poll_t, &mp_type_poll);
poll_set_init(&poll->poll_set, 0);
poll->iter_cnt = 0;
@@ -652,7 +652,7 @@ STATIC mp_obj_t select_poll(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_select_poll_obj, select_poll);
-STATIC const mp_rom_map_elem_t mp_module_select_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_select_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_select) },
#if MICROPY_PY_SELECT_SELECT
{ MP_ROM_QSTR(MP_QSTR_select), MP_ROM_PTR(&mp_select_select_obj) },
@@ -664,7 +664,7 @@ STATIC const mp_rom_map_elem_t mp_module_select_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_POLLHUP), MP_ROM_INT(MP_STREAM_POLL_HUP) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_select_globals, mp_module_select_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_select_globals, mp_module_select_globals_table);
const mp_obj_module_t mp_module_select = {
.base = { &mp_type_module },
diff --git a/extmod/modsocket.c b/extmod/modsocket.c
index 4a857fb62e..eedc17b2ff 100644
--- a/extmod/modsocket.c
+++ b/extmod/modsocket.c
@@ -41,16 +41,16 @@
/******************************************************************************/
// socket class
-STATIC const mp_obj_type_t socket_type;
+static const mp_obj_type_t socket_type;
-STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<socket fd=%d timeout=%d domain=%d type=%d proto=%d bound=%b>",
self->fileno, self->timeout, self->domain, self->type, self->proto, self->bound);
}
// constructor socket(domain=AF_INET, type=SOCK_STREAM, proto=0)
-STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 3, false);
// create socket object (not bound to any NIC yet)
@@ -81,7 +81,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(s);
}
-STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) {
+static void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) {
if (self->nic == MP_OBJ_NULL) {
// select NIC based on IP
self->nic = mod_network_find_nic(ip);
@@ -103,7 +103,7 @@ STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) {
}
// method socket.bind(address)
-STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// get address
@@ -121,10 +121,10 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
// method socket.listen([backlog])
-STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (self->nic == MP_OBJ_NULL) {
@@ -149,10 +149,10 @@ STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
// method socket.accept()
-STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
+static mp_obj_t socket_accept(mp_obj_t self_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->nic == MP_OBJ_NULL) {
@@ -198,10 +198,10 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
return MP_OBJ_FROM_PTR(client);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
+static MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
// method socket.connect(address)
-STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// get address
@@ -222,10 +222,10 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
// method socket.send(bytes)
-STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->nic == MP_OBJ_NULL) {
// not connected
@@ -240,9 +240,9 @@ STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
}
return mp_obj_new_int_from_uint(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
-STATIC mp_obj_t socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->nic == MP_OBJ_NULL) {
// not connected
@@ -274,10 +274,10 @@ STATIC mp_obj_t socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
}
return mp_obj_new_int_from_uint(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_sendall_obj, socket_sendall);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_sendall_obj, socket_sendall);
// method socket.recv(bufsize)
-STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->nic == MP_OBJ_NULL) {
// not connected
@@ -297,10 +297,10 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
vstr.len = ret;
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
// method socket.sendto(bytes, address)
-STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
+static mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// get the data
@@ -323,10 +323,10 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
return mp_obj_new_int(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
+static MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
// method socket.recvfrom(bufsize)
-STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->nic == MP_OBJ_NULL) {
// not connected
@@ -351,10 +351,10 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
tuple[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
// method socket.setsockopt(level, optname, value)
-STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (self->nic == MP_OBJ_NULL) {
@@ -393,19 +393,19 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
-STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return args[0];
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
// method socket.settimeout(value)
// timeout=0 means non-blocking
// timeout=None means blocking
// otherwise, timeout is in seconds
-STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
+static mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t timeout;
if (timeout_in == mp_const_none) {
@@ -433,19 +433,19 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
// method socket.setblocking(flag)
-STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
+static mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
if (mp_obj_is_true(blocking)) {
return socket_settimeout(self_in, mp_const_none);
} else {
return socket_settimeout(self_in, MP_OBJ_NEW_SMALL_INT(0));
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
-STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socket_bind_obj) },
@@ -468,7 +468,7 @@ STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -520,14 +520,14 @@ mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *
return self->nic_protocol->ioctl(self, request, arg, errcode);
}
-STATIC const mp_stream_p_t socket_stream_p = {
+static const mp_stream_p_t socket_stream_p = {
.read = socket_read,
.write = socket_write,
.ioctl = socket_ioctl,
.is_text = false,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
@@ -541,7 +541,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
// socket module
// function socket.getaddrinfo(host, port)
-STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
size_t hlen;
const char *host = mp_obj_str_get_data(args[0], &hlen);
mp_int_t port = mp_obj_get_int(args[1]);
@@ -611,9 +611,9 @@ STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
tuple->items[4] = netutils_format_inet_addr(out_ip, port, NETUTILS_BIG);
return mp_obj_new_list(1, (mp_obj_t *)&tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 6, mod_socket_getaddrinfo);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 6, mod_socket_getaddrinfo);
-STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) },
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) },
@@ -645,7 +645,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
*/
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
const mp_obj_module_t mp_module_socket = {
.base = { &mp_type_module },
diff --git a/extmod/modtime.c b/extmod/modtime.c
index 805c2621c0..deb4bb4c9a 100644
--- a/extmod/modtime.c
+++ b/extmod/modtime.c
@@ -52,7 +52,7 @@
// - second is 0-59
// - weekday is 0-6 for Mon-Sun
// - yearday is 1-366
-STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
if (n_args == 0 || args[0] == mp_const_none) {
// Get current date and time.
return mp_time_localtime_get();
@@ -80,7 +80,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_time_localtime_obj, 0, 1, time_localtime)
// This is the inverse function of localtime. Its argument is a full 8-tuple
// which expresses a time as per localtime. It returns an integer which is
// the number of seconds since the Epoch (eg 1st Jan 1970, or 1st Jan 2000).
-STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
+static mp_obj_t time_mktime(mp_obj_t tuple) {
size_t len;
mp_obj_t *elem;
mp_obj_get_array(tuple, &len, &elem);
@@ -102,21 +102,21 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_time_mktime_obj, time_mktime);
// time()
// Return the number of seconds since the Epoch.
-STATIC mp_obj_t time_time(void) {
+static mp_obj_t time_time(void) {
return mp_time_time_get();
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_time_time_obj, time_time);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_time_time_obj, time_time);
// time_ns()
// Returns the number of nanoseconds since the Epoch, as an integer.
-STATIC mp_obj_t time_time_ns(void) {
+static mp_obj_t time_time_ns(void) {
return mp_obj_new_int_from_ull(mp_hal_time_ns());
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_time_time_ns_obj, time_time_ns);
#endif // MICROPY_PY_TIME_TIME_TIME_NS
-STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
+static mp_obj_t time_sleep(mp_obj_t seconds_o) {
#ifdef MICROPY_PY_TIME_CUSTOM_SLEEP
mp_time_sleep(seconds_o);
#else
@@ -130,7 +130,7 @@ STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_time_sleep_obj, time_sleep);
-STATIC mp_obj_t time_sleep_ms(mp_obj_t arg) {
+static mp_obj_t time_sleep_ms(mp_obj_t arg) {
mp_int_t ms = mp_obj_get_int(arg);
if (ms >= 0) {
mp_hal_delay_ms(ms);
@@ -139,7 +139,7 @@ STATIC mp_obj_t time_sleep_ms(mp_obj_t arg) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_time_sleep_ms_obj, time_sleep_ms);
-STATIC mp_obj_t time_sleep_us(mp_obj_t arg) {
+static mp_obj_t time_sleep_us(mp_obj_t arg) {
mp_int_t us = mp_obj_get_int(arg);
if (us > 0) {
mp_hal_delay_us(us);
@@ -148,22 +148,22 @@ STATIC mp_obj_t time_sleep_us(mp_obj_t arg) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_time_sleep_us_obj, time_sleep_us);
-STATIC mp_obj_t time_ticks_ms(void) {
+static mp_obj_t time_ticks_ms(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms() & (MICROPY_PY_TIME_TICKS_PERIOD - 1));
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_time_ticks_ms_obj, time_ticks_ms);
-STATIC mp_obj_t time_ticks_us(void) {
+static mp_obj_t time_ticks_us(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_us() & (MICROPY_PY_TIME_TICKS_PERIOD - 1));
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_time_ticks_us_obj, time_ticks_us);
-STATIC mp_obj_t time_ticks_cpu(void) {
+static mp_obj_t time_ticks_cpu(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_cpu() & (MICROPY_PY_TIME_TICKS_PERIOD - 1));
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_time_ticks_cpu_obj, time_ticks_cpu);
-STATIC mp_obj_t time_ticks_diff(mp_obj_t end_in, mp_obj_t start_in) {
+static mp_obj_t time_ticks_diff(mp_obj_t end_in, mp_obj_t start_in) {
// we assume that the arguments come from ticks_xx so are small ints
mp_uint_t start = MP_OBJ_SMALL_INT_VALUE(start_in);
mp_uint_t end = MP_OBJ_SMALL_INT_VALUE(end_in);
@@ -175,7 +175,7 @@ STATIC mp_obj_t time_ticks_diff(mp_obj_t end_in, mp_obj_t start_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_time_ticks_diff_obj, time_ticks_diff);
-STATIC mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) {
+static mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) {
// we assume that first argument come from ticks_xx so is small int
mp_uint_t ticks = MP_OBJ_SMALL_INT_VALUE(ticks_in);
mp_uint_t delta = mp_obj_get_int(delta_in);
@@ -196,7 +196,7 @@ STATIC mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_time_ticks_add_obj, time_ticks_add);
-STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_time_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) },
#if MICROPY_PY_TIME_GMTIME_LOCALTIME_MKTIME
@@ -224,7 +224,7 @@ STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
MICROPY_PY_TIME_EXTRA_GLOBALS
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);
const mp_obj_module_t mp_module_time = {
.base = { &mp_type_module },
diff --git a/extmod/modtls_axtls.c b/extmod/modtls_axtls.c
index 4f6b06f66d..08a355cddb 100644
--- a/extmod/modtls_axtls.c
+++ b/extmod/modtls_axtls.c
@@ -65,23 +65,23 @@ struct ssl_args {
mp_arg_val_t do_handshake;
};
-STATIC const mp_obj_type_t ssl_context_type;
-STATIC const mp_obj_type_t ssl_socket_type;
+static const mp_obj_type_t ssl_context_type;
+static const mp_obj_type_t ssl_socket_type;
-STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
+static mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
bool server_side, bool do_handshake_on_connect, mp_obj_t server_hostname);
/******************************************************************************/
// Helper functions.
// Table of error strings corresponding to SSL_xxx error codes.
-STATIC const char *const ssl_error_tab1[] = {
+static const char *const ssl_error_tab1[] = {
"NOT_OK",
"DEAD",
"CLOSE_NOTIFY",
"EAGAIN",
};
-STATIC const char *const ssl_error_tab2[] = {
+static const char *const ssl_error_tab2[] = {
"CONN_LOST",
"RECORD_OVERFLOW",
"SOCK_SETUP_FAILURE",
@@ -103,7 +103,7 @@ STATIC const char *const ssl_error_tab2[] = {
"NOT_SUPPORTED",
};
-STATIC NORETURN void ssl_raise_error(int err) {
+static NORETURN void ssl_raise_error(int err) {
MP_STATIC_ASSERT(SSL_NOT_OK - 3 == SSL_EAGAIN);
MP_STATIC_ASSERT(SSL_ERROR_CONN_LOST - 18 == SSL_ERROR_NOT_SUPPORTED);
@@ -138,7 +138,7 @@ STATIC NORETURN void ssl_raise_error(int err) {
/******************************************************************************/
// SSLContext type.
-STATIC mp_obj_t ssl_context_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t ssl_context_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// The "protocol" argument is ignored in this implementation.
@@ -155,20 +155,20 @@ STATIC mp_obj_t ssl_context_make_new(const mp_obj_type_t *type_in, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC void ssl_context_load_key(mp_obj_ssl_context_t *self, mp_obj_t key_obj, mp_obj_t cert_obj) {
+static void ssl_context_load_key(mp_obj_ssl_context_t *self, mp_obj_t key_obj, mp_obj_t cert_obj) {
self->key = key_obj;
self->cert = cert_obj;
}
// SSLContext.load_cert_chain(certfile, keyfile)
-STATIC mp_obj_t ssl_context_load_cert_chain(mp_obj_t self_in, mp_obj_t cert, mp_obj_t pkey) {
+static mp_obj_t ssl_context_load_cert_chain(mp_obj_t self_in, mp_obj_t cert, mp_obj_t pkey) {
mp_obj_ssl_context_t *self = MP_OBJ_TO_PTR(self_in);
ssl_context_load_key(self, pkey, cert);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(ssl_context_load_cert_chain_obj, ssl_context_load_cert_chain);
+static MP_DEFINE_CONST_FUN_OBJ_3(ssl_context_load_cert_chain_obj, ssl_context_load_cert_chain);
-STATIC mp_obj_t ssl_context_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t ssl_context_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_server_side, ARG_do_handshake_on_connect, ARG_server_hostname };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_server_side, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
@@ -186,15 +186,15 @@ STATIC mp_obj_t ssl_context_wrap_socket(size_t n_args, const mp_obj_t *pos_args,
return ssl_socket_make_new(self, sock, args[ARG_server_side].u_bool,
args[ARG_do_handshake_on_connect].u_bool, args[ARG_server_hostname].u_obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_context_wrap_socket_obj, 2, ssl_context_wrap_socket);
+static MP_DEFINE_CONST_FUN_OBJ_KW(ssl_context_wrap_socket_obj, 2, ssl_context_wrap_socket);
-STATIC const mp_rom_map_elem_t ssl_context_locals_dict_table[] = {
+static const mp_rom_map_elem_t ssl_context_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_load_cert_chain), MP_ROM_PTR(&ssl_context_load_cert_chain_obj)},
{ MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&ssl_context_wrap_socket_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ssl_context_locals_dict, ssl_context_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ssl_context_locals_dict, ssl_context_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ssl_context_type,
MP_QSTR_SSLContext,
MP_TYPE_FLAG_NONE,
@@ -205,7 +205,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
// SSLSocket type.
-STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
+static mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
bool server_side, bool do_handshake_on_connect, mp_obj_t server_hostname) {
#if MICROPY_PY_SSL_FINALISER
@@ -276,7 +276,7 @@ STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t
return o;
}
-STATIC mp_uint_t ssl_socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t ssl_socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
if (o->ssl_sock == NULL) {
@@ -325,7 +325,7 @@ STATIC mp_uint_t ssl_socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *
return size;
}
-STATIC mp_uint_t ssl_socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t ssl_socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
if (o->ssl_sock == NULL) {
@@ -357,7 +357,7 @@ eagain:
return r;
}
-STATIC mp_uint_t ssl_socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t ssl_socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(o_in);
if (request == MP_STREAM_CLOSE) {
if (self->ssl_sock == NULL) {
@@ -378,7 +378,7 @@ STATIC mp_uint_t ssl_socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t ar
return mp_get_stream(self->sock)->ioctl(self->sock, request, arg, errcode);
}
-STATIC mp_obj_t ssl_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
+static mp_obj_t ssl_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(self_in);
mp_obj_t sock = o->sock;
mp_obj_t dest[3];
@@ -388,9 +388,9 @@ STATIC mp_obj_t ssl_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
o->blocking = mp_obj_is_true(flag_in);
return res;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_socket_setblocking_obj, ssl_socket_setblocking);
+static MP_DEFINE_CONST_FUN_OBJ_2(ssl_socket_setblocking_obj, ssl_socket_setblocking);
-STATIC const mp_rom_map_elem_t ssl_socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t ssl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
@@ -401,15 +401,15 @@ STATIC const mp_rom_map_elem_t ssl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(ssl_socket_locals_dict, ssl_socket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ssl_socket_locals_dict, ssl_socket_locals_dict_table);
-STATIC const mp_stream_p_t ssl_socket_stream_p = {
+static const mp_stream_p_t ssl_socket_stream_p = {
.read = ssl_socket_read,
.write = ssl_socket_write,
.ioctl = ssl_socket_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ssl_socket_type,
MP_QSTR_SSLSocket,
MP_TYPE_FLAG_NONE,
@@ -420,7 +420,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
// ssl module.
-STATIC const mp_rom_map_elem_t mp_module_tls_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_tls_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_tls) },
// Classes.
@@ -430,7 +430,7 @@ STATIC const mp_rom_map_elem_t mp_module_tls_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PROTOCOL_TLS_CLIENT), MP_ROM_INT(PROTOCOL_TLS_CLIENT) },
{ MP_ROM_QSTR(MP_QSTR_PROTOCOL_TLS_SERVER), MP_ROM_INT(PROTOCOL_TLS_SERVER) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_tls_globals, mp_module_tls_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_tls_globals, mp_module_tls_globals_table);
const mp_obj_module_t mp_module_tls = {
.base = { &mp_type_module },
diff --git a/extmod/modtls_mbedtls.c b/extmod/modtls_mbedtls.c
index 4d0ccd2c0e..6db6ac1958 100644
--- a/extmod/modtls_mbedtls.c
+++ b/extmod/modtls_mbedtls.c
@@ -81,26 +81,26 @@ typedef struct _mp_obj_ssl_socket_t {
int last_error; // The last error code, if any
} mp_obj_ssl_socket_t;
-STATIC const mp_obj_type_t ssl_context_type;
-STATIC const mp_obj_type_t ssl_socket_type;
+static const mp_obj_type_t ssl_context_type;
+static const mp_obj_type_t ssl_socket_type;
-STATIC const MP_DEFINE_STR_OBJ(mbedtls_version_obj, MBEDTLS_VERSION_STRING_FULL);
+static const MP_DEFINE_STR_OBJ(mbedtls_version_obj, MBEDTLS_VERSION_STRING_FULL);
-STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
+static mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
bool server_side, bool do_handshake_on_connect, mp_obj_t server_hostname);
/******************************************************************************/
// Helper functions.
#ifdef MBEDTLS_DEBUG_C
-STATIC void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) {
+static void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) {
(void)ctx;
(void)level;
mp_printf(&mp_plat_print, "DBG:%s:%04d: %s\n", file, line, str);
}
#endif
-STATIC NORETURN void mbedtls_raise_error(int err) {
+static NORETURN void mbedtls_raise_error(int err) {
// Handle special cases.
if (err == MBEDTLS_ERR_SSL_ALLOC_FAILED) {
mp_raise_OSError(MP_ENOMEM);
@@ -149,7 +149,7 @@ STATIC NORETURN void mbedtls_raise_error(int err) {
#endif
}
-STATIC void ssl_check_async_handshake_failure(mp_obj_ssl_socket_t *sslsock, int *errcode) {
+static void ssl_check_async_handshake_failure(mp_obj_ssl_socket_t *sslsock, int *errcode) {
if (
#if MBEDTLS_VERSION_NUMBER >= 0x03000000
(*errcode < 0) && (mbedtls_ssl_is_handshake_over(&sslsock->ssl) == 0) && (*errcode != MBEDTLS_ERR_SSL_CONN_EOF)
@@ -189,7 +189,7 @@ STATIC void ssl_check_async_handshake_failure(mp_obj_ssl_socket_t *sslsock, int
}
}
-STATIC int ssl_sock_cert_verify(void *ptr, mbedtls_x509_crt *crt, int depth, uint32_t *flags) {
+static int ssl_sock_cert_verify(void *ptr, mbedtls_x509_crt *crt, int depth, uint32_t *flags) {
mp_obj_ssl_context_t *o = ptr;
if (o->handler == mp_const_none) {
return 0;
@@ -202,7 +202,7 @@ STATIC int ssl_sock_cert_verify(void *ptr, mbedtls_x509_crt *crt, int depth, uin
/******************************************************************************/
// SSLContext type.
-STATIC mp_obj_t ssl_context_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t ssl_context_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// This is the "protocol" argument.
@@ -263,7 +263,7 @@ STATIC mp_obj_t ssl_context_make_new(const mp_obj_type_t *type_in, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC void ssl_context_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void ssl_context_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
mp_obj_ssl_context_t *self = MP_OBJ_TO_PTR(self_in);
if (dest[0] == MP_OBJ_NULL) {
// Load attribute.
@@ -289,7 +289,7 @@ STATIC void ssl_context_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
#if MICROPY_PY_SSL_FINALISER
-STATIC mp_obj_t ssl_context___del__(mp_obj_t self_in) {
+static mp_obj_t ssl_context___del__(mp_obj_t self_in) {
mp_obj_ssl_context_t *self = MP_OBJ_TO_PTR(self_in);
mbedtls_pk_free(&self->pkey);
mbedtls_x509_crt_free(&self->cert);
@@ -299,11 +299,11 @@ STATIC mp_obj_t ssl_context___del__(mp_obj_t self_in) {
mbedtls_ssl_config_free(&self->conf);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ssl_context___del___obj, ssl_context___del__);
+static MP_DEFINE_CONST_FUN_OBJ_1(ssl_context___del___obj, ssl_context___del__);
#endif
// SSLContext.get_ciphers()
-STATIC mp_obj_t ssl_context_get_ciphers(mp_obj_t self_in) {
+static mp_obj_t ssl_context_get_ciphers(mp_obj_t self_in) {
mp_obj_t list = mp_obj_new_list(0, NULL);
for (const int *cipher_list = mbedtls_ssl_list_ciphersuites(); *cipher_list; ++cipher_list) {
const char *cipher_name = mbedtls_ssl_get_ciphersuite_name(*cipher_list);
@@ -311,10 +311,10 @@ STATIC mp_obj_t ssl_context_get_ciphers(mp_obj_t self_in) {
}
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ssl_context_get_ciphers_obj, ssl_context_get_ciphers);
+static MP_DEFINE_CONST_FUN_OBJ_1(ssl_context_get_ciphers_obj, ssl_context_get_ciphers);
// SSLContext.set_ciphers(ciphersuite)
-STATIC mp_obj_t ssl_context_set_ciphers(mp_obj_t self_in, mp_obj_t ciphersuite) {
+static mp_obj_t ssl_context_set_ciphers(mp_obj_t self_in, mp_obj_t ciphersuite) {
mp_obj_ssl_context_t *ssl_context = MP_OBJ_TO_PTR(self_in);
// Check that ciphersuite is a list or tuple.
@@ -342,9 +342,9 @@ STATIC mp_obj_t ssl_context_set_ciphers(mp_obj_t self_in, mp_obj_t ciphersuite)
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_context_set_ciphers_obj, ssl_context_set_ciphers);
+static MP_DEFINE_CONST_FUN_OBJ_2(ssl_context_set_ciphers_obj, ssl_context_set_ciphers);
-STATIC void ssl_context_load_key(mp_obj_ssl_context_t *self, mp_obj_t key_obj, mp_obj_t cert_obj) {
+static void ssl_context_load_key(mp_obj_ssl_context_t *self, mp_obj_t key_obj, mp_obj_t cert_obj) {
size_t key_len;
const byte *key = (const byte *)mp_obj_str_get_data(key_obj, &key_len);
// len should include terminating null
@@ -373,14 +373,14 @@ STATIC void ssl_context_load_key(mp_obj_ssl_context_t *self, mp_obj_t key_obj, m
}
// SSLContext.load_cert_chain(certfile, keyfile)
-STATIC mp_obj_t ssl_context_load_cert_chain(mp_obj_t self_in, mp_obj_t cert, mp_obj_t pkey) {
+static mp_obj_t ssl_context_load_cert_chain(mp_obj_t self_in, mp_obj_t cert, mp_obj_t pkey) {
mp_obj_ssl_context_t *self = MP_OBJ_TO_PTR(self_in);
ssl_context_load_key(self, pkey, cert);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(ssl_context_load_cert_chain_obj, ssl_context_load_cert_chain);
+static MP_DEFINE_CONST_FUN_OBJ_3(ssl_context_load_cert_chain_obj, ssl_context_load_cert_chain);
-STATIC void ssl_context_load_cadata(mp_obj_ssl_context_t *self, mp_obj_t cadata_obj) {
+static void ssl_context_load_cadata(mp_obj_ssl_context_t *self, mp_obj_t cadata_obj) {
size_t cacert_len;
const byte *cacert = (const byte *)mp_obj_str_get_data(cadata_obj, &cacert_len);
// len should include terminating null
@@ -393,15 +393,15 @@ STATIC void ssl_context_load_cadata(mp_obj_ssl_context_t *self, mp_obj_t cadata_
}
// SSLContext.load_verify_locations(cadata)
-STATIC mp_obj_t ssl_context_load_verify_locations(mp_obj_t self_in, mp_obj_t cadata) {
+static mp_obj_t ssl_context_load_verify_locations(mp_obj_t self_in, mp_obj_t cadata) {
mp_obj_ssl_context_t *self = MP_OBJ_TO_PTR(self_in);
ssl_context_load_cadata(self, cadata);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_context_load_verify_locations_obj, ssl_context_load_verify_locations);
+static MP_DEFINE_CONST_FUN_OBJ_2(ssl_context_load_verify_locations_obj, ssl_context_load_verify_locations);
-STATIC mp_obj_t ssl_context_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t ssl_context_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_server_side, ARG_do_handshake_on_connect, ARG_server_hostname };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_server_side, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
@@ -419,9 +419,9 @@ STATIC mp_obj_t ssl_context_wrap_socket(size_t n_args, const mp_obj_t *pos_args,
return ssl_socket_make_new(self, sock, args[ARG_server_side].u_bool,
args[ARG_do_handshake_on_connect].u_bool, args[ARG_server_hostname].u_obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_context_wrap_socket_obj, 2, ssl_context_wrap_socket);
+static MP_DEFINE_CONST_FUN_OBJ_KW(ssl_context_wrap_socket_obj, 2, ssl_context_wrap_socket);
-STATIC const mp_rom_map_elem_t ssl_context_locals_dict_table[] = {
+static const mp_rom_map_elem_t ssl_context_locals_dict_table[] = {
#if MICROPY_PY_SSL_FINALISER
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&ssl_context___del___obj) },
#endif
@@ -431,9 +431,9 @@ STATIC const mp_rom_map_elem_t ssl_context_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_load_verify_locations), MP_ROM_PTR(&ssl_context_load_verify_locations_obj)},
{ MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&ssl_context_wrap_socket_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ssl_context_locals_dict, ssl_context_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ssl_context_locals_dict, ssl_context_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ssl_context_type,
MP_QSTR_SSLContext,
MP_TYPE_FLAG_NONE,
@@ -445,7 +445,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
// SSLSocket type.
-STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
+static int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
mp_obj_t sock = *(mp_obj_t *)ctx;
const mp_stream_p_t *sock_stream = mp_get_stream(sock);
@@ -463,7 +463,7 @@ STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
}
// _mbedtls_ssl_recv is called by mbedtls to receive bytes from the underlying socket
-STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
+static int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
mp_obj_t sock = *(mp_obj_t *)ctx;
const mp_stream_p_t *sock_stream = mp_get_stream(sock);
@@ -480,7 +480,7 @@ STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
}
}
-STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
+static mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t sock,
bool server_side, bool do_handshake_on_connect, mp_obj_t server_hostname) {
// Verify the socket object has the full stream protocol
@@ -554,7 +554,7 @@ cleanup:
}
#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
-STATIC mp_obj_t mod_ssl_getpeercert(mp_obj_t o_in, mp_obj_t binary_form) {
+static mp_obj_t mod_ssl_getpeercert(mp_obj_t o_in, mp_obj_t binary_form) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
if (!mp_obj_is_true(binary_form)) {
mp_raise_NotImplementedError(NULL);
@@ -565,10 +565,10 @@ STATIC mp_obj_t mod_ssl_getpeercert(mp_obj_t o_in, mp_obj_t binary_form) {
}
return mp_obj_new_bytes(peer_cert->raw.p, peer_cert->raw.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_ssl_getpeercert_obj, mod_ssl_getpeercert);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_ssl_getpeercert_obj, mod_ssl_getpeercert);
#endif
-STATIC mp_obj_t mod_ssl_cipher(mp_obj_t o_in) {
+static mp_obj_t mod_ssl_cipher(mp_obj_t o_in) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
const char *cipher_suite = mbedtls_ssl_get_ciphersuite(&o->ssl);
const char *tls_version = mbedtls_ssl_get_version(&o->ssl);
@@ -577,9 +577,9 @@ STATIC mp_obj_t mod_ssl_cipher(mp_obj_t o_in) {
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ssl_cipher_obj, mod_ssl_cipher);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_ssl_cipher_obj, mod_ssl_cipher);
-STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
o->poll_mask = 0;
@@ -620,7 +620,7 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
return MP_STREAM_ERROR;
}
-STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
o->poll_mask = 0;
@@ -649,7 +649,7 @@ STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, in
return MP_STREAM_ERROR;
}
-STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
+static mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(self_in);
mp_obj_t sock = o->sock;
mp_obj_t dest[3];
@@ -657,9 +657,9 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
dest[2] = flag_in;
return mp_call_method_n_kw(1, 0, dest);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
-STATIC mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(o_in);
mp_uint_t ret = 0;
uintptr_t saved_arg = 0;
@@ -716,7 +716,7 @@ STATIC mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, i
return ret;
}
-STATIC const mp_rom_map_elem_t ssl_socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t ssl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
@@ -734,15 +734,15 @@ STATIC const mp_rom_map_elem_t ssl_socket_locals_dict_table[] = {
#endif
{ MP_ROM_QSTR(MP_QSTR_cipher), MP_ROM_PTR(&mod_ssl_cipher_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ssl_socket_locals_dict, ssl_socket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ssl_socket_locals_dict, ssl_socket_locals_dict_table);
-STATIC const mp_stream_p_t ssl_socket_stream_p = {
+static const mp_stream_p_t ssl_socket_stream_p = {
.read = socket_read,
.write = socket_write,
.ioctl = socket_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ssl_socket_type,
MP_QSTR_SSLSocket,
MP_TYPE_FLAG_NONE,
@@ -753,7 +753,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
// ssl module.
-STATIC const mp_rom_map_elem_t mp_module_tls_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_tls_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_tls) },
// Classes.
@@ -767,7 +767,7 @@ STATIC const mp_rom_map_elem_t mp_module_tls_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_CERT_OPTIONAL), MP_ROM_INT(MBEDTLS_SSL_VERIFY_OPTIONAL) },
{ MP_ROM_QSTR(MP_QSTR_CERT_REQUIRED), MP_ROM_INT(MBEDTLS_SSL_VERIFY_REQUIRED) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_tls_globals, mp_module_tls_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_tls_globals, mp_module_tls_globals_table);
const mp_obj_module_t mp_module_tls = {
.base = { &mp_type_module },
diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index f56567107d..fa743eb637 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -80,7 +80,7 @@ enum {
#define IS_SCALAR_ARRAY_OF_BYTES(tuple_desc) (GET_TYPE(MP_OBJ_SMALL_INT_VALUE((tuple_desc)->items[1]), VAL_TYPE_BITS) == UINT8)
// "struct" in uctypes context means "structural", i.e. aggregate, type.
-STATIC const mp_obj_type_t uctypes_struct_type;
+static const mp_obj_type_t uctypes_struct_type;
typedef struct _mp_obj_uctypes_struct_t {
mp_obj_base_t base;
@@ -89,11 +89,11 @@ typedef struct _mp_obj_uctypes_struct_t {
uint32_t flags;
} mp_obj_uctypes_struct_t;
-STATIC NORETURN void syntax_error(void) {
+static NORETURN void syntax_error(void) {
mp_raise_TypeError(MP_ERROR_TEXT("syntax error in uctypes descriptor"));
}
-STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, 3, false);
mp_obj_uctypes_struct_t *o = mp_obj_malloc(mp_obj_uctypes_struct_t, type);
o->addr = (void *)(uintptr_t)mp_obj_get_int_truncated(args[0]);
@@ -105,7 +105,7 @@ STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(o);
}
-STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
const char *typen = "unk";
@@ -130,7 +130,7 @@ STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_p
}
// Get size of any type descriptor
-STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size);
+static mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size);
// Get size of scalar type descriptor
static inline mp_uint_t uctypes_struct_scalar_size(int val_type) {
@@ -142,7 +142,7 @@ static inline mp_uint_t uctypes_struct_scalar_size(int val_type) {
}
// Get size of aggregate type descriptor
-STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_uint_t *max_field_size) {
+static mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_uint_t *max_field_size) {
mp_uint_t total_size = 0;
mp_int_t offset_ = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
@@ -181,7 +181,7 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
return total_size;
}
-STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size) {
+static mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size) {
if (!mp_obj_is_dict_or_ordereddict(desc_in)) {
if (mp_obj_is_type(desc_in, &mp_type_tuple)) {
return uctypes_struct_agg_size((mp_obj_tuple_t *)MP_OBJ_TO_PTR(desc_in), layout_type, max_field_size);
@@ -237,7 +237,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
return total_size;
}
-STATIC mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
mp_obj_t obj_in = args[0];
mp_uint_t max_field_size = 0;
if (mp_obj_is_type(obj_in, &mp_type_bytearray)) {
@@ -262,7 +262,7 @@ STATIC mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
mp_uint_t size = uctypes_struct_size(obj_in, layout_type, &max_field_size);
return MP_OBJ_NEW_SMALL_INT(size);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(uctypes_struct_sizeof_obj, 1, 2, uctypes_struct_sizeof);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(uctypes_struct_sizeof_obj, 1, 2, uctypes_struct_sizeof);
static inline mp_obj_t get_unaligned(uint val_type, byte *p, int big_endian) {
char struct_type = big_endian ? '>' : '<';
@@ -304,7 +304,7 @@ static inline void set_aligned_basic(uint val_type, void *p, mp_uint_t v) {
assert(0);
}
-STATIC mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) {
+static mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) {
switch (val_type) {
case UINT8:
return MP_OBJ_NEW_SMALL_INT(((uint8_t *)p)[index]);
@@ -334,7 +334,7 @@ STATIC mp_obj_t get_aligned(uint val_type, void *p, mp_int_t index) {
}
}
-STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
+static void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
#if MICROPY_PY_BUILTINS_FLOAT
if (val_type == FLOAT32 || val_type == FLOAT64) {
if (val_type == FLOAT32) {
@@ -379,7 +379,7 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
}
}
-STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set_val) {
+static mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set_val) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
if (!mp_obj_is_dict_or_ordereddict(self->desc)) {
@@ -489,7 +489,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
return MP_OBJ_NULL;
}
-STATIC void uctypes_struct_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void uctypes_struct_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] == MP_OBJ_NULL) {
// load attribute
mp_obj_t val = uctypes_struct_attr_op(self_in, attr, MP_OBJ_NULL);
@@ -502,7 +502,7 @@ STATIC void uctypes_struct_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
}
-STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
+static mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
if (value == MP_OBJ_NULL) {
@@ -579,7 +579,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
}
}
-STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_INT_MAYBE:
@@ -599,7 +599,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_int_t uctypes_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+static mp_int_t uctypes_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
(void)flags;
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t max_field_size = 0;
@@ -613,7 +613,7 @@ STATIC mp_int_t uctypes_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo,
// addressof()
// Return address of object's data (applies to objects providing the buffer interface).
-STATIC mp_obj_t uctypes_struct_addressof(mp_obj_t buf) {
+static mp_obj_t uctypes_struct_addressof(mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
return mp_obj_new_int((mp_int_t)(uintptr_t)bufinfo.buf);
@@ -622,19 +622,19 @@ MP_DEFINE_CONST_FUN_OBJ_1(uctypes_struct_addressof_obj, uctypes_struct_addressof
// bytearray_at()
// Capture memory at given address of given size as bytearray.
-STATIC mp_obj_t uctypes_struct_bytearray_at(mp_obj_t ptr, mp_obj_t size) {
+static mp_obj_t uctypes_struct_bytearray_at(mp_obj_t ptr, mp_obj_t size) {
return mp_obj_new_bytearray_by_ref(mp_obj_int_get_truncated(size), (void *)(uintptr_t)mp_obj_int_get_truncated(ptr));
}
MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytearray_at_obj, uctypes_struct_bytearray_at);
// bytes_at()
// Capture memory at given address of given size as bytes.
-STATIC mp_obj_t uctypes_struct_bytes_at(mp_obj_t ptr, mp_obj_t size) {
+static mp_obj_t uctypes_struct_bytes_at(mp_obj_t ptr, mp_obj_t size) {
return mp_obj_new_bytes((void *)(uintptr_t)mp_obj_int_get_truncated(ptr), mp_obj_int_get_truncated(size));
}
MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytes_at_obj, uctypes_struct_bytes_at);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
uctypes_struct_type,
MP_QSTR_struct,
MP_TYPE_FLAG_NONE,
@@ -646,7 +646,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
buffer, uctypes_get_buffer
);
-STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uctypes) },
{ MP_ROM_QSTR(MP_QSTR_struct), MP_ROM_PTR(&uctypes_struct_type) },
{ MP_ROM_QSTR(MP_QSTR_sizeof), MP_ROM_PTR(&uctypes_struct_sizeof_obj) },
@@ -711,7 +711,7 @@ STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PTR), MP_ROM_INT(TYPE2SMALLINT(PTR, AGG_TYPE_BITS)) },
{ MP_ROM_QSTR(MP_QSTR_ARRAY), MP_ROM_INT(TYPE2SMALLINT(ARRAY, AGG_TYPE_BITS)) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_uctypes_globals, mp_module_uctypes_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_uctypes_globals, mp_module_uctypes_globals_table);
const mp_obj_module_t mp_module_uctypes = {
.base = { &mp_type_module },
diff --git a/extmod/modvfs.c b/extmod/modvfs.c
index 02dc67d073..32dc0e5d08 100644
--- a/extmod/modvfs.c
+++ b/extmod/modvfs.c
@@ -37,7 +37,7 @@
#error "MICROPY_PY_VFS requires MICROPY_VFS"
#endif
-STATIC const mp_rom_map_elem_t vfs_module_globals_table[] = {
+static const mp_rom_map_elem_t vfs_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_vfs) },
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) },
@@ -55,7 +55,7 @@ STATIC const mp_rom_map_elem_t vfs_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(vfs_module_globals, vfs_module_globals_table);
+static MP_DEFINE_CONST_DICT(vfs_module_globals, vfs_module_globals_table);
const mp_obj_module_t mp_module_vfs = {
.base = { &mp_type_module },
diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c
index 64276b5a8f..9d09f65a37 100644
--- a/extmod/modwebrepl.c
+++ b/extmod/modwebrepl.c
@@ -67,13 +67,13 @@ typedef struct _mp_obj_webrepl_t {
mp_obj_t cur_file;
} mp_obj_webrepl_t;
-STATIC const char passwd_prompt[] = "Password: ";
-STATIC const char connected_prompt[] = "\r\nWebREPL connected\r\n>>> ";
-STATIC const char denied_prompt[] = "\r\nAccess denied\r\n";
+static const char passwd_prompt[] = "Password: ";
+static const char connected_prompt[] = "\r\nWebREPL connected\r\n>>> ";
+static const char denied_prompt[] = "\r\nAccess denied\r\n";
-STATIC char webrepl_passwd[10];
+static char webrepl_passwd[10];
-STATIC void write_webrepl(mp_obj_t websock, const void *buf, size_t len) {
+static void write_webrepl(mp_obj_t websock, const void *buf, size_t len) {
const mp_stream_p_t *sock_stream = mp_get_stream(websock);
int err;
int old_opts = sock_stream->ioctl(websock, MP_STREAM_SET_DATA_OPTS, FRAME_BIN, &err);
@@ -82,18 +82,18 @@ STATIC void write_webrepl(mp_obj_t websock, const void *buf, size_t len) {
}
#define SSTR(s) s, sizeof(s) - 1
-STATIC void write_webrepl_str(mp_obj_t websock, const char *str, int sz) {
+static void write_webrepl_str(mp_obj_t websock, const char *str, int sz) {
int err;
const mp_stream_p_t *sock_stream = mp_get_stream(websock);
sock_stream->write(websock, str, sz, &err);
}
-STATIC void write_webrepl_resp(mp_obj_t websock, uint16_t code) {
+static void write_webrepl_resp(mp_obj_t websock, uint16_t code) {
char buf[4] = {'W', 'B', code & 0xff, code >> 8};
write_webrepl(websock, buf, sizeof(buf));
}
-STATIC mp_obj_t webrepl_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t webrepl_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 2, false);
mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
DEBUG_printf("sizeof(struct webrepl_file) = %lu\n", sizeof(struct webrepl_file));
@@ -106,7 +106,7 @@ STATIC mp_obj_t webrepl_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(o);
}
-STATIC void check_file_op_finished(mp_obj_webrepl_t *self) {
+static void check_file_op_finished(mp_obj_webrepl_t *self) {
if (self->data_to_recv == 0) {
mp_stream_close(self->cur_file);
self->hdr_to_recv = sizeof(struct webrepl_file);
@@ -115,7 +115,7 @@ STATIC void check_file_op_finished(mp_obj_webrepl_t *self) {
}
}
-STATIC int write_file_chunk(mp_obj_webrepl_t *self) {
+static int write_file_chunk(mp_obj_webrepl_t *self) {
const mp_stream_p_t *file_stream = mp_get_stream(self->cur_file);
byte readbuf[2 + 256];
int err;
@@ -130,7 +130,7 @@ STATIC int write_file_chunk(mp_obj_webrepl_t *self) {
return out_sz;
}
-STATIC void handle_op(mp_obj_webrepl_t *self) {
+static void handle_op(mp_obj_webrepl_t *self) {
// Handle operations not requiring opened file
@@ -173,9 +173,9 @@ STATIC void handle_op(mp_obj_webrepl_t *self) {
}
}
-STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode);
+static mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode);
-STATIC mp_uint_t webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
mp_uint_t out_sz;
do {
out_sz = _webrepl_read(self_in, buf, size, errcode);
@@ -183,7 +183,7 @@ STATIC mp_uint_t webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *
return out_sz;
}
-STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
// We know that os.dupterm always calls with size = 1
assert(size == 1);
mp_obj_webrepl_t *self = MP_OBJ_TO_PTR(self_in);
@@ -292,7 +292,7 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
return -2;
}
-STATIC mp_uint_t webrepl_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t webrepl_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_webrepl_t *self = MP_OBJ_TO_PTR(self_in);
if (self->state == STATE_PASSWD) {
// Don't forward output until passwd is entered
@@ -302,7 +302,7 @@ STATIC mp_uint_t webrepl_write(mp_obj_t self_in, const void *buf, mp_uint_t size
return stream_p->write(self->sock, buf, size, errcode);
}
-STATIC mp_uint_t webrepl_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t webrepl_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_webrepl_t *self = MP_OBJ_TO_PTR(o_in);
(void)arg;
switch (request) {
@@ -317,7 +317,7 @@ STATIC mp_uint_t webrepl_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
}
}
-STATIC mp_obj_t webrepl_set_password(mp_obj_t passwd_in) {
+static mp_obj_t webrepl_set_password(mp_obj_t passwd_in) {
size_t len;
const char *passwd = mp_obj_str_get_data(passwd_in, &len);
if (len > sizeof(webrepl_passwd) - 1) {
@@ -326,23 +326,23 @@ STATIC mp_obj_t webrepl_set_password(mp_obj_t passwd_in) {
strcpy(webrepl_passwd, passwd);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(webrepl_set_password_obj, webrepl_set_password);
+static MP_DEFINE_CONST_FUN_OBJ_1(webrepl_set_password_obj, webrepl_set_password);
-STATIC const mp_rom_map_elem_t webrepl_locals_dict_table[] = {
+static const mp_rom_map_elem_t webrepl_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(webrepl_locals_dict, webrepl_locals_dict_table);
+static MP_DEFINE_CONST_DICT(webrepl_locals_dict, webrepl_locals_dict_table);
-STATIC const mp_stream_p_t webrepl_stream_p = {
+static const mp_stream_p_t webrepl_stream_p = {
.read = webrepl_read,
.write = webrepl_write,
.ioctl = webrepl_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
webrepl_type,
MP_QSTR__webrepl,
MP_TYPE_FLAG_NONE,
@@ -351,13 +351,13 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &webrepl_locals_dict
);
-STATIC const mp_rom_map_elem_t webrepl_module_globals_table[] = {
+static const mp_rom_map_elem_t webrepl_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__webrepl) },
{ MP_ROM_QSTR(MP_QSTR__webrepl), MP_ROM_PTR(&webrepl_type) },
{ MP_ROM_QSTR(MP_QSTR_password), MP_ROM_PTR(&webrepl_set_password_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(webrepl_module_globals, webrepl_module_globals_table);
+static MP_DEFINE_CONST_DICT(webrepl_module_globals, webrepl_module_globals_table);
const mp_obj_module_t mp_module_webrepl = {
.base = { &mp_type_module },
diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c
index 3645b771a5..d31d00160b 100644
--- a/extmod/modwebsocket.c
+++ b/extmod/modwebsocket.c
@@ -55,10 +55,10 @@ typedef struct _mp_obj_websocket_t {
byte last_flags;
} mp_obj_websocket_t;
-STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode);
-STATIC mp_uint_t websocket_write_raw(mp_obj_t self_in, const byte *header, int hdr_sz, const void *buf, mp_uint_t size, int *errcode);
+static mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode);
+static mp_uint_t websocket_write_raw(mp_obj_t self_in, const byte *header, int hdr_sz, const void *buf, mp_uint_t size, int *errcode);
-STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 2, false);
mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
mp_obj_websocket_t *o = mp_obj_malloc(mp_obj_websocket_t, type);
@@ -74,7 +74,7 @@ STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
const mp_stream_p_t *stream_p = mp_get_stream(self->sock);
while (1) {
@@ -216,7 +216,7 @@ STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
}
}
-STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
assert(size < 0x10000);
byte header[4] = {0x80 | (self->opts & FRAME_OPCODE_MASK)};
@@ -233,7 +233,7 @@ STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t si
return websocket_write_raw(self_in, header, hdr_sz, buf, size, errcode);
}
-STATIC mp_uint_t websocket_write_raw(mp_obj_t self_in, const byte *header, int hdr_sz, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t websocket_write_raw(mp_obj_t self_in, const byte *header, int hdr_sz, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t dest[3];
@@ -259,7 +259,7 @@ STATIC mp_uint_t websocket_write_raw(mp_obj_t self_in, const byte *header, int h
return out_sz;
}
-STATIC mp_uint_t websocket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t websocket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
switch (request) {
case MP_STREAM_CLOSE:
@@ -280,7 +280,7 @@ STATIC mp_uint_t websocket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t
}
}
-STATIC const mp_rom_map_elem_t websocket_locals_dict_table[] = {
+static const mp_rom_map_elem_t websocket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
@@ -288,15 +288,15 @@ STATIC const mp_rom_map_elem_t websocket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&mp_stream_ioctl_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(websocket_locals_dict, websocket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(websocket_locals_dict, websocket_locals_dict_table);
-STATIC const mp_stream_p_t websocket_stream_p = {
+static const mp_stream_p_t websocket_stream_p = {
.read = websocket_read,
.write = websocket_write,
.ioctl = websocket_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
websocket_type,
MP_QSTR_websocket,
MP_TYPE_FLAG_NONE,
@@ -305,12 +305,12 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &websocket_locals_dict
);
-STATIC const mp_rom_map_elem_t websocket_module_globals_table[] = {
+static const mp_rom_map_elem_t websocket_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_websocket) },
{ MP_ROM_QSTR(MP_QSTR_websocket), MP_ROM_PTR(&websocket_type) },
};
-STATIC MP_DEFINE_CONST_DICT(websocket_module_globals, websocket_module_globals_table);
+static MP_DEFINE_CONST_DICT(websocket_module_globals, websocket_module_globals_table);
const mp_obj_module_t mp_module_websocket = {
.base = { &mp_type_module },
diff --git a/extmod/network_cyw43.c b/extmod/network_cyw43.c
index 2f188dbad4..89e68e2488 100644
--- a/extmod/network_cyw43.c
+++ b/extmod/network_cyw43.c
@@ -57,10 +57,10 @@ typedef struct _network_cyw43_obj_t {
int itf;
} network_cyw43_obj_t;
-STATIC const network_cyw43_obj_t network_cyw43_wl_sta = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_STA };
-STATIC const network_cyw43_obj_t network_cyw43_wl_ap = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_AP };
+static const network_cyw43_obj_t network_cyw43_wl_sta = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_STA };
+static const network_cyw43_obj_t network_cyw43_wl_ap = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_AP };
-STATIC void network_cyw43_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void network_cyw43_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(self_in);
struct netif *netif = &self->cyw->netif[self->itf];
int status = cyw43_tcpip_link_status(self->cyw, self->itf);
@@ -89,7 +89,7 @@ STATIC void network_cyw43_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
);
}
-STATIC mp_obj_t network_cyw43_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t network_cyw43_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
if (n_args == 0 || mp_obj_get_int(args[0]) == MOD_NETWORK_STA_IF) {
return MP_OBJ_FROM_PTR(&network_cyw43_wl_sta);
@@ -98,7 +98,7 @@ STATIC mp_obj_t network_cyw43_make_new(const mp_obj_type_t *type, size_t n_args,
}
}
-STATIC mp_obj_t network_cyw43_send_ethernet(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t network_cyw43_send_ethernet(mp_obj_t self_in, mp_obj_t buf_in) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t buf;
mp_get_buffer_raise(buf_in, &buf, MP_BUFFER_READ);
@@ -108,28 +108,28 @@ STATIC mp_obj_t network_cyw43_send_ethernet(mp_obj_t self_in, mp_obj_t buf_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(network_cyw43_send_ethernet_obj, network_cyw43_send_ethernet);
+static MP_DEFINE_CONST_FUN_OBJ_2(network_cyw43_send_ethernet_obj, network_cyw43_send_ethernet);
-STATIC mp_obj_t network_cyw43_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t buf_in) {
+static mp_obj_t network_cyw43_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t buf_in) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t buf;
mp_get_buffer_raise(buf_in, &buf, MP_BUFFER_READ | MP_BUFFER_WRITE);
cyw43_ioctl(self->cyw, mp_obj_get_int(cmd_in), buf.len, buf.buf, self->itf);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(network_cyw43_ioctl_obj, network_cyw43_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(network_cyw43_ioctl_obj, network_cyw43_ioctl);
/*******************************************************************************/
// network API
-STATIC mp_obj_t network_cyw43_deinit(mp_obj_t self_in) {
+static mp_obj_t network_cyw43_deinit(mp_obj_t self_in) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(self_in);
cyw43_deinit(self->cyw);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_cyw43_deinit_obj, network_cyw43_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_cyw43_deinit_obj, network_cyw43_deinit);
-STATIC mp_obj_t network_cyw43_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_cyw43_active(size_t n_args, const mp_obj_t *args) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
return mp_obj_new_bool(cyw43_tcpip_link_status(self->cyw, self->itf));
@@ -139,9 +139,9 @@ STATIC mp_obj_t network_cyw43_active(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_cyw43_active_obj, 1, 2, network_cyw43_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_cyw43_active_obj, 1, 2, network_cyw43_active);
-STATIC int network_cyw43_scan_cb(void *env, const cyw43_ev_scan_result_t *res) {
+static int network_cyw43_scan_cb(void *env, const cyw43_ev_scan_result_t *res) {
mp_obj_t list = MP_OBJ_FROM_PTR(env);
// Search for existing BSSID to remove duplicates
@@ -178,7 +178,7 @@ STATIC int network_cyw43_scan_cb(void *env, const cyw43_ev_scan_result_t *res) {
return 0; // continue scan
}
-STATIC mp_obj_t network_cyw43_scan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t network_cyw43_scan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_passive, ARG_ssid, ARG_essid, ARG_bssid };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_passive, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
@@ -234,9 +234,9 @@ STATIC mp_obj_t network_cyw43_scan(size_t n_args, const mp_obj_t *pos_args, mp_m
return res;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_cyw43_scan_obj, 1, network_cyw43_scan);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_cyw43_scan_obj, 1, network_cyw43_scan);
-STATIC mp_obj_t network_cyw43_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t network_cyw43_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ssid, ARG_key, ARG_auth, ARG_security, ARG_bssid, ARG_channel };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -300,28 +300,28 @@ STATIC mp_obj_t network_cyw43_connect(size_t n_args, const mp_obj_t *pos_args, m
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_cyw43_connect_obj, 1, network_cyw43_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_cyw43_connect_obj, 1, network_cyw43_connect);
-STATIC mp_obj_t network_cyw43_disconnect(mp_obj_t self_in) {
+static mp_obj_t network_cyw43_disconnect(mp_obj_t self_in) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(self_in);
cyw43_wifi_leave(self->cyw, self->itf);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_cyw43_disconnect_obj, network_cyw43_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_cyw43_disconnect_obj, network_cyw43_disconnect);
-STATIC mp_obj_t network_cyw43_isconnected(mp_obj_t self_in) {
+static mp_obj_t network_cyw43_isconnected(mp_obj_t self_in) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(cyw43_tcpip_link_status(self->cyw, self->itf) == 3);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_cyw43_isconnected_obj, network_cyw43_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_cyw43_isconnected_obj, network_cyw43_isconnected);
-STATIC mp_obj_t network_cyw43_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_cyw43_ifconfig(size_t n_args, const mp_obj_t *args) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(args[0]);
return mod_network_nic_ifconfig(&self->cyw->netif[self->itf], n_args - 1, args + 1);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_cyw43_ifconfig_obj, 1, 2, network_cyw43_ifconfig);
-STATIC mp_obj_t network_cyw43_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_cyw43_status(size_t n_args, const mp_obj_t *args) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(args[0]);
(void)self;
@@ -361,7 +361,7 @@ STATIC mp_obj_t network_cyw43_status(size_t n_args, const mp_obj_t *args) {
mp_raise_ValueError(MP_ERROR_TEXT("unknown status param"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_cyw43_status_obj, 1, 2, network_cyw43_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_cyw43_status_obj, 1, 2, network_cyw43_status);
static inline uint32_t nw_get_le32(const uint8_t *buf) {
return buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
@@ -374,7 +374,7 @@ static inline void nw_put_le32(uint8_t *buf, uint32_t x) {
buf[3] = x >> 24;
}
-STATIC mp_obj_t network_cyw43_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t network_cyw43_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
network_cyw43_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (kwargs->used == 0) {
@@ -516,12 +516,12 @@ STATIC mp_obj_t network_cyw43_config(size_t n_args, const mp_obj_t *args, mp_map
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_cyw43_config_obj, 1, network_cyw43_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_cyw43_config_obj, 1, network_cyw43_config);
/*******************************************************************************/
// class bindings
-STATIC const mp_rom_map_elem_t network_cyw43_locals_dict_table[] = {
+static const mp_rom_map_elem_t network_cyw43_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_send_ethernet), MP_ROM_PTR(&network_cyw43_send_ethernet_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&network_cyw43_ioctl_obj) },
@@ -540,7 +540,7 @@ STATIC const mp_rom_map_elem_t network_cyw43_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PM_PERFORMANCE), MP_ROM_INT(PM_PERFORMANCE) },
{ MP_ROM_QSTR(MP_QSTR_PM_POWERSAVE), MP_ROM_INT(PM_POWERSAVE) },
};
-STATIC MP_DEFINE_CONST_DICT(network_cyw43_locals_dict, network_cyw43_locals_dict_table);
+static MP_DEFINE_CONST_DICT(network_cyw43_locals_dict, network_cyw43_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_network_cyw43_type,
diff --git a/extmod/network_esp_hosted.c b/extmod/network_esp_hosted.c
index 1a3be3f39a..14e8be8b6a 100644
--- a/extmod/network_esp_hosted.c
+++ b/extmod/network_esp_hosted.c
@@ -56,7 +56,7 @@ typedef struct _esp_hosted_obj_t {
static esp_hosted_obj_t esp_hosted_sta_if = {{(mp_obj_type_t *)&mod_network_esp_hosted_type}, ESP_HOSTED_STA_IF};
static esp_hosted_obj_t esp_hosted_ap_if = {{(mp_obj_type_t *)&mod_network_esp_hosted_type}, ESP_HOSTED_AP_IF};
-STATIC mp_obj_t network_esp_hosted_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t network_esp_hosted_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_t esp_hosted_obj;
// TODO fix
@@ -70,7 +70,7 @@ STATIC mp_obj_t network_esp_hosted_make_new(const mp_obj_type_t *type, size_t n_
return esp_hosted_obj;
}
-STATIC mp_obj_t network_esp_hosted_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_esp_hosted_active(size_t n_args, const mp_obj_t *args) {
esp_hosted_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 2) {
@@ -95,9 +95,9 @@ STATIC mp_obj_t network_esp_hosted_active(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_bool(esp_hosted_wifi_link_status(self->itf));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_esp_hosted_active_obj, 1, 2, network_esp_hosted_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_esp_hosted_active_obj, 1, 2, network_esp_hosted_active);
-STATIC int esp_hosted_scan_callback(esp_hosted_scan_result_t *scan_result, void *arg) {
+static int esp_hosted_scan_callback(esp_hosted_scan_result_t *scan_result, void *arg) {
mp_obj_t scan_list = (mp_obj_t)arg;
mp_obj_t ap[6] = {
mp_obj_new_bytes((uint8_t *)scan_result->ssid, strlen(scan_result->ssid)),
@@ -111,15 +111,15 @@ STATIC int esp_hosted_scan_callback(esp_hosted_scan_result_t *scan_result, void
return 0;
}
-STATIC mp_obj_t network_esp_hosted_scan(mp_obj_t self_in) {
+static mp_obj_t network_esp_hosted_scan(mp_obj_t self_in) {
mp_obj_t scan_list;
scan_list = mp_obj_new_list(0, NULL);
esp_hosted_wifi_scan(esp_hosted_scan_callback, scan_list, 10000);
return scan_list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_esp_hosted_scan_obj, network_esp_hosted_scan);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_esp_hosted_scan_obj, network_esp_hosted_scan);
-STATIC mp_obj_t network_esp_hosted_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t network_esp_hosted_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ssid, ARG_key, ARG_security, ARG_bssid, ARG_channel };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -182,29 +182,29 @@ STATIC mp_obj_t network_esp_hosted_connect(mp_uint_t n_args, const mp_obj_t *pos
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_esp_hosted_connect_obj, 1, network_esp_hosted_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_esp_hosted_connect_obj, 1, network_esp_hosted_connect);
-STATIC mp_obj_t network_esp_hosted_disconnect(mp_obj_t self_in) {
+static mp_obj_t network_esp_hosted_disconnect(mp_obj_t self_in) {
esp_hosted_obj_t *self = self_in;
esp_hosted_wifi_disconnect(self->itf);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_esp_hosted_disconnect_obj, network_esp_hosted_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_esp_hosted_disconnect_obj, network_esp_hosted_disconnect);
-STATIC mp_obj_t network_esp_hosted_isconnected(mp_obj_t self_in) {
+static mp_obj_t network_esp_hosted_isconnected(mp_obj_t self_in) {
esp_hosted_obj_t *self = self_in;
return mp_obj_new_bool(esp_hosted_wifi_is_connected(self->itf));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_esp_hosted_isconnected_obj, network_esp_hosted_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_esp_hosted_isconnected_obj, network_esp_hosted_isconnected);
-STATIC mp_obj_t network_esp_hosted_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_esp_hosted_ifconfig(size_t n_args, const mp_obj_t *args) {
esp_hosted_obj_t *self = MP_OBJ_TO_PTR(args[0]);
void *netif = esp_hosted_wifi_get_netif(self->itf);
return mod_network_nic_ifconfig(netif, n_args - 1, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_esp_hosted_ifconfig_obj, 1, 2, network_esp_hosted_ifconfig);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_esp_hosted_ifconfig_obj, 1, 2, network_esp_hosted_ifconfig);
-STATIC mp_obj_t network_esp_hosted_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t network_esp_hosted_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
esp_hosted_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (kwargs->used == 0) {
@@ -253,9 +253,9 @@ STATIC mp_obj_t network_esp_hosted_config(size_t n_args, const mp_obj_t *args, m
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_esp_hosted_config_obj, 1, network_esp_hosted_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_esp_hosted_config_obj, 1, network_esp_hosted_config);
-STATIC mp_obj_t network_esp_hosted_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_esp_hosted_status(size_t n_args, const mp_obj_t *args) {
esp_hosted_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
@@ -290,9 +290,9 @@ STATIC mp_obj_t network_esp_hosted_status(size_t n_args, const mp_obj_t *args) {
mp_raise_ValueError(MP_ERROR_TEXT("unknown status param"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_esp_hosted_status_obj, 1, 2, network_esp_hosted_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_esp_hosted_status_obj, 1, 2, network_esp_hosted_status);
-STATIC const mp_rom_map_elem_t network_esp_hosted_locals_dict_table[] = {
+static const mp_rom_map_elem_t network_esp_hosted_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&network_esp_hosted_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&network_esp_hosted_scan_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&network_esp_hosted_connect_obj) },
@@ -305,7 +305,7 @@ STATIC const mp_rom_map_elem_t network_esp_hosted_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_WEP), MP_ROM_INT(ESP_HOSTED_SEC_WEP) },
{ MP_ROM_QSTR(MP_QSTR_WPA_PSK), MP_ROM_INT(ESP_HOSTED_SEC_WPA_WPA2_PSK) },
};
-STATIC MP_DEFINE_CONST_DICT(network_esp_hosted_locals_dict, network_esp_hosted_locals_dict_table);
+static MP_DEFINE_CONST_DICT(network_esp_hosted_locals_dict, network_esp_hosted_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mod_network_esp_hosted_type,
diff --git a/extmod/network_ninaw10.c b/extmod/network_ninaw10.c
index 1deb117e70..e68a7a66e2 100644
--- a/extmod/network_ninaw10.c
+++ b/extmod/network_ninaw10.c
@@ -85,21 +85,21 @@ static nina_obj_t network_nina_wl_sta = {{(mp_obj_type_t *)&mod_network_nic_type
static nina_obj_t network_nina_wl_ap = {{(mp_obj_type_t *)&mod_network_nic_type_nina}, false, false, MOD_NETWORK_AP_IF};
static mp_sched_node_t mp_wifi_poll_node;
static soft_timer_entry_t mp_wifi_poll_timer;
-STATIC void network_ninaw10_deinit(void);
+static void network_ninaw10_deinit(void);
-STATIC bool network_ninaw10_poll_list_is_empty(void) {
+static bool network_ninaw10_poll_list_is_empty(void) {
return MP_STATE_PORT(mp_wifi_poll_list) == NULL ||
MP_STATE_PORT(mp_wifi_poll_list)->len == 0;
}
-STATIC void network_ninaw10_poll_list_insert(mp_obj_t socket) {
+static void network_ninaw10_poll_list_insert(mp_obj_t socket) {
if (MP_STATE_PORT(mp_wifi_poll_list) == NULL) {
MP_STATE_PORT(mp_wifi_poll_list) = mp_obj_new_list(0, NULL);
}
mp_obj_list_append(MP_STATE_PORT(mp_wifi_poll_list), socket);
}
-STATIC void network_ninaw10_poll_list_remove(mp_obj_t socket) {
+static void network_ninaw10_poll_list_remove(mp_obj_t socket) {
if (MP_STATE_PORT(mp_wifi_poll_list) == NULL) {
return;
}
@@ -109,7 +109,7 @@ STATIC void network_ninaw10_poll_list_remove(mp_obj_t socket) {
}
}
-STATIC void network_ninaw10_poll_sockets(mp_sched_node_t *node) {
+static void network_ninaw10_poll_sockets(mp_sched_node_t *node) {
(void)node;
for (mp_uint_t i = 0; MP_STATE_PORT(mp_wifi_poll_list) && i < MP_STATE_PORT(mp_wifi_poll_list)->len;) {
mod_network_socket_obj_t *socket = MP_STATE_PORT(mp_wifi_poll_list)->items[i];
@@ -134,7 +134,7 @@ STATIC void network_ninaw10_poll_sockets(mp_sched_node_t *node) {
}
}
-STATIC void network_ninaw10_poll_connect(mp_sched_node_t *node) {
+static void network_ninaw10_poll_connect(mp_sched_node_t *node) {
nina_obj_t *self = &network_nina_wl_sta;
int status = nina_connection_status();
@@ -166,7 +166,7 @@ STATIC void network_ninaw10_poll_connect(mp_sched_node_t *node) {
soft_timer_reinsert(&mp_wifi_poll_timer, NINAW10_POLL_INTERVAL);
}
-STATIC void network_ninaw10_timer_callback(soft_timer_entry_t *self) {
+static void network_ninaw10_timer_callback(soft_timer_entry_t *self) {
debug_printf("timer_callback() poll status STA: %d AP: %d SOCKETS: %d\n",
network_nina_wl_sta.poll_enable, network_nina_wl_ap.poll_enable, !network_ninaw10_poll_list_is_empty());
if (network_nina_wl_sta.poll_enable) {
@@ -176,7 +176,7 @@ STATIC void network_ninaw10_timer_callback(soft_timer_entry_t *self) {
}
}
-STATIC mp_obj_t network_ninaw10_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t network_ninaw10_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_t nina_obj;
if (n_args == 0 || mp_obj_get_int(args[0]) == MOD_NETWORK_STA_IF) {
@@ -189,7 +189,7 @@ STATIC mp_obj_t network_ninaw10_make_new(const mp_obj_type_t *type, size_t n_arg
return nina_obj;
}
-STATIC mp_obj_t network_ninaw10_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_ninaw10_active(size_t n_args, const mp_obj_t *args) {
nina_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 2) {
bool active = mp_obj_is_true(args[1]);
@@ -231,9 +231,9 @@ STATIC mp_obj_t network_ninaw10_active(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_bool(self->active);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ninaw10_active_obj, 1, 2, network_ninaw10_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ninaw10_active_obj, 1, 2, network_ninaw10_active);
-STATIC int nina_scan_callback(nina_scan_result_t *scan_result, void *arg) {
+static int nina_scan_callback(nina_scan_result_t *scan_result, void *arg) {
mp_obj_t scan_list = (mp_obj_t)arg;
mp_obj_t ap[6] = {
mp_obj_new_bytes((uint8_t *)scan_result->ssid, strlen(scan_result->ssid)),
@@ -247,15 +247,15 @@ STATIC int nina_scan_callback(nina_scan_result_t *scan_result, void *arg) {
return 0;
}
-STATIC mp_obj_t network_ninaw10_scan(mp_obj_t self_in) {
+static mp_obj_t network_ninaw10_scan(mp_obj_t self_in) {
mp_obj_t scan_list;
scan_list = mp_obj_new_list(0, NULL);
nina_scan(nina_scan_callback, scan_list, 10000);
return scan_list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_ninaw10_scan_obj, network_ninaw10_scan);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_ninaw10_scan_obj, network_ninaw10_scan);
-STATIC mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ssid, ARG_key, ARG_security, ARG_channel };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -322,20 +322,20 @@ STATIC mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_ar
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_ninaw10_connect_obj, 1, network_ninaw10_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_ninaw10_connect_obj, 1, network_ninaw10_connect);
-STATIC mp_obj_t network_ninaw10_disconnect(mp_obj_t self_in) {
+static mp_obj_t network_ninaw10_disconnect(mp_obj_t self_in) {
nina_disconnect();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_ninaw10_disconnect_obj, network_ninaw10_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_ninaw10_disconnect_obj, network_ninaw10_disconnect);
-STATIC mp_obj_t network_ninaw10_isconnected(mp_obj_t self_in) {
+static mp_obj_t network_ninaw10_isconnected(mp_obj_t self_in) {
return mp_obj_new_bool(nina_isconnected());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_ninaw10_isconnected_obj, network_ninaw10_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_ninaw10_isconnected_obj, network_ninaw10_isconnected);
-STATIC mp_obj_t network_ninaw10_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_ninaw10_ifconfig(size_t n_args, const mp_obj_t *args) {
nina_ifconfig_t ifconfig;
if (n_args == 1) {
// get ifconfig info
@@ -359,9 +359,9 @@ STATIC mp_obj_t network_ninaw10_ifconfig(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ninaw10_ifconfig_obj, 1, 2, network_ninaw10_ifconfig);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ninaw10_ifconfig_obj, 1, 2, network_ninaw10_ifconfig);
-STATIC mp_obj_t network_ninaw10_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t network_ninaw10_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
nina_obj_t *self = MP_OBJ_TO_PTR(args[0]);
(void)self;
@@ -410,9 +410,9 @@ STATIC mp_obj_t network_ninaw10_config(size_t n_args, const mp_obj_t *args, mp_m
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_ninaw10_config_obj, 1, network_ninaw10_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_ninaw10_config_obj, 1, network_ninaw10_config);
-STATIC mp_obj_t network_ninaw10_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_ninaw10_status(size_t n_args, const mp_obj_t *args) {
nina_obj_t *self = MP_OBJ_TO_PTR(args[0]);
(void)self;
@@ -444,9 +444,9 @@ STATIC mp_obj_t network_ninaw10_status(size_t n_args, const mp_obj_t *args) {
mp_raise_ValueError(MP_ERROR_TEXT("unknown status param"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ninaw10_status_obj, 1, 2, network_ninaw10_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ninaw10_status_obj, 1, 2, network_ninaw10_status);
-STATIC mp_obj_t network_ninaw10_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t buf_in) {
+static mp_obj_t network_ninaw10_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t buf_in) {
debug_printf("ioctl(%d)\n", mp_obj_get_int(cmd_in));
nina_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t buf;
@@ -458,14 +458,14 @@ STATIC mp_obj_t network_ninaw10_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(network_ninaw10_ioctl_obj, network_ninaw10_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(network_ninaw10_ioctl_obj, network_ninaw10_ioctl);
-STATIC int network_ninaw10_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *out_ip) {
+static int network_ninaw10_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *out_ip) {
debug_printf("gethostbyname(%s)\n", name);
return nina_gethostbyname(name, out_ip);
}
-STATIC int network_ninaw10_socket_poll(mod_network_socket_obj_t *socket, uint32_t rwf, int *_errno) {
+static int network_ninaw10_socket_poll(mod_network_socket_obj_t *socket, uint32_t rwf, int *_errno) {
uint8_t flags = 0;
debug_printf("socket_polling_rw(%d, %d, %d)\n", socket->fileno, socket->timeout, rwf);
if (socket->timeout == 0) {
@@ -488,7 +488,7 @@ STATIC int network_ninaw10_socket_poll(mod_network_socket_obj_t *socket, uint32_
return 0;
}
-STATIC int network_ninaw10_socket_setblocking(mod_network_socket_obj_t *socket, bool blocking, int *_errno) {
+static int network_ninaw10_socket_setblocking(mod_network_socket_obj_t *socket, bool blocking, int *_errno) {
uint32_t nonblocking = !blocking;
// set socket in non-blocking mode
if (nina_socket_ioctl(socket->fileno, SOCKET_IOCTL_FIONBIO, &nonblocking, sizeof(nonblocking)) < 0) {
@@ -499,7 +499,7 @@ STATIC int network_ninaw10_socket_setblocking(mod_network_socket_obj_t *socket,
return 0;
}
-STATIC int network_ninaw10_socket_listening(mod_network_socket_obj_t *socket, int *_errno) {
+static int network_ninaw10_socket_listening(mod_network_socket_obj_t *socket, int *_errno) {
int listening = 0;
if (nina_socket_getsockopt(socket->fileno, MOD_NETWORK_SOL_SOCKET,
SO_ACCEPTCONN, &listening, sizeof(listening)) < 0) {
@@ -510,7 +510,7 @@ STATIC int network_ninaw10_socket_listening(mod_network_socket_obj_t *socket, in
return listening;
}
-STATIC int network_ninaw10_socket_socket(mod_network_socket_obj_t *socket, int *_errno) {
+static int network_ninaw10_socket_socket(mod_network_socket_obj_t *socket, int *_errno) {
debug_printf("socket_socket(%d %d %d)\n", socket->domain, socket->type, socket->proto);
uint8_t socket_type;
@@ -553,7 +553,7 @@ STATIC int network_ninaw10_socket_socket(mod_network_socket_obj_t *socket, int *
return network_ninaw10_socket_setblocking(socket, false, _errno);
}
-STATIC void network_ninaw10_socket_close(mod_network_socket_obj_t *socket) {
+static void network_ninaw10_socket_close(mod_network_socket_obj_t *socket) {
debug_printf("socket_close(%d)\n", socket->fileno);
if (socket->callback != MP_OBJ_NULL) {
socket->callback = MP_OBJ_NULL;
@@ -565,7 +565,7 @@ STATIC void network_ninaw10_socket_close(mod_network_socket_obj_t *socket) {
}
}
-STATIC int network_ninaw10_socket_bind(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
+static int network_ninaw10_socket_bind(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
debug_printf("socket_bind(%d, %d)\n", socket->fileno, port);
int ret = nina_socket_bind(socket->fileno, ip, port);
@@ -581,7 +581,7 @@ STATIC int network_ninaw10_socket_bind(mod_network_socket_obj_t *socket, byte *i
return 0;
}
-STATIC int network_ninaw10_socket_listen(mod_network_socket_obj_t *socket, mp_int_t backlog, int *_errno) {
+static int network_ninaw10_socket_listen(mod_network_socket_obj_t *socket, mp_int_t backlog, int *_errno) {
debug_printf("socket_listen(%d, %d)\n", socket->fileno, backlog);
int ret = nina_socket_listen(socket->fileno, backlog);
if (ret < 0) {
@@ -593,7 +593,7 @@ STATIC int network_ninaw10_socket_listen(mod_network_socket_obj_t *socket, mp_in
return 0;
}
-STATIC int network_ninaw10_socket_accept(mod_network_socket_obj_t *socket,
+static int network_ninaw10_socket_accept(mod_network_socket_obj_t *socket,
mod_network_socket_obj_t *socket2, byte *ip, mp_uint_t *port, int *_errno) {
debug_printf("socket_accept(%d)\n", socket->fileno);
@@ -622,7 +622,7 @@ STATIC int network_ninaw10_socket_accept(mod_network_socket_obj_t *socket,
return network_ninaw10_socket_setblocking(socket2, false, _errno);
}
-STATIC int network_ninaw10_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
+static int network_ninaw10_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
debug_printf("socket_connect(%d)\n", socket->fileno);
int ret = nina_socket_connect(socket->fileno, ip, port);
@@ -645,7 +645,7 @@ STATIC int network_ninaw10_socket_connect(mod_network_socket_obj_t *socket, byte
return 0;
}
-STATIC mp_uint_t network_ninaw10_socket_send(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) {
+static mp_uint_t network_ninaw10_socket_send(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) {
debug_printf("socket_send(%d, %d)\n", socket->fileno, len);
if (network_ninaw10_socket_poll(socket, SOCKET_POLL_WR, _errno) != 0) {
@@ -665,7 +665,7 @@ STATIC mp_uint_t network_ninaw10_socket_send(mod_network_socket_obj_t *socket, c
return ret;
}
-STATIC mp_uint_t network_ninaw10_socket_recv(mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno) {
+static mp_uint_t network_ninaw10_socket_recv(mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno) {
debug_printf("socket_recv(%d)\n", socket->fileno);
// check if socket in listening state.
if (network_ninaw10_socket_listening(socket, _errno) == 1) {
@@ -694,7 +694,7 @@ STATIC mp_uint_t network_ninaw10_socket_recv(mod_network_socket_obj_t *socket, b
return ret;
}
-STATIC mp_uint_t network_ninaw10_socket_auto_bind(mod_network_socket_obj_t *socket, int *_errno) {
+static mp_uint_t network_ninaw10_socket_auto_bind(mod_network_socket_obj_t *socket, int *_errno) {
debug_printf("socket_autobind(%d)\n", socket->fileno);
if (socket->bound == false && socket->type != MOD_NETWORK_SOCK_RAW) {
if (network_ninaw10_socket_bind(socket, NULL, bind_port, _errno) != 0) {
@@ -708,7 +708,7 @@ STATIC mp_uint_t network_ninaw10_socket_auto_bind(mod_network_socket_obj_t *sock
return 0;
}
-STATIC mp_uint_t network_ninaw10_socket_sendto(mod_network_socket_obj_t *socket,
+static mp_uint_t network_ninaw10_socket_sendto(mod_network_socket_obj_t *socket,
const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
debug_printf("socket_sendto(%d)\n", socket->fileno);
// Auto-bind the socket first if the socket is unbound.
@@ -732,7 +732,7 @@ STATIC mp_uint_t network_ninaw10_socket_sendto(mod_network_socket_obj_t *socket,
return ret;
}
-STATIC mp_uint_t network_ninaw10_socket_recvfrom(mod_network_socket_obj_t *socket,
+static mp_uint_t network_ninaw10_socket_recvfrom(mod_network_socket_obj_t *socket,
byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
debug_printf("socket_recvfrom(%d)\n", socket->fileno);
// Auto-bind the socket first if the socket is unbound.
@@ -758,7 +758,7 @@ STATIC mp_uint_t network_ninaw10_socket_recvfrom(mod_network_socket_obj_t *socke
return ret;
}
-STATIC int network_ninaw10_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t
+static int network_ninaw10_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t
level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
debug_printf("socket_setsockopt(%d, %d)\n", socket->fileno, opt);
if (opt == 20) {
@@ -781,7 +781,7 @@ STATIC int network_ninaw10_socket_setsockopt(mod_network_socket_obj_t *socket, m
return 0;
}
-STATIC int network_ninaw10_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno) {
+static int network_ninaw10_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno) {
debug_printf("socket_settimeout(%d, %d)\n", socket->fileno, timeout_ms);
#if 0
if (timeout_ms == 0 || timeout_ms == UINT32_MAX) {
@@ -806,7 +806,7 @@ STATIC int network_ninaw10_socket_settimeout(mod_network_socket_obj_t *socket, m
return 0;
}
-STATIC int network_ninaw10_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno) {
+static int network_ninaw10_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno) {
mp_uint_t ret = 0;
debug_printf("socket_ioctl(%d, %d)\n", socket->fileno, request);
if (request == MP_STREAM_POLL) {
@@ -830,7 +830,7 @@ STATIC int network_ninaw10_socket_ioctl(mod_network_socket_obj_t *socket, mp_uin
return ret;
}
-STATIC void network_ninaw10_deinit(void) {
+static void network_ninaw10_deinit(void) {
// On soft-reboot, gc_sweep_all is called and all open sockets are closed
// and collected. Make sure that the driver is not keeping any references
// to collected sockets in the poll list.
@@ -838,7 +838,7 @@ STATIC void network_ninaw10_deinit(void) {
MP_STATE_PORT(mp_wifi_poll_list) = NULL;
}
-STATIC const mp_rom_map_elem_t nina_locals_dict_table[] = {
+static const mp_rom_map_elem_t nina_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&network_ninaw10_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&network_ninaw10_scan_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&network_ninaw10_connect_obj) },
@@ -857,9 +857,9 @@ STATIC const mp_rom_map_elem_t nina_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_WPA_PSK), MP_ROM_INT(NINA_SEC_WPA_PSK) },
};
-STATIC MP_DEFINE_CONST_DICT(nina_locals_dict, nina_locals_dict_table);
+static MP_DEFINE_CONST_DICT(nina_locals_dict, nina_locals_dict_table);
-STATIC const mod_network_nic_protocol_t mod_network_nic_protocol_nina = {
+static const mod_network_nic_protocol_t mod_network_nic_protocol_nina = {
.gethostbyname = network_ninaw10_gethostbyname,
.deinit = network_ninaw10_deinit,
.socket = network_ninaw10_socket_socket,
diff --git a/extmod/network_wiznet5k.c b/extmod/network_wiznet5k.c
index d4841e0176..d1aadc3e15 100644
--- a/extmod/network_wiznet5k.c
+++ b/extmod/network_wiznet5k.c
@@ -120,21 +120,21 @@ typedef struct _wiznet5k_obj_t {
#endif
// Global object holding the Wiznet5k state
-STATIC wiznet5k_obj_t wiznet5k_obj;
+static wiznet5k_obj_t wiznet5k_obj;
-STATIC void wiz_cris_enter(void) {
+static void wiz_cris_enter(void) {
wiznet5k_obj.cris_state = MICROPY_BEGIN_ATOMIC_SECTION();
}
-STATIC void wiz_cris_exit(void) {
+static void wiz_cris_exit(void) {
MICROPY_END_ATOMIC_SECTION(wiznet5k_obj.cris_state);
}
-STATIC void wiz_cs_select(void) {
+static void wiz_cs_select(void) {
mp_hal_pin_low(wiznet5k_obj.cs);
}
-STATIC void wiz_cs_deselect(void) {
+static void wiz_cs_deselect(void) {
mp_hal_pin_high(wiznet5k_obj.cs);
}
@@ -147,25 +147,25 @@ void mpy_wiznet_yield(void) {
#endif
}
-STATIC void wiz_spi_read(uint8_t *buf, uint16_t len) {
+static void wiz_spi_read(uint8_t *buf, uint16_t len) {
wiznet5k_obj.spi_transfer(wiznet5k_obj.spi, len, buf, buf);
}
-STATIC void wiz_spi_write(const uint8_t *buf, uint16_t len) {
+static void wiz_spi_write(const uint8_t *buf, uint16_t len) {
wiznet5k_obj.spi_transfer(wiznet5k_obj.spi, len, buf, NULL);
}
-STATIC uint8_t wiz_spi_readbyte() {
+static uint8_t wiz_spi_readbyte() {
uint8_t buf = 0;
wiznet5k_obj.spi_transfer(wiznet5k_obj.spi, 1, &buf, &buf);
return buf;
}
-STATIC void wiz_spi_writebyte(const uint8_t buf) {
+static void wiz_spi_writebyte(const uint8_t buf) {
wiznet5k_obj.spi_transfer(wiznet5k_obj.spi, 1, &buf, NULL);
}
-STATIC void wiznet5k_get_mac_address(wiznet5k_obj_t *self, uint8_t mac[6]) {
+static void wiznet5k_get_mac_address(wiznet5k_obj_t *self, uint8_t mac[6]) {
(void)self;
getSHAR(mac);
}
@@ -173,9 +173,9 @@ STATIC void wiznet5k_get_mac_address(wiznet5k_obj_t *self, uint8_t mac[6]) {
#if WIZNET5K_WITH_LWIP_STACK
void wiznet5k_try_poll(void);
-STATIC void wiznet5k_lwip_init(wiznet5k_obj_t *self);
+static void wiznet5k_lwip_init(wiznet5k_obj_t *self);
-STATIC mp_obj_t mpy_wiznet_read_int(mp_obj_t none_in) {
+static mp_obj_t mpy_wiznet_read_int(mp_obj_t none_in) {
(void)none_in;
// Handle incoming data, unless the SPI bus is busy
if (mp_hal_pin_read(wiznet5k_obj.cs)) {
@@ -183,9 +183,9 @@ STATIC mp_obj_t mpy_wiznet_read_int(mp_obj_t none_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mpy_wiznet_read_int_obj, mpy_wiznet_read_int);
+static MP_DEFINE_CONST_FUN_OBJ_1(mpy_wiznet_read_int_obj, mpy_wiznet_read_int);
-STATIC void wiznet5k_config_interrupt(bool enabled) {
+static void wiznet5k_config_interrupt(bool enabled) {
if (!wiznet5k_obj.use_interrupt) {
return;
}
@@ -207,7 +207,7 @@ void wiznet5k_deinit(void) {
}
}
-STATIC void wiznet5k_init(void) {
+static void wiznet5k_init(void) {
// Configure wiznet for raw ethernet frame usage.
// Configure 16k buffers for fast MACRAW
@@ -241,7 +241,7 @@ STATIC void wiznet5k_init(void) {
mod_network_register_nic(&wiznet5k_obj);
}
-STATIC void wiznet5k_send_ethernet(wiznet5k_obj_t *self, size_t len, const uint8_t *buf) {
+static void wiznet5k_send_ethernet(wiznet5k_obj_t *self, size_t len, const uint8_t *buf) {
uint8_t ip[4] = {1, 1, 1, 1}; // dummy
int ret = WIZCHIP_EXPORT(sendto)(0, (byte *)buf, len, ip, 11); // dummy port
if (ret != len) {
@@ -252,7 +252,7 @@ STATIC void wiznet5k_send_ethernet(wiznet5k_obj_t *self, size_t len, const uint8
}
// Stores the frame in self->eth_frame and returns number of bytes in the frame, 0 for no frame
-STATIC uint16_t wiznet5k_recv_ethernet(wiznet5k_obj_t *self) {
+static uint16_t wiznet5k_recv_ethernet(wiznet5k_obj_t *self) {
uint16_t len = getSn_RX_RSR(0);
if (len == 0) {
return 0;
@@ -274,7 +274,7 @@ STATIC uint16_t wiznet5k_recv_ethernet(wiznet5k_obj_t *self) {
/*******************************************************************************/
// Wiznet5k lwIP interface
-STATIC err_t wiznet5k_netif_output(struct netif *netif, struct pbuf *p) {
+static err_t wiznet5k_netif_output(struct netif *netif, struct pbuf *p) {
wiznet5k_obj_t *self = netif->state;
pbuf_copy_partial(p, self->eth_frame, p->tot_len, 0);
if (self->trace_flags & TRACE_ETH_TX) {
@@ -284,7 +284,7 @@ STATIC err_t wiznet5k_netif_output(struct netif *netif, struct pbuf *p) {
return ERR_OK;
}
-STATIC err_t wiznet5k_netif_init(struct netif *netif) {
+static err_t wiznet5k_netif_init(struct netif *netif) {
netif->linkoutput = wiznet5k_netif_output;
netif->output = etharp_output;
netif->mtu = 1500;
@@ -303,7 +303,7 @@ STATIC err_t wiznet5k_netif_init(struct netif *netif) {
return ERR_OK;
}
-STATIC void wiznet5k_lwip_init(wiznet5k_obj_t *self) {
+static void wiznet5k_lwip_init(wiznet5k_obj_t *self) {
ip_addr_t ipconfig[4];
IP_ADDR4(&ipconfig[0], 0, 0, 0, 0);
IP_ADDR4(&ipconfig[1], 0, 0, 0, 0);
@@ -350,7 +350,7 @@ void wiznet5k_poll(void) {
#if WIZNET5K_PROVIDED_STACK
-STATIC void wiz_dhcp_assign(void) {
+static void wiz_dhcp_assign(void) {
getIPfromDHCP(wiznet5k_obj.netinfo.ip);
getGWfromDHCP(wiznet5k_obj.netinfo.gw);
getSNfromDHCP(wiznet5k_obj.netinfo.sn);
@@ -358,16 +358,16 @@ STATIC void wiz_dhcp_assign(void) {
ctlnetwork(CN_SET_NETINFO, (void *)&wiznet5k_obj.netinfo);
}
-STATIC void wiz_dhcp_update(void) {
+static void wiz_dhcp_update(void) {
;
}
-STATIC void wiz_dhcp_conflict(void) {
+static void wiz_dhcp_conflict(void) {
;
}
-STATIC void wiznet5k_init(void) {
+static void wiznet5k_init(void) {
// Configure wiznet provided TCP / socket interface
reg_dhcp_cbfunc(wiz_dhcp_assign, wiz_dhcp_update, wiz_dhcp_conflict);
@@ -394,7 +394,7 @@ STATIC void wiznet5k_init(void) {
wiznet5k_obj.active = true;
}
-STATIC int wiznet5k_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *out_ip) {
+static int wiznet5k_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *out_ip) {
uint8_t dns_ip[MOD_NETWORK_IPADDR_BUF_SIZE] = {8, 8, 8, 8};
uint8_t *buf = m_new(uint8_t, MAX_DNS_BUF_SIZE);
DNS_init(2, buf);
@@ -412,7 +412,7 @@ STATIC int wiznet5k_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len,
}
}
-STATIC int wiznet5k_socket_socket(mod_network_socket_obj_t *socket, int *_errno) {
+static int wiznet5k_socket_socket(mod_network_socket_obj_t *socket, int *_errno) {
if (socket->domain != MOD_NETWORK_AF_INET) {
*_errno = MP_EAFNOSUPPORT;
return -1;
@@ -456,7 +456,7 @@ STATIC int wiznet5k_socket_socket(mod_network_socket_obj_t *socket, int *_errno)
return 0;
}
-STATIC void wiznet5k_socket_close(mod_network_socket_obj_t *socket) {
+static void wiznet5k_socket_close(mod_network_socket_obj_t *socket) {
uint8_t sn = (uint8_t)socket->fileno;
if (sn < _WIZCHIP_SOCK_NUM_) {
wiznet5k_obj.socket_used &= ~(1 << sn);
@@ -464,7 +464,7 @@ STATIC void wiznet5k_socket_close(mod_network_socket_obj_t *socket) {
}
}
-STATIC int wiznet5k_socket_bind(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
+static int wiznet5k_socket_bind(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
// open the socket in server mode (if port != 0)
mp_int_t ret = WIZCHIP_EXPORT(socket)(socket->fileno, socket->type, port, 0);
if (ret < 0) {
@@ -480,7 +480,7 @@ STATIC int wiznet5k_socket_bind(mod_network_socket_obj_t *socket, byte *ip, mp_u
return 0;
}
-STATIC int wiznet5k_socket_listen(mod_network_socket_obj_t *socket, mp_int_t backlog, int *_errno) {
+static int wiznet5k_socket_listen(mod_network_socket_obj_t *socket, mp_int_t backlog, int *_errno) {
mp_int_t ret = WIZCHIP_EXPORT(listen)(socket->fileno);
if (ret < 0) {
wiznet5k_socket_close(socket);
@@ -490,7 +490,7 @@ STATIC int wiznet5k_socket_listen(mod_network_socket_obj_t *socket, mp_int_t bac
return 0;
}
-STATIC int wiznet5k_socket_accept(mod_network_socket_obj_t *socket, mod_network_socket_obj_t *socket2, byte *ip, mp_uint_t *port, int *_errno) {
+static int wiznet5k_socket_accept(mod_network_socket_obj_t *socket, mod_network_socket_obj_t *socket2, byte *ip, mp_uint_t *port, int *_errno) {
for (;;) {
int sr = getSn_SR((uint8_t)socket->fileno);
if (sr == SOCK_ESTABLISHED) {
@@ -525,7 +525,7 @@ STATIC int wiznet5k_socket_accept(mod_network_socket_obj_t *socket, mod_network_
}
}
-STATIC int wiznet5k_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
+static int wiznet5k_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) {
// use "bind" function to open the socket in client mode
if (wiznet5k_socket_bind(socket, ip, 0, _errno) != 0) {
return -1;
@@ -546,7 +546,7 @@ STATIC int wiznet5k_socket_connect(mod_network_socket_obj_t *socket, byte *ip, m
return 0;
}
-STATIC mp_uint_t wiznet5k_socket_send(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) {
+static mp_uint_t wiznet5k_socket_send(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) {
MP_THREAD_GIL_EXIT();
mp_int_t ret = WIZCHIP_EXPORT(send)(socket->fileno, (byte *)buf, len);
MP_THREAD_GIL_ENTER();
@@ -560,7 +560,7 @@ STATIC mp_uint_t wiznet5k_socket_send(mod_network_socket_obj_t *socket, const by
return ret;
}
-STATIC mp_uint_t wiznet5k_socket_recv(mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno) {
+static mp_uint_t wiznet5k_socket_recv(mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno) {
MP_THREAD_GIL_EXIT();
mp_int_t ret = WIZCHIP_EXPORT(recv)(socket->fileno, buf, len);
MP_THREAD_GIL_ENTER();
@@ -574,7 +574,7 @@ STATIC mp_uint_t wiznet5k_socket_recv(mod_network_socket_obj_t *socket, byte *bu
return ret;
}
-STATIC mp_uint_t wiznet5k_socket_sendto(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
+static mp_uint_t wiznet5k_socket_sendto(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
if (socket->domain == 0) {
// socket not opened; use "bind" function to open the socket in client mode
if (wiznet5k_socket_bind(socket, ip, 0, _errno) != 0) {
@@ -594,7 +594,7 @@ STATIC mp_uint_t wiznet5k_socket_sendto(mod_network_socket_obj_t *socket, const
return ret;
}
-STATIC mp_uint_t wiznet5k_socket_recvfrom(mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
+static mp_uint_t wiznet5k_socket_recvfrom(mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
uint16_t port2;
MP_THREAD_GIL_EXIT();
mp_int_t ret = WIZCHIP_EXPORT(recvfrom)(socket->fileno, buf, len, ip, &port2);
@@ -608,13 +608,13 @@ STATIC mp_uint_t wiznet5k_socket_recvfrom(mod_network_socket_obj_t *socket, byte
return ret;
}
-STATIC int wiznet5k_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
+static int wiznet5k_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
// TODO
*_errno = MP_EINVAL;
return -1;
}
-STATIC int wiznet5k_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno) {
+static int wiznet5k_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno) {
// TODO
*_errno = MP_EINVAL;
return -1;
@@ -628,7 +628,7 @@ STATIC int wiznet5k_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_
*/
}
-STATIC int wiznet5k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno) {
+static int wiznet5k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno) {
if (request == MP_STREAM_POLL) {
int ret = 0;
if (arg & MP_STREAM_POLL_RD && getSn_RX_RSR(socket->fileno) != 0) {
@@ -644,7 +644,7 @@ STATIC int wiznet5k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t req
}
}
-STATIC void wiznet5k_dhcp_init(wiznet5k_obj_t *self) {
+static void wiznet5k_dhcp_init(wiznet5k_obj_t *self) {
uint8_t test_buf[2048];
uint8_t ret = 0;
uint8_t dhcp_retry = 0;
@@ -682,7 +682,7 @@ STATIC void wiznet5k_dhcp_init(wiznet5k_obj_t *self) {
// WIZNET5K(spi, pin_cs, pin_rst[, pin_intn])
// Create and return a WIZNET5K object.
-STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_obj_base_t *spi;
mp_hal_pin_obj_t cs;
mp_hal_pin_obj_t rst;
@@ -763,7 +763,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
// regs()
// Dump WIZNET5K registers.
-STATIC mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
+static mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
(void)self_in;
printf("Wiz CREG:");
for (int i = 0; i < 0x50; ++i) {
@@ -794,9 +794,9 @@ STATIC mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
printf("\n");
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(wiznet5k_regs_obj, wiznet5k_regs);
+static MP_DEFINE_CONST_FUN_OBJ_1(wiznet5k_regs_obj, wiznet5k_regs);
-STATIC mp_obj_t wiznet5k_isconnected(mp_obj_t self_in) {
+static mp_obj_t wiznet5k_isconnected(mp_obj_t self_in) {
wiznet5k_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(
wizphy_getphylink() == PHY_LINK_ON
@@ -806,9 +806,9 @@ STATIC mp_obj_t wiznet5k_isconnected(mp_obj_t self_in) {
#endif
);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(wiznet5k_isconnected_obj, wiznet5k_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(wiznet5k_isconnected_obj, wiznet5k_isconnected);
-STATIC mp_obj_t wiznet5k_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wiznet5k_active(size_t n_args, const mp_obj_t *args) {
wiznet5k_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
return mp_obj_new_bool(IS_ACTIVE(self));
@@ -860,12 +860,12 @@ STATIC mp_obj_t wiznet5k_active(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_active_obj, 1, 2, wiznet5k_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_active_obj, 1, 2, wiznet5k_active);
#if WIZNET5K_PROVIDED_STACK
// ifconfig([(ip, subnet, gateway, dns)])
// Get/set IP address, subnet mask, gateway and DNS.
-STATIC mp_obj_t wiznet5k_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wiznet5k_ifconfig(size_t n_args, const mp_obj_t *args) {
wiz_NetInfo netinfo;
wiznet5k_obj_t *self = MP_OBJ_TO_PTR(args[0]);
ctlnetwork(CN_GET_NETINFO, &netinfo);
@@ -904,29 +904,29 @@ STATIC mp_obj_t wiznet5k_ifconfig(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_ifconfig_obj, 1, 2, wiznet5k_ifconfig);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_ifconfig_obj, 1, 2, wiznet5k_ifconfig);
#endif // WIZNET5K_PROVIDED_STACK
#if WIZNET5K_WITH_LWIP_STACK
-STATIC mp_obj_t wiznet5k_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wiznet5k_ifconfig(size_t n_args, const mp_obj_t *args) {
wiznet5k_obj_t *self = MP_OBJ_TO_PTR(args[0]);
return mod_network_nic_ifconfig(&self->netif, n_args - 1, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_ifconfig_obj, 1, 2, wiznet5k_ifconfig);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_ifconfig_obj, 1, 2, wiznet5k_ifconfig);
-STATIC mp_obj_t send_ethernet_wrapper(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t send_ethernet_wrapper(mp_obj_t self_in, mp_obj_t buf_in) {
wiznet5k_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t buf;
mp_get_buffer_raise(buf_in, &buf, MP_BUFFER_READ);
wiznet5k_send_ethernet(self, buf.len, buf.buf);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(send_ethernet_obj, send_ethernet_wrapper);
+static MP_DEFINE_CONST_FUN_OBJ_2(send_ethernet_obj, send_ethernet_wrapper);
#endif // MICROPY_PY_LWIP
-STATIC mp_obj_t wiznet5k_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wiznet5k_status(size_t n_args, const mp_obj_t *args) {
wiznet5k_obj_t *self = MP_OBJ_TO_PTR(args[0]);
(void)self;
@@ -944,9 +944,9 @@ STATIC mp_obj_t wiznet5k_status(size_t n_args, const mp_obj_t *args) {
}
mp_raise_ValueError(MP_ERROR_TEXT("unknown status param"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_status_obj, 1, 2, wiznet5k_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wiznet5k_status_obj, 1, 2, wiznet5k_status);
-STATIC mp_obj_t wiznet5k_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t wiznet5k_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
wiznet5k_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (kwargs->used == 0) {
@@ -1001,9 +1001,9 @@ STATIC mp_obj_t wiznet5k_config(size_t n_args, const mp_obj_t *args, mp_map_t *k
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wiznet5k_config_obj, 1, wiznet5k_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(wiznet5k_config_obj, 1, wiznet5k_config);
-STATIC const mp_rom_map_elem_t wiznet5k_locals_dict_table[] = {
+static const mp_rom_map_elem_t wiznet5k_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_regs), MP_ROM_PTR(&wiznet5k_regs_obj) },
{ MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&wiznet5k_isconnected_obj) },
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&wiznet5k_active_obj) },
@@ -1014,7 +1014,7 @@ STATIC const mp_rom_map_elem_t wiznet5k_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_send_ethernet), MP_ROM_PTR(&send_ethernet_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(wiznet5k_locals_dict, wiznet5k_locals_dict_table);
+static MP_DEFINE_CONST_DICT(wiznet5k_locals_dict, wiznet5k_locals_dict_table);
#if WIZNET5K_WITH_LWIP_STACK
#define NIC_TYPE_WIZNET_PROTOCOL
diff --git a/extmod/nimble/hal/hal_uart.c b/extmod/nimble/hal/hal_uart.c
index f4a9319c8b..b571178784 100644
--- a/extmod/nimble/hal/hal_uart.c
+++ b/extmod/nimble/hal/hal_uart.c
@@ -93,7 +93,7 @@ int hal_uart_close(uint32_t port) {
return 0; // success
}
-STATIC void mp_bluetooth_hci_uart_char_cb(uint8_t chr) {
+static void mp_bluetooth_hci_uart_char_cb(uint8_t chr) {
#if HCI_TRACE
printf(COL_BLUE "> [% 8d] %02x" COL_OFF "\n", (int)mp_hal_ticks_ms(), chr);
#endif
diff --git a/extmod/nimble/modbluetooth_nimble.c b/extmod/nimble/modbluetooth_nimble.c
index 5bab43a0cc..92bc6764ed 100644
--- a/extmod/nimble/modbluetooth_nimble.c
+++ b/extmod/nimble/modbluetooth_nimble.c
@@ -57,12 +57,12 @@
#define ERRNO_BLUETOOTH_NOT_ACTIVE MP_ENODEV
-STATIC uint8_t nimble_address_mode = BLE_OWN_ADDR_RANDOM;
+static uint8_t nimble_address_mode = BLE_OWN_ADDR_RANDOM;
#define NIMBLE_STARTUP_TIMEOUT 2000
// Any BLE_HS_xxx code not in this table will default to MP_EIO.
-STATIC int8_t ble_hs_err_to_errno_table[] = {
+static int8_t ble_hs_err_to_errno_table[] = {
[BLE_HS_EAGAIN] = MP_EAGAIN,
[BLE_HS_EALREADY] = MP_EALREADY,
[BLE_HS_EINVAL] = MP_EINVAL,
@@ -76,70 +76,70 @@ STATIC int8_t ble_hs_err_to_errno_table[] = {
[BLE_HS_EBADDATA] = MP_EINVAL,
};
-STATIC int ble_hs_err_to_errno(int err);
+static int ble_hs_err_to_errno(int err);
-STATIC ble_uuid_t *create_nimble_uuid(const mp_obj_bluetooth_uuid_t *uuid, ble_uuid_any_t *storage);
-STATIC void reverse_addr_byte_order(uint8_t *addr_out, const uint8_t *addr_in);
+static ble_uuid_t *create_nimble_uuid(const mp_obj_bluetooth_uuid_t *uuid, ble_uuid_any_t *storage);
+static void reverse_addr_byte_order(uint8_t *addr_out, const uint8_t *addr_in);
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid);
-STATIC ble_addr_t create_nimble_addr(uint8_t addr_type, const uint8_t *addr);
+static mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid);
+static ble_addr_t create_nimble_addr(uint8_t addr_type, const uint8_t *addr);
#endif
-STATIC void reset_cb(int reason);
+static void reset_cb(int reason);
-STATIC bool has_public_address(void);
-STATIC void set_random_address(bool nrpa);
+static bool has_public_address(void);
+static void set_random_address(bool nrpa);
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
-STATIC int load_irk(void);
+static int load_irk(void);
#endif
-STATIC void sync_cb(void);
+static void sync_cb(void);
#if !MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY
-STATIC void ble_hs_shutdown_stop_cb(int status, void *arg);
+static void ble_hs_shutdown_stop_cb(int status, void *arg);
#endif
// Successfully registered service/char/desc handles.
-STATIC void gatts_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
+static void gatts_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
// Events about a connected central (we're in peripheral role).
-STATIC int central_gap_event_cb(struct ble_gap_event *event, void *arg);
+static int central_gap_event_cb(struct ble_gap_event *event, void *arg);
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
// Events about a connected peripheral (we're in central role).
-STATIC int peripheral_gap_event_cb(struct ble_gap_event *event, void *arg);
+static int peripheral_gap_event_cb(struct ble_gap_event *event, void *arg);
#endif
// Used by both of the above.
-STATIC int commmon_gap_event_cb(struct ble_gap_event *event, void *arg);
+static int commmon_gap_event_cb(struct ble_gap_event *event, void *arg);
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
// Scan results.
-STATIC int gap_scan_cb(struct ble_gap_event *event, void *arg);
+static int gap_scan_cb(struct ble_gap_event *event, void *arg);
#endif
#if MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
// Data available (either due to notify/indicate or successful read).
-STATIC void gattc_on_data_available(uint8_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om);
+static void gattc_on_data_available(uint8_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om);
// Client discovery callbacks.
-STATIC int ble_gattc_service_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, void *arg);
-STATIC int ble_gattc_characteristic_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_chr *characteristic, void *arg);
-STATIC int ble_gattc_descriptor_cb(uint16_t conn_handle, const struct ble_gatt_error *error, uint16_t characteristic_val_handle, const struct ble_gatt_dsc *descriptor, void *arg);
+static int ble_gattc_service_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, void *arg);
+static int ble_gattc_characteristic_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_chr *characteristic, void *arg);
+static int ble_gattc_descriptor_cb(uint16_t conn_handle, const struct ble_gatt_error *error, uint16_t characteristic_val_handle, const struct ble_gatt_dsc *descriptor, void *arg);
// Client read/write handlers.
-STATIC int ble_gattc_attr_read_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg);
-STATIC int ble_gattc_attr_write_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg);
+static int ble_gattc_attr_read_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg);
+static int ble_gattc_attr_write_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg);
#endif
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
// Bonding store.
-STATIC int ble_secret_store_read(int obj_type, const union ble_store_key *key, union ble_store_value *value);
-STATIC int ble_secret_store_write(int obj_type, const union ble_store_value *val);
-STATIC int ble_secret_store_delete(int obj_type, const union ble_store_key *key);
+static int ble_secret_store_read(int obj_type, const union ble_store_key *key, union ble_store_value *value);
+static int ble_secret_store_write(int obj_type, const union ble_store_value *val);
+static int ble_secret_store_delete(int obj_type, const union ble_store_key *key);
#endif
-STATIC int ble_hs_err_to_errno(int err) {
+static int ble_hs_err_to_errno(int err) {
DEBUG_printf("ble_hs_err_to_errno: %d\n", err);
if (!err) {
return 0;
@@ -154,7 +154,7 @@ STATIC int ble_hs_err_to_errno(int err) {
}
// Note: modbluetooth UUIDs store their data in LE.
-STATIC ble_uuid_t *create_nimble_uuid(const mp_obj_bluetooth_uuid_t *uuid, ble_uuid_any_t *storage) {
+static ble_uuid_t *create_nimble_uuid(const mp_obj_bluetooth_uuid_t *uuid, ble_uuid_any_t *storage) {
if (uuid->type == MP_BLUETOOTH_UUID_TYPE_16) {
ble_uuid16_t *result = storage ? &storage->u16 : m_new(ble_uuid16_t, 1);
result->u.type = BLE_UUID_TYPE_16;
@@ -176,7 +176,7 @@ STATIC ble_uuid_t *create_nimble_uuid(const mp_obj_bluetooth_uuid_t *uuid, ble_u
}
// modbluetooth (and the layers above it) work in BE for addresses, Nimble works in LE.
-STATIC void reverse_addr_byte_order(uint8_t *addr_out, const uint8_t *addr_in) {
+static void reverse_addr_byte_order(uint8_t *addr_out, const uint8_t *addr_in) {
for (int i = 0; i < 6; ++i) {
addr_out[i] = addr_in[5 - i];
}
@@ -184,7 +184,7 @@ STATIC void reverse_addr_byte_order(uint8_t *addr_out, const uint8_t *addr_in) {
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid) {
+static mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid) {
mp_obj_bluetooth_uuid_t result;
result.base.type = &mp_type_bluetooth_uuid;
switch (uuid->u.type) {
@@ -210,7 +210,7 @@ STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(const ble_uuid_any_t *uuid) {
return result;
}
-STATIC ble_addr_t create_nimble_addr(uint8_t addr_type, const uint8_t *addr) {
+static ble_addr_t create_nimble_addr(uint8_t addr_type, const uint8_t *addr) {
ble_addr_t addr_nimble;
addr_nimble.type = addr_type;
// Incoming addr is from modbluetooth (BE), so copy and convert to LE for Nimble.
@@ -222,15 +222,15 @@ STATIC ble_addr_t create_nimble_addr(uint8_t addr_type, const uint8_t *addr) {
volatile int mp_bluetooth_nimble_ble_state = MP_BLUETOOTH_NIMBLE_BLE_STATE_OFF;
-STATIC void reset_cb(int reason) {
+static void reset_cb(int reason) {
(void)reason;
}
-STATIC bool has_public_address(void) {
+static bool has_public_address(void) {
return ble_hs_id_copy_addr(BLE_ADDR_PUBLIC, NULL, NULL) == 0;
}
-STATIC void set_random_address(bool nrpa) {
+static void set_random_address(bool nrpa) {
int rc;
(void)rc;
ble_addr_t addr;
@@ -274,7 +274,7 @@ STATIC void set_random_address(bool nrpa) {
// Must be distinct to BLE_STORE_OBJ_TYPE_ in ble_store.h.
#define SECRET_TYPE_OUR_IRK 10
-STATIC int load_irk(void) {
+static int load_irk(void) {
// NimBLE unconditionally loads a fixed IRK on startup.
// See https://github.com/apache/mynewt-nimble/issues/887
@@ -318,7 +318,7 @@ STATIC int load_irk(void) {
}
#endif
-STATIC void sync_cb(void) {
+static void sync_cb(void) {
int rc;
(void)rc;
@@ -349,7 +349,7 @@ STATIC void sync_cb(void) {
mp_bluetooth_nimble_ble_state = MP_BLUETOOTH_NIMBLE_BLE_STATE_ACTIVE;
}
-STATIC void gatts_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg) {
+static void gatts_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg) {
if (!mp_bluetooth_is_active()) {
return;
}
@@ -390,7 +390,7 @@ STATIC void gatts_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg) {
}
}
-STATIC int commmon_gap_event_cb(struct ble_gap_event *event, void *arg) {
+static int commmon_gap_event_cb(struct ble_gap_event *event, void *arg) {
struct ble_gap_conn_desc desc;
switch (event->type) {
@@ -436,7 +436,7 @@ STATIC int commmon_gap_event_cb(struct ble_gap_event *event, void *arg) {
}
}
-STATIC int central_gap_event_cb(struct ble_gap_event *event, void *arg) {
+static int central_gap_event_cb(struct ble_gap_event *event, void *arg) {
DEBUG_printf("central_gap_event_cb: type=%d\n", event->type);
if (!mp_bluetooth_is_active()) {
return 0;
@@ -546,13 +546,13 @@ void mp_bluetooth_nimble_port_start(void) {
}
// Called when the host stop procedure has completed.
-STATIC void ble_hs_shutdown_stop_cb(int status, void *arg) {
+static void ble_hs_shutdown_stop_cb(int status, void *arg) {
(void)status;
(void)arg;
mp_bluetooth_nimble_ble_state = MP_BLUETOOTH_NIMBLE_BLE_STATE_OFF;
}
-STATIC struct ble_hs_stop_listener ble_hs_shutdown_stop_listener;
+static struct ble_hs_stop_listener ble_hs_shutdown_stop_listener;
void mp_bluetooth_nimble_port_shutdown(void) {
DEBUG_printf("mp_bluetooth_nimble_port_shutdown (nimble default)\n");
@@ -1127,7 +1127,7 @@ int mp_bluetooth_gap_passkey(uint16_t conn_handle, uint8_t action, mp_int_t pass
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC int gap_scan_cb(struct ble_gap_event *event, void *arg) {
+static int gap_scan_cb(struct ble_gap_event *event, void *arg) {
DEBUG_printf("gap_scan_cb: event=%d type=%d\n", event->type, event->type == BLE_GAP_EVENT_DISC ? event->disc.event_type : -1);
if (!mp_bluetooth_is_active()) {
return 0;
@@ -1185,7 +1185,7 @@ int mp_bluetooth_gap_scan_stop(void) {
}
// Central role: GAP events for a connected peripheral.
-STATIC int peripheral_gap_event_cb(struct ble_gap_event *event, void *arg) {
+static int peripheral_gap_event_cb(struct ble_gap_event *event, void *arg) {
DEBUG_printf("peripheral_gap_event_cb: event=%d\n", event->type);
if (!mp_bluetooth_is_active()) {
return 0;
@@ -1255,7 +1255,7 @@ int mp_bluetooth_gap_peripheral_connect_cancel(void) {
return ble_hs_err_to_errno(err);
}
-STATIC int ble_gattc_service_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, void *arg) {
+static int ble_gattc_service_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, void *arg) {
DEBUG_printf("ble_gattc_service_cb: conn_handle=%d status=%d start_handle=%d\n", conn_handle, error->status, service ? service->start_handle : -1);
if (!mp_bluetooth_is_active()) {
return 0;
@@ -1273,7 +1273,7 @@ STATIC int ble_gattc_service_cb(uint16_t conn_handle, const struct ble_gatt_erro
#if MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
-STATIC void gattc_on_data_available(uint8_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om) {
+static void gattc_on_data_available(uint8_t event, uint16_t conn_handle, uint16_t value_handle, const struct os_mbuf *om) {
// When the HCI data for an ATT payload arrives, the L2CAP channel will
// buffer it into its receive buffer. We set BLE_L2CAP_JOIN_RX_FRAGS=1 in
// syscfg.h so it should be rare that the mbuf is fragmented, but we do need
@@ -1320,7 +1320,7 @@ int mp_bluetooth_gattc_discover_primary_services(uint16_t conn_handle, const mp_
return ble_hs_err_to_errno(err);
}
-STATIC bool match_char_uuid(const mp_obj_bluetooth_uuid_t *filter_uuid, const ble_uuid_any_t *result_uuid) {
+static bool match_char_uuid(const mp_obj_bluetooth_uuid_t *filter_uuid, const ble_uuid_any_t *result_uuid) {
if (!filter_uuid) {
return true;
}
@@ -1329,7 +1329,7 @@ STATIC bool match_char_uuid(const mp_obj_bluetooth_uuid_t *filter_uuid, const bl
return ble_uuid_cmp(&result_uuid->u, &filter_uuid_nimble.u) == 0;
}
-STATIC int ble_gattc_characteristic_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_chr *characteristic, void *arg) {
+static int ble_gattc_characteristic_cb(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_chr *characteristic, void *arg) {
DEBUG_printf("ble_gattc_characteristic_cb: conn_handle=%d status=%d def_handle=%d val_handle=%d\n", conn_handle, error->status, characteristic ? characteristic->def_handle : -1, characteristic ? characteristic->val_handle : -1);
if (!mp_bluetooth_is_active()) {
return 0;
@@ -1401,7 +1401,7 @@ int mp_bluetooth_gattc_discover_characteristics(uint16_t conn_handle, uint16_t s
return ble_hs_err_to_errno(err);
}
-STATIC int ble_gattc_descriptor_cb(uint16_t conn_handle, const struct ble_gatt_error *error, uint16_t characteristic_val_handle, const struct ble_gatt_dsc *descriptor, void *arg) {
+static int ble_gattc_descriptor_cb(uint16_t conn_handle, const struct ble_gatt_error *error, uint16_t characteristic_val_handle, const struct ble_gatt_dsc *descriptor, void *arg) {
DEBUG_printf("ble_gattc_descriptor_cb: conn_handle=%d status=%d chr_handle=%d dsc_handle=%d\n", conn_handle, error->status, characteristic_val_handle, descriptor ? descriptor->handle : -1);
if (!mp_bluetooth_is_active()) {
return 0;
@@ -1423,7 +1423,7 @@ int mp_bluetooth_gattc_discover_descriptors(uint16_t conn_handle, uint16_t start
return ble_hs_err_to_errno(err);
}
-STATIC int ble_gattc_attr_read_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) {
+static int ble_gattc_attr_read_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) {
uint16_t handle = attr ? attr->handle : (error ? error->att_handle : 0xffff);
DEBUG_printf("ble_gattc_attr_read_cb: conn_handle=%d status=%d handle=%d\n", conn_handle, error->status, handle);
if (!mp_bluetooth_is_active()) {
@@ -1445,7 +1445,7 @@ int mp_bluetooth_gattc_read(uint16_t conn_handle, uint16_t value_handle) {
return ble_hs_err_to_errno(err);
}
-STATIC int ble_gattc_attr_write_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) {
+static int ble_gattc_attr_write_cb(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) {
uint16_t handle = attr ? attr->handle : (error ? error->att_handle : 0xffff);
DEBUG_printf("ble_gattc_attr_write_cb: conn_handle=%d status=%d handle=%d\n", conn_handle, error->status, handle);
if (!mp_bluetooth_is_active()) {
@@ -1481,7 +1481,7 @@ int mp_bluetooth_gattc_exchange_mtu(uint16_t conn_handle) {
#endif // MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
#if MICROPY_PY_BLUETOOTH_ENABLE_L2CAP_CHANNELS
-STATIC void unstall_l2cap_channel(void);
+static void unstall_l2cap_channel(void);
#endif
void mp_bluetooth_nimble_sent_hci_packet(void) {
@@ -1518,12 +1518,12 @@ typedef struct _mp_bluetooth_nimble_l2cap_channel_t {
os_membuf_t sdu_mem[];
} mp_bluetooth_nimble_l2cap_channel_t;
-STATIC void destroy_l2cap_channel();
-STATIC int l2cap_channel_event(struct ble_l2cap_event *event, void *arg);
-STATIC mp_bluetooth_nimble_l2cap_channel_t *get_l2cap_channel_for_conn_cid(uint16_t conn_handle, uint16_t cid);
-STATIC int create_l2cap_channel(uint16_t mtu, mp_bluetooth_nimble_l2cap_channel_t **out);
+static void destroy_l2cap_channel();
+static int l2cap_channel_event(struct ble_l2cap_event *event, void *arg);
+static mp_bluetooth_nimble_l2cap_channel_t *get_l2cap_channel_for_conn_cid(uint16_t conn_handle, uint16_t cid);
+static int create_l2cap_channel(uint16_t mtu, mp_bluetooth_nimble_l2cap_channel_t **out);
-STATIC void destroy_l2cap_channel() {
+static void destroy_l2cap_channel() {
// Only free the l2cap channel if we're the one that initiated the connection.
// Listeners continue listening on the same channel.
if (!MP_STATE_PORT(bluetooth_nimble_root_pointers)->l2cap_listening) {
@@ -1531,7 +1531,7 @@ STATIC void destroy_l2cap_channel() {
}
}
-STATIC void unstall_l2cap_channel(void) {
+static void unstall_l2cap_channel(void) {
// Whenever we send an HCI packet and the sys mempool is now less than 1/4 full,
// we can un-stall the L2CAP channel if it was marked as "mem_stalled" by
// mp_bluetooth_l2cap_send. (This happens if the pool is half-empty).
@@ -1544,7 +1544,7 @@ STATIC void unstall_l2cap_channel(void) {
mp_bluetooth_on_l2cap_send_ready(chan->chan->conn_handle, chan->chan->scid, 0);
}
-STATIC int l2cap_channel_event(struct ble_l2cap_event *event, void *arg) {
+static int l2cap_channel_event(struct ble_l2cap_event *event, void *arg) {
DEBUG_printf("l2cap_channel_event: type=%d\n", event->type);
mp_bluetooth_nimble_l2cap_channel_t *chan = (mp_bluetooth_nimble_l2cap_channel_t *)arg;
struct ble_l2cap_chan_info info;
@@ -1665,7 +1665,7 @@ STATIC int l2cap_channel_event(struct ble_l2cap_event *event, void *arg) {
return 0;
}
-STATIC mp_bluetooth_nimble_l2cap_channel_t *get_l2cap_channel_for_conn_cid(uint16_t conn_handle, uint16_t cid) {
+static mp_bluetooth_nimble_l2cap_channel_t *get_l2cap_channel_for_conn_cid(uint16_t conn_handle, uint16_t cid) {
// TODO: Support more than one concurrent L2CAP channel. At the moment we
// just verify that the cid refers to the current channel.
mp_bluetooth_nimble_l2cap_channel_t *chan = MP_STATE_PORT(bluetooth_nimble_root_pointers)->l2cap_chan;
@@ -1684,7 +1684,7 @@ STATIC mp_bluetooth_nimble_l2cap_channel_t *get_l2cap_channel_for_conn_cid(uint1
return chan;
}
-STATIC int create_l2cap_channel(uint16_t mtu, mp_bluetooth_nimble_l2cap_channel_t **out) {
+static int create_l2cap_channel(uint16_t mtu, mp_bluetooth_nimble_l2cap_channel_t **out) {
if (MP_STATE_PORT(bluetooth_nimble_root_pointers)->l2cap_chan) {
// Only one L2CAP channel allowed.
// Additionally, if we're listening, then no connections may be initiated.
@@ -1897,7 +1897,7 @@ int mp_bluetooth_hci_cmd(uint16_t ogf, uint16_t ocf, const uint8_t *req, size_t
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
-STATIC int ble_secret_store_read(int obj_type, const union ble_store_key *key, union ble_store_value *value) {
+static int ble_secret_store_read(int obj_type, const union ble_store_key *key, union ble_store_value *value) {
DEBUG_printf("ble_secret_store_read: %d\n", obj_type);
const uint8_t *key_data;
size_t key_data_len;
@@ -1962,7 +1962,7 @@ STATIC int ble_secret_store_read(int obj_type, const union ble_store_key *key, u
return 0;
}
-STATIC int ble_secret_store_write(int obj_type, const union ble_store_value *val) {
+static int ble_secret_store_write(int obj_type, const union ble_store_value *val) {
DEBUG_printf("ble_secret_store_write: %d\n", obj_type);
switch (obj_type) {
case BLE_STORE_OBJ_TYPE_PEER_SEC:
@@ -1996,7 +1996,7 @@ STATIC int ble_secret_store_write(int obj_type, const union ble_store_value *val
}
}
-STATIC int ble_secret_store_delete(int obj_type, const union ble_store_key *key) {
+static int ble_secret_store_delete(int obj_type, const union ble_store_key *key) {
DEBUG_printf("ble_secret_store_delete: %d\n", obj_type);
switch (obj_type) {
case BLE_STORE_OBJ_TYPE_PEER_SEC:
diff --git a/extmod/nimble/nimble/nimble_npl_os.c b/extmod/nimble/nimble/nimble_npl_os.c
index b68957fabf..0dc80482c4 100644
--- a/extmod/nimble/nimble/nimble_npl_os.c
+++ b/extmod/nimble/nimble/nimble_npl_os.c
@@ -67,7 +67,7 @@ typedef struct _mp_bluetooth_nimble_malloc_t {
} mp_bluetooth_nimble_malloc_t;
// TODO: This is duplicated from mbedtls. Perhaps make this a generic feature?
-STATIC void *m_malloc_bluetooth(size_t size) {
+static void *m_malloc_bluetooth(size_t size) {
size += sizeof(mp_bluetooth_nimble_malloc_t);
mp_bluetooth_nimble_malloc_t *alloc = m_malloc0(size);
alloc->size = size;
@@ -79,11 +79,11 @@ STATIC void *m_malloc_bluetooth(size_t size) {
return alloc->data;
}
-STATIC mp_bluetooth_nimble_malloc_t* get_nimble_malloc(void *ptr) {
+static mp_bluetooth_nimble_malloc_t* get_nimble_malloc(void *ptr) {
return (mp_bluetooth_nimble_malloc_t*)((uintptr_t)ptr - sizeof(mp_bluetooth_nimble_malloc_t));
}
-STATIC void m_free_bluetooth(void *ptr) {
+static void m_free_bluetooth(void *ptr) {
mp_bluetooth_nimble_malloc_t *alloc = get_nimble_malloc(ptr);
if (alloc->next) {
alloc->next->prev = alloc->prev;
@@ -102,7 +102,7 @@ STATIC void m_free_bluetooth(void *ptr) {
// Check if a nimble ptr is tracked.
// If it isn't, that means that it's from a previous soft-reset cycle.
-STATIC bool is_valid_nimble_malloc(void *ptr) {
+static bool is_valid_nimble_malloc(void *ptr) {
DEBUG_MALLOC_printf("NIMBLE is_valid_nimble_malloc(%p)\n", ptr);
mp_bluetooth_nimble_malloc_t *alloc = MP_STATE_PORT(bluetooth_nimble_memory);
while (alloc) {
diff --git a/extmod/os_dupterm.c b/extmod/os_dupterm.c
index dcd9c54b99..156766a43c 100644
--- a/extmod/os_dupterm.c
+++ b/extmod/os_dupterm.c
@@ -208,7 +208,7 @@ int mp_os_dupterm_tx_strn(const char *str, size_t len) {
return did_write ? ret : -1;
}
-STATIC mp_obj_t mp_os_dupterm(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_os_dupterm(size_t n_args, const mp_obj_t *args) {
mp_int_t idx = 0;
if (n_args == 2) {
idx = mp_obj_get_int(args[1]);
diff --git a/extmod/vfs.c b/extmod/vfs.c
index af63ceb37e..ae09b8afe8 100644
--- a/extmod/vfs.c
+++ b/extmod/vfs.c
@@ -93,7 +93,7 @@ mp_vfs_mount_t *mp_vfs_lookup_path(const char *path, const char **path_out) {
}
// Version of mp_vfs_lookup_path that takes and returns uPy string objects.
-STATIC mp_vfs_mount_t *lookup_path(mp_obj_t path_in, mp_obj_t *path_out) {
+static mp_vfs_mount_t *lookup_path(mp_obj_t path_in, mp_obj_t *path_out) {
const char *path = mp_obj_str_get_str(path_in);
const char *p_out;
mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out);
@@ -106,7 +106,7 @@ STATIC mp_vfs_mount_t *lookup_path(mp_obj_t path_in, mp_obj_t *path_out) {
return vfs;
}
-STATIC mp_obj_t mp_vfs_proxy_call(mp_vfs_mount_t *vfs, qstr meth_name, size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_vfs_proxy_call(mp_vfs_mount_t *vfs, qstr meth_name, size_t n_args, const mp_obj_t *args) {
assert(n_args <= PROXY_MAX_ARGS);
if (vfs == MP_VFS_NONE) {
// mount point not found
@@ -159,7 +159,7 @@ mp_import_stat_t mp_vfs_import_stat(const char *path) {
}
}
-STATIC mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
+static mp_obj_t mp_vfs_autodetect(mp_obj_t bdev_obj) {
#if MICROPY_VFS_LFS1 || MICROPY_VFS_LFS2
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
@@ -376,7 +376,7 @@ typedef struct _mp_vfs_ilistdir_it_t {
bool is_iter;
} mp_vfs_ilistdir_it_t;
-STATIC mp_obj_t mp_vfs_ilistdir_it_iternext(mp_obj_t self_in) {
+static mp_obj_t mp_vfs_ilistdir_it_iternext(mp_obj_t self_in) {
mp_vfs_ilistdir_it_t *self = MP_OBJ_TO_PTR(self_in);
if (self->is_iter) {
// continue delegating to root dir
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index 67c95d9a17..38c1663363 100644
--- a/extmod/vfs_fat.c
+++ b/extmod/vfs_fat.c
@@ -51,7 +51,7 @@
#define mp_obj_fat_vfs_t fs_user_mount_t
-STATIC mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
+static mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
fs_user_mount_t *vfs = vfs_in;
FILINFO fno;
assert(vfs != NULL);
@@ -66,7 +66,7 @@ STATIC mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
return MP_IMPORT_STAT_NO_EXIST;
}
-STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// create new object
@@ -91,16 +91,16 @@ STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_
}
#if _FS_REENTRANT
-STATIC mp_obj_t fat_vfs_del(mp_obj_t self_in) {
+static mp_obj_t fat_vfs_del(mp_obj_t self_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(self_in);
// f_umount only needs to be called to release the sync object
f_umount(&self->fatfs);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_del_obj, fat_vfs_del);
+static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_del_obj, fat_vfs_del);
#endif
-STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
+static mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
// create new object
fs_user_mount_t *vfs = MP_OBJ_TO_PTR(fat_vfs_make_new(&mp_fat_vfs_type, 1, 0, &bdev_in));
@@ -116,8 +116,8 @@ STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_mkfs_fun_obj, fat_vfs_mkfs);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(fat_vfs_mkfs_obj, MP_ROM_PTR(&fat_vfs_mkfs_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_mkfs_fun_obj, fat_vfs_mkfs);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(fat_vfs_mkfs_obj, MP_ROM_PTR(&fat_vfs_mkfs_fun_obj));
typedef struct _mp_vfs_fat_ilistdir_it_t {
mp_obj_base_t base;
@@ -127,7 +127,7 @@ typedef struct _mp_vfs_fat_ilistdir_it_t {
FF_DIR dir;
} mp_vfs_fat_ilistdir_it_t;
-STATIC mp_obj_t mp_vfs_fat_ilistdir_it_iternext(mp_obj_t self_in) {
+static mp_obj_t mp_vfs_fat_ilistdir_it_iternext(mp_obj_t self_in) {
mp_vfs_fat_ilistdir_it_t *self = MP_OBJ_TO_PTR(self_in);
for (;;) {
@@ -167,14 +167,14 @@ STATIC mp_obj_t mp_vfs_fat_ilistdir_it_iternext(mp_obj_t self_in) {
return MP_OBJ_STOP_ITERATION;
}
-STATIC mp_obj_t mp_vfs_fat_ilistdir_it_del(mp_obj_t self_in) {
+static mp_obj_t mp_vfs_fat_ilistdir_it_del(mp_obj_t self_in) {
mp_vfs_fat_ilistdir_it_t *self = MP_OBJ_TO_PTR(self_in);
// ignore result / error because we may be closing a second time.
f_closedir(&self->dir);
return mp_const_none;
}
-STATIC mp_obj_t fat_vfs_ilistdir_func(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t fat_vfs_ilistdir_func(size_t n_args, const mp_obj_t *args) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(args[0]);
bool is_str_type = true;
const char *path;
@@ -199,9 +199,9 @@ STATIC mp_obj_t fat_vfs_ilistdir_func(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(iter);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fat_vfs_ilistdir_obj, 1, 2, fat_vfs_ilistdir_func);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fat_vfs_ilistdir_obj, 1, 2, fat_vfs_ilistdir_func);
-STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_int_t attr) {
+static mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_int_t attr) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path = mp_obj_str_get_str(path_in);
@@ -225,17 +225,17 @@ STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_in
}
}
-STATIC mp_obj_t fat_vfs_remove(mp_obj_t vfs_in, mp_obj_t path_in) {
+static mp_obj_t fat_vfs_remove(mp_obj_t vfs_in, mp_obj_t path_in) {
return fat_vfs_remove_internal(vfs_in, path_in, 0); // 0 == file attribute
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_remove_obj, fat_vfs_remove);
+static MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_remove_obj, fat_vfs_remove);
-STATIC mp_obj_t fat_vfs_rmdir(mp_obj_t vfs_in, mp_obj_t path_in) {
+static mp_obj_t fat_vfs_rmdir(mp_obj_t vfs_in, mp_obj_t path_in) {
return fat_vfs_remove_internal(vfs_in, path_in, AM_DIR);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_rmdir_obj, fat_vfs_rmdir);
+static MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_rmdir_obj, fat_vfs_rmdir);
-STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_out) {
+static mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_out) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *old_path = mp_obj_str_get_str(path_in);
const char *new_path = mp_obj_str_get_str(path_out);
@@ -253,9 +253,9 @@ STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_rename_obj, fat_vfs_rename);
+static MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_rename_obj, fat_vfs_rename);
-STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {
+static mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path = mp_obj_str_get_str(path_o);
FRESULT res = f_mkdir(&self->fatfs, path);
@@ -265,10 +265,10 @@ STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_mkdir_obj, fat_vfs_mkdir);
+static MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_mkdir_obj, fat_vfs_mkdir);
// Change current directory.
-STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
+static mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path;
path = mp_obj_str_get_str(path_in);
@@ -281,10 +281,10 @@ STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_chdir_obj, fat_vfs_chdir);
+static MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_chdir_obj, fat_vfs_chdir);
// Get the current directory.
-STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
+static mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
char buf[MICROPY_ALLOC_PATH_MAX + 1];
FRESULT res = f_getcwd(&self->fatfs, buf, sizeof(buf));
@@ -293,10 +293,10 @@ STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) {
}
return mp_obj_new_str(buf, strlen(buf));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getcwd_obj, fat_vfs_getcwd);
+static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getcwd_obj, fat_vfs_getcwd);
// Get the status of a file or directory.
-STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
+static mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
const char *path = mp_obj_str_get_str(path_in);
@@ -342,10 +342,10 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_stat_obj, fat_vfs_stat);
+static MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_stat_obj, fat_vfs_stat);
// Get the status of a VFS.
-STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
+static mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
(void)path_in;
@@ -371,9 +371,9 @@ STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_statvfs_obj, fat_vfs_statvfs);
+static MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_statvfs_obj, fat_vfs_statvfs);
-STATIC mp_obj_t vfs_fat_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs) {
+static mp_obj_t vfs_fat_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs) {
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
// Read-only device indicated by writeblocks[0] == MP_OBJ_NULL.
@@ -397,16 +397,16 @@ STATIC mp_obj_t vfs_fat_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(vfs_fat_mount_obj, vfs_fat_mount);
+static MP_DEFINE_CONST_FUN_OBJ_3(vfs_fat_mount_obj, vfs_fat_mount);
-STATIC mp_obj_t vfs_fat_umount(mp_obj_t self_in) {
+static mp_obj_t vfs_fat_umount(mp_obj_t self_in) {
(void)self_in;
// keep the FAT filesystem mounted internally so the VFS methods can still be used
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_umount_obj, vfs_fat_umount);
+static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_umount_obj, vfs_fat_umount);
-STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
+static const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
#if _FS_REENTRANT
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&fat_vfs_del_obj) },
#endif
@@ -424,9 +424,9 @@ STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&vfs_fat_mount_obj) },
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&fat_vfs_umount_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(fat_vfs_locals_dict, fat_vfs_locals_dict_table);
+static MP_DEFINE_CONST_DICT(fat_vfs_locals_dict, fat_vfs_locals_dict_table);
-STATIC const mp_vfs_proto_t fat_vfs_proto = {
+static const mp_vfs_proto_t fat_vfs_proto = {
.import_stat = fat_vfs_import_stat,
};
diff --git a/extmod/vfs_fat_diskio.c b/extmod/vfs_fat_diskio.c
index 1bcd471f21..6f500104d1 100644
--- a/extmod/vfs_fat_diskio.c
+++ b/extmod/vfs_fat_diskio.c
@@ -44,7 +44,7 @@
#include "extmod/vfs_fat.h"
typedef void *bdev_t;
-STATIC fs_user_mount_t *disk_get_device(void *bdev) {
+static fs_user_mount_t *disk_get_device(void *bdev) {
return (fs_user_mount_t *)bdev;
}
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index e2f6937694..887249b663 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -64,12 +64,12 @@ typedef struct _pyb_file_obj_t {
FIL fp;
} pyb_file_obj_t;
-STATIC void file_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void file_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_printf(print, "<io.%s %p>", mp_obj_get_type_str(self_in), MP_OBJ_TO_PTR(self_in));
}
-STATIC mp_uint_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
pyb_file_obj_t *self = MP_OBJ_TO_PTR(self_in);
UINT sz_out;
FRESULT res = f_read(&self->fp, buf, size, &sz_out);
@@ -80,7 +80,7 @@ STATIC mp_uint_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
return sz_out;
}
-STATIC mp_uint_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
pyb_file_obj_t *self = MP_OBJ_TO_PTR(self_in);
UINT sz_out;
FRESULT res = f_write(&self->fp, buf, size, &sz_out);
@@ -96,7 +96,7 @@ STATIC mp_uint_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t siz
return sz_out;
}
-STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
pyb_file_obj_t *self = MP_OBJ_TO_PTR(o_in);
if (request == MP_STREAM_SEEK) {
@@ -146,7 +146,7 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
// TODO gc hook to close the file if not already closed
-STATIC const mp_rom_map_elem_t vfs_fat_rawfile_locals_dict_table[] = {
+static const mp_rom_map_elem_t vfs_fat_rawfile_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
@@ -161,9 +161,9 @@ STATIC const mp_rom_map_elem_t vfs_fat_rawfile_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&mp_stream___exit___obj) },
};
-STATIC MP_DEFINE_CONST_DICT(vfs_fat_rawfile_locals_dict, vfs_fat_rawfile_locals_dict_table);
+static MP_DEFINE_CONST_DICT(vfs_fat_rawfile_locals_dict, vfs_fat_rawfile_locals_dict_table);
-STATIC const mp_stream_p_t vfs_fat_fileio_stream_p = {
+static const mp_stream_p_t vfs_fat_fileio_stream_p = {
.read = file_obj_read,
.write = file_obj_write,
.ioctl = file_obj_ioctl,
@@ -178,7 +178,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &vfs_fat_rawfile_locals_dict
);
-STATIC const mp_stream_p_t vfs_fat_textio_stream_p = {
+static const mp_stream_p_t vfs_fat_textio_stream_p = {
.read = file_obj_read,
.write = file_obj_write,
.ioctl = file_obj_ioctl,
@@ -195,7 +195,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
);
// Factory function for I/O stream classes
-STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in) {
+static mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in) {
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
const mp_obj_type_t *type = &mp_type_vfs_fat_textio;
diff --git a/extmod/vfs_lfs.c b/extmod/vfs_lfs.c
index 4fb86b89b7..19063d6306 100644
--- a/extmod/vfs_lfs.c
+++ b/extmod/vfs_lfs.c
@@ -127,7 +127,7 @@ typedef struct _mp_obj_vfs_lfs2_file_t {
const char *mp_vfs_lfs2_make_path(mp_obj_vfs_lfs2_t *self, mp_obj_t path_in);
mp_obj_t mp_vfs_lfs2_file_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in);
-STATIC void lfs_get_mtime(uint8_t buf[8]) {
+static void lfs_get_mtime(uint8_t buf[8]) {
// On-disk storage of timestamps uses 1970 as the Epoch, so convert from host's Epoch.
uint64_t ns = timeutils_nanoseconds_since_epoch_to_nanoseconds_since_1970(mp_hal_time_ns());
// Store "ns" to "buf" in little-endian format (essentially htole64).
diff --git a/extmod/vfs_lfsx.c b/extmod/vfs_lfsx.c
index ddcbdf3ac4..19da4417e6 100644
--- a/extmod/vfs_lfsx.c
+++ b/extmod/vfs_lfsx.c
@@ -43,7 +43,7 @@
#error "MICROPY_VFS_LFS requires MICROPY_ENABLE_FINALISER"
#endif
-STATIC int MP_VFS_LFSx(dev_ioctl)(const struct LFSx_API (config) * c, int cmd, int arg, bool must_return_int) {
+static int MP_VFS_LFSx(dev_ioctl)(const struct LFSx_API (config) * c, int cmd, int arg, bool must_return_int) {
mp_obj_t ret = mp_vfs_blockdev_ioctl(c->context, cmd, arg);
int ret_i = 0;
if (must_return_int || ret != mp_const_none) {
@@ -52,23 +52,23 @@ STATIC int MP_VFS_LFSx(dev_ioctl)(const struct LFSx_API (config) * c, int cmd, i
return ret_i;
}
-STATIC int MP_VFS_LFSx(dev_read)(const struct LFSx_API (config) * c, LFSx_API(block_t) block, LFSx_API(off_t) off, void *buffer, LFSx_API(size_t) size) {
+static int MP_VFS_LFSx(dev_read)(const struct LFSx_API (config) * c, LFSx_API(block_t) block, LFSx_API(off_t) off, void *buffer, LFSx_API(size_t) size) {
return mp_vfs_blockdev_read_ext(c->context, block, off, size, buffer);
}
-STATIC int MP_VFS_LFSx(dev_prog)(const struct LFSx_API (config) * c, LFSx_API(block_t) block, LFSx_API(off_t) off, const void *buffer, LFSx_API(size_t) size) {
+static int MP_VFS_LFSx(dev_prog)(const struct LFSx_API (config) * c, LFSx_API(block_t) block, LFSx_API(off_t) off, const void *buffer, LFSx_API(size_t) size) {
return mp_vfs_blockdev_write_ext(c->context, block, off, size, buffer);
}
-STATIC int MP_VFS_LFSx(dev_erase)(const struct LFSx_API (config) * c, LFSx_API(block_t) block) {
+static int MP_VFS_LFSx(dev_erase)(const struct LFSx_API (config) * c, LFSx_API(block_t) block) {
return MP_VFS_LFSx(dev_ioctl)(c, MP_BLOCKDEV_IOCTL_BLOCK_ERASE, block, true);
}
-STATIC int MP_VFS_LFSx(dev_sync)(const struct LFSx_API (config) * c) {
+static int MP_VFS_LFSx(dev_sync)(const struct LFSx_API (config) * c) {
return MP_VFS_LFSx(dev_ioctl)(c, MP_BLOCKDEV_IOCTL_SYNC, 0, false);
}
-STATIC void MP_VFS_LFSx(init_config)(MP_OBJ_VFS_LFSx * self, mp_obj_t bdev, size_t read_size, size_t prog_size, size_t lookahead) {
+static void MP_VFS_LFSx(init_config)(MP_OBJ_VFS_LFSx * self, mp_obj_t bdev, size_t read_size, size_t prog_size, size_t lookahead) {
self->blockdev.flags = MP_BLOCKDEV_FLAG_FREE_OBJ;
mp_vfs_blockdev_init(&self->blockdev, bdev);
@@ -120,7 +120,7 @@ const char *MP_VFS_LFSx(make_path)(MP_OBJ_VFS_LFSx * self, mp_obj_t path_in) {
return path;
}
-STATIC mp_obj_t MP_VFS_LFSx(make_new)(const mp_obj_type_t * type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t MP_VFS_LFSx(make_new)(const mp_obj_type_t * type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
mp_arg_val_t args[MP_ARRAY_SIZE(lfs_make_allowed_args)];
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(lfs_make_allowed_args), lfs_make_allowed_args, args);
@@ -140,7 +140,7 @@ STATIC mp_obj_t MP_VFS_LFSx(make_new)(const mp_obj_type_t * type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t MP_VFS_LFSx(mkfs)(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t MP_VFS_LFSx(mkfs)(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_val_t args[MP_ARRAY_SIZE(lfs_make_allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(lfs_make_allowed_args), lfs_make_allowed_args, args);
@@ -153,11 +153,11 @@ STATIC mp_obj_t MP_VFS_LFSx(mkfs)(size_t n_args, const mp_obj_t *pos_args, mp_ma
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(MP_VFS_LFSx(mkfs_fun_obj), 0, MP_VFS_LFSx(mkfs));
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(MP_VFS_LFSx(mkfs_obj), MP_ROM_PTR(&MP_VFS_LFSx(mkfs_fun_obj)));
+static MP_DEFINE_CONST_FUN_OBJ_KW(MP_VFS_LFSx(mkfs_fun_obj), 0, MP_VFS_LFSx(mkfs));
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(MP_VFS_LFSx(mkfs_obj), MP_ROM_PTR(&MP_VFS_LFSx(mkfs_fun_obj)));
// Implementation of mp_vfs_lfs_file_open is provided in vfs_lfsx_file.c
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(MP_VFS_LFSx(open_obj), MP_VFS_LFSx(file_open));
+static MP_DEFINE_CONST_FUN_OBJ_3(MP_VFS_LFSx(open_obj), MP_VFS_LFSx(file_open));
typedef struct MP_VFS_LFSx (_ilistdir_it_t) {
mp_obj_base_t base;
@@ -168,7 +168,7 @@ typedef struct MP_VFS_LFSx (_ilistdir_it_t) {
LFSx_API(dir_t) dir;
} MP_VFS_LFSx(ilistdir_it_t);
-STATIC mp_obj_t MP_VFS_LFSx(ilistdir_it_iternext)(mp_obj_t self_in) {
+static mp_obj_t MP_VFS_LFSx(ilistdir_it_iternext)(mp_obj_t self_in) {
MP_VFS_LFSx(ilistdir_it_t) * self = MP_OBJ_TO_PTR(self_in);
if (self->vfs == NULL) {
@@ -203,7 +203,7 @@ STATIC mp_obj_t MP_VFS_LFSx(ilistdir_it_iternext)(mp_obj_t self_in) {
return MP_OBJ_FROM_PTR(t);
}
-STATIC mp_obj_t MP_VFS_LFSx(ilistdir_it_del)(mp_obj_t self_in) {
+static mp_obj_t MP_VFS_LFSx(ilistdir_it_del)(mp_obj_t self_in) {
MP_VFS_LFSx(ilistdir_it_t) * self = MP_OBJ_TO_PTR(self_in);
if (self->vfs != NULL) {
LFSx_API(dir_close)(&self->vfs->lfs, &self->dir);
@@ -211,7 +211,7 @@ STATIC mp_obj_t MP_VFS_LFSx(ilistdir_it_del)(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC mp_obj_t MP_VFS_LFSx(ilistdir_func)(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t MP_VFS_LFSx(ilistdir_func)(size_t n_args, const mp_obj_t *args) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(args[0]);
bool is_str_type = true;
const char *path;
@@ -236,9 +236,9 @@ STATIC mp_obj_t MP_VFS_LFSx(ilistdir_func)(size_t n_args, const mp_obj_t *args)
iter->vfs = self;
return MP_OBJ_FROM_PTR(iter);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(MP_VFS_LFSx(ilistdir_obj), 1, 2, MP_VFS_LFSx(ilistdir_func));
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(MP_VFS_LFSx(ilistdir_obj), 1, 2, MP_VFS_LFSx(ilistdir_func));
-STATIC mp_obj_t MP_VFS_LFSx(remove)(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t MP_VFS_LFSx(remove)(mp_obj_t self_in, mp_obj_t path_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
const char *path = MP_VFS_LFSx(make_path)(self, path_in);
int ret = LFSx_API(remove)(&self->lfs, path);
@@ -247,9 +247,9 @@ STATIC mp_obj_t MP_VFS_LFSx(remove)(mp_obj_t self_in, mp_obj_t path_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(remove_obj), MP_VFS_LFSx(remove));
+static MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(remove_obj), MP_VFS_LFSx(remove));
-STATIC mp_obj_t MP_VFS_LFSx(rmdir)(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t MP_VFS_LFSx(rmdir)(mp_obj_t self_in, mp_obj_t path_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
const char *path = MP_VFS_LFSx(make_path)(self, path_in);
int ret = LFSx_API(remove)(&self->lfs, path);
@@ -258,9 +258,9 @@ STATIC mp_obj_t MP_VFS_LFSx(rmdir)(mp_obj_t self_in, mp_obj_t path_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(rmdir_obj), MP_VFS_LFSx(rmdir));
+static MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(rmdir_obj), MP_VFS_LFSx(rmdir));
-STATIC mp_obj_t MP_VFS_LFSx(rename)(mp_obj_t self_in, mp_obj_t path_old_in, mp_obj_t path_new_in) {
+static mp_obj_t MP_VFS_LFSx(rename)(mp_obj_t self_in, mp_obj_t path_old_in, mp_obj_t path_new_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
const char *path_old = MP_VFS_LFSx(make_path)(self, path_old_in);
const char *path = mp_obj_str_get_str(path_new_in);
@@ -277,9 +277,9 @@ STATIC mp_obj_t MP_VFS_LFSx(rename)(mp_obj_t self_in, mp_obj_t path_old_in, mp_o
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(MP_VFS_LFSx(rename_obj), MP_VFS_LFSx(rename));
+static MP_DEFINE_CONST_FUN_OBJ_3(MP_VFS_LFSx(rename_obj), MP_VFS_LFSx(rename));
-STATIC mp_obj_t MP_VFS_LFSx(mkdir)(mp_obj_t self_in, mp_obj_t path_o) {
+static mp_obj_t MP_VFS_LFSx(mkdir)(mp_obj_t self_in, mp_obj_t path_o) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
const char *path = MP_VFS_LFSx(make_path)(self, path_o);
int ret = LFSx_API(mkdir)(&self->lfs, path);
@@ -288,9 +288,9 @@ STATIC mp_obj_t MP_VFS_LFSx(mkdir)(mp_obj_t self_in, mp_obj_t path_o) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(mkdir_obj), MP_VFS_LFSx(mkdir));
+static MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(mkdir_obj), MP_VFS_LFSx(mkdir));
-STATIC mp_obj_t MP_VFS_LFSx(chdir)(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t MP_VFS_LFSx(chdir)(mp_obj_t self_in, mp_obj_t path_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
// Check path exists
@@ -356,9 +356,9 @@ STATIC mp_obj_t MP_VFS_LFSx(chdir)(mp_obj_t self_in, mp_obj_t path_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(chdir_obj), MP_VFS_LFSx(chdir));
+static MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(chdir_obj), MP_VFS_LFSx(chdir));
-STATIC mp_obj_t MP_VFS_LFSx(getcwd)(mp_obj_t self_in) {
+static mp_obj_t MP_VFS_LFSx(getcwd)(mp_obj_t self_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
if (vstr_len(&self->cur_dir) == 1) {
return MP_OBJ_NEW_QSTR(MP_QSTR__slash_);
@@ -367,9 +367,9 @@ STATIC mp_obj_t MP_VFS_LFSx(getcwd)(mp_obj_t self_in) {
return mp_obj_new_str(self->cur_dir.buf, self->cur_dir.len - 1);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(MP_VFS_LFSx(getcwd_obj), MP_VFS_LFSx(getcwd));
+static MP_DEFINE_CONST_FUN_OBJ_1(MP_VFS_LFSx(getcwd_obj), MP_VFS_LFSx(getcwd));
-STATIC mp_obj_t MP_VFS_LFSx(stat)(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t MP_VFS_LFSx(stat)(mp_obj_t self_in, mp_obj_t path_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
const char *path = MP_VFS_LFSx(make_path)(self, path_in);
struct LFSx_API (info) info;
@@ -406,16 +406,16 @@ STATIC mp_obj_t MP_VFS_LFSx(stat)(mp_obj_t self_in, mp_obj_t path_in) {
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(stat_obj), MP_VFS_LFSx(stat));
+static MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(stat_obj), MP_VFS_LFSx(stat));
-STATIC int LFSx_API(traverse_cb)(void *data, LFSx_API(block_t) bl) {
+static int LFSx_API(traverse_cb)(void *data, LFSx_API(block_t) bl) {
(void)bl;
uint32_t *n = (uint32_t *)data;
*n += 1;
return LFSx_MACRO(_ERR_OK);
}
-STATIC mp_obj_t MP_VFS_LFSx(statvfs)(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t MP_VFS_LFSx(statvfs)(mp_obj_t self_in, mp_obj_t path_in) {
(void)path_in;
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
uint32_t n_used_blocks = 0;
@@ -442,9 +442,9 @@ STATIC mp_obj_t MP_VFS_LFSx(statvfs)(mp_obj_t self_in, mp_obj_t path_in) {
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(statvfs_obj), MP_VFS_LFSx(statvfs));
+static MP_DEFINE_CONST_FUN_OBJ_2(MP_VFS_LFSx(statvfs_obj), MP_VFS_LFSx(statvfs));
-STATIC mp_obj_t MP_VFS_LFSx(mount)(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs) {
+static mp_obj_t MP_VFS_LFSx(mount)(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
(void)mkfs;
@@ -457,17 +457,17 @@ STATIC mp_obj_t MP_VFS_LFSx(mount)(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(MP_VFS_LFSx(mount_obj), MP_VFS_LFSx(mount));
+static MP_DEFINE_CONST_FUN_OBJ_3(MP_VFS_LFSx(mount_obj), MP_VFS_LFSx(mount));
-STATIC mp_obj_t MP_VFS_LFSx(umount)(mp_obj_t self_in) {
+static mp_obj_t MP_VFS_LFSx(umount)(mp_obj_t self_in) {
MP_OBJ_VFS_LFSx *self = MP_OBJ_TO_PTR(self_in);
// LFS unmount never fails
LFSx_API(unmount)(&self->lfs);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(MP_VFS_LFSx(umount_obj), MP_VFS_LFSx(umount));
+static MP_DEFINE_CONST_FUN_OBJ_1(MP_VFS_LFSx(umount_obj), MP_VFS_LFSx(umount));
-STATIC const mp_rom_map_elem_t MP_VFS_LFSx(locals_dict_table)[] = {
+static const mp_rom_map_elem_t MP_VFS_LFSx(locals_dict_table)[] = {
{ MP_ROM_QSTR(MP_QSTR_mkfs), MP_ROM_PTR(&MP_VFS_LFSx(mkfs_obj)) },
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&MP_VFS_LFSx(open_obj)) },
{ MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&MP_VFS_LFSx(ilistdir_obj)) },
@@ -482,9 +482,9 @@ STATIC const mp_rom_map_elem_t MP_VFS_LFSx(locals_dict_table)[] = {
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&MP_VFS_LFSx(mount_obj)) },
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&MP_VFS_LFSx(umount_obj)) },
};
-STATIC MP_DEFINE_CONST_DICT(MP_VFS_LFSx(locals_dict), MP_VFS_LFSx(locals_dict_table));
+static MP_DEFINE_CONST_DICT(MP_VFS_LFSx(locals_dict), MP_VFS_LFSx(locals_dict_table));
-STATIC mp_import_stat_t MP_VFS_LFSx(import_stat)(void *self_in, const char *path) {
+static mp_import_stat_t MP_VFS_LFSx(import_stat)(void *self_in, const char *path) {
MP_OBJ_VFS_LFSx *self = self_in;
struct LFSx_API (info) info;
mp_obj_str_t path_obj = { { &mp_type_str }, 0, 0, (const byte *)path };
@@ -500,7 +500,7 @@ STATIC mp_import_stat_t MP_VFS_LFSx(import_stat)(void *self_in, const char *path
return MP_IMPORT_STAT_NO_EXIST;
}
-STATIC const mp_vfs_proto_t MP_VFS_LFSx(proto) = {
+static const mp_vfs_proto_t MP_VFS_LFSx(proto) = {
.import_stat = MP_VFS_LFSx(import_stat),
};
diff --git a/extmod/vfs_lfsx_file.c b/extmod/vfs_lfsx_file.c
index 0405850644..ab5cce5008 100644
--- a/extmod/vfs_lfsx_file.c
+++ b/extmod/vfs_lfsx_file.c
@@ -35,13 +35,13 @@
#include "py/mperrno.h"
#include "extmod/vfs.h"
-STATIC void MP_VFS_LFSx(check_open)(MP_OBJ_VFS_LFSx_FILE * self) {
+static void MP_VFS_LFSx(check_open)(MP_OBJ_VFS_LFSx_FILE * self) {
if (self->vfs == NULL) {
mp_raise_ValueError(NULL);
}
}
-STATIC void MP_VFS_LFSx(file_print)(const mp_print_t * print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void MP_VFS_LFSx(file_print)(const mp_print_t * print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)self_in;
(void)kind;
mp_printf(print, "<io.%s>", mp_obj_get_type_str(self_in));
@@ -122,7 +122,7 @@ mp_obj_t MP_VFS_LFSx(file_open)(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mod
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_uint_t MP_VFS_LFSx(file_read)(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t MP_VFS_LFSx(file_read)(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
MP_OBJ_VFS_LFSx_FILE *self = MP_OBJ_TO_PTR(self_in);
MP_VFS_LFSx(check_open)(self);
LFSx_API(ssize_t) sz = LFSx_API(file_read)(&self->vfs->lfs, &self->file, buf, size);
@@ -133,7 +133,7 @@ STATIC mp_uint_t MP_VFS_LFSx(file_read)(mp_obj_t self_in, void *buf, mp_uint_t s
return sz;
}
-STATIC mp_uint_t MP_VFS_LFSx(file_write)(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t MP_VFS_LFSx(file_write)(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
MP_OBJ_VFS_LFSx_FILE *self = MP_OBJ_TO_PTR(self_in);
MP_VFS_LFSx(check_open)(self);
#if LFS_BUILD_VERSION == 2
@@ -149,7 +149,7 @@ STATIC mp_uint_t MP_VFS_LFSx(file_write)(mp_obj_t self_in, const void *buf, mp_u
return sz;
}
-STATIC mp_uint_t MP_VFS_LFSx(file_ioctl)(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t MP_VFS_LFSx(file_ioctl)(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
MP_OBJ_VFS_LFSx_FILE *self = MP_OBJ_TO_PTR(self_in);
if (request != MP_STREAM_CLOSE) {
@@ -194,7 +194,7 @@ STATIC mp_uint_t MP_VFS_LFSx(file_ioctl)(mp_obj_t self_in, mp_uint_t request, ui
}
}
-STATIC const mp_rom_map_elem_t MP_VFS_LFSx(file_locals_dict_table)[] = {
+static const mp_rom_map_elem_t MP_VFS_LFSx(file_locals_dict_table)[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
@@ -208,9 +208,9 @@ STATIC const mp_rom_map_elem_t MP_VFS_LFSx(file_locals_dict_table)[] = {
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&mp_stream___exit___obj) },
};
-STATIC MP_DEFINE_CONST_DICT(MP_VFS_LFSx(file_locals_dict), MP_VFS_LFSx(file_locals_dict_table));
+static MP_DEFINE_CONST_DICT(MP_VFS_LFSx(file_locals_dict), MP_VFS_LFSx(file_locals_dict_table));
-STATIC const mp_stream_p_t MP_VFS_LFSx(fileio_stream_p) = {
+static const mp_stream_p_t MP_VFS_LFSx(fileio_stream_p) = {
.read = MP_VFS_LFSx(file_read),
.write = MP_VFS_LFSx(file_write),
.ioctl = MP_VFS_LFSx(file_ioctl),
@@ -225,7 +225,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &MP_VFS_LFSx(file_locals_dict)
);
-STATIC const mp_stream_p_t MP_VFS_LFSx(textio_stream_p) = {
+static const mp_stream_p_t MP_VFS_LFSx(textio_stream_p) = {
.read = MP_VFS_LFSx(file_read),
.write = MP_VFS_LFSx(file_write),
.ioctl = MP_VFS_LFSx(file_ioctl),
diff --git a/extmod/vfs_posix.c b/extmod/vfs_posix.c
index 2e0f712e25..ed4c06e367 100644
--- a/extmod/vfs_posix.c
+++ b/extmod/vfs_posix.c
@@ -57,7 +57,7 @@ typedef struct _mp_obj_vfs_posix_t {
bool readonly;
} mp_obj_vfs_posix_t;
-STATIC const char *vfs_posix_get_path_str(mp_obj_vfs_posix_t *self, mp_obj_t path) {
+static const char *vfs_posix_get_path_str(mp_obj_vfs_posix_t *self, mp_obj_t path) {
const char *path_str = mp_obj_str_get_str(path);
if (self->root_len == 0 || path_str[0] != '/') {
return path_str;
@@ -68,7 +68,7 @@ STATIC const char *vfs_posix_get_path_str(mp_obj_vfs_posix_t *self, mp_obj_t pat
}
}
-STATIC mp_obj_t vfs_posix_get_path_obj(mp_obj_vfs_posix_t *self, mp_obj_t path) {
+static mp_obj_t vfs_posix_get_path_obj(mp_obj_vfs_posix_t *self, mp_obj_t path) {
const char *path_str = mp_obj_str_get_str(path);
if (self->root_len == 0 || path_str[0] != '/') {
return path;
@@ -79,7 +79,7 @@ STATIC mp_obj_t vfs_posix_get_path_obj(mp_obj_vfs_posix_t *self, mp_obj_t path)
}
}
-STATIC mp_obj_t vfs_posix_fun1_helper(mp_obj_t self_in, mp_obj_t path_in, int (*f)(const char *)) {
+static mp_obj_t vfs_posix_fun1_helper(mp_obj_t self_in, mp_obj_t path_in, int (*f)(const char *)) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
int ret = f(vfs_posix_get_path_str(self, path_in));
if (ret != 0) {
@@ -88,7 +88,7 @@ STATIC mp_obj_t vfs_posix_fun1_helper(mp_obj_t self_in, mp_obj_t path_in, int (*
return mp_const_none;
}
-STATIC mp_import_stat_t mp_vfs_posix_import_stat(void *self_in, const char *path) {
+static mp_import_stat_t mp_vfs_posix_import_stat(void *self_in, const char *path) {
mp_obj_vfs_posix_t *self = self_in;
if (self->root_len != 0) {
self->root.len = self->root_len;
@@ -106,7 +106,7 @@ STATIC mp_import_stat_t mp_vfs_posix_import_stat(void *self_in, const char *path
return MP_IMPORT_STAT_NO_EXIST;
}
-STATIC mp_obj_t vfs_posix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t vfs_posix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_vfs_posix_t *vfs = mp_obj_malloc(mp_obj_vfs_posix_t, type);
@@ -142,7 +142,7 @@ STATIC mp_obj_t vfs_posix_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(vfs);
}
-STATIC mp_obj_t vfs_posix_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs) {
+static mp_obj_t vfs_posix_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
if (mp_obj_is_true(readonly)) {
self->readonly = true;
@@ -152,15 +152,15 @@ STATIC mp_obj_t vfs_posix_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mk
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(vfs_posix_mount_obj, vfs_posix_mount);
+static MP_DEFINE_CONST_FUN_OBJ_3(vfs_posix_mount_obj, vfs_posix_mount);
-STATIC mp_obj_t vfs_posix_umount(mp_obj_t self_in) {
+static mp_obj_t vfs_posix_umount(mp_obj_t self_in) {
(void)self_in;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(vfs_posix_umount_obj, vfs_posix_umount);
+static MP_DEFINE_CONST_FUN_OBJ_1(vfs_posix_umount_obj, vfs_posix_umount);
-STATIC mp_obj_t vfs_posix_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in) {
+static mp_obj_t vfs_posix_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
const char *mode = mp_obj_str_get_str(mode_in);
if (self->readonly
@@ -172,14 +172,14 @@ STATIC mp_obj_t vfs_posix_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode
}
return mp_vfs_posix_file_open(&mp_type_vfs_posix_textio, path_in, mode_in);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(vfs_posix_open_obj, vfs_posix_open);
+static MP_DEFINE_CONST_FUN_OBJ_3(vfs_posix_open_obj, vfs_posix_open);
-STATIC mp_obj_t vfs_posix_chdir(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t vfs_posix_chdir(mp_obj_t self_in, mp_obj_t path_in) {
return vfs_posix_fun1_helper(self_in, path_in, chdir);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_chdir_obj, vfs_posix_chdir);
+static MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_chdir_obj, vfs_posix_chdir);
-STATIC mp_obj_t vfs_posix_getcwd(mp_obj_t self_in) {
+static mp_obj_t vfs_posix_getcwd(mp_obj_t self_in) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
char buf[MICROPY_ALLOC_PATH_MAX + 1];
const char *ret = getcwd(buf, sizeof(buf));
@@ -196,7 +196,7 @@ STATIC mp_obj_t vfs_posix_getcwd(mp_obj_t self_in) {
}
return mp_obj_new_str(ret, strlen(ret));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(vfs_posix_getcwd_obj, vfs_posix_getcwd);
+static MP_DEFINE_CONST_FUN_OBJ_1(vfs_posix_getcwd_obj, vfs_posix_getcwd);
typedef struct _vfs_posix_ilistdir_it_t {
mp_obj_base_t base;
@@ -206,7 +206,7 @@ typedef struct _vfs_posix_ilistdir_it_t {
DIR *dir;
} vfs_posix_ilistdir_it_t;
-STATIC mp_obj_t vfs_posix_ilistdir_it_iternext(mp_obj_t self_in) {
+static mp_obj_t vfs_posix_ilistdir_it_iternext(mp_obj_t self_in) {
vfs_posix_ilistdir_it_t *self = MP_OBJ_TO_PTR(self_in);
if (self->dir == NULL) {
@@ -266,7 +266,7 @@ STATIC mp_obj_t vfs_posix_ilistdir_it_iternext(mp_obj_t self_in) {
}
}
-STATIC mp_obj_t vfs_posix_ilistdir_it_del(mp_obj_t self_in) {
+static mp_obj_t vfs_posix_ilistdir_it_del(mp_obj_t self_in) {
vfs_posix_ilistdir_it_t *self = MP_OBJ_TO_PTR(self_in);
if (self->dir != NULL) {
MP_THREAD_GIL_EXIT();
@@ -276,7 +276,7 @@ STATIC mp_obj_t vfs_posix_ilistdir_it_del(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC mp_obj_t vfs_posix_ilistdir(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t vfs_posix_ilistdir(mp_obj_t self_in, mp_obj_t path_in) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
vfs_posix_ilistdir_it_t *iter = mp_obj_malloc_with_finaliser(vfs_posix_ilistdir_it_t, &mp_type_polymorph_iter_with_finaliser);
iter->iternext = vfs_posix_ilistdir_it_iternext;
@@ -294,7 +294,7 @@ STATIC mp_obj_t vfs_posix_ilistdir(mp_obj_t self_in, mp_obj_t path_in) {
}
return MP_OBJ_FROM_PTR(iter);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_ilistdir_obj, vfs_posix_ilistdir);
+static MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_ilistdir_obj, vfs_posix_ilistdir);
typedef struct _mp_obj_listdir_t {
mp_obj_base_t base;
@@ -302,7 +302,7 @@ typedef struct _mp_obj_listdir_t {
DIR *dir;
} mp_obj_listdir_t;
-STATIC mp_obj_t vfs_posix_mkdir(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t vfs_posix_mkdir(mp_obj_t self_in, mp_obj_t path_in) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
const char *path = vfs_posix_get_path_str(self, path_in);
MP_THREAD_GIL_EXIT();
@@ -317,14 +317,14 @@ STATIC mp_obj_t vfs_posix_mkdir(mp_obj_t self_in, mp_obj_t path_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_mkdir_obj, vfs_posix_mkdir);
+static MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_mkdir_obj, vfs_posix_mkdir);
-STATIC mp_obj_t vfs_posix_remove(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t vfs_posix_remove(mp_obj_t self_in, mp_obj_t path_in) {
return vfs_posix_fun1_helper(self_in, path_in, unlink);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_remove_obj, vfs_posix_remove);
+static MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_remove_obj, vfs_posix_remove);
-STATIC mp_obj_t vfs_posix_rename(mp_obj_t self_in, mp_obj_t old_path_in, mp_obj_t new_path_in) {
+static mp_obj_t vfs_posix_rename(mp_obj_t self_in, mp_obj_t old_path_in, mp_obj_t new_path_in) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
const char *old_path = vfs_posix_get_path_str(self, old_path_in);
const char *new_path = vfs_posix_get_path_str(self, new_path_in);
@@ -336,14 +336,14 @@ STATIC mp_obj_t vfs_posix_rename(mp_obj_t self_in, mp_obj_t old_path_in, mp_obj_
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(vfs_posix_rename_obj, vfs_posix_rename);
+static MP_DEFINE_CONST_FUN_OBJ_3(vfs_posix_rename_obj, vfs_posix_rename);
-STATIC mp_obj_t vfs_posix_rmdir(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t vfs_posix_rmdir(mp_obj_t self_in, mp_obj_t path_in) {
return vfs_posix_fun1_helper(self_in, path_in, rmdir);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_rmdir_obj, vfs_posix_rmdir);
+static MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_rmdir_obj, vfs_posix_rmdir);
-STATIC mp_obj_t vfs_posix_stat(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t vfs_posix_stat(mp_obj_t self_in, mp_obj_t path_in) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
struct stat sb;
const char *path = vfs_posix_get_path_str(self, path_in);
@@ -362,7 +362,7 @@ STATIC mp_obj_t vfs_posix_stat(mp_obj_t self_in, mp_obj_t path_in) {
t->items[9] = mp_obj_new_int_from_uint(sb.st_ctime);
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_stat_obj, vfs_posix_stat);
+static MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_stat_obj, vfs_posix_stat);
#if MICROPY_PY_OS_STATVFS
@@ -386,7 +386,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_stat_obj, vfs_posix_stat);
#define F_FLAG sb.f_flag
#endif
-STATIC mp_obj_t vfs_posix_statvfs(mp_obj_t self_in, mp_obj_t path_in) {
+static mp_obj_t vfs_posix_statvfs(mp_obj_t self_in, mp_obj_t path_in) {
mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in);
STRUCT_STATVFS sb;
const char *path = vfs_posix_get_path_str(self, path_in);
@@ -405,11 +405,11 @@ STATIC mp_obj_t vfs_posix_statvfs(mp_obj_t self_in, mp_obj_t path_in) {
t->items[9] = MP_OBJ_NEW_SMALL_INT(F_NAMEMAX);
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_statvfs_obj, vfs_posix_statvfs);
+static MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_statvfs_obj, vfs_posix_statvfs);
#endif
-STATIC const mp_rom_map_elem_t vfs_posix_locals_dict_table[] = {
+static const mp_rom_map_elem_t vfs_posix_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&vfs_posix_mount_obj) },
{ MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&vfs_posix_umount_obj) },
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&vfs_posix_open_obj) },
@@ -426,9 +426,9 @@ STATIC const mp_rom_map_elem_t vfs_posix_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&vfs_posix_statvfs_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(vfs_posix_locals_dict, vfs_posix_locals_dict_table);
+static MP_DEFINE_CONST_DICT(vfs_posix_locals_dict, vfs_posix_locals_dict_table);
-STATIC const mp_vfs_proto_t vfs_posix_proto = {
+static const mp_vfs_proto_t vfs_posix_proto = {
.import_stat = mp_vfs_posix_import_stat,
};
diff --git a/extmod/vfs_posix_file.c b/extmod/vfs_posix_file.c
index eb9146d47b..bc06bc74db 100644
--- a/extmod/vfs_posix_file.c
+++ b/extmod/vfs_posix_file.c
@@ -47,7 +47,7 @@ typedef struct _mp_obj_vfs_posix_file_t {
} mp_obj_vfs_posix_file_t;
#if MICROPY_CPYTHON_COMPAT
-STATIC void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) {
+static void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) {
if (o->fd < 0) {
mp_raise_ValueError(MP_ERROR_TEXT("I/O operation on closed file"));
}
@@ -56,7 +56,7 @@ STATIC void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) {
#define check_fd_is_open(o)
#endif
-STATIC void vfs_posix_file_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void vfs_posix_file_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_vfs_posix_file_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<io.%s %d>", mp_obj_get_type_str(self_in), self->fd);
@@ -108,14 +108,14 @@ mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t vfs_posix_file_fileno(mp_obj_t self_in) {
+static mp_obj_t vfs_posix_file_fileno(mp_obj_t self_in) {
mp_obj_vfs_posix_file_t *self = MP_OBJ_TO_PTR(self_in);
check_fd_is_open(self);
return MP_OBJ_NEW_SMALL_INT(self->fd);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(vfs_posix_file_fileno_obj, vfs_posix_file_fileno);
+static MP_DEFINE_CONST_FUN_OBJ_1(vfs_posix_file_fileno_obj, vfs_posix_file_fileno);
-STATIC mp_uint_t vfs_posix_file_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t vfs_posix_file_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_vfs_posix_file_t *o = MP_OBJ_TO_PTR(o_in);
check_fd_is_open(o);
ssize_t r;
@@ -126,7 +126,7 @@ STATIC mp_uint_t vfs_posix_file_read(mp_obj_t o_in, void *buf, mp_uint_t size, i
return (mp_uint_t)r;
}
-STATIC mp_uint_t vfs_posix_file_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t vfs_posix_file_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_vfs_posix_file_t *o = MP_OBJ_TO_PTR(o_in);
check_fd_is_open(o);
#if MICROPY_PY_OS_DUPTERM
@@ -143,7 +143,7 @@ STATIC mp_uint_t vfs_posix_file_write(mp_obj_t o_in, const void *buf, mp_uint_t
return (mp_uint_t)r;
}
-STATIC mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_vfs_posix_file_t *o = MP_OBJ_TO_PTR(o_in);
if (request != MP_STREAM_CLOSE) {
@@ -237,7 +237,7 @@ STATIC mp_uint_t vfs_posix_file_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_
}
}
-STATIC const mp_rom_map_elem_t vfs_posix_rawfile_locals_dict_table[] = {
+static const mp_rom_map_elem_t vfs_posix_rawfile_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_fileno), MP_ROM_PTR(&vfs_posix_file_fileno_obj) },
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
@@ -253,9 +253,9 @@ STATIC const mp_rom_map_elem_t vfs_posix_rawfile_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&mp_stream___exit___obj) },
};
-STATIC MP_DEFINE_CONST_DICT(vfs_posix_rawfile_locals_dict, vfs_posix_rawfile_locals_dict_table);
+static MP_DEFINE_CONST_DICT(vfs_posix_rawfile_locals_dict, vfs_posix_rawfile_locals_dict_table);
-STATIC const mp_stream_p_t vfs_posix_fileio_stream_p = {
+static const mp_stream_p_t vfs_posix_fileio_stream_p = {
.read = vfs_posix_file_read,
.write = vfs_posix_file_write,
.ioctl = vfs_posix_file_ioctl,
@@ -270,7 +270,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &vfs_posix_rawfile_locals_dict
);
-STATIC const mp_stream_p_t vfs_posix_textio_stream_p = {
+static const mp_stream_p_t vfs_posix_textio_stream_p = {
.read = vfs_posix_file_read,
.write = vfs_posix_file_write,
.ioctl = vfs_posix_file_ioctl,
@@ -288,7 +288,7 @@ mp_obj_vfs_posix_file_t mp_sys_stdin_obj;
mp_obj_vfs_posix_file_t mp_sys_stdout_obj;
mp_obj_vfs_posix_file_t mp_sys_stderr_obj;
-STATIC void vfs_posix_textio_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void vfs_posix_textio_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// These objects are read-only.
return;
diff --git a/extmod/vfs_reader.c b/extmod/vfs_reader.c
index 13fc31bee5..80d0fa6344 100644
--- a/extmod/vfs_reader.c
+++ b/extmod/vfs_reader.c
@@ -49,7 +49,7 @@ typedef struct _mp_reader_vfs_t {
byte buf[];
} mp_reader_vfs_t;
-STATIC mp_uint_t mp_reader_vfs_readbyte(void *data) {
+static mp_uint_t mp_reader_vfs_readbyte(void *data) {
mp_reader_vfs_t *reader = (mp_reader_vfs_t *)data;
if (reader->bufpos >= reader->buflen) {
if (reader->buflen < reader->bufsize) {
@@ -70,7 +70,7 @@ STATIC mp_uint_t mp_reader_vfs_readbyte(void *data) {
return reader->buf[reader->bufpos++];
}
-STATIC void mp_reader_vfs_close(void *data) {
+static void mp_reader_vfs_close(void *data) {
mp_reader_vfs_t *reader = (mp_reader_vfs_t *)data;
mp_stream_close(reader->file);
m_del_obj(mp_reader_vfs_t, reader);
diff --git a/mpy-cross/main.c b/mpy-cross/main.c
index f05aef5dd8..0ac2e891d6 100644
--- a/mpy-cross/main.c
+++ b/mpy-cross/main.c
@@ -41,30 +41,30 @@
#endif
// Command line options, with their defaults
-STATIC uint emit_opt = MP_EMIT_OPT_NONE;
+static uint emit_opt = MP_EMIT_OPT_NONE;
mp_uint_t mp_verbose_flag = 0;
// Heap size of GC heap (if enabled)
// Make it larger on a 64 bit machine, because pointers are larger.
long heap_size = 1024 * 1024 * (sizeof(mp_uint_t) / 4);
-STATIC void stdout_print_strn(void *env, const char *str, size_t len) {
+static void stdout_print_strn(void *env, const char *str, size_t len) {
(void)env;
ssize_t dummy = write(STDOUT_FILENO, str, len);
(void)dummy;
}
-STATIC const mp_print_t mp_stdout_print = {NULL, stdout_print_strn};
+static const mp_print_t mp_stdout_print = {NULL, stdout_print_strn};
-STATIC void stderr_print_strn(void *env, const char *str, size_t len) {
+static void stderr_print_strn(void *env, const char *str, size_t len) {
(void)env;
ssize_t dummy = write(STDERR_FILENO, str, len);
(void)dummy;
}
-STATIC const mp_print_t mp_stderr_print = {NULL, stderr_print_strn};
+static const mp_print_t mp_stderr_print = {NULL, stderr_print_strn};
-STATIC int compile_and_save(const char *file, const char *output_file, const char *source_file) {
+static int compile_and_save(const char *file, const char *output_file, const char *source_file) {
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
mp_lexer_t *lex;
@@ -117,7 +117,7 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha
}
}
-STATIC int usage(char **argv) {
+static int usage(char **argv) {
printf(
"usage: %s [<opts>] [-X <implopt>] [--] <input filename>\n"
"Options:\n"
@@ -155,7 +155,7 @@ STATIC int usage(char **argv) {
}
// Process options which set interpreter init options
-STATIC void pre_process_options(int argc, char **argv) {
+static void pre_process_options(int argc, char **argv) {
for (int a = 1; a < argc; a++) {
if (argv[a][0] == '-') {
if (strcmp(argv[a], "-X") == 0) {
@@ -201,7 +201,7 @@ STATIC void pre_process_options(int argc, char **argv) {
}
}
-STATIC char *backslash_to_forwardslash(char *path) {
+static char *backslash_to_forwardslash(char *path) {
for (char *p = path; p != NULL && *p != '\0'; ++p) {
if (*p == '\\') {
*p = '/';
diff --git a/ports/cc3200/boards/make-pins.py b/ports/cc3200/boards/make-pins.py
index f1bdf15a30..e30c02ce94 100644
--- a/ports/cc3200/boards/make-pins.py
+++ b/ports/cc3200/boards/make-pins.py
@@ -162,7 +162,7 @@ class Pins:
def print_named(self, label, pins, out_source):
print("", file=out_source)
print(
- "STATIC const mp_rom_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{".format(label),
+ "static const mp_rom_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{".format(label),
file=out_source,
)
for pin in pins:
diff --git a/ports/cc3200/ftp/ftp.c b/ports/cc3200/ftp/ftp.c
index fc071fc951..3f1099518f 100644
--- a/ports/cc3200/ftp/ftp.c
+++ b/ports/cc3200/ftp/ftp.c
@@ -201,7 +201,7 @@ static FIFO_t ftp_socketfifo;
// all calls in an nlr handler. The wrapper functions below assume that there
// are only FATFS filesystems mounted.
-STATIC FATFS *lookup_path(const TCHAR **path) {
+static FATFS *lookup_path(const TCHAR **path) {
mp_vfs_mount_t *fs = mp_vfs_lookup_path(*path, path);
if (fs == MP_VFS_NONE || fs == MP_VFS_ROOT) {
return NULL;
@@ -210,7 +210,7 @@ STATIC FATFS *lookup_path(const TCHAR **path) {
return &((fs_user_mount_t*)MP_OBJ_TO_PTR(fs->obj))->fatfs;
}
-STATIC FRESULT f_open_helper(FIL *fp, const TCHAR *path, BYTE mode) {
+static FRESULT f_open_helper(FIL *fp, const TCHAR *path, BYTE mode) {
FATFS *fs = lookup_path(&path);
if (fs == NULL) {
return FR_NO_PATH;
@@ -218,7 +218,7 @@ STATIC FRESULT f_open_helper(FIL *fp, const TCHAR *path, BYTE mode) {
return f_open(fs, fp, path, mode);
}
-STATIC FRESULT f_opendir_helper(FF_DIR *dp, const TCHAR *path) {
+static FRESULT f_opendir_helper(FF_DIR *dp, const TCHAR *path) {
FATFS *fs = lookup_path(&path);
if (fs == NULL) {
return FR_NO_PATH;
@@ -226,7 +226,7 @@ STATIC FRESULT f_opendir_helper(FF_DIR *dp, const TCHAR *path) {
return f_opendir(fs, dp, path);
}
-STATIC FRESULT f_stat_helper(const TCHAR *path, FILINFO *fno) {
+static FRESULT f_stat_helper(const TCHAR *path, FILINFO *fno) {
FATFS *fs = lookup_path(&path);
if (fs == NULL) {
return FR_NO_PATH;
@@ -234,7 +234,7 @@ STATIC FRESULT f_stat_helper(const TCHAR *path, FILINFO *fno) {
return f_stat(fs, path, fno);
}
-STATIC FRESULT f_mkdir_helper(const TCHAR *path) {
+static FRESULT f_mkdir_helper(const TCHAR *path) {
FATFS *fs = lookup_path(&path);
if (fs == NULL) {
return FR_NO_PATH;
@@ -242,7 +242,7 @@ STATIC FRESULT f_mkdir_helper(const TCHAR *path) {
return f_mkdir(fs, path);
}
-STATIC FRESULT f_unlink_helper(const TCHAR *path) {
+static FRESULT f_unlink_helper(const TCHAR *path) {
FATFS *fs = lookup_path(&path);
if (fs == NULL) {
return FR_NO_PATH;
@@ -250,7 +250,7 @@ STATIC FRESULT f_unlink_helper(const TCHAR *path) {
return f_unlink(fs, path);
}
-STATIC FRESULT f_rename_helper(const TCHAR *path_old, const TCHAR *path_new) {
+static FRESULT f_rename_helper(const TCHAR *path_old, const TCHAR *path_new) {
FATFS *fs_old = lookup_path(&path_old);
if (fs_old == NULL) {
return FR_NO_PATH;
diff --git a/ports/cc3200/misc/mpirq.c b/ports/cc3200/misc/mpirq.c
index eb813fa4c6..e371366b11 100644
--- a/ports/cc3200/misc/mpirq.c
+++ b/ports/cc3200/misc/mpirq.c
@@ -50,7 +50,7 @@ const mp_arg_t mp_irq_init_args[] = {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC uint8_t mp_irq_priorities[] = { INT_PRIORITY_LVL_7, INT_PRIORITY_LVL_6, INT_PRIORITY_LVL_5, INT_PRIORITY_LVL_4,
+static uint8_t mp_irq_priorities[] = { INT_PRIORITY_LVL_7, INT_PRIORITY_LVL_6, INT_PRIORITY_LVL_5, INT_PRIORITY_LVL_4,
INT_PRIORITY_LVL_3, INT_PRIORITY_LVL_2, INT_PRIORITY_LVL_1 };
/******************************************************************************
@@ -143,7 +143,7 @@ void mp_irq_handler (mp_obj_t self_in) {
/******************************************************************************/
// MicroPython bindings
-STATIC mp_obj_t mp_irq_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mp_irq_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_irq_obj_t *self = pos_args[0];
// this is a bit of a hack, but it let us reuse the callback_create method from our parent
((mp_obj_t *)pos_args)[0] = self->parent;
@@ -152,35 +152,35 @@ STATIC mp_obj_t mp_irq_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
}
MP_DEFINE_CONST_FUN_OBJ_KW(mp_irq_init_obj, 1, mp_irq_init);
-STATIC mp_obj_t mp_irq_enable (mp_obj_t self_in) {
+static mp_obj_t mp_irq_enable (mp_obj_t self_in) {
mp_irq_obj_t *self = self_in;
self->methods->enable(self->parent);
self->isenabled = true;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_enable_obj, mp_irq_enable);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_enable_obj, mp_irq_enable);
-STATIC mp_obj_t mp_irq_disable (mp_obj_t self_in) {
+static mp_obj_t mp_irq_disable (mp_obj_t self_in) {
mp_irq_obj_t *self = self_in;
self->methods->disable(self->parent);
self->isenabled = false;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_disable_obj, mp_irq_disable);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_disable_obj, mp_irq_disable);
-STATIC mp_obj_t mp_irq_flags (mp_obj_t self_in) {
+static mp_obj_t mp_irq_flags (mp_obj_t self_in) {
mp_irq_obj_t *self = self_in;
return mp_obj_new_int(self->methods->flags(self->parent));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_flags_obj, mp_irq_flags);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_flags_obj, mp_irq_flags);
-STATIC mp_obj_t mp_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
mp_irq_handler (self_in);
return mp_const_none;
}
-STATIC const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
+static const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&mp_irq_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_enable), MP_ROM_PTR(&mp_irq_enable_obj) },
@@ -188,7 +188,7 @@ STATIC const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_flags), MP_ROM_PTR(&mp_irq_flags_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
+static MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_irq_type,
diff --git a/ports/cc3200/mods/machine_wdt.c b/ports/cc3200/mods/machine_wdt.c
index b20ef7eb93..58ecc1b533 100644
--- a/ports/cc3200/mods/machine_wdt.c
+++ b/ports/cc3200/mods/machine_wdt.c
@@ -59,7 +59,7 @@ typedef struct _machine_wdt_obj_t {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC machine_wdt_obj_t machine_wdt_obj = {.servers = false, .servers_sleeping = false, .simplelink = false, .running = false};
+static machine_wdt_obj_t machine_wdt_obj = {.servers = false, .servers_sleeping = false, .simplelink = false, .running = false};
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
@@ -84,7 +84,7 @@ void pybwdt_sl_alive (void) {
/******************************************************************************/
// MicroPython bindings
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
if (id != 0) {
mp_raise_OSError(MP_ENODEV);
}
@@ -119,7 +119,7 @@ STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t
return &machine_wdt_obj;
}
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
if ((self->servers || self->servers_sleeping) && self->simplelink && self->running) {
self->servers = false;
self->simplelink = false;
diff --git a/ports/cc3200/mods/modhashlib.c b/ports/cc3200/mods/modhashlib.c
index de56e114af..528ceeb2ee 100644
--- a/ports/cc3200/mods/modhashlib.c
+++ b/ports/cc3200/mods/modhashlib.c
@@ -61,13 +61,13 @@ typedef struct _mp_obj_hash_t {
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void hash_update_internal(mp_obj_t self_in, mp_obj_t data, bool digest);
-STATIC mp_obj_t hash_read (mp_obj_t self_in);
+static void hash_update_internal(mp_obj_t self_in, mp_obj_t data, bool digest);
+static mp_obj_t hash_read (mp_obj_t self_in);
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void hash_update_internal(mp_obj_t self_in, mp_obj_t data, bool digest) {
+static void hash_update_internal(mp_obj_t self_in, mp_obj_t data, bool digest) {
mp_obj_hash_t *self = self_in;
mp_buffer_info_t bufinfo;
@@ -95,7 +95,7 @@ STATIC void hash_update_internal(mp_obj_t self_in, mp_obj_t data, bool digest) {
}
}
-STATIC mp_obj_t hash_read (mp_obj_t self_in) {
+static mp_obj_t hash_read (mp_obj_t self_in) {
mp_obj_hash_t *self = self_in;
if (!self->fixedlen) {
@@ -119,7 +119,7 @@ STATIC mp_obj_t hash_read (mp_obj_t self_in) {
/// \classmethod \constructor([data[, block_size]])
/// initial data must be given if block_size wants to be passed
-STATIC mp_obj_t hash_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t hash_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 2, false);
mp_obj_hash_t *self = m_new0(mp_obj_hash_t, 1);
self->base.type = type_in;
@@ -151,24 +151,24 @@ STATIC mp_obj_t hash_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw, cons
return self;
}
-STATIC mp_obj_t hash_update(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t hash_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = self_in;
hash_update_internal(self, arg, false);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(hash_update_obj, hash_update);
-STATIC mp_obj_t hash_digest(mp_obj_t self_in) {
+static mp_obj_t hash_digest(mp_obj_t self_in) {
return hash_read(self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(hash_digest_obj, hash_digest);
-STATIC const mp_rom_map_elem_t hash_locals_dict_table[] = {
+static const mp_rom_map_elem_t hash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&hash_update_obj) },
{ MP_ROM_QSTR(MP_QSTR_digest), MP_ROM_PTR(&hash_digest_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(hash_locals_dict, hash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(hash_locals_dict, hash_locals_dict_table);
//STATIC const mp_obj_type_t md5_type = {
// { &mp_type_type },
@@ -177,7 +177,7 @@ STATIC MP_DEFINE_CONST_DICT(hash_locals_dict, hash_locals_dict_table);
// .locals_dict = (mp_obj_t)&hash_locals_dict,
//};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
sha1_type,
MP_QSTR_sha1,
MP_TYPE_FLAG_NONE,
@@ -185,7 +185,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &hash_locals_dict
);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
sha256_type,
MP_QSTR_sha256,
MP_TYPE_FLAG_NONE,
@@ -193,14 +193,14 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &hash_locals_dict
);
-STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hashlib) },
//{ MP_ROM_QSTR(MP_QSTR_md5), MP_ROM_PTR(&md5_type) },
{ MP_ROM_QSTR(MP_QSTR_sha1), MP_ROM_PTR(&sha1_type) },
{ MP_ROM_QSTR(MP_QSTR_sha256), MP_ROM_PTR(&sha256_type) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table);
const mp_obj_module_t mp_module_hashlib = {
.base = { &mp_type_module },
diff --git a/ports/cc3200/mods/modmachine.c b/ports/cc3200/mods/modmachine.c
index 6e50553365..f7184df442 100644
--- a/ports/cc3200/mods/modmachine.c
+++ b/ports/cc3200/mods/modmachine.c
@@ -93,7 +93,7 @@ extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
/******************************************************************************/
// MicroPython bindings;
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
// disable wlan
wlan_stop(SL_STOP_TIMEOUT_LONG);
// reset the cpu and it's peripherals
@@ -103,7 +103,7 @@ NORETURN STATIC void mp_machine_reset(void) {
}
#ifdef DEBUG
-STATIC mp_obj_t machine_info(uint n_args, const mp_obj_t *args) {
+static mp_obj_t machine_info(uint n_args, const mp_obj_t *args) {
// FreeRTOS info
{
printf("---------------------------------------------\n");
@@ -126,24 +126,24 @@ STATIC mp_obj_t machine_info(uint n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info);
#endif
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
return mp_obj_new_int(HAL_FCPU_HZ);
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_raise_NotImplementedError(NULL);
}
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
uint8_t mac[SL_BSSID_LENGTH];
wlan_get_mac (mac);
return mp_obj_new_bytes(mac, SL_BSSID_LENGTH);
}
-STATIC mp_obj_t machine_main(mp_obj_t main) {
+static mp_obj_t machine_main(mp_obj_t main) {
if (mp_obj_is_str(main)) {
MP_STATE_PORT(machine_config_main) = main;
} else {
@@ -153,27 +153,27 @@ STATIC mp_obj_t machine_main(mp_obj_t main) {
}
MP_DEFINE_CONST_FUN_OBJ_1(machine_main_obj, machine_main);
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
__WFI();
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
pyb_sleep_sleep();
}
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
pyb_sleep_deepsleep();
for (;;) {
}
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
return pyb_sleep_get_reset_cause();
}
-STATIC mp_obj_t machine_wake_reason (void) {
+static mp_obj_t machine_wake_reason (void) {
return mp_obj_new_int(pyb_sleep_get_wake_reason());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_wake_reason_obj, machine_wake_reason);
+static MP_DEFINE_CONST_FUN_OBJ_0(machine_wake_reason_obj, machine_wake_reason);
MP_REGISTER_ROOT_POINTER(mp_obj_t machine_config_main);
diff --git a/ports/cc3200/mods/modnetwork.c b/ports/cc3200/mods/modnetwork.c
index 590e872683..3a949136dc 100644
--- a/ports/cc3200/mods/modnetwork.c
+++ b/ports/cc3200/mods/modnetwork.c
@@ -43,8 +43,8 @@ typedef struct {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC network_server_obj_t network_server_obj;
-STATIC const mp_obj_type_t network_server_type;
+static network_server_obj_t network_server_obj;
+static const mp_obj_type_t network_server_type;
/// \module network - network configuration
///
@@ -54,7 +54,7 @@ void mod_network_init0(void) {
}
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
-STATIC mp_obj_t network_server_init_helper(mp_obj_t self, const mp_arg_val_t *args) {
+static mp_obj_t network_server_init_helper(mp_obj_t self, const mp_arg_val_t *args) {
const char *user = SERVERS_DEF_USER;
const char *pass = SERVERS_DEF_PASS;
if (args[0].u_obj != MP_OBJ_NULL) {
@@ -81,12 +81,12 @@ STATIC mp_obj_t network_server_init_helper(mp_obj_t self, const mp_arg_val_t *ar
return mp_const_none;
}
-STATIC const mp_arg_t network_server_args[] = {
+static const mp_arg_t network_server_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_login, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
};
-STATIC mp_obj_t network_server_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t network_server_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -108,16 +108,16 @@ STATIC mp_obj_t network_server_make_new(const mp_obj_type_t *type, size_t n_args
return (mp_obj_t)self;
}
-STATIC mp_obj_t network_server_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t network_server_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(network_server_args) - 1];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &network_server_args[1], args);
return network_server_init_helper(pos_args[0], args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_server_init_obj, 1, network_server_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_server_init_obj, 1, network_server_init);
// timeout value given in seconds
-STATIC mp_obj_t network_server_timeout(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_server_timeout(size_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
uint32_t timeout = mp_obj_get_int(args[1]);
servers_set_timeout(timeout * 1000);
@@ -127,23 +127,23 @@ STATIC mp_obj_t network_server_timeout(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_int(servers_get_timeout() / 1000);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_server_timeout_obj, 1, 2, network_server_timeout);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_server_timeout_obj, 1, 2, network_server_timeout);
-STATIC mp_obj_t network_server_running(mp_obj_t self_in) {
+static mp_obj_t network_server_running(mp_obj_t self_in) {
// get
return mp_obj_new_bool(servers_are_enabled());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_server_running_obj, network_server_running);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_server_running_obj, network_server_running);
-STATIC mp_obj_t network_server_deinit(mp_obj_t self_in) {
+static mp_obj_t network_server_deinit(mp_obj_t self_in) {
// simply stop the servers
servers_stop();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_server_deinit_obj, network_server_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_server_deinit_obj, network_server_deinit);
#endif
-STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_network_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_network) },
{ MP_ROM_QSTR(MP_QSTR_WLAN), MP_ROM_PTR(&mod_network_nic_type_wlan) },
@@ -152,7 +152,7 @@ STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_network_globals, mp_module_network_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_network_globals, mp_module_network_globals_table);
const mp_obj_module_t mp_module_network = {
.base = { &mp_type_module },
@@ -162,16 +162,16 @@ const mp_obj_module_t mp_module_network = {
MP_REGISTER_MODULE(MP_QSTR_network, mp_module_network);
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
-STATIC const mp_rom_map_elem_t network_server_locals_dict_table[] = {
+static const mp_rom_map_elem_t network_server_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&network_server_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&network_server_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_timeout), MP_ROM_PTR(&network_server_timeout_obj) },
{ MP_ROM_QSTR(MP_QSTR_isrunning), MP_ROM_PTR(&network_server_running_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(network_server_locals_dict, network_server_locals_dict_table);
+static MP_DEFINE_CONST_DICT(network_server_locals_dict, network_server_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
network_server_type,
MP_QSTR_Server,
MP_TYPE_FLAG_NONE,
diff --git a/ports/cc3200/mods/modos.c b/ports/cc3200/mods/modos.c
index c62c5e22c4..8c22ad8daf 100644
--- a/ports/cc3200/mods/modos.c
+++ b/ports/cc3200/mods/modos.c
@@ -31,7 +31,7 @@
#include "py/runtime.h"
#include "random.h"
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -40,4 +40,4 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
diff --git a/ports/cc3200/mods/modsocket.c b/ports/cc3200/mods/modsocket.c
index 0f56c15e82..c9065d488d 100644
--- a/ports/cc3200/mods/modsocket.c
+++ b/ports/cc3200/mods/modsocket.c
@@ -70,7 +70,7 @@
#define SOCKET_TIMEOUT_QUANTA_MS (20)
-STATIC int convert_sl_errno(int sl_errno) {
+static int convert_sl_errno(int sl_errno) {
return -sl_errno;
}
@@ -93,7 +93,7 @@ int check_timedout(mod_network_socket_obj_t *s, int ret, uint32_t *timeout_ms, i
return 0;
}
-STATIC int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip, uint8_t family) {
+static int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip, uint8_t family) {
uint32_t ip;
int result = sl_NetAppDnsGetHostByName((_i8 *)name, (_u16)len, (_u32*)&ip, (_u8)family);
out_ip[0] = ip;
@@ -103,7 +103,7 @@ STATIC int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip,
return result;
}
-STATIC int wlan_socket_socket(mod_network_socket_obj_t *s, int *_errno) {
+static int wlan_socket_socket(mod_network_socket_obj_t *s, int *_errno) {
int16_t sd = sl_Socket(s->sock_base.u_param.domain, s->sock_base.u_param.type, s->sock_base.u_param.proto);
if (sd < 0) {
*_errno = sd;
@@ -113,7 +113,7 @@ STATIC int wlan_socket_socket(mod_network_socket_obj_t *s, int *_errno) {
return 0;
}
-STATIC void wlan_socket_close(mod_network_socket_obj_t *s) {
+static void wlan_socket_close(mod_network_socket_obj_t *s) {
// this is to prevent the finalizer to close a socket that failed when being created
if (s->sock_base.sd >= 0) {
modusocket_socket_delete(s->sock_base.sd);
@@ -122,7 +122,7 @@ STATIC void wlan_socket_close(mod_network_socket_obj_t *s) {
}
}
-STATIC int wlan_socket_bind(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
+static int wlan_socket_bind(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
int ret = sl_Bind(s->sock_base.sd, &addr, sizeof(addr));
if (ret != 0) {
@@ -132,7 +132,7 @@ STATIC int wlan_socket_bind(mod_network_socket_obj_t *s, byte *ip, mp_uint_t por
return 0;
}
-STATIC int wlan_socket_listen(mod_network_socket_obj_t *s, mp_int_t backlog, int *_errno) {
+static int wlan_socket_listen(mod_network_socket_obj_t *s, mp_int_t backlog, int *_errno) {
int ret = sl_Listen(s->sock_base.sd, backlog);
if (ret != 0) {
*_errno = ret;
@@ -141,7 +141,7 @@ STATIC int wlan_socket_listen(mod_network_socket_obj_t *s, mp_int_t backlog, int
return 0;
}
-STATIC int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_obj_t *s2, byte *ip, mp_uint_t *port, int *_errno) {
+static int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_obj_t *s2, byte *ip, mp_uint_t *port, int *_errno) {
// accept incoming connection
int16_t sd;
SlSockAddr_t addr;
@@ -163,7 +163,7 @@ STATIC int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_ob
}
}
-STATIC int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
+static int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
uint32_t timeout_ms = s->sock_base.timeout_ms;
@@ -195,7 +195,7 @@ STATIC int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t
}
}
-STATIC int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno) {
+static int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno) {
if (len == 0) {
return 0;
}
@@ -211,7 +211,7 @@ STATIC int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uin
}
}
-STATIC int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno) {
+static int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno) {
uint32_t timeout_ms = s->sock_base.timeout_ms;
for (;;) {
int ret = sl_Recv(s->sock_base.sd, buf, MIN(len, WLAN_MAX_RX_SIZE), 0);
@@ -224,7 +224,7 @@ STATIC int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t le
}
}
-STATIC int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
+static int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
uint32_t timeout_ms = s->sock_base.timeout_ms;
for (;;) {
@@ -238,7 +238,7 @@ STATIC int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_
}
}
-STATIC int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
+static int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
SlSockAddr_t addr;
SlSocklen_t addr_len = sizeof(addr);
uint32_t timeout_ms = s->sock_base.timeout_ms;
@@ -254,7 +254,7 @@ STATIC int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_
}
}
-STATIC int wlan_socket_setsockopt(mod_network_socket_obj_t *s, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
+static int wlan_socket_setsockopt(mod_network_socket_obj_t *s, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
int ret = sl_SetSockOpt(s->sock_base.sd, level, opt, optval, optlen);
if (ret < 0) {
*_errno = ret;
@@ -263,7 +263,7 @@ STATIC int wlan_socket_setsockopt(mod_network_socket_obj_t *s, mp_uint_t level,
return 0;
}
-STATIC int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout_s, int *_errno) {
+static int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout_s, int *_errno) {
SlSockNonblocking_t option;
if (timeout_s == 0 || timeout_s == -1) {
if (timeout_s == 0) {
@@ -289,7 +289,7 @@ STATIC int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout
return 0;
}
-STATIC int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t arg, int *_errno) {
+static int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t arg, int *_errno) {
mp_int_t ret;
if (request == MP_STREAM_POLL) {
mp_uint_t flags = arg;
@@ -361,9 +361,9 @@ typedef struct {
/******************************************************************************
DEFINE PRIVATE DATA
******************************************************************************/
-STATIC const mp_obj_type_t socket_type;
-STATIC OsiLockObj_t modusocket_LockObj;
-STATIC modusocket_sock_t modusocket_sockets[MOD_NETWORK_MAX_SOCKETS] = {{.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1},
+static const mp_obj_type_t socket_type;
+static OsiLockObj_t modusocket_LockObj;
+static modusocket_sock_t modusocket_sockets[MOD_NETWORK_MAX_SOCKETS] = {{.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1},
{.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1}};
/******************************************************************************
@@ -432,7 +432,7 @@ void modusocket_close_all_user_sockets (void) {
// socket class
// constructor socket(family=AF_INET, type=SOCK_STREAM, proto=IPPROTO_TCP, fileno=None)
-STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 4, false);
// create socket object
@@ -468,7 +468,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
}
// method socket.bind(address)
-STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
mod_network_socket_obj_t *self = self_in;
// get address
@@ -482,10 +482,10 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
// method socket.listen([backlog])
-STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
mod_network_socket_obj_t *self = args[0];
int32_t backlog = MICROPY_PY_SOCKET_LISTEN_BACKLOG_DEFAULT;
@@ -500,10 +500,10 @@ STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
// method socket.accept()
-STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
+static mp_obj_t socket_accept(mp_obj_t self_in) {
mod_network_socket_obj_t *self = self_in;
// create new socket object
@@ -528,10 +528,10 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
client->items[1] = netutils_format_inet_addr(ip, port, NETUTILS_LITTLE);
return client;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
+static MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
// method socket.connect(address)
-STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
mod_network_socket_obj_t *self = self_in;
// get address
@@ -548,10 +548,10 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
// method socket.send(bytes)
-STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
mod_network_socket_obj_t *self = self_in;
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
@@ -562,10 +562,10 @@ STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
}
return mp_obj_new_int_from_uint(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
// method socket.recv(bufsize)
-STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
mod_network_socket_obj_t *self = self_in;
mp_int_t len = mp_obj_get_int(len_in);
vstr_t vstr;
@@ -582,10 +582,10 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
vstr.buf[vstr.len] = '\0';
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
// method socket.sendto(bytes, address)
-STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
+static mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
mod_network_socket_obj_t *self = self_in;
// get the data
@@ -604,10 +604,10 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
}
return mp_obj_new_int(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
+static MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
// method socket.recvfrom(bufsize)
-STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
mod_network_socket_obj_t *self = self_in;
vstr_t vstr;
vstr_init_len(&vstr, mp_obj_get_int(len_in));
@@ -629,10 +629,10 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
tuple[1] = netutils_format_inet_addr(ip, port, NETUTILS_LITTLE);
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
// method socket.setsockopt(level, optname, value)
-STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
mod_network_socket_obj_t *self = args[0];
mp_int_t level = mp_obj_get_int(args[1]);
@@ -658,13 +658,13 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
// method socket.settimeout(value)
// timeout=0 means non-blocking
// timeout=None means blocking
// otherwise, timeout is in seconds
-STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
+static mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
mod_network_socket_obj_t *self = self_in;
mp_uint_t timeout;
if (timeout_in == mp_const_none) {
@@ -678,25 +678,25 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
// method socket.setblocking(flag)
-STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
+static mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
if (mp_obj_is_true(blocking)) {
return socket_settimeout(self_in, mp_const_none);
} else {
return socket_settimeout(self_in, MP_OBJ_NEW_SMALL_INT(0));
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
-STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return args[0];
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 6, socket_makefile);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 6, socket_makefile);
-STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socket_bind_obj) },
@@ -722,7 +722,7 @@ STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
-STATIC mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
mod_network_socket_obj_t *self = self_in;
mp_int_t ret = wlan_socket_recv(self, buf, size, errcode);
if (ret < 0) {
@@ -737,7 +737,7 @@ STATIC mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *e
return ret;
}
-STATIC mp_uint_t socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
mod_network_socket_obj_t *self = self_in;
mp_int_t ret = wlan_socket_send(self, buf, size, errcode);
if (ret < 0) {
@@ -746,7 +746,7 @@ STATIC mp_uint_t socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size,
return ret;
}
-STATIC mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
+static mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
mod_network_socket_obj_t *self = self_in;
return wlan_socket_ioctl(self, request, arg, errcode);
}
@@ -758,7 +758,7 @@ const mp_stream_p_t socket_stream_p = {
.is_text = false,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
@@ -772,7 +772,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
// function socket.getaddrinfo(host, port)
/// \function getaddrinfo(host, port)
-STATIC mp_obj_t mod_socket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) {
+static mp_obj_t mod_socket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) {
size_t hlen;
const char *host = mp_obj_str_get_data(host_in, &hlen);
mp_int_t port = mp_obj_get_int(port_in);
@@ -791,9 +791,9 @@ STATIC mp_obj_t mod_socket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) {
tuple->items[4] = netutils_format_inet_addr(out_ip, port, NETUTILS_LITTLE);
return mp_obj_new_list(1, (mp_obj_t*)&tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_getaddrinfo_obj, mod_socket_getaddrinfo);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_getaddrinfo_obj, mod_socket_getaddrinfo);
-STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) },
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) },
@@ -810,7 +810,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_UDP), MP_ROM_INT(SL_IPPROTO_UDP) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
const mp_obj_module_t mp_module_socket = {
.base = { &mp_type_module },
diff --git a/ports/cc3200/mods/modssl.c b/ports/cc3200/mods/modssl.c
index 15c825fcf4..62067d3f32 100644
--- a/ports/cc3200/mods/modssl.c
+++ b/ports/cc3200/mods/modssl.c
@@ -53,14 +53,14 @@ typedef struct _mp_obj_ssl_socket_t {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC const mp_obj_type_t ssl_socket_type;
+static const mp_obj_type_t ssl_socket_type;
/******************************************************************************/
// MicroPython bindings; SSL class
// ssl sockets inherit from normal socket, so we take its
// locals and stream methods
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ssl_socket_type,
MP_QSTR_ssl,
MP_TYPE_FLAG_NONE,
@@ -68,8 +68,8 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &socket_locals_dict
);
-STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t allowed_args[] = {
+static mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t allowed_args[] = {
{ MP_QSTR_sock, MP_ARG_REQUIRED | MP_ARG_OBJ, },
{ MP_QSTR_keyfile, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_certfile, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -133,9 +133,9 @@ socket_error:
arg_error:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_ssl_wrap_socket_obj, 0, mod_ssl_wrap_socket);
+static MP_DEFINE_CONST_FUN_OBJ_KW(mod_ssl_wrap_socket_obj, 0, mod_ssl_wrap_socket);
-STATIC const mp_rom_map_elem_t mp_module_ssl_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_ssl_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ssl) },
{ MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&mod_ssl_wrap_socket_obj) },
@@ -153,7 +153,7 @@ STATIC const mp_rom_map_elem_t mp_module_ssl_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PROTOCOL_TLSv1_2), MP_ROM_INT(SL_SO_SEC_METHOD_TLSV1_2) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table);
const mp_obj_module_t mp_module_ssl = {
.base = { &mp_type_module },
diff --git a/ports/cc3200/mods/modtime.c b/ports/cc3200/mods/modtime.c
index 6fa98296d2..21388568ab 100644
--- a/ports/cc3200/mods/modtime.c
+++ b/ports/cc3200/mods/modtime.c
@@ -30,7 +30,7 @@
#include "pybrtc.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
timeutils_struct_time_t tm;
// get the seconds from the RTC
@@ -49,6 +49,6 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Returns the number of seconds, as an integer, since the Epoch.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
return mp_obj_new_int(pyb_rtc_get_seconds());
}
diff --git a/ports/cc3200/mods/modwipy.c b/ports/cc3200/mods/modwipy.c
index 110c3cfd36..bb0ac4978d 100644
--- a/ports/cc3200/mods/modwipy.c
+++ b/ports/cc3200/mods/modwipy.c
@@ -7,7 +7,7 @@
/******************************************************************************/
// MicroPython bindings
-STATIC mp_obj_t mod_wipy_heartbeat(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_wipy_heartbeat(size_t n_args, const mp_obj_t *args) {
if (n_args) {
mperror_enable_heartbeat (mp_obj_is_true(args[0]));
return mp_const_none;
@@ -15,14 +15,14 @@ STATIC mp_obj_t mod_wipy_heartbeat(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_bool(mperror_is_heartbeat_enabled());
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_wipy_heartbeat_obj, 0, 1, mod_wipy_heartbeat);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_wipy_heartbeat_obj, 0, 1, mod_wipy_heartbeat);
-STATIC const mp_rom_map_elem_t wipy_module_globals_table[] = {
+static const mp_rom_map_elem_t wipy_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_wipy) },
{ MP_ROM_QSTR(MP_QSTR_heartbeat), MP_ROM_PTR(&mod_wipy_heartbeat_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(wipy_module_globals, wipy_module_globals_table);
+static MP_DEFINE_CONST_DICT(wipy_module_globals, wipy_module_globals_table);
const mp_obj_module_t wipy_module = {
.base = { &mp_type_module },
diff --git a/ports/cc3200/mods/modwlan.c b/ports/cc3200/mods/modwlan.c
index 8d98dd0421..fc55201eaa 100644
--- a/ports/cc3200/mods/modwlan.c
+++ b/ports/cc3200/mods/modwlan.c
@@ -114,7 +114,7 @@ typedef enum{
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC wlan_obj_t wlan_obj = {
+static wlan_obj_t wlan_obj = {
.mode = -1,
.status = 0,
.ip = 0,
@@ -130,7 +130,7 @@ STATIC wlan_obj_t wlan_obj = {
#endif
};
-STATIC const mp_irq_methods_t wlan_irq_methods;
+static const mp_irq_methods_t wlan_irq_methods;
/******************************************************************************
DECLARE PUBLIC DATA
@@ -142,31 +142,31 @@ OsiLockObj_t wlan_LockObj;
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void wlan_clear_data (void);
-STATIC void wlan_reenable (SlWlanMode_t mode);
-STATIC void wlan_servers_start (void);
-STATIC void wlan_servers_stop (void);
-STATIC void wlan_reset (void);
-STATIC void wlan_validate_mode (uint mode);
-STATIC void wlan_set_mode (uint mode);
-STATIC void wlan_validate_ssid_len (uint32_t len);
-STATIC void wlan_set_ssid (const char *ssid, uint8_t len, bool add_mac);
-STATIC void wlan_validate_security (uint8_t auth, const char *key, uint8_t len);
-STATIC void wlan_set_security (uint8_t auth, const char *key, uint8_t len);
-STATIC void wlan_validate_channel (uint8_t channel);
-STATIC void wlan_set_channel (uint8_t channel);
+static void wlan_clear_data (void);
+static void wlan_reenable (SlWlanMode_t mode);
+static void wlan_servers_start (void);
+static void wlan_servers_stop (void);
+static void wlan_reset (void);
+static void wlan_validate_mode (uint mode);
+static void wlan_set_mode (uint mode);
+static void wlan_validate_ssid_len (uint32_t len);
+static void wlan_set_ssid (const char *ssid, uint8_t len, bool add_mac);
+static void wlan_validate_security (uint8_t auth, const char *key, uint8_t len);
+static void wlan_set_security (uint8_t auth, const char *key, uint8_t len);
+static void wlan_validate_channel (uint8_t channel);
+static void wlan_set_channel (uint8_t channel);
#if MICROPY_HW_ANTENNA_DIVERSITY
-STATIC void wlan_validate_antenna (uint8_t antenna);
-STATIC void wlan_set_antenna (uint8_t antenna);
+static void wlan_validate_antenna (uint8_t antenna);
+static void wlan_set_antenna (uint8_t antenna);
#endif
-STATIC void wlan_sl_disconnect (void);
-STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, const char* bssid, uint8_t sec,
+static void wlan_sl_disconnect (void);
+static modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, const char* bssid, uint8_t sec,
const char* key, uint32_t key_len, int32_t timeout);
-STATIC void wlan_get_sl_mac (void);
-STATIC void wlan_wep_key_unhexlify (const char *key, char *key_out);
-STATIC void wlan_lpds_irq_enable (mp_obj_t self_in);
-STATIC void wlan_lpds_irq_disable (mp_obj_t self_in);
-STATIC bool wlan_scan_result_is_unique (const mp_obj_list_t *nets, _u8 *bssid);
+static void wlan_get_sl_mac (void);
+static void wlan_wep_key_unhexlify (const char *key, char *key_out);
+static void wlan_lpds_irq_enable (mp_obj_t self_in);
+static void wlan_lpds_irq_disable (mp_obj_t self_in);
+static bool wlan_scan_result_is_unique (const mp_obj_list_t *nets, _u8 *bssid);
//*****************************************************************************
//
@@ -541,14 +541,14 @@ void wlan_off_on (void) {
// DEFINE STATIC FUNCTIONS
//*****************************************************************************
-STATIC void wlan_clear_data (void) {
+static void wlan_clear_data (void) {
CLR_STATUS_BIT_ALL(wlan_obj.status);
wlan_obj.ip = 0;
//memset(wlan_obj.ssid_o, 0, sizeof(wlan_obj.ssid));
//memset(wlan_obj.bssid, 0, sizeof(wlan_obj.bssid));
}
-STATIC void wlan_reenable (SlWlanMode_t mode) {
+static void wlan_reenable (SlWlanMode_t mode) {
// stop and start again
#ifdef SL_PLATFORM_MULTI_THREADED
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
@@ -562,7 +562,7 @@ STATIC void wlan_reenable (SlWlanMode_t mode) {
ASSERT (wlan_obj.mode == mode);
}
-STATIC void wlan_servers_start (void) {
+static void wlan_servers_start (void) {
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
// start the servers if they were enabled before
if (wlan_obj.servers_enabled) {
@@ -571,7 +571,7 @@ STATIC void wlan_servers_start (void) {
#endif
}
-STATIC void wlan_servers_stop (void) {
+static void wlan_servers_stop (void) {
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
// Stop all other processes using the wlan engine
if ((wlan_obj.servers_enabled = servers_are_enabled())) {
@@ -580,30 +580,30 @@ STATIC void wlan_servers_stop (void) {
#endif
}
-STATIC void wlan_reset (void) {
+static void wlan_reset (void) {
wlan_servers_stop();
wlan_reenable (wlan_obj.mode);
wlan_servers_start();
}
-STATIC void wlan_validate_mode (uint mode) {
+static void wlan_validate_mode (uint mode) {
if (mode != ROLE_STA && mode != ROLE_AP) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
-STATIC void wlan_set_mode (uint mode) {
+static void wlan_set_mode (uint mode) {
wlan_obj.mode = mode;
ASSERT_ON_ERROR(sl_WlanSetMode(mode));
}
-STATIC void wlan_validate_ssid_len (uint32_t len) {
+static void wlan_validate_ssid_len (uint32_t len) {
if (len > MODWLAN_SSID_LEN_MAX) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
-STATIC void wlan_set_ssid (const char *ssid, uint8_t len, bool add_mac) {
+static void wlan_set_ssid (const char *ssid, uint8_t len, bool add_mac) {
if (ssid != NULL) {
// save the ssid
memcpy(&wlan_obj.ssid, ssid, len);
@@ -618,7 +618,7 @@ STATIC void wlan_set_ssid (const char *ssid, uint8_t len, bool add_mac) {
}
}
-STATIC void wlan_validate_security (uint8_t auth, const char *key, uint8_t len) {
+static void wlan_validate_security (uint8_t auth, const char *key, uint8_t len) {
if (auth != SL_SEC_TYPE_WEP && auth != SL_SEC_TYPE_WPA_WPA2) {
goto invalid_args;
}
@@ -635,7 +635,7 @@ invalid_args:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC void wlan_set_security (uint8_t auth, const char *key, uint8_t len) {
+static void wlan_set_security (uint8_t auth, const char *key, uint8_t len) {
wlan_obj.auth = auth;
ASSERT_ON_ERROR(sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, sizeof(uint8_t), &auth));
if (key != NULL) {
@@ -653,31 +653,31 @@ STATIC void wlan_set_security (uint8_t auth, const char *key, uint8_t len) {
}
}
-STATIC void wlan_validate_channel (uint8_t channel) {
+static void wlan_validate_channel (uint8_t channel) {
if (channel < 1 || channel > 11) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
-STATIC void wlan_set_channel (uint8_t channel) {
+static void wlan_set_channel (uint8_t channel) {
wlan_obj.channel = channel;
ASSERT_ON_ERROR(sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, &channel));
}
#if MICROPY_HW_ANTENNA_DIVERSITY
-STATIC void wlan_validate_antenna (uint8_t antenna) {
+static void wlan_validate_antenna (uint8_t antenna) {
if (antenna != ANTENNA_TYPE_INTERNAL && antenna != ANTENNA_TYPE_EXTERNAL) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
-STATIC void wlan_set_antenna (uint8_t antenna) {
+static void wlan_set_antenna (uint8_t antenna) {
wlan_obj.antenna = antenna;
antenna_select(antenna);
}
#endif
-STATIC void wlan_sl_disconnect (void) {
+static void wlan_sl_disconnect (void) {
// Device in station-mode. Disconnect previous connection if any
// The function returns 0 if 'Disconnected done', negative number if already
// disconnected Wait for 'disconnection' event if 0 is returned, Ignore
@@ -690,7 +690,7 @@ STATIC void wlan_sl_disconnect (void) {
}
}
-STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, const char* bssid, uint8_t sec,
+static modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, const char* bssid, uint8_t sec,
const char* key, uint32_t key_len, int32_t timeout) {
SlSecParams_t secParams;
secParams.Key = (_i8*)key;
@@ -716,13 +716,13 @@ STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, co
return MODWLAN_ERROR_INVALID_PARAMS;
}
-STATIC void wlan_get_sl_mac (void) {
+static void wlan_get_sl_mac (void) {
// Get the MAC address
uint8_t macAddrLen = SL_MAC_ADDR_LEN;
sl_NetCfgGet(SL_MAC_ADDRESS_GET, NULL, &macAddrLen, wlan_obj.mac);
}
-STATIC void wlan_wep_key_unhexlify (const char *key, char *key_out) {
+static void wlan_wep_key_unhexlify (const char *key, char *key_out) {
byte hex_byte = 0;
for (mp_uint_t i = strlen(key); i > 0 ; i--) {
hex_byte += unichar_xdigit_value(*key++);
@@ -735,22 +735,22 @@ STATIC void wlan_wep_key_unhexlify (const char *key, char *key_out) {
}
}
-STATIC void wlan_lpds_irq_enable (mp_obj_t self_in) {
+static void wlan_lpds_irq_enable (mp_obj_t self_in) {
wlan_obj_t *self = self_in;
self->irq_enabled = true;
}
-STATIC void wlan_lpds_irq_disable (mp_obj_t self_in) {
+static void wlan_lpds_irq_disable (mp_obj_t self_in) {
wlan_obj_t *self = self_in;
self->irq_enabled = false;
}
-STATIC int wlan_irq_flags (mp_obj_t self_in) {
+static int wlan_irq_flags (mp_obj_t self_in) {
wlan_obj_t *self = self_in;
return self->irq_flags;
}
-STATIC bool wlan_scan_result_is_unique (const mp_obj_list_t *nets, _u8 *bssid) {
+static bool wlan_scan_result_is_unique (const mp_obj_list_t *nets, _u8 *bssid) {
for (int i = 0; i < nets->len; i++) {
// index 1 in the list is the bssid
mp_obj_str_t *_bssid = (mp_obj_str_t *)((mp_obj_tuple_t *)nets->items[i])->items[1];
@@ -766,7 +766,7 @@ STATIC bool wlan_scan_result_is_unique (const mp_obj_list_t *nets, _u8 *bssid) {
/// \class WLAN - WiFi driver
-STATIC mp_obj_t wlan_init_helper(wlan_obj_t *self, const mp_arg_val_t *args) {
+static mp_obj_t wlan_init_helper(wlan_obj_t *self, const mp_arg_val_t *args) {
// get the mode
int8_t mode = args[0].u_int;
wlan_validate_mode(mode);
@@ -808,7 +808,7 @@ STATIC mp_obj_t wlan_init_helper(wlan_obj_t *self, const mp_arg_val_t *args) {
return mp_const_none;
}
-STATIC const mp_arg_t wlan_init_args[] = {
+static const mp_arg_t wlan_init_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_mode, MP_ARG_INT, {.u_int = ROLE_STA} },
{ MP_QSTR_ssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -818,7 +818,7 @@ STATIC const mp_arg_t wlan_init_args[] = {
{ MP_QSTR_antenna, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = ANTENNA_TYPE_INTERNAL} },
#endif
};
-STATIC mp_obj_t wlan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t wlan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -844,16 +844,16 @@ STATIC mp_obj_t wlan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return (mp_obj_t)self;
}
-STATIC mp_obj_t wlan_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t wlan_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(wlan_init_args) - 1];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &wlan_init_args[1], args);
return wlan_init_helper(pos_args[0], args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wlan_init_obj, 1, wlan_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(wlan_init_obj, 1, wlan_init);
-STATIC mp_obj_t wlan_scan(mp_obj_t self_in) {
- STATIC const qstr wlan_scan_info_fields[] = {
+static mp_obj_t wlan_scan(mp_obj_t self_in) {
+ static const qstr wlan_scan_info_fields[] = {
MP_QSTR_ssid, MP_QSTR_bssid, MP_QSTR_sec, MP_QSTR_channel, MP_QSTR_rssi
};
@@ -901,10 +901,10 @@ STATIC mp_obj_t wlan_scan(mp_obj_t self_in) {
return nets;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(wlan_scan_obj, wlan_scan);
+static MP_DEFINE_CONST_FUN_OBJ_1(wlan_scan_obj, wlan_scan);
-STATIC mp_obj_t wlan_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t allowed_args[] = {
+static mp_obj_t wlan_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t allowed_args[] = {
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ, },
{ MP_QSTR_auth, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -967,21 +967,21 @@ STATIC mp_obj_t wlan_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wlan_connect_obj, 1, wlan_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(wlan_connect_obj, 1, wlan_connect);
-STATIC mp_obj_t wlan_disconnect(mp_obj_t self_in) {
+static mp_obj_t wlan_disconnect(mp_obj_t self_in) {
wlan_sl_disconnect();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(wlan_disconnect_obj, wlan_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_1(wlan_disconnect_obj, wlan_disconnect);
-STATIC mp_obj_t wlan_isconnected(mp_obj_t self_in) {
+static mp_obj_t wlan_isconnected(mp_obj_t self_in) {
return wlan_is_connected() ? mp_const_true : mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(wlan_isconnected_obj, wlan_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(wlan_isconnected_obj, wlan_isconnected);
-STATIC mp_obj_t wlan_ifconfig(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t wlan_ifconfig_args[] = {
+static mp_obj_t wlan_ifconfig(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t wlan_ifconfig_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_config, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
};
@@ -1055,9 +1055,9 @@ STATIC mp_obj_t wlan_ifconfig(size_t n_args, const mp_obj_t *pos_args, mp_map_t
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wlan_ifconfig_obj, 1, wlan_ifconfig);
+static MP_DEFINE_CONST_FUN_OBJ_KW(wlan_ifconfig_obj, 1, wlan_ifconfig);
-STATIC mp_obj_t wlan_mode(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wlan_mode(size_t n_args, const mp_obj_t *args) {
wlan_obj_t *self = args[0];
if (n_args == 1) {
return mp_obj_new_int(self->mode);
@@ -1069,9 +1069,9 @@ STATIC mp_obj_t wlan_mode(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_mode_obj, 1, 2, wlan_mode);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_mode_obj, 1, 2, wlan_mode);
-STATIC mp_obj_t wlan_ssid(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wlan_ssid(size_t n_args, const mp_obj_t *args) {
wlan_obj_t *self = args[0];
if (n_args == 1) {
return mp_obj_new_str((const char *)self->ssid, strlen((const char *)self->ssid));
@@ -1084,9 +1084,9 @@ STATIC mp_obj_t wlan_ssid(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_ssid_obj, 1, 2, wlan_ssid);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_ssid_obj, 1, 2, wlan_ssid);
-STATIC mp_obj_t wlan_auth(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wlan_auth(size_t n_args, const mp_obj_t *args) {
wlan_obj_t *self = args[0];
if (n_args == 1) {
if (self->auth == SL_SEC_TYPE_OPEN) {
@@ -1114,9 +1114,9 @@ STATIC mp_obj_t wlan_auth(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_auth_obj, 1, 2, wlan_auth);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_auth_obj, 1, 2, wlan_auth);
-STATIC mp_obj_t wlan_channel(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wlan_channel(size_t n_args, const mp_obj_t *args) {
wlan_obj_t *self = args[0];
if (n_args == 1) {
return mp_obj_new_int(self->channel);
@@ -1128,9 +1128,9 @@ STATIC mp_obj_t wlan_channel(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_channel_obj, 1, 2, wlan_channel);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_channel_obj, 1, 2, wlan_channel);
-STATIC mp_obj_t wlan_antenna(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wlan_antenna(size_t n_args, const mp_obj_t *args) {
wlan_obj_t *self = args[0];
if (n_args == 1) {
return mp_obj_new_int(self->antenna);
@@ -1143,9 +1143,9 @@ STATIC mp_obj_t wlan_antenna(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_antenna_obj, 1, 2, wlan_antenna);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_antenna_obj, 1, 2, wlan_antenna);
-STATIC mp_obj_t wlan_mac(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t wlan_mac(size_t n_args, const mp_obj_t *args) {
wlan_obj_t *self = args[0];
if (n_args == 1) {
return mp_obj_new_bytes((const byte *)self->mac, SL_BSSID_LENGTH);
@@ -1161,9 +1161,9 @@ STATIC mp_obj_t wlan_mac(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_mac_obj, 1, 2, wlan_mac);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_mac_obj, 1, 2, wlan_mac);
-STATIC mp_obj_t wlan_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t wlan_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_val_t args[mp_irq_INIT_NUM_ARGS];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, mp_irq_INIT_NUM_ARGS, mp_irq_init_args, args);
@@ -1191,7 +1191,7 @@ STATIC mp_obj_t wlan_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
invalid_args:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wlan_irq_obj, 1, wlan_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(wlan_irq_obj, 1, wlan_irq);
//STATIC mp_obj_t wlan_connections (mp_obj_t self_in) {
// mp_obj_t device[2];
@@ -1238,7 +1238,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wlan_irq_obj, 1, wlan_irq);
//}
//STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(wlan_urn_obj, 1, 2, wlan_urn);
-STATIC mp_obj_t wlan_print_ver(void) {
+static mp_obj_t wlan_print_ver(void) {
SlVersionFull ver;
byte config_opt = SL_DEVICE_GENERAL_VERSION;
byte config_len = sizeof(ver);
@@ -1250,10 +1250,10 @@ STATIC mp_obj_t wlan_print_ver(void) {
ver.ChipFwAndPhyVersion.PhyVersion[2], ver.ChipFwAndPhyVersion.PhyVersion[3]);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(wlan_print_ver_fun_obj, wlan_print_ver);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(wlan_print_ver_obj, MP_ROM_PTR(&wlan_print_ver_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_0(wlan_print_ver_fun_obj, wlan_print_ver);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(wlan_print_ver_obj, MP_ROM_PTR(&wlan_print_ver_fun_obj));
-STATIC const mp_rom_map_elem_t wlan_locals_dict_table[] = {
+static const mp_rom_map_elem_t wlan_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&wlan_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&wlan_scan_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&wlan_connect_obj) },
@@ -1283,7 +1283,7 @@ STATIC const mp_rom_map_elem_t wlan_locals_dict_table[] = {
#endif
{ MP_ROM_QSTR(MP_QSTR_ANY_EVENT), MP_ROM_INT(MODWLAN_WIFI_EVENT_ANY) },
};
-STATIC MP_DEFINE_CONST_DICT(wlan_locals_dict, wlan_locals_dict_table);
+static MP_DEFINE_CONST_DICT(wlan_locals_dict, wlan_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mod_network_nic_type_wlan,
@@ -1293,7 +1293,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &wlan_locals_dict
);
-STATIC const mp_irq_methods_t wlan_irq_methods = {
+static const mp_irq_methods_t wlan_irq_methods = {
.init = wlan_irq,
.enable = wlan_lpds_irq_enable,
.disable = wlan_lpds_irq_disable,
diff --git a/ports/cc3200/mods/pybadc.c b/ports/cc3200/mods/pybadc.c
index 6f9f1f19ae..cfa19a408e 100644
--- a/ports/cc3200/mods/pybadc.c
+++ b/ports/cc3200/mods/pybadc.c
@@ -74,23 +74,23 @@ typedef struct {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC pyb_adc_channel_obj_t pyb_adc_channel_obj[PYB_ADC_NUM_CHANNELS] = { {.pin = &pin_GP2, .channel = ADC_CH_0, .id = 0, .enabled = false},
+static pyb_adc_channel_obj_t pyb_adc_channel_obj[PYB_ADC_NUM_CHANNELS] = { {.pin = &pin_GP2, .channel = ADC_CH_0, .id = 0, .enabled = false},
{.pin = &pin_GP3, .channel = ADC_CH_1, .id = 1, .enabled = false},
{.pin = &pin_GP4, .channel = ADC_CH_2, .id = 2, .enabled = false},
{.pin = &pin_GP5, .channel = ADC_CH_3, .id = 3, .enabled = false} };
-STATIC pyb_adc_obj_t pyb_adc_obj = {.enabled = false};
+static pyb_adc_obj_t pyb_adc_obj = {.enabled = false};
-STATIC const mp_obj_type_t pyb_adc_channel_type;
+static const mp_obj_type_t pyb_adc_channel_type;
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC mp_obj_t adc_channel_deinit(mp_obj_t self_in);
+static mp_obj_t adc_channel_deinit(mp_obj_t self_in);
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
******************************************************************************/
-STATIC void pyb_adc_init (pyb_adc_obj_t *self) {
+static void pyb_adc_init (pyb_adc_obj_t *self) {
// enable and configure the timer
MAP_ADCTimerConfig(ADC_BASE, (1 << 17) - 1);
MAP_ADCTimerEnable(ADC_BASE);
@@ -99,14 +99,14 @@ STATIC void pyb_adc_init (pyb_adc_obj_t *self) {
self->enabled = true;
}
-STATIC void pyb_adc_check_init(void) {
+static void pyb_adc_check_init(void) {
// not initialized
if (!pyb_adc_obj.enabled) {
mp_raise_OSError(MP_EPERM);
}
}
-STATIC void pyb_adc_channel_init (pyb_adc_channel_obj_t *self) {
+static void pyb_adc_channel_init (pyb_adc_channel_obj_t *self) {
// the ADC block must be enabled first
pyb_adc_check_init();
// configure the pin in analog mode
@@ -116,7 +116,7 @@ STATIC void pyb_adc_channel_init (pyb_adc_channel_obj_t *self) {
self->enabled = true;
}
-STATIC void pyb_adc_deinit_all_channels (void) {
+static void pyb_adc_deinit_all_channels (void) {
for (int i = 0; i < PYB_ADC_NUM_CHANNELS; i++) {
adc_channel_deinit(&pyb_adc_channel_obj[i]);
}
@@ -125,7 +125,7 @@ STATIC void pyb_adc_deinit_all_channels (void) {
/******************************************************************************/
/* MicroPython bindings : adc object */
-STATIC void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_adc_obj_t *self = self_in;
if (self->enabled) {
mp_printf(print, "ADC(0, bits=12)");
@@ -134,11 +134,11 @@ STATIC void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
}
}
-STATIC const mp_arg_t pyb_adc_init_args[] = {
+static const mp_arg_t pyb_adc_init_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_bits, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 12} },
};
-STATIC mp_obj_t adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -165,7 +165,7 @@ STATIC mp_obj_t adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
return self;
}
-STATIC mp_obj_t adc_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t adc_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_adc_init_args) - 1];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &pyb_adc_init_args[1], args);
@@ -176,9 +176,9 @@ STATIC mp_obj_t adc_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
pyb_adc_init(pos_args[0]);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adc_init_obj, 1, adc_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(adc_init_obj, 1, adc_init);
-STATIC mp_obj_t adc_deinit(mp_obj_t self_in) {
+static mp_obj_t adc_deinit(mp_obj_t self_in) {
pyb_adc_obj_t *self = self_in;
// first deinit all channels
pyb_adc_deinit_all_channels();
@@ -188,10 +188,10 @@ STATIC mp_obj_t adc_deinit(mp_obj_t self_in) {
pyb_sleep_remove ((const mp_obj_t)self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_deinit_obj, adc_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_deinit_obj, adc_deinit);
-STATIC mp_obj_t adc_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t pyb_adc_channel_args[] = {
+static mp_obj_t adc_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t pyb_adc_channel_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
};
@@ -223,15 +223,15 @@ STATIC mp_obj_t adc_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
pyb_sleep_add ((const mp_obj_t)self, (WakeUpCB_t)pyb_adc_channel_init);
return self;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adc_channel_obj, 1, adc_channel);
+static MP_DEFINE_CONST_FUN_OBJ_KW(adc_channel_obj, 1, adc_channel);
-STATIC const mp_rom_map_elem_t adc_locals_dict_table[] = {
+static const mp_rom_map_elem_t adc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&adc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&adc_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&adc_channel_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_type,
@@ -242,7 +242,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &adc_locals_dict
);
-STATIC void adc_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void adc_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_adc_channel_obj_t *self = self_in;
if (self->enabled) {
mp_printf(print, "ADCChannel(%u, pin=%q)", self->id, self->pin->name);
@@ -251,15 +251,15 @@ STATIC void adc_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
}
}
-STATIC mp_obj_t adc_channel_init(mp_obj_t self_in) {
+static mp_obj_t adc_channel_init(mp_obj_t self_in) {
pyb_adc_channel_obj_t *self = self_in;
// re-enable it
pyb_adc_channel_init(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_channel_init_obj, adc_channel_init);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_channel_init_obj, adc_channel_init);
-STATIC mp_obj_t adc_channel_deinit(mp_obj_t self_in) {
+static mp_obj_t adc_channel_deinit(mp_obj_t self_in) {
pyb_adc_channel_obj_t *self = self_in;
MAP_ADCChannelDisable(ADC_BASE, self->channel);
@@ -268,9 +268,9 @@ STATIC mp_obj_t adc_channel_deinit(mp_obj_t self_in) {
self->enabled = false;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_channel_deinit_obj, adc_channel_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_channel_deinit_obj, adc_channel_deinit);
-STATIC mp_obj_t adc_channel_value(mp_obj_t self_in) {
+static mp_obj_t adc_channel_value(mp_obj_t self_in) {
pyb_adc_channel_obj_t *self = self_in;
uint32_t value;
@@ -286,22 +286,22 @@ STATIC mp_obj_t adc_channel_value(mp_obj_t self_in) {
// the 12 bit sampled value is stored in bits [13:2]
return MP_OBJ_NEW_SMALL_INT((value & 0x3FFF) >> 2);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_channel_value_obj, adc_channel_value);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_channel_value_obj, adc_channel_value);
-STATIC mp_obj_t adc_channel_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t adc_channel_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
return adc_channel_value (self_in);
}
-STATIC const mp_rom_map_elem_t adc_channel_locals_dict_table[] = {
+static const mp_rom_map_elem_t adc_channel_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&adc_channel_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&adc_channel_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&adc_channel_value_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(adc_channel_locals_dict, adc_channel_locals_dict_table);
+static MP_DEFINE_CONST_DICT(adc_channel_locals_dict, adc_channel_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_channel_type,
MP_QSTR_ADCChannel,
MP_TYPE_FLAG_NONE,
diff --git a/ports/cc3200/mods/pybflash.c b/ports/cc3200/mods/pybflash.c
index 46b7be234f..671b5137e2 100644
--- a/ports/cc3200/mods/pybflash.c
+++ b/ports/cc3200/mods/pybflash.c
@@ -37,9 +37,9 @@
// block protocol.
// there is a singleton Flash object
-STATIC const mp_obj_base_t pyb_flash_obj = {&pyb_flash_type};
+static const mp_obj_base_t pyb_flash_obj = {&pyb_flash_type};
-STATIC mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -47,23 +47,23 @@ STATIC mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, siz
return (mp_obj_t)&pyb_flash_obj;
}
-STATIC mp_obj_t pyb_flash_readblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t pyb_flash_readblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
DRESULT res = sflash_disk_read(bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / SFLASH_SECTOR_SIZE);
return MP_OBJ_NEW_SMALL_INT(res != RES_OK); // return of 0 means success
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_readblocks_obj, pyb_flash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_readblocks_obj, pyb_flash_readblocks);
-STATIC mp_obj_t pyb_flash_writeblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t pyb_flash_writeblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
DRESULT res = sflash_disk_write(bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / SFLASH_SECTOR_SIZE);
return MP_OBJ_NEW_SMALL_INT(res != RES_OK); // return of 0 means success
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_writeblocks_obj, pyb_flash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_writeblocks_obj, pyb_flash_writeblocks);
-STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t pyb_flash_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
mp_int_t cmd = mp_obj_get_int(cmd_in);
switch (cmd) {
case MP_BLOCKDEV_IOCTL_INIT: return MP_OBJ_NEW_SMALL_INT(sflash_disk_init() != RES_OK);
@@ -74,15 +74,15 @@ STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in)
default: return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_ioctl_obj, pyb_flash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_ioctl_obj, pyb_flash_ioctl);
-STATIC const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&pyb_flash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&pyb_flash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&pyb_flash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_flash_type,
diff --git a/ports/cc3200/mods/pybi2c.c b/ports/cc3200/mods/pybi2c.c
index a413eddeb2..0a9e778081 100644
--- a/ports/cc3200/mods/pybi2c.c
+++ b/ports/cc3200/mods/pybi2c.c
@@ -74,18 +74,18 @@ typedef struct _pyb_i2c_obj_t {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC pyb_i2c_obj_t pyb_i2c_obj = {.baudrate = 0};
+static pyb_i2c_obj_t pyb_i2c_obj = {.baudrate = 0};
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC bool pyb_i2c_write(byte addr, byte *data, uint len, bool stop);
+static bool pyb_i2c_write(byte addr, byte *data, uint len, bool stop);
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
// only master mode is available for the moment
-STATIC void i2c_init (pyb_i2c_obj_t *self) {
+static void i2c_init (pyb_i2c_obj_t *self) {
// Enable the I2C Peripheral
MAP_PRCMPeripheralClkEnable(PRCM_I2CA0, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
MAP_PRCMPeripheralReset(PRCM_I2CA0);
@@ -93,7 +93,7 @@ STATIC void i2c_init (pyb_i2c_obj_t *self) {
MAP_I2CMasterInitExpClk(I2CA0_BASE, self->baudrate);
}
-STATIC bool pyb_i2c_transaction(uint cmd) {
+static bool pyb_i2c_transaction(uint cmd) {
// Convert the timeout to microseconds
int32_t timeout = PYBI2C_TRANSC_TIMEOUT_MS * 1000;
// Sanity check, t_timeout must be between 1 and 255
@@ -137,14 +137,14 @@ STATIC bool pyb_i2c_transaction(uint cmd) {
return true;
}
-STATIC void pyb_i2c_check_init(pyb_i2c_obj_t *self) {
+static void pyb_i2c_check_init(pyb_i2c_obj_t *self) {
// not initialized
if (!self->baudrate) {
mp_raise_OSError(MP_EPERM);
}
}
-STATIC bool pyb_i2c_scan_device(byte devAddr) {
+static bool pyb_i2c_scan_device(byte devAddr) {
bool ret = false;
// Set the I2C slave address
MAP_I2CMasterSlaveAddrSet(I2CA0_BASE, devAddr, true);
@@ -163,7 +163,7 @@ STATIC bool pyb_i2c_scan_device(byte devAddr) {
return ret;
}
-STATIC bool pyb_i2c_mem_addr_write (byte addr, byte *mem_addr, uint mem_addr_len) {
+static bool pyb_i2c_mem_addr_write (byte addr, byte *mem_addr, uint mem_addr_len) {
// Set I2C codec slave address
MAP_I2CMasterSlaveAddrSet(I2CA0_BASE, addr, false);
// Write the first byte to the controller.
@@ -181,7 +181,7 @@ STATIC bool pyb_i2c_mem_addr_write (byte addr, byte *mem_addr, uint mem_addr_len
return true;
}
-STATIC bool pyb_i2c_mem_write (byte addr, byte *mem_addr, uint mem_addr_len, byte *data, uint data_len) {
+static bool pyb_i2c_mem_write (byte addr, byte *mem_addr, uint mem_addr_len, byte *data, uint data_len) {
if (pyb_i2c_mem_addr_write (addr, mem_addr, mem_addr_len)) {
// Loop until the completion of transfer or error
while (data_len--) {
@@ -197,7 +197,7 @@ STATIC bool pyb_i2c_mem_write (byte addr, byte *mem_addr, uint mem_addr_len, byt
return false;
}
-STATIC bool pyb_i2c_write(byte addr, byte *data, uint len, bool stop) {
+static bool pyb_i2c_write(byte addr, byte *data, uint len, bool stop) {
// Set I2C codec slave address
MAP_I2CMasterSlaveAddrSet(I2CA0_BASE, addr, false);
// Write the first byte to the controller.
@@ -220,7 +220,7 @@ STATIC bool pyb_i2c_write(byte addr, byte *data, uint len, bool stop) {
return true;
}
-STATIC bool pyb_i2c_read(byte addr, byte *data, uint len) {
+static bool pyb_i2c_read(byte addr, byte *data, uint len) {
// Initiate a burst or single receive sequence
uint cmd = --len > 0 ? I2C_MASTER_CMD_BURST_RECEIVE_START : I2C_MASTER_CMD_SINGLE_RECEIVE;
// Set I2C codec slave address
@@ -245,7 +245,7 @@ STATIC bool pyb_i2c_read(byte addr, byte *data, uint len) {
return true;
}
-STATIC void pyb_i2c_read_into (mp_arg_val_t *args, vstr_t *vstr) {
+static void pyb_i2c_read_into (mp_arg_val_t *args, vstr_t *vstr) {
pyb_i2c_check_init(&pyb_i2c_obj);
// get the buffer to receive into
pyb_buf_get_for_recv(args[1].u_obj, vstr);
@@ -256,7 +256,7 @@ STATIC void pyb_i2c_read_into (mp_arg_val_t *args, vstr_t *vstr) {
}
}
-STATIC void pyb_i2c_readmem_into (mp_arg_val_t *args, vstr_t *vstr) {
+static void pyb_i2c_readmem_into (mp_arg_val_t *args, vstr_t *vstr) {
pyb_i2c_check_init(&pyb_i2c_obj);
// get the buffer to receive into
pyb_buf_get_for_recv(args[2].u_obj, vstr);
@@ -281,7 +281,7 @@ STATIC void pyb_i2c_readmem_into (mp_arg_val_t *args, vstr_t *vstr) {
/******************************************************************************/
/* MicroPython bindings */
/******************************************************************************/
-STATIC void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_i2c_obj_t *self = self_in;
if (self->baudrate > 0) {
mp_printf(print, "I2C(0, baudrate=%u)", self->baudrate);
@@ -290,7 +290,7 @@ STATIC void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
}
}
-STATIC mp_obj_t pyb_i2c_init_helper(pyb_i2c_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_init_helper(pyb_i2c_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_scl, ARG_sda, ARG_freq };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_scl, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -322,7 +322,7 @@ STATIC mp_obj_t pyb_i2c_init_helper(pyb_i2c_obj_t *self, size_t n_args, const mp
return mp_const_none;
}
-STATIC mp_obj_t pyb_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t pyb_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// check the id argument, if given
if (n_args > 0) {
if (all_args[0] != MP_OBJ_NEW_SMALL_INT(0)) {
@@ -346,12 +346,12 @@ STATIC mp_obj_t pyb_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_
return (mp_obj_t)self;
}
-STATIC mp_obj_t pyb_i2c_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return pyb_i2c_init_helper(pos_args[0], n_args - 1, pos_args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_init_obj, 1, pyb_i2c_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_init_obj, 1, pyb_i2c_init);
-STATIC mp_obj_t pyb_i2c_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_i2c_deinit(mp_obj_t self_in) {
// disable the peripheral
MAP_I2CMasterDisable(I2CA0_BASE);
MAP_PRCMPeripheralClkDisable(PRCM_I2CA0, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
@@ -361,9 +361,9 @@ STATIC mp_obj_t pyb_i2c_deinit(mp_obj_t self_in) {
pyb_sleep_remove ((const mp_obj_t)self_in);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_deinit_obj, pyb_i2c_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_deinit_obj, pyb_i2c_deinit);
-STATIC mp_obj_t pyb_i2c_scan(mp_obj_t self_in) {
+static mp_obj_t pyb_i2c_scan(mp_obj_t self_in) {
pyb_i2c_check_init(&pyb_i2c_obj);
mp_obj_t list = mp_obj_new_list(0, NULL);
for (uint addr = 0x08; addr <= 0x77; addr++) {
@@ -376,10 +376,10 @@ STATIC mp_obj_t pyb_i2c_scan(mp_obj_t self_in) {
}
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_scan_obj, pyb_i2c_scan);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_scan_obj, pyb_i2c_scan);
-STATIC mp_obj_t pyb_i2c_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t pyb_i2c_readfrom_args[] = {
+static mp_obj_t pyb_i2c_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t pyb_i2c_readfrom_args[] = {
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_nbytes, MP_ARG_REQUIRED | MP_ARG_OBJ, },
};
@@ -394,10 +394,10 @@ STATIC mp_obj_t pyb_i2c_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map
// return the received data
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_obj, 3, pyb_i2c_readfrom);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_obj, 3, pyb_i2c_readfrom);
-STATIC mp_obj_t pyb_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t pyb_i2c_readfrom_into_args[] = {
+static mp_obj_t pyb_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t pyb_i2c_readfrom_into_args[] = {
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_OBJ, },
};
@@ -412,10 +412,10 @@ STATIC mp_obj_t pyb_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, m
// return the number of bytes received
return mp_obj_new_int(vstr.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_into_obj, 1, pyb_i2c_readfrom_into);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_into_obj, 1, pyb_i2c_readfrom_into);
-STATIC mp_obj_t pyb_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t pyb_i2c_writeto_args[] = {
+static mp_obj_t pyb_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t pyb_i2c_writeto_args[] = {
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_OBJ, },
{ MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
@@ -440,10 +440,10 @@ STATIC mp_obj_t pyb_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_
// return the number of bytes written
return mp_obj_new_int(bufinfo.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_writeto_obj, 1, pyb_i2c_writeto);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_writeto_obj, 1, pyb_i2c_writeto);
-STATIC mp_obj_t pyb_i2c_readfrom_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t pyb_i2c_readfrom_mem_args[] = {
+static mp_obj_t pyb_i2c_readfrom_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t pyb_i2c_readfrom_mem_args[] = {
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_memaddr, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_nbytes, MP_ARG_REQUIRED | MP_ARG_OBJ, },
@@ -458,16 +458,16 @@ STATIC mp_obj_t pyb_i2c_readfrom_mem(size_t n_args, const mp_obj_t *pos_args, mp
pyb_i2c_readmem_into (args, &vstr);
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_mem_obj, 1, pyb_i2c_readfrom_mem);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_mem_obj, 1, pyb_i2c_readfrom_mem);
-STATIC const mp_arg_t pyb_i2c_readfrom_mem_into_args[] = {
+static const mp_arg_t pyb_i2c_readfrom_mem_into_args[] = {
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_memaddr, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_OBJ, },
{ MP_QSTR_addrsize, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 8} },
};
-STATIC mp_obj_t pyb_i2c_readfrom_mem_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_readfrom_mem_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_i2c_readfrom_mem_into_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), pyb_i2c_readfrom_mem_into_args, args);
@@ -477,9 +477,9 @@ STATIC mp_obj_t pyb_i2c_readfrom_mem_into(size_t n_args, const mp_obj_t *pos_arg
pyb_i2c_readmem_into (args, &vstr);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_mem_into_obj, 1, pyb_i2c_readfrom_mem_into);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_mem_into_obj, 1, pyb_i2c_readfrom_mem_into);
-STATIC mp_obj_t pyb_i2c_writeto_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_writeto_mem(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_i2c_readfrom_mem_into_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(pyb_i2c_readfrom_mem_into_args), pyb_i2c_readfrom_mem_into_args, args);
@@ -504,9 +504,9 @@ STATIC mp_obj_t pyb_i2c_writeto_mem(size_t n_args, const mp_obj_t *pos_args, mp_
mp_raise_OSError(MP_EIO);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_writeto_mem_obj, 1, pyb_i2c_writeto_mem);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_writeto_mem_obj, 1, pyb_i2c_writeto_mem);
-STATIC const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_i2c_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_i2c_deinit_obj) },
@@ -519,7 +519,7 @@ STATIC const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_writeto_mem), MP_ROM_PTR(&pyb_i2c_writeto_mem_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_i2c_locals_dict, pyb_i2c_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_i2c_locals_dict, pyb_i2c_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_i2c_type,
diff --git a/ports/cc3200/mods/pybpin.c b/ports/cc3200/mods/pybpin.c
index 6d10abab57..037c78a32c 100644
--- a/ports/cc3200/mods/pybpin.c
+++ b/ports/cc3200/mods/pybpin.c
@@ -53,26 +53,26 @@
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name);
-STATIC pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uint port, uint bit);
-STATIC int8_t pin_obj_find_af (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_t type);
-STATIC void pin_free_af_from_pins (uint8_t fn, uint8_t unit, uint8_t type);
-STATIC void pin_deassign (pin_obj_t* pin);
-STATIC void pin_obj_configure (const pin_obj_t *self);
-STATIC void pin_get_hibernate_pin_and_idx (const pin_obj_t *self, uint *wake_pin, uint *idx);
-STATIC void pin_irq_enable (mp_obj_t self_in);
-STATIC void pin_irq_disable (mp_obj_t self_in);
-STATIC void pin_extint_register(pin_obj_t *self, uint32_t intmode, uint32_t priority);
-STATIC void pin_validate_mode (uint mode);
-STATIC void pin_validate_pull (uint pull);
-STATIC void pin_validate_drive (uint strength);
-STATIC void pin_validate_af(const pin_obj_t* pin, int8_t idx, uint8_t *fn, uint8_t *unit, uint8_t *type);
-STATIC uint8_t pin_get_value(const pin_obj_t* self);
-STATIC void GPIOA0IntHandler (void);
-STATIC void GPIOA1IntHandler (void);
-STATIC void GPIOA2IntHandler (void);
-STATIC void GPIOA3IntHandler (void);
-STATIC void EXTI_Handler(uint port);
+static pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name);
+static pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uint port, uint bit);
+static int8_t pin_obj_find_af (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_t type);
+static void pin_free_af_from_pins (uint8_t fn, uint8_t unit, uint8_t type);
+static void pin_deassign (pin_obj_t* pin);
+static void pin_obj_configure (const pin_obj_t *self);
+static void pin_get_hibernate_pin_and_idx (const pin_obj_t *self, uint *wake_pin, uint *idx);
+static void pin_irq_enable (mp_obj_t self_in);
+static void pin_irq_disable (mp_obj_t self_in);
+static void pin_extint_register(pin_obj_t *self, uint32_t intmode, uint32_t priority);
+static void pin_validate_mode (uint mode);
+static void pin_validate_pull (uint pull);
+static void pin_validate_drive (uint strength);
+static void pin_validate_af(const pin_obj_t* pin, int8_t idx, uint8_t *fn, uint8_t *unit, uint8_t *type);
+static uint8_t pin_get_value(const pin_obj_t* self);
+static void GPIOA0IntHandler (void);
+static void GPIOA1IntHandler (void);
+static void GPIOA2IntHandler (void);
+static void GPIOA3IntHandler (void);
+static void EXTI_Handler(uint port);
/******************************************************************************
DEFINE CONSTANTS
@@ -100,8 +100,8 @@ typedef struct {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC const mp_irq_methods_t pin_irq_methods;
-STATIC pybpin_wake_pin_t pybpin_wake_pin[PYBPIN_NUM_WAKE_PINS] =
+static const mp_irq_methods_t pin_irq_methods;
+static pybpin_wake_pin_t pybpin_wake_pin[PYBPIN_NUM_WAKE_PINS] =
{ {.active = false, .lpds = PYBPIN_WAKES_NOT, .hib = PYBPIN_WAKES_NOT},
{.active = false, .lpds = PYBPIN_WAKES_NOT, .hib = PYBPIN_WAKES_NOT},
{.active = false, .lpds = PYBPIN_WAKES_NOT, .hib = PYBPIN_WAKES_NOT},
@@ -205,7 +205,7 @@ int8_t pin_find_af_index (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name) {
+static pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name) {
const mp_map_t *named_map = &named_pins->map;
mp_map_elem_t *named_elem = mp_map_lookup((mp_map_t*)named_map, name, MP_MAP_LOOKUP);
if (named_elem != NULL && named_elem->value != NULL) {
@@ -214,7 +214,7 @@ STATIC pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t n
return NULL;
}
-STATIC pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uint port, uint bit) {
+static pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uint port, uint bit) {
const mp_map_t *named_map = &named_pins->map;
for (uint i = 0; i < named_map->used; i++) {
if ((((pin_obj_t *)named_map->table[i].value)->port == port) &&
@@ -225,7 +225,7 @@ STATIC pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uin
return NULL;
}
-STATIC int8_t pin_obj_find_af (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_t type) {
+static int8_t pin_obj_find_af (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_t type) {
for (int i = 0; i < pin->num_afs; i++) {
if (pin->af_list[i].fn == fn && pin->af_list[i].unit == unit && pin->af_list[i].type == type) {
return pin->af_list[i].idx;
@@ -234,7 +234,7 @@ STATIC int8_t pin_obj_find_af (const pin_obj_t* pin, uint8_t fn, uint8_t unit, u
return -1;
}
-STATIC void pin_free_af_from_pins (uint8_t fn, uint8_t unit, uint8_t type) {
+static void pin_free_af_from_pins (uint8_t fn, uint8_t unit, uint8_t type) {
const mp_map_t *named_map = &pin_board_pins_locals_dict.map;
for (uint i = 0; i < named_map->used - 1; i++) {
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
@@ -250,12 +250,12 @@ STATIC void pin_free_af_from_pins (uint8_t fn, uint8_t unit, uint8_t type) {
}
}
-STATIC void pin_deassign (pin_obj_t* pin) {
+static void pin_deassign (pin_obj_t* pin) {
pin_config (pin, PIN_MODE_0, GPIO_DIR_MODE_IN, PIN_TYPE_STD, -1, PIN_STRENGTH_4MA);
pin->used = false;
}
-STATIC void pin_obj_configure (const pin_obj_t *self) {
+static void pin_obj_configure (const pin_obj_t *self) {
uint32_t type;
if (self->mode == PIN_TYPE_ANALOG) {
type = PIN_TYPE_ANALOG;
@@ -299,7 +299,7 @@ STATIC void pin_obj_configure (const pin_obj_t *self) {
MAP_PinConfigSet(self->pin_num, self->strength, type);
}
-STATIC void pin_get_hibernate_pin_and_idx (const pin_obj_t *self, uint *hib_pin, uint *idx) {
+static void pin_get_hibernate_pin_and_idx (const pin_obj_t *self, uint *hib_pin, uint *idx) {
// pin_num is actually : (package_pin - 1)
switch (self->pin_num) {
case 56: // GP2
@@ -332,7 +332,7 @@ STATIC void pin_get_hibernate_pin_and_idx (const pin_obj_t *self, uint *hib_pin,
}
}
-STATIC void pin_irq_enable (mp_obj_t self_in) {
+static void pin_irq_enable (mp_obj_t self_in) {
const pin_obj_t *self = self_in;
uint hib_pin, idx;
@@ -364,7 +364,7 @@ STATIC void pin_irq_enable (mp_obj_t self_in) {
}
}
-STATIC void pin_irq_disable (mp_obj_t self_in) {
+static void pin_irq_disable (mp_obj_t self_in) {
const pin_obj_t *self = self_in;
uint hib_pin, idx;
@@ -383,12 +383,12 @@ STATIC void pin_irq_disable (mp_obj_t self_in) {
MAP_GPIOIntDisable(self->port, self->bit);
}
-STATIC int pin_irq_flags (mp_obj_t self_in) {
+static int pin_irq_flags (mp_obj_t self_in) {
const pin_obj_t *self = self_in;
return self->irq_flags;
}
-STATIC void pin_extint_register(pin_obj_t *self, uint32_t intmode, uint32_t priority) {
+static void pin_extint_register(pin_obj_t *self, uint32_t intmode, uint32_t priority) {
void *handler;
uint32_t intnum;
@@ -419,25 +419,25 @@ STATIC void pin_extint_register(pin_obj_t *self, uint32_t intmode, uint32_t prio
MAP_IntPrioritySet(intnum, priority);
}
-STATIC void pin_validate_mode (uint mode) {
+static void pin_validate_mode (uint mode) {
if (mode != GPIO_DIR_MODE_IN && mode != GPIO_DIR_MODE_OUT && mode != PIN_TYPE_OD &&
mode != GPIO_DIR_MODE_ALT && mode != GPIO_DIR_MODE_ALT_OD) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
-STATIC void pin_validate_pull (uint pull) {
+static void pin_validate_pull (uint pull) {
if (pull != PIN_TYPE_STD && pull != PIN_TYPE_STD_PU && pull != PIN_TYPE_STD_PD) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
-STATIC void pin_validate_drive(uint strength) {
+static void pin_validate_drive(uint strength) {
if (strength != PIN_STRENGTH_2MA && strength != PIN_STRENGTH_4MA && strength != PIN_STRENGTH_6MA) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
-STATIC void pin_validate_af(const pin_obj_t* pin, int8_t idx, uint8_t *fn, uint8_t *unit, uint8_t *type) {
+static void pin_validate_af(const pin_obj_t* pin, int8_t idx, uint8_t *fn, uint8_t *unit, uint8_t *type) {
for (int i = 0; i < pin->num_afs; i++) {
if (pin->af_list[i].idx == idx) {
*fn = pin->af_list[i].fn;
@@ -449,7 +449,7 @@ STATIC void pin_validate_af(const pin_obj_t* pin, int8_t idx, uint8_t *fn, uint8
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC uint8_t pin_get_value (const pin_obj_t* self) {
+static uint8_t pin_get_value (const pin_obj_t* self) {
uint32_t value;
bool setdir = false;
if (self->mode == PIN_TYPE_OD || self->mode == GPIO_DIR_MODE_ALT_OD) {
@@ -472,24 +472,24 @@ STATIC uint8_t pin_get_value (const pin_obj_t* self) {
return value ? 1 : 0;
}
-STATIC void GPIOA0IntHandler (void) {
+static void GPIOA0IntHandler (void) {
EXTI_Handler(GPIOA0_BASE);
}
-STATIC void GPIOA1IntHandler (void) {
+static void GPIOA1IntHandler (void) {
EXTI_Handler(GPIOA1_BASE);
}
-STATIC void GPIOA2IntHandler (void) {
+static void GPIOA2IntHandler (void) {
EXTI_Handler(GPIOA2_BASE);
}
-STATIC void GPIOA3IntHandler (void) {
+static void GPIOA3IntHandler (void) {
EXTI_Handler(GPIOA3_BASE);
}
// common interrupt handler
-STATIC void EXTI_Handler(uint port) {
+static void EXTI_Handler(uint port) {
uint32_t bits = MAP_GPIOIntStatus(port, true);
MAP_GPIOIntClear(port, bits);
@@ -517,7 +517,7 @@ STATIC void EXTI_Handler(uint port) {
/******************************************************************************/
// MicroPython bindings
-STATIC const mp_arg_t pin_init_args[] = {
+static const mp_arg_t pin_init_args[] = {
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_pull, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_value, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -526,7 +526,7 @@ STATIC const mp_arg_t pin_init_args[] = {
};
#define pin_INIT_NUM_ARGS MP_ARRAY_SIZE(pin_init_args)
-STATIC mp_obj_t pin_obj_init_helper(pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pin_obj_init_helper(pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[pin_INIT_NUM_ARGS];
mp_arg_parse_all(n_args, pos_args, kw_args, pin_INIT_NUM_ARGS, pin_init_args, args);
@@ -590,7 +590,7 @@ invalid_args:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pin_obj_t *self = self_in;
uint32_t pull = self->pull;
uint32_t drive = self->strength;
@@ -643,7 +643,7 @@ STATIC void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
mp_printf(print, ", alt=%d)", alt);
}
-STATIC mp_obj_t pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// Run an argument through the mapper and return the result.
@@ -656,12 +656,12 @@ STATIC mp_obj_t pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
return (mp_obj_t)pin;
}
-STATIC mp_obj_t pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(pin_init_obj, 1, pin_obj_init);
-STATIC mp_obj_t pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_value(size_t n_args, const mp_obj_t *args) {
pin_obj_t *self = args[0];
if (n_args == 1) {
// get the value
@@ -678,15 +678,15 @@ STATIC mp_obj_t pin_value(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_value_obj, 1, 2, pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_value_obj, 1, 2, pin_value);
-STATIC mp_obj_t pin_id(mp_obj_t self_in) {
+static mp_obj_t pin_id(mp_obj_t self_in) {
pin_obj_t *self = self_in;
return MP_OBJ_NEW_QSTR(self->name);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_id_obj, pin_id);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_id_obj, pin_id);
-STATIC mp_obj_t pin_mode(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_mode(size_t n_args, const mp_obj_t *args) {
pin_obj_t *self = args[0];
if (n_args == 1) {
return mp_obj_new_int(self->mode);
@@ -698,9 +698,9 @@ STATIC mp_obj_t pin_mode(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_mode_obj, 1, 2, pin_mode);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_mode_obj, 1, 2, pin_mode);
-STATIC mp_obj_t pin_pull(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_pull(size_t n_args, const mp_obj_t *args) {
pin_obj_t *self = args[0];
if (n_args == 1) {
if (self->pull == PIN_TYPE_STD) {
@@ -720,9 +720,9 @@ STATIC mp_obj_t pin_pull(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_pull_obj, 1, 2, pin_pull);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_pull_obj, 1, 2, pin_pull);
-STATIC mp_obj_t pin_drive(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_drive(size_t n_args, const mp_obj_t *args) {
pin_obj_t *self = args[0];
if (n_args == 1) {
return mp_obj_new_int(self->strength);
@@ -734,15 +734,15 @@ STATIC mp_obj_t pin_drive(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_drive_obj, 1, 2, pin_drive);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_drive_obj, 1, 2, pin_drive);
-STATIC mp_obj_t pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_t _args[2] = {self_in, *args};
return pin_value (n_args + 1, _args);
}
-STATIC mp_obj_t pin_alt_list(mp_obj_t self_in) {
+static mp_obj_t pin_alt_list(mp_obj_t self_in) {
pin_obj_t *self = self_in;
mp_obj_t af[2];
mp_obj_t afs = mp_obj_new_list(0, NULL);
@@ -754,10 +754,10 @@ STATIC mp_obj_t pin_alt_list(mp_obj_t self_in) {
}
return afs;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_alt_list_obj, pin_alt_list);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_alt_list_obj, pin_alt_list);
/// \method irq(trigger, priority, handler, wake)
-STATIC mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_val_t args[mp_irq_INIT_NUM_ARGS];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, mp_irq_INIT_NUM_ARGS, mp_irq_init_args, args);
pin_obj_t *self = pos_args[0];
@@ -896,9 +896,9 @@ STATIC mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
invalid_args:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pin_irq_obj, 1, pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pin_irq_obj, 1, pin_irq);
-STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pin_value_obj) },
@@ -929,7 +929,7 @@ STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_HIGH_LEVEL), MP_ROM_INT(PYB_PIN_HIGH_LEVEL) },
};
-STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pin_type,
@@ -941,14 +941,14 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &pin_locals_dict
);
-STATIC const mp_irq_methods_t pin_irq_methods = {
+static const mp_irq_methods_t pin_irq_methods = {
.init = pin_irq,
.enable = pin_irq_enable,
.disable = pin_irq_disable,
.flags = pin_irq_flags,
};
-STATIC void pin_named_pins_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pin_named_pins_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pin_named_pins_obj_t *self = self_in;
mp_printf(print, "<Pin.%q>", self->name);
}
diff --git a/ports/cc3200/mods/pybrtc.c b/ports/cc3200/mods/pybrtc.c
index 340e86e158..243fe99931 100644
--- a/ports/cc3200/mods/pybrtc.c
+++ b/ports/cc3200/mods/pybrtc.c
@@ -48,8 +48,8 @@
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC const mp_irq_methods_t pyb_rtc_irq_methods;
-STATIC pyb_rtc_obj_t pyb_rtc_obj;
+static const mp_irq_methods_t pyb_rtc_irq_methods;
+static pyb_rtc_obj_t pyb_rtc_obj;
/******************************************************************************
FUNCTION-LIKE MACROS
@@ -60,16 +60,16 @@ STATIC pyb_rtc_obj_t pyb_rtc_obj;
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void pyb_rtc_set_time (uint32_t secs, uint16_t msecs);
-STATIC uint32_t pyb_rtc_reset (void);
-STATIC void pyb_rtc_disable_interupt (void);
-STATIC void pyb_rtc_irq_enable (mp_obj_t self_in);
-STATIC void pyb_rtc_irq_disable (mp_obj_t self_in);
-STATIC int pyb_rtc_irq_flags (mp_obj_t self_in);
-STATIC uint pyb_rtc_datetime_s_us(const mp_obj_t datetime, uint32_t *seconds);
-STATIC mp_obj_t pyb_rtc_datetime(mp_obj_t self, const mp_obj_t datetime);
-STATIC void pyb_rtc_set_alarm (pyb_rtc_obj_t *self, uint32_t seconds, uint16_t mseconds);
-STATIC void rtc_msec_add(uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2);
+static void pyb_rtc_set_time (uint32_t secs, uint16_t msecs);
+static uint32_t pyb_rtc_reset (void);
+static void pyb_rtc_disable_interupt (void);
+static void pyb_rtc_irq_enable (mp_obj_t self_in);
+static void pyb_rtc_irq_disable (mp_obj_t self_in);
+static int pyb_rtc_irq_flags (mp_obj_t self_in);
+static uint pyb_rtc_datetime_s_us(const mp_obj_t datetime, uint32_t *seconds);
+static mp_obj_t pyb_rtc_datetime(mp_obj_t self, const mp_obj_t datetime);
+static void pyb_rtc_set_alarm (pyb_rtc_obj_t *self, uint32_t seconds, uint16_t mseconds);
+static void rtc_msec_add(uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2);
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
@@ -137,7 +137,7 @@ void pyb_rtc_disable_alarm (void) {
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void pyb_rtc_set_time (uint32_t secs, uint16_t msecs) {
+static void pyb_rtc_set_time (uint32_t secs, uint16_t msecs) {
// add the RTC access time
rtc_msec_add(RTC_ACCESS_TIME_MSEC, &secs, &msecs);
// convert from mseconds to cycles
@@ -146,7 +146,7 @@ STATIC void pyb_rtc_set_time (uint32_t secs, uint16_t msecs) {
MAP_PRCMRTCSet(secs, msecs);
}
-STATIC uint32_t pyb_rtc_reset (void) {
+static uint32_t pyb_rtc_reset (void) {
// fresh reset; configure the RTC Calendar
// set the date to 1st Jan 2015
// set the time to 00:00:00
@@ -158,14 +158,14 @@ STATIC uint32_t pyb_rtc_reset (void) {
return seconds;
}
-STATIC void pyb_rtc_disable_interupt (void) {
+static void pyb_rtc_disable_interupt (void) {
uint primsk = disable_irq();
MAP_PRCMIntDisable(PRCM_INT_SLOW_CLK_CTR);
(void)MAP_PRCMIntStatus();
enable_irq(primsk);
}
-STATIC void pyb_rtc_irq_enable (mp_obj_t self_in) {
+static void pyb_rtc_irq_enable (mp_obj_t self_in) {
pyb_rtc_obj_t *self = self_in;
// we always need interrupts if repeat is enabled
if ((self->pwrmode & PYB_PWR_MODE_ACTIVE) || self->repeat) {
@@ -176,7 +176,7 @@ STATIC void pyb_rtc_irq_enable (mp_obj_t self_in) {
self->irq_enabled = true;
}
-STATIC void pyb_rtc_irq_disable (mp_obj_t self_in) {
+static void pyb_rtc_irq_disable (mp_obj_t self_in) {
pyb_rtc_obj_t *self = self_in;
self->irq_enabled = false;
if (!self->repeat) { // we always need interrupts if repeat is enabled
@@ -184,12 +184,12 @@ STATIC void pyb_rtc_irq_disable (mp_obj_t self_in) {
}
}
-STATIC int pyb_rtc_irq_flags (mp_obj_t self_in) {
+static int pyb_rtc_irq_flags (mp_obj_t self_in) {
pyb_rtc_obj_t *self = self_in;
return self->irq_flags;
}
-STATIC uint pyb_rtc_datetime_s_us(const mp_obj_t datetime, uint32_t *seconds) {
+static uint pyb_rtc_datetime_s_us(const mp_obj_t datetime, uint32_t *seconds) {
timeutils_struct_time_t tm;
uint32_t useconds;
@@ -234,7 +234,7 @@ STATIC uint pyb_rtc_datetime_s_us(const mp_obj_t datetime, uint32_t *seconds) {
///
/// (year, month, day, hours, minutes, seconds, milliseconds, tzinfo=None)
///
-STATIC mp_obj_t pyb_rtc_datetime(mp_obj_t self_in, const mp_obj_t datetime) {
+static mp_obj_t pyb_rtc_datetime(mp_obj_t self_in, const mp_obj_t datetime) {
uint32_t seconds;
uint32_t useconds;
@@ -250,7 +250,7 @@ STATIC mp_obj_t pyb_rtc_datetime(mp_obj_t self_in, const mp_obj_t datetime) {
return mp_const_none;
}
-STATIC void pyb_rtc_set_alarm (pyb_rtc_obj_t *self, uint32_t seconds, uint16_t mseconds) {
+static void pyb_rtc_set_alarm (pyb_rtc_obj_t *self, uint32_t seconds, uint16_t mseconds) {
// disable the interrupt before updating anything
if (self->irq_enabled) {
MAP_PRCMIntDisable(PRCM_INT_SLOW_CLK_CTR);
@@ -266,7 +266,7 @@ STATIC void pyb_rtc_set_alarm (pyb_rtc_obj_t *self, uint32_t seconds, uint16_t m
}
}
-STATIC void rtc_msec_add (uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2) {
+static void rtc_msec_add (uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2) {
if (msecs_1 + *msecs_2 >= 1000) { // larger than one second
*msecs_2 = (msecs_1 + *msecs_2) - 1000;
*secs += 1; // carry flag
@@ -279,11 +279,11 @@ STATIC void rtc_msec_add (uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2) {
/******************************************************************************/
// MicroPython bindings
-STATIC const mp_arg_t pyb_rtc_init_args[] = {
+static const mp_arg_t pyb_rtc_init_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_datetime, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
};
-STATIC mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -309,15 +309,15 @@ STATIC mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_
return (mp_obj_t)&pyb_rtc_obj;
}
-STATIC mp_obj_t pyb_rtc_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_rtc_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_rtc_init_args) - 1];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &pyb_rtc_init_args[1], args);
return pyb_rtc_datetime(pos_args[0], args[0].u_obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_init_obj, 1, pyb_rtc_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_init_obj, 1, pyb_rtc_init);
-STATIC mp_obj_t pyb_rtc_now (mp_obj_t self_in) {
+static mp_obj_t pyb_rtc_now (mp_obj_t self_in) {
timeutils_struct_time_t tm;
uint32_t seconds;
uint16_t mseconds;
@@ -338,16 +338,16 @@ STATIC mp_obj_t pyb_rtc_now (mp_obj_t self_in) {
};
return mp_obj_new_tuple(8, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_rtc_now_obj, pyb_rtc_now);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_rtc_now_obj, pyb_rtc_now);
-STATIC mp_obj_t pyb_rtc_deinit (mp_obj_t self_in) {
+static mp_obj_t pyb_rtc_deinit (mp_obj_t self_in) {
pyb_rtc_reset();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_rtc_deinit_obj, pyb_rtc_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_rtc_deinit_obj, pyb_rtc_deinit);
-STATIC mp_obj_t pyb_rtc_alarm(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t allowed_args[] = {
+static mp_obj_t pyb_rtc_alarm(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_time, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_repeat, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
@@ -385,9 +385,9 @@ STATIC mp_obj_t pyb_rtc_alarm(size_t n_args, const mp_obj_t *pos_args, mp_map_t
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_alarm_obj, 1, pyb_rtc_alarm);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_alarm_obj, 1, pyb_rtc_alarm);
-STATIC mp_obj_t pyb_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
pyb_rtc_obj_t *self = args[0];
int32_t ms_left;
uint32_t c_seconds;
@@ -408,9 +408,9 @@ STATIC mp_obj_t pyb_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_int(ms_left);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_alarm_left_obj, 1, 2, pyb_rtc_alarm_left);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_alarm_left_obj, 1, 2, pyb_rtc_alarm_left);
-STATIC mp_obj_t pyb_rtc_alarm_cancel(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_rtc_alarm_cancel(size_t n_args, const mp_obj_t *args) {
// only alarm id 0 is available
if (n_args > 1 && mp_obj_get_int(args[1]) != 0) {
mp_raise_OSError(MP_ENODEV);
@@ -419,10 +419,10 @@ STATIC mp_obj_t pyb_rtc_alarm_cancel(size_t n_args, const mp_obj_t *args) {
pyb_rtc_disable_alarm();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_alarm_cancel_obj, 1, 2, pyb_rtc_alarm_cancel);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_alarm_cancel_obj, 1, 2, pyb_rtc_alarm_cancel);
/// \method irq(trigger, priority, handler, wake)
-STATIC mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_val_t args[mp_irq_INIT_NUM_ARGS];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, mp_irq_INIT_NUM_ARGS, mp_irq_init_args, args);
pyb_rtc_obj_t *self = pos_args[0];
@@ -453,9 +453,9 @@ STATIC mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
invalid_args:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_irq_obj, 1, pyb_rtc_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_irq_obj, 1, pyb_rtc_irq);
-STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_rtc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_rtc_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_now), MP_ROM_PTR(&pyb_rtc_now_obj) },
@@ -467,7 +467,7 @@ STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
// class constants
{ MP_ROM_QSTR(MP_QSTR_ALARM0), MP_ROM_INT(PYB_RTC_ALARM0) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_rtc_type,
@@ -477,7 +477,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &pyb_rtc_locals_dict
);
-STATIC const mp_irq_methods_t pyb_rtc_irq_methods = {
+static const mp_irq_methods_t pyb_rtc_irq_methods = {
.init = pyb_rtc_irq,
.enable = pyb_rtc_irq_enable,
.disable = pyb_rtc_irq_disable,
diff --git a/ports/cc3200/mods/pybsd.c b/ports/cc3200/mods/pybsd.c
index 952a117c45..98972ce3a5 100644
--- a/ports/cc3200/mods/pybsd.c
+++ b/ports/cc3200/mods/pybsd.c
@@ -59,20 +59,20 @@ pybsd_obj_t pybsd_obj;
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC const mp_obj_t pyb_sd_def_pin[3] = {&pin_GP10, &pin_GP11, &pin_GP15};
+static const mp_obj_t pyb_sd_def_pin[3] = {&pin_GP10, &pin_GP11, &pin_GP15};
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void pyb_sd_hw_init (pybsd_obj_t *self);
-STATIC mp_obj_t pyb_sd_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
-STATIC mp_obj_t pyb_sd_deinit (mp_obj_t self_in);
+static void pyb_sd_hw_init (pybsd_obj_t *self);
+static mp_obj_t pyb_sd_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
+static mp_obj_t pyb_sd_deinit (mp_obj_t self_in);
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
/// Initializes the sd card hardware driver
-STATIC void pyb_sd_hw_init (pybsd_obj_t *self) {
+static void pyb_sd_hw_init (pybsd_obj_t *self) {
if (self->pin_clk) {
// Configure the clock pin as output only
MAP_PinDirModeSet(((pin_obj_t *)(self->pin_clk))->pin_num, PIN_DIR_MODE_OUT);
@@ -90,7 +90,7 @@ STATIC void pyb_sd_hw_init (pybsd_obj_t *self) {
self->enabled = true;
}
-STATIC mp_obj_t pyb_sd_init_helper (pybsd_obj_t *self, const mp_arg_val_t *args) {
+static mp_obj_t pyb_sd_init_helper (pybsd_obj_t *self, const mp_arg_val_t *args) {
// assign the pins
mp_obj_t pins_o = args[0].u_obj;
if (pins_o != mp_const_none) {
@@ -120,11 +120,11 @@ STATIC mp_obj_t pyb_sd_init_helper (pybsd_obj_t *self, const mp_arg_val_t *args)
// MicroPython bindings
//
-STATIC const mp_arg_t pyb_sd_init_args[] = {
+static const mp_arg_t pyb_sd_init_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_pins, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
};
-STATIC mp_obj_t pyb_sd_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t pyb_sd_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -143,15 +143,15 @@ STATIC mp_obj_t pyb_sd_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return self;
}
-STATIC mp_obj_t pyb_sd_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_sd_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_sd_init_args) - 1];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &pyb_sd_init_args[1], args);
return pyb_sd_init_helper(pos_args[0], args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_sd_init_obj, 1, pyb_sd_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_sd_init_obj, 1, pyb_sd_init);
-STATIC mp_obj_t pyb_sd_deinit (mp_obj_t self_in) {
+static mp_obj_t pyb_sd_deinit (mp_obj_t self_in) {
pybsd_obj_t *self = self_in;
// disable the peripheral
self->enabled = false;
@@ -162,25 +162,25 @@ STATIC mp_obj_t pyb_sd_deinit (mp_obj_t self_in) {
pyb_sleep_remove (self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_sd_deinit_obj, pyb_sd_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_sd_deinit_obj, pyb_sd_deinit);
-STATIC mp_obj_t pyb_sd_readblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t pyb_sd_readblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
DRESULT res = sd_disk_read(bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / SD_SECTOR_SIZE);
return MP_OBJ_NEW_SMALL_INT(res != RES_OK); // return of 0 means success
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_sd_readblocks_obj, pyb_sd_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_sd_readblocks_obj, pyb_sd_readblocks);
-STATIC mp_obj_t pyb_sd_writeblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t pyb_sd_writeblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
DRESULT res = sd_disk_write(bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / SD_SECTOR_SIZE);
return MP_OBJ_NEW_SMALL_INT(res != RES_OK); // return of 0 means success
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_sd_writeblocks_obj, pyb_sd_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_sd_writeblocks_obj, pyb_sd_writeblocks);
-STATIC mp_obj_t pyb_sd_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t pyb_sd_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
mp_int_t cmd = mp_obj_get_int(cmd_in);
switch (cmd) {
case MP_BLOCKDEV_IOCTL_INIT:
@@ -199,9 +199,9 @@ STATIC mp_obj_t pyb_sd_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
return MP_OBJ_NEW_SMALL_INT(-1); // error
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_sd_ioctl_obj, pyb_sd_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_sd_ioctl_obj, pyb_sd_ioctl);
-STATIC const mp_rom_map_elem_t pyb_sd_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_sd_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_sd_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_sd_deinit_obj) },
// block device protocol
@@ -210,7 +210,7 @@ STATIC const mp_rom_map_elem_t pyb_sd_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&pyb_sd_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_sd_locals_dict, pyb_sd_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_sd_locals_dict, pyb_sd_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_sd_type,
diff --git a/ports/cc3200/mods/pybsleep.c b/ports/cc3200/mods/pybsleep.c
index ea2642c260..9d04dd411d 100644
--- a/ports/cc3200/mods/pybsleep.c
+++ b/ports/cc3200/mods/pybsleep.c
@@ -120,12 +120,12 @@ typedef struct {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC nvic_reg_store_t *nvic_reg_store;
-STATIC pybsleep_data_t pybsleep_data = {NULL, NULL, NULL};
+static nvic_reg_store_t *nvic_reg_store;
+static pybsleep_data_t pybsleep_data = {NULL, NULL, NULL};
volatile arm_cm4_core_regs_t vault_arm_registers;
-STATIC pybsleep_reset_cause_t pybsleep_reset_cause = PYB_SLP_PWRON_RESET;
-STATIC pybsleep_wake_reason_t pybsleep_wake_reason = PYB_SLP_WAKED_PWRON;
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static pybsleep_reset_cause_t pybsleep_reset_cause = PYB_SLP_PWRON_RESET;
+static pybsleep_wake_reason_t pybsleep_wake_reason = PYB_SLP_WAKED_PWRON;
+static MP_DEFINE_CONST_OBJ_TYPE(
pyb_sleep_type,
MP_QSTR_sleep,
MP_TYPE_FLAG_NONE
@@ -134,15 +134,15 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC pyb_sleep_obj_t *pyb_sleep_find (mp_obj_t obj);
-STATIC void pyb_sleep_flash_powerdown (void);
-STATIC NORETURN void pyb_sleep_suspend_enter (void);
+static pyb_sleep_obj_t *pyb_sleep_find (mp_obj_t obj);
+static void pyb_sleep_flash_powerdown (void);
+static NORETURN void pyb_sleep_suspend_enter (void);
void pyb_sleep_suspend_exit (void);
-STATIC void pyb_sleep_obj_wakeup (void);
-STATIC void PRCMInterruptHandler (void);
-STATIC void pyb_sleep_iopark (bool hibernate);
-STATIC bool setup_timer_lpds_wake (void);
-STATIC bool setup_timer_hibernate_wake (void);
+static void pyb_sleep_obj_wakeup (void);
+static void PRCMInterruptHandler (void);
+static void pyb_sleep_iopark (bool hibernate);
+static bool setup_timer_lpds_wake (void);
+static bool setup_timer_hibernate_wake (void);
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
@@ -304,7 +304,7 @@ pybsleep_wake_reason_t pyb_sleep_get_wake_reason (void) {
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC pyb_sleep_obj_t *pyb_sleep_find (mp_obj_t obj) {
+static pyb_sleep_obj_t *pyb_sleep_find (mp_obj_t obj) {
for (mp_uint_t i = 0; i < MP_STATE_PORT(pyb_sleep_obj_list).len; i++) {
// search for the object and then remove it
pyb_sleep_obj_t *sleep_obj = ((pyb_sleep_obj_t *)(MP_STATE_PORT(pyb_sleep_obj_list).items[i]));
@@ -315,7 +315,7 @@ STATIC pyb_sleep_obj_t *pyb_sleep_find (mp_obj_t obj) {
return NULL;
}
-STATIC void pyb_sleep_flash_powerdown (void) {
+static void pyb_sleep_flash_powerdown (void) {
uint32_t status;
// Enable clock for SSPI module
@@ -360,7 +360,7 @@ STATIC void pyb_sleep_flash_powerdown (void) {
MAP_SPICSDisable(SSPI_BASE);
}
-STATIC NORETURN void pyb_sleep_suspend_enter (void) {
+static NORETURN void pyb_sleep_suspend_enter (void) {
// enable full RAM retention
MAP_PRCMSRAMRetentionEnable(PRCM_SRAM_COL_1 | PRCM_SRAM_COL_2 | PRCM_SRAM_COL_3 | PRCM_SRAM_COL_4, PRCM_SRAM_LPDS_RET);
@@ -479,7 +479,7 @@ void pyb_sleep_suspend_exit (void) {
mp_raise_type(&mp_type_SystemExit);
}
-STATIC void PRCMInterruptHandler (void) {
+static void PRCMInterruptHandler (void) {
// reading the interrupt status automatically clears the interrupt
if (PRCM_INT_SLOW_CLK_CTR == MAP_PRCMIntStatus()) {
// reconfigure it again (if repeat is true)
@@ -519,14 +519,14 @@ STATIC void PRCMInterruptHandler (void) {
}
}
-STATIC void pyb_sleep_obj_wakeup (void) {
+static void pyb_sleep_obj_wakeup (void) {
for (mp_uint_t i = 0; i < MP_STATE_PORT(pyb_sleep_obj_list).len; i++) {
pyb_sleep_obj_t *sleep_obj = ((pyb_sleep_obj_t *)MP_STATE_PORT(pyb_sleep_obj_list).items[i]);
sleep_obj->wakeup(sleep_obj->obj);
}
}
-STATIC void pyb_sleep_iopark (bool hibernate) {
+static void pyb_sleep_iopark (bool hibernate) {
const mp_map_t *named_map = &pin_board_pins_locals_dict.map;
for (uint i = 0; i < named_map->used; i++) {
pin_obj_t * pin = (pin_obj_t *)named_map->table[i].value;
@@ -583,7 +583,7 @@ STATIC void pyb_sleep_iopark (bool hibernate) {
#endif
}
-STATIC bool setup_timer_lpds_wake (void) {
+static bool setup_timer_lpds_wake (void) {
uint64_t t_match, t_curr;
int64_t t_remaining;
@@ -618,7 +618,7 @@ STATIC bool setup_timer_lpds_wake (void) {
return false;
}
-STATIC bool setup_timer_hibernate_wake (void) {
+static bool setup_timer_hibernate_wake (void) {
uint64_t t_match, t_curr;
int64_t t_remaining;
diff --git a/ports/cc3200/mods/pybspi.c b/ports/cc3200/mods/pybspi.c
index fa38f0c657..e49bb14b47 100644
--- a/ports/cc3200/mods/pybspi.c
+++ b/ports/cc3200/mods/pybspi.c
@@ -68,15 +68,15 @@ typedef struct _pyb_spi_obj_t {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC pyb_spi_obj_t pyb_spi_obj = {.baudrate = 0};
+static pyb_spi_obj_t pyb_spi_obj = {.baudrate = 0};
-STATIC const mp_obj_t pyb_spi_def_pin[3] = {&pin_GP14, &pin_GP16, &pin_GP30};
+static const mp_obj_t pyb_spi_def_pin[3] = {&pin_GP14, &pin_GP16, &pin_GP30};
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
// only master mode is available for the moment
-STATIC void pybspi_init (const pyb_spi_obj_t *self) {
+static void pybspi_init (const pyb_spi_obj_t *self) {
// enable the peripheral clock
MAP_PRCMPeripheralClkEnable(PRCM_GSPI, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
MAP_PRCMPeripheralReset(PRCM_GSPI);
@@ -90,7 +90,7 @@ STATIC void pybspi_init (const pyb_spi_obj_t *self) {
MAP_SPIEnable(GSPI_BASE);
}
-STATIC void pybspi_tx (pyb_spi_obj_t *self, const void *data) {
+static void pybspi_tx (pyb_spi_obj_t *self, const void *data) {
uint32_t txdata;
switch (self->wlen) {
case 1:
@@ -108,7 +108,7 @@ STATIC void pybspi_tx (pyb_spi_obj_t *self, const void *data) {
MAP_SPIDataPut (GSPI_BASE, txdata);
}
-STATIC void pybspi_rx (pyb_spi_obj_t *self, void *data) {
+static void pybspi_rx (pyb_spi_obj_t *self, void *data) {
uint32_t rxdata;
MAP_SPIDataGet (GSPI_BASE, &rxdata);
if (data) {
@@ -128,7 +128,7 @@ STATIC void pybspi_rx (pyb_spi_obj_t *self, void *data) {
}
}
-STATIC void pybspi_transfer (pyb_spi_obj_t *self, const char *txdata, char *rxdata, uint32_t len, uint32_t *txchar) {
+static void pybspi_transfer (pyb_spi_obj_t *self, const char *txdata, char *rxdata, uint32_t len, uint32_t *txchar) {
if (!self->baudrate) {
mp_raise_OSError(MP_EPERM);
}
@@ -144,7 +144,7 @@ STATIC void pybspi_transfer (pyb_spi_obj_t *self, const char *txdata, char *rxda
/******************************************************************************/
/* MicroPython bindings */
/******************************************************************************/
-STATIC void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_spi_obj_t *self = self_in;
if (self->baudrate > 0) {
mp_printf(print, "SPI(0, baudrate=%u, bits=%u, polarity=%u, phase=%u, firstbit=SPI.MSB)",
@@ -154,7 +154,7 @@ STATIC void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
}
}
-STATIC mp_obj_t pyb_spi_init_helper(pyb_spi_obj_t *self, const mp_arg_val_t *args) {
+static mp_obj_t pyb_spi_init_helper(pyb_spi_obj_t *self, const mp_arg_val_t *args) {
uint bits;
switch (args[1].u_int) {
case 8:
@@ -224,7 +224,7 @@ static const mp_arg_t pyb_spi_init_args[] = {
{ MP_QSTR_firstbit, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = PYBSPI_FIRST_BIT_MSB} },
{ MP_QSTR_pins, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
};
-STATIC mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -246,17 +246,17 @@ STATIC mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_
return self;
}
-STATIC mp_obj_t pyb_spi_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_spi_init_args) - 1];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &pyb_spi_init_args[1], args);
return pyb_spi_init_helper(pos_args[0], args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_init_obj, 1, pyb_spi_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_init_obj, 1, pyb_spi_init);
/// \method deinit()
/// Turn off the spi bus.
-STATIC mp_obj_t pyb_spi_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_spi_deinit(mp_obj_t self_in) {
// disable the peripheral
MAP_SPIDisable(GSPI_BASE);
MAP_PRCMPeripheralClkDisable(PRCM_GSPI, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
@@ -266,9 +266,9 @@ STATIC mp_obj_t pyb_spi_deinit(mp_obj_t self_in) {
pyb_sleep_remove((const mp_obj_t)self_in);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_spi_deinit_obj, pyb_spi_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_spi_deinit_obj, pyb_spi_deinit);
-STATIC mp_obj_t pyb_spi_write (mp_obj_t self_in, mp_obj_t buf) {
+static mp_obj_t pyb_spi_write (mp_obj_t self_in, mp_obj_t buf) {
// parse args
pyb_spi_obj_t *self = self_in;
@@ -283,9 +283,9 @@ STATIC mp_obj_t pyb_spi_write (mp_obj_t self_in, mp_obj_t buf) {
// return the number of bytes written
return mp_obj_new_int(bufinfo.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_spi_write_obj, pyb_spi_write);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_spi_write_obj, pyb_spi_write);
-STATIC mp_obj_t pyb_spi_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_nbytes, MP_ARG_REQUIRED | MP_ARG_OBJ, },
{ MP_QSTR_write, MP_ARG_INT, {.u_int = 0x00} },
@@ -307,9 +307,9 @@ STATIC mp_obj_t pyb_spi_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
// return the received data
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_read_obj, 1, pyb_spi_read);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_read_obj, 1, pyb_spi_read);
-STATIC mp_obj_t pyb_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_OBJ, },
{ MP_QSTR_write, MP_ARG_INT, {.u_int = 0x00} },
@@ -331,9 +331,9 @@ STATIC mp_obj_t pyb_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map
// return the number of bytes received
return mp_obj_new_int(vstr.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_readinto_obj, 1, pyb_spi_readinto);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_readinto_obj, 1, pyb_spi_readinto);
-STATIC mp_obj_t pyb_spi_write_readinto (mp_obj_t self, mp_obj_t writebuf, mp_obj_t readbuf) {
+static mp_obj_t pyb_spi_write_readinto (mp_obj_t self, mp_obj_t writebuf, mp_obj_t readbuf) {
// get buffers to write from/read to
mp_buffer_info_t bufinfo_write;
uint8_t data_send[1];
@@ -360,9 +360,9 @@ STATIC mp_obj_t pyb_spi_write_readinto (mp_obj_t self, mp_obj_t writebuf, mp_obj
// return the number of transferred bytes
return mp_obj_new_int(bufinfo_write.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_spi_write_readinto_obj, pyb_spi_write_readinto);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_spi_write_readinto_obj, pyb_spi_write_readinto);
-STATIC const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_spi_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_spi_deinit_obj) },
@@ -375,7 +375,7 @@ STATIC const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_MSB), MP_ROM_INT(PYBSPI_FIRST_BIT_MSB) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_spi_type,
diff --git a/ports/cc3200/mods/pybtimer.c b/ports/cc3200/mods/pybtimer.c
index be365f3c92..a9a154308e 100644
--- a/ports/cc3200/mods/pybtimer.c
+++ b/ports/cc3200/mods/pybtimer.c
@@ -96,28 +96,28 @@ typedef struct _pyb_timer_channel_obj_t {
/******************************************************************************
DEFINE PRIVATE DATA
******************************************************************************/
-STATIC const mp_irq_methods_t pyb_timer_channel_irq_methods;
-STATIC pyb_timer_obj_t pyb_timer_obj[PYBTIMER_NUM_TIMERS] = {{.timer = TIMERA0_BASE, .peripheral = PRCM_TIMERA0},
+static const mp_irq_methods_t pyb_timer_channel_irq_methods;
+static pyb_timer_obj_t pyb_timer_obj[PYBTIMER_NUM_TIMERS] = {{.timer = TIMERA0_BASE, .peripheral = PRCM_TIMERA0},
{.timer = TIMERA1_BASE, .peripheral = PRCM_TIMERA1},
{.timer = TIMERA2_BASE, .peripheral = PRCM_TIMERA2},
{.timer = TIMERA3_BASE, .peripheral = PRCM_TIMERA3}};
-STATIC const mp_obj_type_t pyb_timer_channel_type;
-STATIC const mp_obj_t pyb_timer_pwm_pin[8] = {&pin_GP24, MP_OBJ_NULL, &pin_GP25, MP_OBJ_NULL, MP_OBJ_NULL, &pin_GP9, &pin_GP10, &pin_GP11};
+static const mp_obj_type_t pyb_timer_channel_type;
+static const mp_obj_t pyb_timer_pwm_pin[8] = {&pin_GP24, MP_OBJ_NULL, &pin_GP25, MP_OBJ_NULL, MP_OBJ_NULL, &pin_GP9, &pin_GP10, &pin_GP11};
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC mp_obj_t pyb_timer_channel_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
-STATIC void timer_disable (pyb_timer_obj_t *tim);
-STATIC void timer_channel_init (pyb_timer_channel_obj_t *ch);
-STATIC void TIMER0AIntHandler(void);
-STATIC void TIMER0BIntHandler(void);
-STATIC void TIMER1AIntHandler(void);
-STATIC void TIMER1BIntHandler(void);
-STATIC void TIMER2AIntHandler(void);
-STATIC void TIMER2BIntHandler(void);
-STATIC void TIMER3AIntHandler(void);
-STATIC void TIMER3BIntHandler(void);
+static mp_obj_t pyb_timer_channel_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static void timer_disable (pyb_timer_obj_t *tim);
+static void timer_channel_init (pyb_timer_channel_obj_t *ch);
+static void TIMER0AIntHandler(void);
+static void TIMER0BIntHandler(void);
+static void TIMER1AIntHandler(void);
+static void TIMER1BIntHandler(void);
+static void TIMER2AIntHandler(void);
+static void TIMER2BIntHandler(void);
+static void TIMER3AIntHandler(void);
+static void TIMER3BIntHandler(void);
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
@@ -129,23 +129,23 @@ void timer_init0 (void) {
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void pyb_timer_channel_irq_enable (mp_obj_t self_in) {
+static void pyb_timer_channel_irq_enable (mp_obj_t self_in) {
pyb_timer_channel_obj_t *self = self_in;
MAP_TimerIntClear(self->timer->timer, self->timer->irq_trigger & self->channel);
MAP_TimerIntEnable(self->timer->timer, self->timer->irq_trigger & self->channel);
}
-STATIC void pyb_timer_channel_irq_disable (mp_obj_t self_in) {
+static void pyb_timer_channel_irq_disable (mp_obj_t self_in) {
pyb_timer_channel_obj_t *self = self_in;
MAP_TimerIntDisable(self->timer->timer, self->timer->irq_trigger & self->channel);
}
-STATIC int pyb_timer_channel_irq_flags (mp_obj_t self_in) {
+static int pyb_timer_channel_irq_flags (mp_obj_t self_in) {
pyb_timer_channel_obj_t *self = self_in;
return self->timer->irq_flags;
}
-STATIC pyb_timer_channel_obj_t *pyb_timer_channel_find (uint32_t timer, uint16_t channel_n) {
+static pyb_timer_channel_obj_t *pyb_timer_channel_find (uint32_t timer, uint16_t channel_n) {
for (mp_uint_t i = 0; i < MP_STATE_PORT(pyb_timer_channel_obj_list).len; i++) {
pyb_timer_channel_obj_t *ch = ((pyb_timer_channel_obj_t *)(MP_STATE_PORT(pyb_timer_channel_obj_list).items[i]));
// any 32-bit timer must be matched by any of its 16-bit versions
@@ -156,7 +156,7 @@ STATIC pyb_timer_channel_obj_t *pyb_timer_channel_find (uint32_t timer, uint16_t
return MP_OBJ_NULL;
}
-STATIC void pyb_timer_channel_remove (pyb_timer_channel_obj_t *ch) {
+static void pyb_timer_channel_remove (pyb_timer_channel_obj_t *ch) {
pyb_timer_channel_obj_t *channel;
if ((channel = pyb_timer_channel_find(ch->timer->timer, ch->channel))) {
mp_obj_list_remove(&MP_STATE_PORT(pyb_timer_channel_obj_list), channel);
@@ -165,7 +165,7 @@ STATIC void pyb_timer_channel_remove (pyb_timer_channel_obj_t *ch) {
}
}
-STATIC void pyb_timer_channel_add (pyb_timer_channel_obj_t *ch) {
+static void pyb_timer_channel_add (pyb_timer_channel_obj_t *ch) {
// remove it in case it already exists
pyb_timer_channel_remove(ch);
mp_obj_list_append(&MP_STATE_PORT(pyb_timer_channel_obj_list), ch);
@@ -173,7 +173,7 @@ STATIC void pyb_timer_channel_add (pyb_timer_channel_obj_t *ch) {
pyb_sleep_add((const mp_obj_t)ch, (WakeUpCB_t)timer_channel_init);
}
-STATIC void timer_disable (pyb_timer_obj_t *tim) {
+static void timer_disable (pyb_timer_obj_t *tim) {
// disable all timers and it's interrupts
MAP_TimerDisable(tim->timer, TIMER_A | TIMER_B);
MAP_TimerIntDisable(tim->timer, tim->irq_trigger);
@@ -190,7 +190,7 @@ STATIC void timer_disable (pyb_timer_obj_t *tim) {
}
// computes prescaler period and match value so timer triggers at freq-Hz
-STATIC uint32_t compute_prescaler_period_and_match_value(pyb_timer_channel_obj_t *ch, uint32_t *period_out, uint32_t *match_out) {
+static uint32_t compute_prescaler_period_and_match_value(pyb_timer_channel_obj_t *ch, uint32_t *period_out, uint32_t *match_out) {
uint32_t maxcount = (ch->channel == (TIMER_A | TIMER_B)) ? 0xFFFFFFFF : 0xFFFF;
uint32_t prescaler;
uint32_t period_c = (ch->frequency > 0) ? PYBTIMER_SRC_FREQ_HZ / ch->frequency : ((PYBTIMER_SRC_FREQ_HZ / 1000000) * ch->period);
@@ -223,13 +223,13 @@ error:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC void timer_init (pyb_timer_obj_t *tim) {
+static void timer_init (pyb_timer_obj_t *tim) {
MAP_PRCMPeripheralClkEnable(tim->peripheral, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
MAP_PRCMPeripheralReset(tim->peripheral);
MAP_TimerConfigure(tim->timer, tim->config);
}
-STATIC void timer_channel_init (pyb_timer_channel_obj_t *ch) {
+static void timer_channel_init (pyb_timer_channel_obj_t *ch) {
// calculate the period, the prescaler and the match value
uint32_t period_c;
uint32_t match;
@@ -262,7 +262,7 @@ STATIC void timer_channel_init (pyb_timer_channel_obj_t *ch) {
/******************************************************************************/
/* MicroPython bindings */
-STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_obj_t *tim = self_in;
uint32_t mode = tim->config & 0xFF;
@@ -281,7 +281,7 @@ STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
mp_printf(print, "Timer(%u, mode=Timer.%q)", tim->id, mode_qst);
}
-STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *tim, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *tim, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, },
{ MP_QSTR_width, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 16} },
@@ -319,7 +319,7 @@ error:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -342,19 +342,19 @@ STATIC mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, siz
return (mp_obj_t)tim;
}
-STATIC mp_obj_t pyb_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_timer_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
-STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
pyb_timer_obj_t *self = self_in;
timer_disable(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
-STATIC mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_freq, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_period, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -438,9 +438,9 @@ STATIC mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_ma
error:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_obj, 2, pyb_timer_channel);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_obj, 2, pyb_timer_channel);
-STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_timer_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_timer_deinit_obj) },
@@ -457,7 +457,7 @@ STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_TIMEOUT), MP_ROM_INT(PYBTIMER_TIMEOUT_TRIGGER) },
{ MP_ROM_QSTR(MP_QSTR_MATCH), MP_ROM_INT(PYBTIMER_MATCH_TRIGGER) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_type,
@@ -468,14 +468,14 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &pyb_timer_locals_dict
);
-STATIC const mp_irq_methods_t pyb_timer_channel_irq_methods = {
+static const mp_irq_methods_t pyb_timer_channel_irq_methods = {
.init = pyb_timer_channel_irq,
.enable = pyb_timer_channel_irq_enable,
.disable = pyb_timer_channel_irq_disable,
.flags = pyb_timer_channel_irq_flags,
};
-STATIC void TIMERGenericIntHandler(uint32_t timer, uint16_t channel) {
+static void TIMERGenericIntHandler(uint32_t timer, uint16_t channel) {
pyb_timer_channel_obj_t *self;
uint32_t status;
if ((self = pyb_timer_channel_find(timer, channel))) {
@@ -485,39 +485,39 @@ STATIC void TIMERGenericIntHandler(uint32_t timer, uint16_t channel) {
}
}
-STATIC void TIMER0AIntHandler(void) {
+static void TIMER0AIntHandler(void) {
TIMERGenericIntHandler(TIMERA0_BASE, TIMER_A);
}
-STATIC void TIMER0BIntHandler(void) {
+static void TIMER0BIntHandler(void) {
TIMERGenericIntHandler(TIMERA0_BASE, TIMER_B);
}
-STATIC void TIMER1AIntHandler(void) {
+static void TIMER1AIntHandler(void) {
TIMERGenericIntHandler(TIMERA1_BASE, TIMER_A);
}
-STATIC void TIMER1BIntHandler(void) {
+static void TIMER1BIntHandler(void) {
TIMERGenericIntHandler(TIMERA1_BASE, TIMER_B);
}
-STATIC void TIMER2AIntHandler(void) {
+static void TIMER2AIntHandler(void) {
TIMERGenericIntHandler(TIMERA2_BASE, TIMER_A);
}
-STATIC void TIMER2BIntHandler(void) {
+static void TIMER2BIntHandler(void) {
TIMERGenericIntHandler(TIMERA2_BASE, TIMER_B);
}
-STATIC void TIMER3AIntHandler(void) {
+static void TIMER3AIntHandler(void) {
TIMERGenericIntHandler(TIMERA3_BASE, TIMER_A);
}
-STATIC void TIMER3BIntHandler(void) {
+static void TIMER3BIntHandler(void) {
TIMERGenericIntHandler(TIMERA3_BASE, TIMER_B);
}
-STATIC void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_channel_obj_t *ch = self_in;
char *ch_id = "AB";
// timer channel
@@ -548,7 +548,7 @@ STATIC void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, m
mp_printf(print, ")");
}
-STATIC mp_obj_t pyb_timer_channel_freq(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_channel_freq(size_t n_args, const mp_obj_t *args) {
pyb_timer_channel_obj_t *ch = args[0];
if (n_args == 1) {
// get
@@ -565,9 +565,9 @@ STATIC mp_obj_t pyb_timer_channel_freq(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_freq_obj, 1, 2, pyb_timer_channel_freq);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_freq_obj, 1, 2, pyb_timer_channel_freq);
-STATIC mp_obj_t pyb_timer_channel_period(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_channel_period(size_t n_args, const mp_obj_t *args) {
pyb_timer_channel_obj_t *ch = args[0];
if (n_args == 1) {
// get
@@ -584,9 +584,9 @@ STATIC mp_obj_t pyb_timer_channel_period(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_period_obj, 1, 2, pyb_timer_channel_period);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_period_obj, 1, 2, pyb_timer_channel_period);
-STATIC mp_obj_t pyb_timer_channel_duty_cycle(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_channel_duty_cycle(size_t n_args, const mp_obj_t *args) {
pyb_timer_channel_obj_t *ch = args[0];
if (n_args == 1) {
// get
@@ -608,9 +608,9 @@ STATIC mp_obj_t pyb_timer_channel_duty_cycle(size_t n_args, const mp_obj_t *args
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_duty_cycle_obj, 1, 3, pyb_timer_channel_duty_cycle);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_duty_cycle_obj, 1, 3, pyb_timer_channel_duty_cycle);
-STATIC mp_obj_t pyb_timer_channel_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_channel_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_val_t args[mp_irq_INIT_NUM_ARGS];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, mp_irq_INIT_NUM_ARGS, mp_irq_init_args, args);
pyb_timer_channel_obj_t *ch = pos_args[0];
@@ -711,18 +711,18 @@ STATIC mp_obj_t pyb_timer_channel_irq(size_t n_args, const mp_obj_t *pos_args, m
invalid_args:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_irq_obj, 1, pyb_timer_channel_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_irq_obj, 1, pyb_timer_channel_irq);
-STATIC const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&pyb_timer_channel_freq_obj) },
{ MP_ROM_QSTR(MP_QSTR_period), MP_ROM_PTR(&pyb_timer_channel_period_obj) },
{ MP_ROM_QSTR(MP_QSTR_duty_cycle), MP_ROM_PTR(&pyb_timer_channel_duty_cycle_obj) },
{ MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pyb_timer_channel_irq_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_channel_type,
MP_QSTR_TimerChannel,
MP_TYPE_FLAG_NONE,
diff --git a/ports/cc3200/mods/pybuart.c b/ports/cc3200/mods/pybuart.c
index c9a753da04..6ab2371ba7 100644
--- a/ports/cc3200/mods/pybuart.c
+++ b/ports/cc3200/mods/pybuart.c
@@ -76,15 +76,15 @@
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void uart_init (pyb_uart_obj_t *self);
-STATIC bool uart_rx_wait (pyb_uart_obj_t *self);
-STATIC void uart_check_init(pyb_uart_obj_t *self);
-STATIC mp_obj_t uart_irq_new (pyb_uart_obj_t *self, byte trigger, mp_int_t priority, mp_obj_t handler);
-STATIC void UARTGenericIntHandler(uint32_t uart_id);
-STATIC void UART0IntHandler(void);
-STATIC void UART1IntHandler(void);
-STATIC void uart_irq_enable (mp_obj_t self_in);
-STATIC void uart_irq_disable (mp_obj_t self_in);
+static void uart_init (pyb_uart_obj_t *self);
+static bool uart_rx_wait (pyb_uart_obj_t *self);
+static void uart_check_init(pyb_uart_obj_t *self);
+static mp_obj_t uart_irq_new (pyb_uart_obj_t *self, byte trigger, mp_int_t priority, mp_obj_t handler);
+static void UARTGenericIntHandler(uint32_t uart_id);
+static void UART0IntHandler(void);
+static void UART1IntHandler(void);
+static void uart_irq_enable (mp_obj_t self_in);
+static void uart_irq_disable (mp_obj_t self_in);
/******************************************************************************
DEFINE PRIVATE TYPES
@@ -108,11 +108,11 @@ struct _pyb_uart_obj_t {
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
-STATIC pyb_uart_obj_t pyb_uart_obj[PYB_NUM_UARTS] = { {.reg = UARTA0_BASE, .baudrate = 0, .read_buf = NULL, .peripheral = PRCM_UARTA0},
+static pyb_uart_obj_t pyb_uart_obj[PYB_NUM_UARTS] = { {.reg = UARTA0_BASE, .baudrate = 0, .read_buf = NULL, .peripheral = PRCM_UARTA0},
{.reg = UARTA1_BASE, .baudrate = 0, .read_buf = NULL, .peripheral = PRCM_UARTA1} };
-STATIC const mp_irq_methods_t uart_irq_methods;
+static const mp_irq_methods_t uart_irq_methods;
-STATIC const mp_obj_t pyb_uart_def_pin[PYB_NUM_UARTS][2] = { {&pin_GP1, &pin_GP2}, {&pin_GP3, &pin_GP4} };
+static const mp_obj_t pyb_uart_def_pin[PYB_NUM_UARTS][2] = { {&pin_GP1, &pin_GP2}, {&pin_GP3, &pin_GP4} };
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
@@ -168,7 +168,7 @@ bool uart_tx_strn(pyb_uart_obj_t *self, const char *str, uint len) {
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
// assumes init parameters have been set up correctly
-STATIC void uart_init (pyb_uart_obj_t *self) {
+static void uart_init (pyb_uart_obj_t *self) {
// Enable the peripheral clock
MAP_PRCMPeripheralClkEnable(self->peripheral, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
@@ -198,7 +198,7 @@ STATIC void uart_init (pyb_uart_obj_t *self) {
// Waits at most timeout microseconds for at least 1 char to become ready for
// reading (from buf or for direct reading).
// Returns true if something available, false if not.
-STATIC bool uart_rx_wait (pyb_uart_obj_t *self) {
+static bool uart_rx_wait (pyb_uart_obj_t *self) {
int timeout = PYBUART_RX_TIMEOUT_US(self->baudrate);
for ( ; ; ) {
if (uart_rx_any(self)) {
@@ -214,7 +214,7 @@ STATIC bool uart_rx_wait (pyb_uart_obj_t *self) {
}
}
-STATIC mp_obj_t uart_irq_new (pyb_uart_obj_t *self, byte trigger, mp_int_t priority, mp_obj_t handler) {
+static mp_obj_t uart_irq_new (pyb_uart_obj_t *self, byte trigger, mp_int_t priority, mp_obj_t handler) {
// disable the uart interrupts before updating anything
uart_irq_disable (self);
@@ -235,7 +235,7 @@ STATIC mp_obj_t uart_irq_new (pyb_uart_obj_t *self, byte trigger, mp_int_t prior
return _irq;
}
-STATIC void UARTGenericIntHandler(uint32_t uart_id) {
+static void UARTGenericIntHandler(uint32_t uart_id) {
pyb_uart_obj_t *self;
uint32_t status;
@@ -272,22 +272,22 @@ STATIC void UARTGenericIntHandler(uint32_t uart_id) {
self->irq_flags = 0;
}
-STATIC void uart_check_init(pyb_uart_obj_t *self) {
+static void uart_check_init(pyb_uart_obj_t *self) {
// not initialized
if (!self->baudrate) {
mp_raise_OSError(MP_EPERM);
}
}
-STATIC void UART0IntHandler(void) {
+static void UART0IntHandler(void) {
UARTGenericIntHandler(0);
}
-STATIC void UART1IntHandler(void) {
+static void UART1IntHandler(void) {
UARTGenericIntHandler(1);
}
-STATIC void uart_irq_enable (mp_obj_t self_in) {
+static void uart_irq_enable (mp_obj_t self_in) {
pyb_uart_obj_t *self = self_in;
// check for any of the rx interrupt types
if (self->irq_trigger & (UART_TRIGGER_RX_ANY | UART_TRIGGER_RX_HALF | UART_TRIGGER_RX_FULL)) {
@@ -297,12 +297,12 @@ STATIC void uart_irq_enable (mp_obj_t self_in) {
self->irq_enabled = true;
}
-STATIC void uart_irq_disable (mp_obj_t self_in) {
+static void uart_irq_disable (mp_obj_t self_in) {
pyb_uart_obj_t *self = self_in;
self->irq_enabled = false;
}
-STATIC int uart_irq_flags (mp_obj_t self_in) {
+static int uart_irq_flags (mp_obj_t self_in) {
pyb_uart_obj_t *self = self_in;
return self->irq_flags;
}
@@ -310,7 +310,7 @@ STATIC int uart_irq_flags (mp_obj_t self_in) {
/******************************************************************************/
/* MicroPython bindings */
-STATIC void pyb_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_uart_obj_t *self = self_in;
if (self->baudrate > 0) {
mp_printf(print, "UART(%u, baudrate=%u, bits=", self->uart_id, self->baudrate);
@@ -342,7 +342,7 @@ STATIC void pyb_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_k
}
}
-STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, const mp_arg_val_t *args) {
+static mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, const mp_arg_val_t *args) {
// get the baudrate
if (args[0].u_int <= 0) {
goto error;
@@ -433,7 +433,7 @@ error:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC const mp_arg_t pyb_uart_init_args[] = {
+static const mp_arg_t pyb_uart_init_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 9600} },
{ MP_QSTR_bits, MP_ARG_INT, {.u_int = 8} },
@@ -441,7 +441,7 @@ STATIC const mp_arg_t pyb_uart_init_args[] = {
{ MP_QSTR_stop, MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_pins, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
};
-STATIC mp_obj_t pyb_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t pyb_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -484,15 +484,15 @@ STATIC mp_obj_t pyb_uart_make_new(const mp_obj_type_t *type, size_t n_args, size
return self;
}
-STATIC mp_obj_t pyb_uart_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_uart_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_uart_init_args) - 1];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &pyb_uart_init_args[1], args);
return pyb_uart_init_helper(pos_args[0], args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_uart_init_obj, 1, pyb_uart_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_uart_init_obj, 1, pyb_uart_init);
-STATIC mp_obj_t pyb_uart_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_uart_deinit(mp_obj_t self_in) {
pyb_uart_obj_t *self = self_in;
// unregister it with the sleep module
@@ -506,16 +506,16 @@ STATIC mp_obj_t pyb_uart_deinit(mp_obj_t self_in) {
MAP_PRCMPeripheralClkDisable(self->peripheral, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_deinit_obj, pyb_uart_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_deinit_obj, pyb_uart_deinit);
-STATIC mp_obj_t pyb_uart_any(mp_obj_t self_in) {
+static mp_obj_t pyb_uart_any(mp_obj_t self_in) {
pyb_uart_obj_t *self = self_in;
uart_check_init(self);
return mp_obj_new_int(uart_rx_any(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_any_obj, pyb_uart_any);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_any_obj, pyb_uart_any);
-STATIC mp_obj_t pyb_uart_sendbreak(mp_obj_t self_in) {
+static mp_obj_t pyb_uart_sendbreak(mp_obj_t self_in) {
pyb_uart_obj_t *self = self_in;
uart_check_init(self);
// send a break signal for at least 2 complete frames
@@ -524,10 +524,10 @@ STATIC mp_obj_t pyb_uart_sendbreak(mp_obj_t self_in) {
MAP_UARTBreakCtl(self->reg, false);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_sendbreak_obj, pyb_uart_sendbreak);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_sendbreak_obj, pyb_uart_sendbreak);
/// \method irq(trigger, priority, handler, wake)
-STATIC mp_obj_t pyb_uart_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_uart_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_val_t args[mp_irq_INIT_NUM_ARGS];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, mp_irq_INIT_NUM_ARGS, mp_irq_init_args, args);
@@ -556,9 +556,9 @@ STATIC mp_obj_t pyb_uart_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
invalid_args:
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_uart_irq_obj, 1, pyb_uart_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_uart_irq_obj, 1, pyb_uart_irq);
-STATIC mp_obj_t machine_uart_txdone(mp_obj_t self_in) {
+static mp_obj_t machine_uart_txdone(mp_obj_t self_in) {
pyb_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (MAP_UARTBusy(self->reg) == false) {
@@ -567,9 +567,9 @@ STATIC mp_obj_t machine_uart_txdone(mp_obj_t self_in) {
return mp_const_false;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_txdone_obj, machine_uart_txdone);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_txdone_obj, machine_uart_txdone);
-STATIC const mp_rom_map_elem_t pyb_uart_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_uart_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_uart_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_uart_deinit_obj) },
@@ -592,9 +592,9 @@ STATIC const mp_rom_map_elem_t pyb_uart_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_RX_ANY), MP_ROM_INT(UART_TRIGGER_RX_ANY) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_uart_locals_dict, pyb_uart_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_uart_locals_dict, pyb_uart_locals_dict_table);
-STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
pyb_uart_obj_t *self = self_in;
byte *buf = buf_in;
uart_check_init(self);
@@ -622,7 +622,7 @@ STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, i
}
}
-STATIC mp_uint_t pyb_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t pyb_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
pyb_uart_obj_t *self = self_in;
const char *buf = buf_in;
uart_check_init(self);
@@ -634,7 +634,7 @@ STATIC mp_uint_t pyb_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t
return size;
}
-STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
+static mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
pyb_uart_obj_t *self = self_in;
mp_uint_t ret;
uart_check_init(self);
@@ -670,14 +670,14 @@ STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t a
return ret;
}
-STATIC const mp_stream_p_t uart_stream_p = {
+static const mp_stream_p_t uart_stream_p = {
.read = pyb_uart_read,
.write = pyb_uart_write,
.ioctl = pyb_uart_ioctl,
.is_text = false,
};
-STATIC const mp_irq_methods_t uart_irq_methods = {
+static const mp_irq_methods_t uart_irq_methods = {
.init = pyb_uart_irq,
.enable = uart_irq_enable,
.disable = uart_irq_disable,
diff --git a/ports/cc3200/mptask.c b/ports/cc3200/mptask.c
index 83b5c091b8..656a8fb872 100644
--- a/ports/cc3200/mptask.c
+++ b/ports/cc3200/mptask.c
@@ -80,10 +80,10 @@
/******************************************************************************
DECLARE PRIVATE FUNCTIONS
******************************************************************************/
-STATIC void mptask_pre_init(void);
-STATIC void mptask_init_sflash_filesystem(void);
-STATIC void mptask_enter_ap_mode(void);
-STATIC void mptask_create_main_py(void);
+static void mptask_pre_init(void);
+static void mptask_init_sflash_filesystem(void);
+static void mptask_enter_ap_mode(void);
+static void mptask_create_main_py(void);
/******************************************************************************
DECLARE PUBLIC DATA
@@ -256,7 +256,7 @@ soft_reset_exit:
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
__attribute__ ((section(".boot")))
-STATIC void mptask_pre_init(void) {
+static void mptask_pre_init(void) {
// this one only makes sense after a poweron reset
pyb_rtc_pre_init();
@@ -288,7 +288,7 @@ STATIC void mptask_pre_init(void) {
ASSERT(svTaskHandle != NULL);
}
-STATIC void mptask_init_sflash_filesystem(void) {
+static void mptask_init_sflash_filesystem(void) {
FILINFO fno;
// Initialise the local flash filesystem.
@@ -371,7 +371,7 @@ STATIC void mptask_init_sflash_filesystem(void) {
}
}
-STATIC void mptask_enter_ap_mode(void) {
+static void mptask_enter_ap_mode(void) {
// append the mac only if it's not the first boot
bool add_mac = !PRCMGetSpecialBit(PRCM_FIRST_BOOT_BIT);
// enable simplelink in ap mode (use the MAC address to make the ssid unique)
@@ -380,7 +380,7 @@ STATIC void mptask_enter_ap_mode(void) {
MICROPY_PORT_WLAN_AP_CHANNEL, ANTENNA_TYPE_INTERNAL, add_mac);
}
-STATIC void mptask_create_main_py(void) {
+static void mptask_create_main_py(void) {
// create empty main.py
FIL fp;
f_open(&sflash_vfs_fat->fatfs, &fp, "/main.py", FA_WRITE | FA_CREATE_ALWAYS);
diff --git a/ports/cc3200/mpthreadport.c b/ports/cc3200/mpthreadport.c
index c3f5f38d06..6c3a581871 100644
--- a/ports/cc3200/mpthreadport.c
+++ b/ports/cc3200/mpthreadport.c
@@ -46,9 +46,9 @@ typedef struct _mp_thread_t {
} mp_thread_t;
// the mutex controls access to the linked list
-STATIC mp_thread_mutex_t thread_mutex;
-STATIC mp_thread_t thread_entry0;
-STATIC mp_thread_t *thread; // root pointer, handled bp mp_thread_gc_others
+static mp_thread_mutex_t thread_mutex;
+static mp_thread_t thread_entry0;
+static mp_thread_t *thread; // root pointer, handled bp mp_thread_gc_others
void mp_thread_init(void) {
mp_thread_mutex_init(&thread_mutex);
@@ -103,9 +103,9 @@ void mp_thread_start(void) {
mp_thread_mutex_unlock(&thread_mutex);
}
-STATIC void *(*ext_thread_entry)(void *) = NULL;
+static void *(*ext_thread_entry)(void *) = NULL;
-STATIC void freertos_entry(void *arg) {
+static void freertos_entry(void *arg) {
if (ext_thread_entry) {
ext_thread_entry(arg);
}
diff --git a/ports/cc3200/util/random.c b/ports/cc3200/util/random.c
index f8e9cdf0cb..e6285c98eb 100644
--- a/ports/cc3200/util/random.c
+++ b/ports/cc3200/util/random.c
@@ -56,12 +56,12 @@ static uint32_t s_seed;
/******************************************************************************
* LOCAL FUNCTION DECLARATIONS
******************************************************************************/
-STATIC uint32_t lfsr (uint32_t input);
+static uint32_t lfsr (uint32_t input);
/******************************************************************************
* PRIVATE FUNCTIONS
******************************************************************************/
-STATIC uint32_t lfsr (uint32_t input) {
+static uint32_t lfsr (uint32_t input) {
assert( input != 0 );
return (input >> 1) ^ (-(input & 0x01) & 0x00E10000);
}
@@ -69,7 +69,7 @@ STATIC uint32_t lfsr (uint32_t input) {
/******************************************************************************/
// MicroPython bindings;
-STATIC mp_obj_t machine_rng_get(void) {
+static mp_obj_t machine_rng_get(void) {
return mp_obj_new_int(rng_get());
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_rng_get_obj, machine_rng_get);
diff --git a/ports/esp32/esp32_nvs.c b/ports/esp32/esp32_nvs.c
index 0b3661918c..daeec4c269 100644
--- a/ports/esp32/esp32_nvs.c
+++ b/ports/esp32/esp32_nvs.c
@@ -43,7 +43,7 @@ typedef struct _esp32_nvs_obj_t {
} esp32_nvs_obj_t;
// *esp32_nvs_new allocates a python NVS object given a handle to an esp-idf namespace C obj.
-STATIC esp32_nvs_obj_t *esp32_nvs_new(nvs_handle_t namespace) {
+static esp32_nvs_obj_t *esp32_nvs_new(nvs_handle_t namespace) {
esp32_nvs_obj_t *self = mp_obj_malloc(esp32_nvs_obj_t, &esp32_nvs_type);
self->namespace = namespace;
return self;
@@ -51,13 +51,13 @@ STATIC esp32_nvs_obj_t *esp32_nvs_new(nvs_handle_t namespace) {
// esp32_nvs_print prints an NVS object, unfortunately it doesn't seem possible to extract the
// namespace string or anything else from the opaque handle provided by esp-idf.
-STATIC void esp32_nvs_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void esp32_nvs_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
// esp32_nvs_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<NVS namespace>");
}
// esp32_nvs_make_new constructs a handle to an NVS namespace.
-STATIC mp_obj_t esp32_nvs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t esp32_nvs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Check args
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -69,27 +69,27 @@ STATIC mp_obj_t esp32_nvs_make_new(const mp_obj_type_t *type, size_t n_args, siz
}
// esp32_nvs_set_i32 sets a 32-bit integer value
-STATIC mp_obj_t esp32_nvs_set_i32(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
+static mp_obj_t esp32_nvs_set_i32(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
esp32_nvs_obj_t *self = MP_OBJ_TO_PTR(self_in);
const char *key = mp_obj_str_get_str(key_in);
int32_t value = mp_obj_get_int(value_in);
check_esp_err(nvs_set_i32(self->namespace, key, value));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp32_nvs_set_i32_obj, esp32_nvs_set_i32);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp32_nvs_set_i32_obj, esp32_nvs_set_i32);
// esp32_nvs_get_i32 reads a 32-bit integer value
-STATIC mp_obj_t esp32_nvs_get_i32(mp_obj_t self_in, mp_obj_t key_in) {
+static mp_obj_t esp32_nvs_get_i32(mp_obj_t self_in, mp_obj_t key_in) {
esp32_nvs_obj_t *self = MP_OBJ_TO_PTR(self_in);
const char *key = mp_obj_str_get_str(key_in);
int32_t value;
check_esp_err(nvs_get_i32(self->namespace, key, &value));
return mp_obj_new_int(value);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_nvs_get_i32_obj, esp32_nvs_get_i32);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp32_nvs_get_i32_obj, esp32_nvs_get_i32);
// esp32_nvs_set_blob writes a buffer object into a binary blob value.
-STATIC mp_obj_t esp32_nvs_set_blob(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
+static mp_obj_t esp32_nvs_set_blob(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
esp32_nvs_obj_t *self = MP_OBJ_TO_PTR(self_in);
const char *key = mp_obj_str_get_str(key_in);
mp_buffer_info_t value;
@@ -97,10 +97,10 @@ STATIC mp_obj_t esp32_nvs_set_blob(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t v
check_esp_err(nvs_set_blob(self->namespace, key, value.buf, value.len));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp32_nvs_set_blob_obj, esp32_nvs_set_blob);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp32_nvs_set_blob_obj, esp32_nvs_set_blob);
// esp32_nvs_get_blob reads a binary blob value into a bytearray. Returns actual length.
-STATIC mp_obj_t esp32_nvs_get_blob(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
+static mp_obj_t esp32_nvs_get_blob(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
esp32_nvs_obj_t *self = MP_OBJ_TO_PTR(self_in);
const char *key = mp_obj_str_get_str(key_in);
// get buffer to be filled
@@ -112,26 +112,26 @@ STATIC mp_obj_t esp32_nvs_get_blob(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t v
check_esp_err(nvs_get_blob(self->namespace, key, value.buf, &length));
return MP_OBJ_NEW_SMALL_INT(length);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp32_nvs_get_blob_obj, esp32_nvs_get_blob);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp32_nvs_get_blob_obj, esp32_nvs_get_blob);
// esp32_nvs_erase_key erases one key.
-STATIC mp_obj_t esp32_nvs_erase_key(mp_obj_t self_in, mp_obj_t key_in) {
+static mp_obj_t esp32_nvs_erase_key(mp_obj_t self_in, mp_obj_t key_in) {
esp32_nvs_obj_t *self = MP_OBJ_TO_PTR(self_in);
const char *key = mp_obj_str_get_str(key_in);
check_esp_err(nvs_erase_key(self->namespace, key));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_nvs_erase_key_obj, esp32_nvs_erase_key);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp32_nvs_erase_key_obj, esp32_nvs_erase_key);
// esp32_nvs_commit commits any changes to flash.
-STATIC mp_obj_t esp32_nvs_commit(mp_obj_t self_in) {
+static mp_obj_t esp32_nvs_commit(mp_obj_t self_in) {
esp32_nvs_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_esp_err(nvs_commit(self->namespace));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_nvs_commit_obj, esp32_nvs_commit);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_nvs_commit_obj, esp32_nvs_commit);
-STATIC const mp_rom_map_elem_t esp32_nvs_locals_dict_table[] = {
+static const mp_rom_map_elem_t esp32_nvs_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_get_i32), MP_ROM_PTR(&esp32_nvs_get_i32_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_i32), MP_ROM_PTR(&esp32_nvs_set_i32_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_blob), MP_ROM_PTR(&esp32_nvs_get_blob_obj) },
@@ -139,7 +139,7 @@ STATIC const mp_rom_map_elem_t esp32_nvs_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_erase_key), MP_ROM_PTR(&esp32_nvs_erase_key_obj) },
{ MP_ROM_QSTR(MP_QSTR_commit), MP_ROM_PTR(&esp32_nvs_commit_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(esp32_nvs_locals_dict, esp32_nvs_locals_dict_table);
+static MP_DEFINE_CONST_DICT(esp32_nvs_locals_dict, esp32_nvs_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
esp32_nvs_type,
diff --git a/ports/esp32/esp32_partition.c b/ports/esp32/esp32_partition.c
index 3bca3b5273..e5d4809620 100644
--- a/ports/esp32/esp32_partition.c
+++ b/ports/esp32/esp32_partition.c
@@ -53,7 +53,7 @@ typedef struct _esp32_partition_obj_t {
uint16_t block_size;
} esp32_partition_obj_t;
-STATIC esp32_partition_obj_t *esp32_partition_new(const esp_partition_t *part, uint16_t block_size) {
+static esp32_partition_obj_t *esp32_partition_new(const esp_partition_t *part, uint16_t block_size) {
if (part == NULL) {
mp_raise_OSError(MP_ENOENT);
}
@@ -68,7 +68,7 @@ STATIC esp32_partition_obj_t *esp32_partition_new(const esp_partition_t *part, u
return self;
}
-STATIC void esp32_partition_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void esp32_partition_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
esp32_partition_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<Partition type=%u, subtype=%u, address=%u, size=%u, label=%s, encrypted=%u>",
self->part->type, self->part->subtype,
@@ -77,7 +77,7 @@ STATIC void esp32_partition_print(const mp_print_t *print, mp_obj_t self_in, mp_
);
}
-STATIC mp_obj_t esp32_partition_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t esp32_partition_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Check args
mp_arg_check_num(n_args, n_kw, 1, 2, false);
@@ -114,7 +114,7 @@ STATIC mp_obj_t esp32_partition_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(esp32_partition_new(part, block_size));
}
-STATIC mp_obj_t esp32_partition_find(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t esp32_partition_find(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// Parse args
enum { ARG_type, ARG_subtype, ARG_label, ARG_block_size };
static const mp_arg_t allowed_args[] = {
@@ -146,10 +146,10 @@ STATIC mp_obj_t esp32_partition_find(size_t n_args, const mp_obj_t *pos_args, mp
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp32_partition_find_fun_obj, 0, esp32_partition_find);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(esp32_partition_find_obj, MP_ROM_PTR(&esp32_partition_find_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_partition_find_fun_obj, 0, esp32_partition_find);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(esp32_partition_find_obj, MP_ROM_PTR(&esp32_partition_find_fun_obj));
-STATIC mp_obj_t esp32_partition_info(mp_obj_t self_in) {
+static mp_obj_t esp32_partition_info(mp_obj_t self_in) {
esp32_partition_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t tuple[] = {
MP_OBJ_NEW_SMALL_INT(self->part->type),
@@ -161,9 +161,9 @@ STATIC mp_obj_t esp32_partition_info(mp_obj_t self_in) {
};
return mp_obj_new_tuple(6, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_info_obj, esp32_partition_info);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_info_obj, esp32_partition_info);
-STATIC mp_obj_t esp32_partition_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp32_partition_readblocks(size_t n_args, const mp_obj_t *args) {
esp32_partition_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = mp_obj_get_int(args[1]) * self->block_size;
mp_buffer_info_t bufinfo;
@@ -174,9 +174,9 @@ STATIC mp_obj_t esp32_partition_readblocks(size_t n_args, const mp_obj_t *args)
check_esp_err(esp_partition_read(self->part, offset, bufinfo.buf, bufinfo.len));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_partition_readblocks_obj, 3, 4, esp32_partition_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_partition_readblocks_obj, 3, 4, esp32_partition_readblocks);
-STATIC mp_obj_t esp32_partition_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp32_partition_writeblocks(size_t n_args, const mp_obj_t *args) {
esp32_partition_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = mp_obj_get_int(args[1]) * self->block_size;
mp_buffer_info_t bufinfo;
@@ -213,9 +213,9 @@ STATIC mp_obj_t esp32_partition_writeblocks(size_t n_args, const mp_obj_t *args)
check_esp_err(esp_partition_write(self->part, offset, bufinfo.buf, bufinfo.len));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_partition_writeblocks_obj, 3, 4, esp32_partition_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_partition_writeblocks_obj, 3, 4, esp32_partition_writeblocks);
-STATIC mp_obj_t esp32_partition_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t esp32_partition_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
esp32_partition_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
switch (cmd) {
@@ -241,31 +241,31 @@ STATIC mp_obj_t esp32_partition_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp32_partition_ioctl_obj, esp32_partition_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp32_partition_ioctl_obj, esp32_partition_ioctl);
-STATIC mp_obj_t esp32_partition_set_boot(mp_obj_t self_in) {
+static mp_obj_t esp32_partition_set_boot(mp_obj_t self_in) {
esp32_partition_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_esp_err(esp_ota_set_boot_partition(self->part));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_set_boot_obj, esp32_partition_set_boot);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_set_boot_obj, esp32_partition_set_boot);
-STATIC mp_obj_t esp32_partition_get_next_update(mp_obj_t self_in) {
+static mp_obj_t esp32_partition_get_next_update(mp_obj_t self_in) {
esp32_partition_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_FROM_PTR(esp32_partition_new(esp_ota_get_next_update_partition(self->part), NATIVE_BLOCK_SIZE_BYTES));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_get_next_update_obj, esp32_partition_get_next_update);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_get_next_update_obj, esp32_partition_get_next_update);
-STATIC mp_obj_t esp32_partition_mark_app_valid_cancel_rollback(mp_obj_t cls_in) {
+static mp_obj_t esp32_partition_mark_app_valid_cancel_rollback(mp_obj_t cls_in) {
check_esp_err(esp_ota_mark_app_valid_cancel_rollback());
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_mark_app_valid_cancel_rollback_fun_obj,
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_mark_app_valid_cancel_rollback_fun_obj,
esp32_partition_mark_app_valid_cancel_rollback);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(esp32_partition_mark_app_valid_cancel_rollback_obj,
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(esp32_partition_mark_app_valid_cancel_rollback_obj,
MP_ROM_PTR(&esp32_partition_mark_app_valid_cancel_rollback_fun_obj));
-STATIC const mp_rom_map_elem_t esp32_partition_locals_dict_table[] = {
+static const mp_rom_map_elem_t esp32_partition_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&esp32_partition_find_obj) },
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&esp32_partition_info_obj) },
@@ -282,7 +282,7 @@ STATIC const mp_rom_map_elem_t esp32_partition_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_TYPE_APP), MP_ROM_INT(ESP_PARTITION_TYPE_APP) },
{ MP_ROM_QSTR(MP_QSTR_TYPE_DATA), MP_ROM_INT(ESP_PARTITION_TYPE_DATA) },
};
-STATIC MP_DEFINE_CONST_DICT(esp32_partition_locals_dict, esp32_partition_locals_dict_table);
+static MP_DEFINE_CONST_DICT(esp32_partition_locals_dict, esp32_partition_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
esp32_partition_type,
diff --git a/ports/esp32/esp32_rmt.c b/ports/esp32/esp32_rmt.c
index 494ae48f46..c765a9741b 100644
--- a/ports/esp32/esp32_rmt.c
+++ b/ports/esp32/esp32_rmt.c
@@ -75,7 +75,7 @@ typedef struct _rmt_install_state_t {
esp_err_t ret;
} rmt_install_state_t;
-STATIC void rmt_install_task(void *pvParameter) {
+static void rmt_install_task(void *pvParameter) {
rmt_install_state_t *state = pvParameter;
state->ret = rmt_driver_install(state->channel_id, 0, 0);
xSemaphoreGive(state->handle);
@@ -107,7 +107,7 @@ esp_err_t rmt_driver_install_core1(uint8_t channel_id) {
#endif
-STATIC mp_obj_t esp32_rmt_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t esp32_rmt_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = -1} },
{ MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -177,7 +177,7 @@ STATIC mp_obj_t esp32_rmt_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC void esp32_rmt_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void esp32_rmt_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
esp32_rmt_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->pin != -1) {
bool idle_output_en;
@@ -190,7 +190,7 @@ STATIC void esp32_rmt_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
}
}
-STATIC mp_obj_t esp32_rmt_deinit(mp_obj_t self_in) {
+static mp_obj_t esp32_rmt_deinit(mp_obj_t self_in) {
// fixme: check for valid channel. Return exception if error occurs.
esp32_rmt_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->pin != -1) { // Check if channel has already been deinitialised.
@@ -200,28 +200,28 @@ STATIC mp_obj_t esp32_rmt_deinit(mp_obj_t self_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_rmt_deinit_obj, esp32_rmt_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_rmt_deinit_obj, esp32_rmt_deinit);
// Return the source frequency.
// Currently only the APB clock (80MHz) can be used but it is possible other
// clock sources will added in the future.
-STATIC mp_obj_t esp32_rmt_source_freq() {
+static mp_obj_t esp32_rmt_source_freq() {
return mp_obj_new_int(APB_CLK_FREQ);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp32_rmt_source_freq_obj, esp32_rmt_source_freq);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(esp32_rmt_source_obj, MP_ROM_PTR(&esp32_rmt_source_freq_obj));
+static MP_DEFINE_CONST_FUN_OBJ_0(esp32_rmt_source_freq_obj, esp32_rmt_source_freq);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(esp32_rmt_source_obj, MP_ROM_PTR(&esp32_rmt_source_freq_obj));
// Return the clock divider.
-STATIC mp_obj_t esp32_rmt_clock_div(mp_obj_t self_in) {
+static mp_obj_t esp32_rmt_clock_div(mp_obj_t self_in) {
esp32_rmt_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(self->clock_div);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_rmt_clock_div_obj, esp32_rmt_clock_div);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_rmt_clock_div_obj, esp32_rmt_clock_div);
// Query whether the channel has finished sending pulses. Takes an optional
// timeout (in milliseconds), returning true if the pulse stream has
// completed or false if they are still transmitting (or timeout is reached).
-STATIC mp_obj_t esp32_rmt_wait_done(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t esp32_rmt_wait_done(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_self, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -235,9 +235,9 @@ STATIC mp_obj_t esp32_rmt_wait_done(size_t n_args, const mp_obj_t *pos_args, mp_
esp_err_t err = rmt_wait_tx_done(self->channel_id, args[1].u_int / portTICK_PERIOD_MS);
return err == ESP_OK ? mp_const_true : mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp32_rmt_wait_done_obj, 1, esp32_rmt_wait_done);
+static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_rmt_wait_done_obj, 1, esp32_rmt_wait_done);
-STATIC mp_obj_t esp32_rmt_loop(mp_obj_t self_in, mp_obj_t loop) {
+static mp_obj_t esp32_rmt_loop(mp_obj_t self_in, mp_obj_t loop) {
esp32_rmt_obj_t *self = MP_OBJ_TO_PTR(self_in);
self->loop_en = mp_obj_get_int(loop);
if (!self->loop_en) {
@@ -250,9 +250,9 @@ STATIC mp_obj_t esp32_rmt_loop(mp_obj_t self_in, mp_obj_t loop) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_rmt_loop_obj, esp32_rmt_loop);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp32_rmt_loop_obj, esp32_rmt_loop);
-STATIC mp_obj_t esp32_rmt_write_pulses(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp32_rmt_write_pulses(size_t n_args, const mp_obj_t *args) {
esp32_rmt_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_t duration_obj = args[1];
mp_obj_t data_obj = n_args > 2 ? args[2] : mp_const_true;
@@ -337,9 +337,9 @@ STATIC mp_obj_t esp32_rmt_write_pulses(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_rmt_write_pulses_obj, 2, 3, esp32_rmt_write_pulses);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_rmt_write_pulses_obj, 2, 3, esp32_rmt_write_pulses);
-STATIC mp_obj_t esp32_rmt_bitstream_channel(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp32_rmt_bitstream_channel(size_t n_args, const mp_obj_t *args) {
if (n_args > 0) {
if (args[0] == mp_const_none) {
esp32_rmt_bitstream_channel_id = -1;
@@ -357,10 +357,10 @@ STATIC mp_obj_t esp32_rmt_bitstream_channel(size_t n_args, const mp_obj_t *args)
return MP_OBJ_NEW_SMALL_INT(esp32_rmt_bitstream_channel_id);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_rmt_bitstream_channel_fun_obj, 0, 1, esp32_rmt_bitstream_channel);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(esp32_rmt_bitstream_channel_obj, MP_ROM_PTR(&esp32_rmt_bitstream_channel_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_rmt_bitstream_channel_fun_obj, 0, 1, esp32_rmt_bitstream_channel);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(esp32_rmt_bitstream_channel_obj, MP_ROM_PTR(&esp32_rmt_bitstream_channel_fun_obj));
-STATIC const mp_rom_map_elem_t esp32_rmt_locals_dict_table[] = {
+static const mp_rom_map_elem_t esp32_rmt_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&esp32_rmt_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&esp32_rmt_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_clock_div), MP_ROM_PTR(&esp32_rmt_clock_div_obj) },
@@ -377,7 +377,7 @@ STATIC const mp_rom_map_elem_t esp32_rmt_locals_dict_table[] = {
// Constants
{ MP_ROM_QSTR(MP_QSTR_PULSE_MAX), MP_ROM_INT(32767) },
};
-STATIC MP_DEFINE_CONST_DICT(esp32_rmt_locals_dict, esp32_rmt_locals_dict_table);
+static MP_DEFINE_CONST_DICT(esp32_rmt_locals_dict, esp32_rmt_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
esp32_rmt_type,
diff --git a/ports/esp32/esp32_ulp.c b/ports/esp32/esp32_ulp.c
index 97041c60bd..17d210952f 100644
--- a/ports/esp32/esp32_ulp.c
+++ b/ports/esp32/esp32_ulp.c
@@ -43,9 +43,9 @@ typedef struct _esp32_ulp_obj_t {
const mp_obj_type_t esp32_ulp_type;
// singleton ULP object
-STATIC const esp32_ulp_obj_t esp32_ulp_obj = {{&esp32_ulp_type}};
+static const esp32_ulp_obj_t esp32_ulp_obj = {{&esp32_ulp_type}};
-STATIC mp_obj_t esp32_ulp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t esp32_ulp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -53,7 +53,7 @@ STATIC mp_obj_t esp32_ulp_make_new(const mp_obj_type_t *type, size_t n_args, siz
return (mp_obj_t)&esp32_ulp_obj;
}
-STATIC mp_obj_t esp32_ulp_set_wakeup_period(mp_obj_t self_in, mp_obj_t period_index_in, mp_obj_t period_us_in) {
+static mp_obj_t esp32_ulp_set_wakeup_period(mp_obj_t self_in, mp_obj_t period_index_in, mp_obj_t period_us_in) {
mp_uint_t period_index = mp_obj_get_int(period_index_in);
mp_uint_t period_us = mp_obj_get_int(period_us_in);
int _errno = ulp_set_wakeup_period(period_index, period_us);
@@ -62,9 +62,9 @@ STATIC mp_obj_t esp32_ulp_set_wakeup_period(mp_obj_t self_in, mp_obj_t period_in
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp32_ulp_set_wakeup_period_obj, esp32_ulp_set_wakeup_period);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp32_ulp_set_wakeup_period_obj, esp32_ulp_set_wakeup_period);
-STATIC mp_obj_t esp32_ulp_load_binary(mp_obj_t self_in, mp_obj_t load_addr_in, mp_obj_t program_binary_in) {
+static mp_obj_t esp32_ulp_load_binary(mp_obj_t self_in, mp_obj_t load_addr_in, mp_obj_t program_binary_in) {
mp_uint_t load_addr = mp_obj_get_int(load_addr_in);
mp_buffer_info_t bufinfo;
@@ -76,9 +76,9 @@ STATIC mp_obj_t esp32_ulp_load_binary(mp_obj_t self_in, mp_obj_t load_addr_in, m
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp32_ulp_load_binary_obj, esp32_ulp_load_binary);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp32_ulp_load_binary_obj, esp32_ulp_load_binary);
-STATIC mp_obj_t esp32_ulp_run(mp_obj_t self_in, mp_obj_t entry_point_in) {
+static mp_obj_t esp32_ulp_run(mp_obj_t self_in, mp_obj_t entry_point_in) {
mp_uint_t entry_point = mp_obj_get_int(entry_point_in);
int _errno = ulp_run(entry_point / sizeof(uint32_t));
if (_errno != ESP_OK) {
@@ -86,15 +86,15 @@ STATIC mp_obj_t esp32_ulp_run(mp_obj_t self_in, mp_obj_t entry_point_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_ulp_run_obj, esp32_ulp_run);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp32_ulp_run_obj, esp32_ulp_run);
-STATIC const mp_rom_map_elem_t esp32_ulp_locals_dict_table[] = {
+static const mp_rom_map_elem_t esp32_ulp_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_set_wakeup_period), MP_ROM_PTR(&esp32_ulp_set_wakeup_period_obj) },
{ MP_ROM_QSTR(MP_QSTR_load_binary), MP_ROM_PTR(&esp32_ulp_load_binary_obj) },
{ MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&esp32_ulp_run_obj) },
{ MP_ROM_QSTR(MP_QSTR_RESERVE_MEM), MP_ROM_INT(CONFIG_ULP_COPROC_RESERVE_MEM) },
};
-STATIC MP_DEFINE_CONST_DICT(esp32_ulp_locals_dict, esp32_ulp_locals_dict_table);
+static MP_DEFINE_CONST_DICT(esp32_ulp_locals_dict, esp32_ulp_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
esp32_ulp_type,
diff --git a/ports/esp32/machine_adc.c b/ports/esp32/machine_adc.c
index b5233e4dda..0ac9f5d266 100644
--- a/ports/esp32/machine_adc.c
+++ b/ports/esp32/machine_adc.c
@@ -67,7 +67,7 @@
MICROPY_PY_MACHINE_ADC_CLASS_CONSTANTS_WIDTH_12 \
MICROPY_PY_MACHINE_ADC_CLASS_CONSTANTS_WIDTH_13 \
-STATIC const machine_adc_obj_t madc_obj[] = {
+static const machine_adc_obj_t madc_obj[] = {
#if CONFIG_IDF_TARGET_ESP32
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_0, GPIO_NUM_36},
{{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_1, GPIO_NUM_37},
@@ -121,7 +121,7 @@ STATIC const machine_adc_obj_t madc_obj[] = {
// These values are initialised to 0, which means the corresponding ADC channel is not initialised.
// The madc_atten_get/madc_atten_set functions store (atten+1) here so that the uninitialised state
// can be distinguished from the initialised state.
-STATIC uint8_t madc_obj_atten[MP_ARRAY_SIZE(madc_obj)];
+static uint8_t madc_obj_atten[MP_ARRAY_SIZE(madc_obj)];
static inline adc_atten_t madc_atten_get(const machine_adc_obj_t *self) {
uint8_t value = madc_obj_atten[self - &madc_obj[0]];
@@ -142,12 +142,12 @@ const machine_adc_obj_t *madc_search_helper(machine_adc_block_obj_t *block, adc_
return NULL;
}
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
const machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "ADC(Pin(%u), atten=%u)", self->gpio_id, madc_atten_get(self));
}
-STATIC void madc_atten_helper(const machine_adc_obj_t *self, mp_int_t atten) {
+static void madc_atten_helper(const machine_adc_obj_t *self, mp_int_t atten) {
esp_err_t err;
if (self->block->unit_id == ADC_UNIT_1) {
err = adc1_config_channel_atten(self->channel_id, atten);
@@ -180,11 +180,11 @@ void madc_init_helper(const machine_adc_obj_t *self, size_t n_pos_args, const mp
}
}
-STATIC void mp_machine_adc_init_helper(machine_adc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_adc_init_helper(machine_adc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
madc_init_helper(self, n_pos_args, pos_args, kw_args);
}
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) {
mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true);
gpio_num_t gpio_id = machine_pin_get_id(args[0]);
const machine_adc_obj_t *self = madc_search_helper(NULL, -1, gpio_id);
@@ -203,16 +203,16 @@ STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_pos_
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t mp_machine_adc_block(machine_adc_obj_t *self) {
+static mp_obj_t mp_machine_adc_block(machine_adc_obj_t *self) {
return MP_OBJ_FROM_PTR(self->block);
}
-STATIC mp_int_t mp_machine_adc_read(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read(machine_adc_obj_t *self) {
mp_int_t raw = madcblock_read_helper(self->block, self->channel_id);
return raw;
}
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
mp_uint_t raw = madcblock_read_helper(self->block, self->channel_id);
// Scale raw reading to 16 bit value using a Taylor expansion (for 8 <= bits <= 16)
mp_int_t bits = self->block->bits;
@@ -220,15 +220,15 @@ STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
return u16;
}
-STATIC mp_int_t mp_machine_adc_read_uv(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_uv(machine_adc_obj_t *self) {
adc_atten_t atten = madc_atten_get(self);
return madcblock_read_uv_helper(self->block, self->channel_id, atten);
}
-STATIC void mp_machine_adc_atten_set(machine_adc_obj_t *self, mp_int_t atten) {
+static void mp_machine_adc_atten_set(machine_adc_obj_t *self, mp_int_t atten) {
madc_atten_helper(self, atten);
}
-STATIC void mp_machine_adc_width_set(machine_adc_obj_t *self, mp_int_t width) {
+static void mp_machine_adc_width_set(machine_adc_obj_t *self, mp_int_t width) {
madcblock_bits_helper(self->block, width);
}
diff --git a/ports/esp32/machine_adc_block.c b/ports/esp32/machine_adc_block.c
index f2975ff2f2..c610233900 100644
--- a/ports/esp32/machine_adc_block.c
+++ b/ports/esp32/machine_adc_block.c
@@ -41,11 +41,11 @@ machine_adc_block_obj_t madcblock_obj[] = {
#endif
};
-STATIC void mp_machine_adc_block_print(const mp_print_t *print, machine_adc_block_obj_t *self) {
+static void mp_machine_adc_block_print(const mp_print_t *print, machine_adc_block_obj_t *self) {
mp_printf(print, "ADCBlock(%u, bits=%u)", self->unit_id, self->bits);
}
-STATIC void mp_machine_adc_block_bits_set(machine_adc_block_obj_t *self, mp_int_t bits) {
+static void mp_machine_adc_block_bits_set(machine_adc_block_obj_t *self, mp_int_t bits) {
if (bits != -1) {
madcblock_bits_helper(self, bits);
} else if (self->width == -1) {
@@ -53,7 +53,7 @@ STATIC void mp_machine_adc_block_bits_set(machine_adc_block_obj_t *self, mp_int_
}
}
-STATIC machine_adc_block_obj_t *mp_machine_adc_block_get(mp_int_t unit) {
+static machine_adc_block_obj_t *mp_machine_adc_block_get(mp_int_t unit) {
for (int i = 0; i < MP_ARRAY_SIZE(madcblock_obj); i++) {
if (unit == madcblock_obj[i].unit_id) {
return &madcblock_obj[i];
@@ -62,7 +62,7 @@ STATIC machine_adc_block_obj_t *mp_machine_adc_block_get(mp_int_t unit) {
return NULL;
}
-STATIC machine_adc_obj_t *mp_machine_adc_block_connect(machine_adc_block_obj_t *self, mp_int_t channel_id, mp_hal_pin_obj_t gpio_id, mp_map_t *kw_args) {
+static machine_adc_obj_t *mp_machine_adc_block_connect(machine_adc_block_obj_t *self, mp_int_t channel_id, mp_hal_pin_obj_t gpio_id, mp_map_t *kw_args) {
const machine_adc_obj_t *adc = madc_search_helper(self, channel_id, gpio_id);
if (adc == NULL) {
return NULL;
diff --git a/ports/esp32/machine_bitstream.c b/ports/esp32/machine_bitstream.c
index 87a5ae53cf..ceb1e6ad14 100644
--- a/ports/esp32/machine_bitstream.c
+++ b/ports/esp32/machine_bitstream.c
@@ -40,7 +40,7 @@
#define NS_TICKS_OVERHEAD (6)
// This is a translation of the cycle counter implementation in ports/stm32/machine_bitstream.c.
-STATIC void IRAM_ATTR machine_bitstream_high_low_bitbang(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len) {
+static void IRAM_ATTR machine_bitstream_high_low_bitbang(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len) {
uint32_t pin_mask, gpio_reg_set, gpio_reg_clear;
#if !CONFIG_IDF_TARGET_ESP32C3
if (pin >= 32) {
@@ -97,13 +97,13 @@ STATIC void IRAM_ATTR machine_bitstream_high_low_bitbang(mp_hal_pin_obj_t pin, u
// Logical 0 and 1 values (encoded as a rmt_item32_t).
// The duration fields will be set later.
-STATIC rmt_item32_t bitstream_high_low_0 = {{{ 0, 1, 0, 0 }}};
-STATIC rmt_item32_t bitstream_high_low_1 = {{{ 0, 1, 0, 0 }}};
+static rmt_item32_t bitstream_high_low_0 = {{{ 0, 1, 0, 0 }}};
+static rmt_item32_t bitstream_high_low_1 = {{{ 0, 1, 0, 0 }}};
// See https://github.com/espressif/esp-idf/blob/master/examples/common_components/led_strip/led_strip_rmt_ws2812.c
// This is called automatically by the IDF during rmt_write_sample in order to
// convert the byte stream to rmt_item32_t's.
-STATIC void IRAM_ATTR bitstream_high_low_rmt_adapter(const void *src, rmt_item32_t *dest, size_t src_size, size_t wanted_num, size_t *translated_size, size_t *item_num) {
+static void IRAM_ATTR bitstream_high_low_rmt_adapter(const void *src, rmt_item32_t *dest, size_t src_size, size_t wanted_num, size_t *translated_size, size_t *item_num) {
if (src == NULL || dest == NULL) {
*translated_size = 0;
*item_num = 0;
@@ -134,7 +134,7 @@ STATIC void IRAM_ATTR bitstream_high_low_rmt_adapter(const void *src, rmt_item32
}
// Use the reserved RMT channel to stream high/low data on the specified pin.
-STATIC void machine_bitstream_high_low_rmt(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len, uint8_t channel_id) {
+static void machine_bitstream_high_low_rmt(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len, uint8_t channel_id) {
rmt_config_t config = RMT_DEFAULT_CONFIG_TX(pin, channel_id);
// Use 40MHz clock (although 2MHz would probably be sufficient).
diff --git a/ports/esp32/machine_dac.c b/ports/esp32/machine_dac.c
index 34f51cc521..3d1d2df808 100644
--- a/ports/esp32/machine_dac.c
+++ b/ports/esp32/machine_dac.c
@@ -51,7 +51,7 @@ typedef struct _mdac_obj_t {
#endif
} mdac_obj_t;
-STATIC mdac_obj_t mdac_obj[] = {
+static mdac_obj_t mdac_obj[] = {
#if CONFIG_IDF_TARGET_ESP32
{{&machine_dac_type}, GPIO_NUM_25, DAC_CHAN_0},
{{&machine_dac_type}, GPIO_NUM_26, DAC_CHAN_1},
@@ -61,7 +61,7 @@ STATIC mdac_obj_t mdac_obj[] = {
#endif
};
-STATIC mp_obj_t mdac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
+static mp_obj_t mdac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, true);
@@ -94,12 +94,12 @@ STATIC mp_obj_t mdac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
#endif
}
-STATIC void mdac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mdac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mdac_obj_t *self = self_in;
mp_printf(print, "DAC(Pin(%u))", self->gpio_id);
}
-STATIC mp_obj_t mdac_write(mp_obj_t self_in, mp_obj_t value_in) {
+static mp_obj_t mdac_write(mp_obj_t self_in, mp_obj_t value_in) {
mdac_obj_t *self = self_in;
int value = mp_obj_get_int(value_in);
if (value < 0 || value > 255) {
@@ -119,11 +119,11 @@ STATIC mp_obj_t mdac_write(mp_obj_t self_in, mp_obj_t value_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mdac_write_obj, mdac_write);
-STATIC const mp_rom_map_elem_t mdac_locals_dict_table[] = {
+static const mp_rom_map_elem_t mdac_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mdac_write_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mdac_locals_dict, mdac_locals_dict_table);
+static MP_DEFINE_CONST_DICT(mdac_locals_dict, mdac_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_dac_type,
diff --git a/ports/esp32/machine_hw_spi.c b/ports/esp32/machine_hw_spi.c
index 06e9ec3c82..a0531b95f8 100644
--- a/ports/esp32/machine_hw_spi.c
+++ b/ports/esp32/machine_hw_spi.c
@@ -111,7 +111,7 @@ typedef struct _machine_hw_spi_obj_t {
} machine_hw_spi_obj_t;
// Default pin mappings for the hardware SPI instances
-STATIC const machine_hw_spi_default_pins_t machine_hw_spi_default_pins[MICROPY_HW_SPI_MAX] = {
+static const machine_hw_spi_default_pins_t machine_hw_spi_default_pins[MICROPY_HW_SPI_MAX] = {
{ .pins = { .sck = MICROPY_HW_SPI1_SCK, .mosi = MICROPY_HW_SPI1_MOSI, .miso = MICROPY_HW_SPI1_MISO }},
#ifdef MICROPY_HW_SPI2_SCK
{ .pins = { .sck = MICROPY_HW_SPI2_SCK, .mosi = MICROPY_HW_SPI2_MOSI, .miso = MICROPY_HW_SPI2_MISO }},
@@ -133,9 +133,9 @@ static const mp_arg_t spi_allowed_args[] = {
};
// Static objects mapping to SPI2 (and SPI3 if available) hardware peripherals.
-STATIC machine_hw_spi_obj_t machine_hw_spi_obj[MICROPY_HW_SPI_MAX];
+static machine_hw_spi_obj_t machine_hw_spi_obj[MICROPY_HW_SPI_MAX];
-STATIC void machine_hw_spi_deinit_internal(machine_hw_spi_obj_t *self) {
+static void machine_hw_spi_deinit_internal(machine_hw_spi_obj_t *self) {
switch (spi_bus_remove_device(self->spi)) {
case ESP_ERR_INVALID_ARG:
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("invalid configuration"));
@@ -167,7 +167,7 @@ STATIC void machine_hw_spi_deinit_internal(machine_hw_spi_obj_t *self) {
}
}
-STATIC void machine_hw_spi_init_internal(machine_hw_spi_obj_t *self, mp_arg_val_t args[]) {
+static void machine_hw_spi_init_internal(machine_hw_spi_obj_t *self, mp_arg_val_t args[]) {
// if we're not initialized, then we're
// implicitly 'changed', since this is the init routine
@@ -292,7 +292,7 @@ STATIC void machine_hw_spi_init_internal(machine_hw_spi_obj_t *self, mp_arg_val_
self->state = MACHINE_HW_SPI_STATE_INIT;
}
-STATIC void machine_hw_spi_deinit(mp_obj_base_t *self_in) {
+static void machine_hw_spi_deinit(mp_obj_base_t *self_in) {
machine_hw_spi_obj_t *self = (machine_hw_spi_obj_t *)self_in;
if (self->state == MACHINE_HW_SPI_STATE_INIT) {
self->state = MACHINE_HW_SPI_STATE_DEINIT;
@@ -300,7 +300,7 @@ STATIC void machine_hw_spi_deinit(mp_obj_base_t *self_in) {
}
}
-STATIC mp_uint_t gcd(mp_uint_t x, mp_uint_t y) {
+static mp_uint_t gcd(mp_uint_t x, mp_uint_t y) {
while (x != y) {
if (x > y) {
x -= y;
@@ -311,7 +311,7 @@ STATIC mp_uint_t gcd(mp_uint_t x, mp_uint_t y) {
return x;
}
-STATIC void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
machine_hw_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->state == MACHINE_HW_SPI_STATE_DEINIT) {
@@ -389,7 +389,7 @@ STATIC void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const ui
/******************************************************************************/
// MicroPython bindings for hw_spi
-STATIC void machine_hw_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hw_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hw_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "SPI(id=%u, baudrate=%u, polarity=%u, phase=%u, bits=%u, firstbit=%u, sck=%d, mosi=%d, miso=%d)",
self->host, self->baudrate, self->polarity,
@@ -401,7 +401,7 @@ STATIC void machine_hw_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_p
// into all the u_int fields.
// The behavior is slightly different for a new call vs an init method on an existing object.
// Unspecified arguments for new will use defaults, for init they keep the existing value.
-STATIC void machine_hw_spi_argcheck(mp_arg_val_t args[], const machine_hw_spi_default_pins_t *default_pins) {
+static void machine_hw_spi_argcheck(mp_arg_val_t args[], const machine_hw_spi_default_pins_t *default_pins) {
// A non-NULL default_pins argument will trigger the "use default" behavior.
// Replace pin args with default/current values for new vs init call, respectively
for (int i = ARG_sck; i <= ARG_miso; i++) {
@@ -415,7 +415,7 @@ STATIC void machine_hw_spi_argcheck(mp_arg_val_t args[], const machine_hw_spi_de
}
}
-STATIC void machine_hw_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_hw_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_hw_spi_obj_t *self = (machine_hw_spi_obj_t *)self_in;
mp_arg_val_t args[MP_ARRAY_SIZE(spi_allowed_args)];
@@ -465,7 +465,7 @@ spi_host_device_t machine_hw_spi_get_host(mp_obj_t in) {
return self->host;
}
-STATIC const mp_machine_spi_p_t machine_hw_spi_p = {
+static const mp_machine_spi_p_t machine_hw_spi_p = {
.init = machine_hw_spi_init,
.deinit = machine_hw_spi_deinit,
.transfer = machine_hw_spi_transfer,
diff --git a/ports/esp32/machine_i2c.c b/ports/esp32/machine_i2c.c
index f4cfa58166..fe42d2e8c2 100755
--- a/ports/esp32/machine_i2c.c
+++ b/ports/esp32/machine_i2c.c
@@ -66,9 +66,9 @@ typedef struct _machine_hw_i2c_obj_t {
gpio_num_t sda : 8;
} machine_hw_i2c_obj_t;
-STATIC machine_hw_i2c_obj_t machine_hw_i2c_obj[I2C_NUM_MAX];
+static machine_hw_i2c_obj_t machine_hw_i2c_obj[I2C_NUM_MAX];
-STATIC void machine_hw_i2c_init(machine_hw_i2c_obj_t *self, uint32_t freq, uint32_t timeout_us, bool first_init) {
+static void machine_hw_i2c_init(machine_hw_i2c_obj_t *self, uint32_t freq, uint32_t timeout_us, bool first_init) {
if (!first_init) {
i2c_driver_delete(self->port);
}
@@ -137,7 +137,7 @@ int machine_hw_i2c_transfer(mp_obj_base_t *self_in, uint16_t addr, size_t n, mp_
/******************************************************************************/
// MicroPython bindings for machine API
-STATIC void machine_hw_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hw_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hw_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
int h, l;
i2c_get_period(self->port, &h, &l);
@@ -198,7 +198,7 @@ mp_obj_t machine_hw_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(self);
}
-STATIC const mp_machine_i2c_p_t machine_hw_i2c_p = {
+static const mp_machine_i2c_p_t machine_hw_i2c_p = {
.transfer_supports_write1 = true,
.transfer = machine_hw_i2c_transfer,
};
diff --git a/ports/esp32/machine_i2s.c b/ports/esp32/machine_i2s.c
index 3b7bcfeffc..574125ad6a 100644
--- a/ports/esp32/machine_i2s.c
+++ b/ports/esp32/machine_i2s.c
@@ -81,12 +81,12 @@ typedef struct _machine_i2s_obj_t {
TaskHandle_t non_blocking_mode_task;
} machine_i2s_obj_t;
-STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
+static mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
// The frame map is used with the readinto() method to transform the audio sample data coming
// from DMA memory (32-bit stereo, with the L and R channels reversed) to the format specified
// in the I2S constructor. e.g. 16-bit mono
-STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
+static const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
{ 6, 7, -1, -1, -1, -1, -1, -1 }, // Mono, 16-bits
{ 4, 5, 6, 7, -1, -1, -1, -1 }, // Mono, 32-bits
{ 6, 7, 2, 3, -1, -1, -1, -1 }, // Stereo, 16-bits
@@ -122,7 +122,7 @@ void machine_i2s_init0() {
// samples in appbuf are in little endian format:
// 0x77 is the most significant byte of the 32-bit sample
// 0x44 is the least significant byte of the 32-bit sample
-STATIC void swap_32_bit_stereo_channels(mp_buffer_info_t *bufinfo) {
+static void swap_32_bit_stereo_channels(mp_buffer_info_t *bufinfo) {
int32_t swap_sample;
int32_t *sample = bufinfo->buf;
uint32_t num_samples = bufinfo->len / 4;
@@ -133,7 +133,7 @@ STATIC void swap_32_bit_stereo_channels(mp_buffer_info_t *bufinfo) {
}
}
-STATIC int8_t get_frame_mapping_index(i2s_bits_per_sample_t bits, format_t format) {
+static int8_t get_frame_mapping_index(i2s_bits_per_sample_t bits, format_t format) {
if (format == MONO) {
if (bits == I2S_BITS_PER_SAMPLE_16BIT) {
return 0;
@@ -149,7 +149,7 @@ STATIC int8_t get_frame_mapping_index(i2s_bits_per_sample_t bits, format_t forma
}
}
-STATIC i2s_bits_per_sample_t get_dma_bits(uint8_t mode, i2s_bits_per_sample_t bits) {
+static i2s_bits_per_sample_t get_dma_bits(uint8_t mode, i2s_bits_per_sample_t bits) {
if (mode == (I2S_MODE_MASTER | I2S_MODE_TX)) {
return bits;
} else { // Master Rx
@@ -158,7 +158,7 @@ STATIC i2s_bits_per_sample_t get_dma_bits(uint8_t mode, i2s_bits_per_sample_t bi
}
}
-STATIC i2s_channel_fmt_t get_dma_format(uint8_t mode, format_t format) {
+static i2s_channel_fmt_t get_dma_format(uint8_t mode, format_t format) {
if (mode == (I2S_MODE_MASTER | I2S_MODE_TX)) {
if (format == MONO) {
return I2S_CHANNEL_FMT_ONLY_LEFT;
@@ -171,7 +171,7 @@ STATIC i2s_channel_fmt_t get_dma_format(uint8_t mode, format_t format) {
}
}
-STATIC uint32_t get_dma_buf_count(uint8_t mode, i2s_bits_per_sample_t bits, format_t format, int32_t ibuf) {
+static uint32_t get_dma_buf_count(uint8_t mode, i2s_bits_per_sample_t bits, format_t format, int32_t ibuf) {
// calculate how many DMA buffers need to be allocated
uint32_t dma_frame_size_in_bytes =
(get_dma_bits(mode, bits) / 8) * (get_dma_format(mode, format) == I2S_CHANNEL_FMT_RIGHT_LEFT ? 2: 1);
@@ -181,7 +181,7 @@ STATIC uint32_t get_dma_buf_count(uint8_t mode, i2s_bits_per_sample_t bits, form
return dma_buf_count;
}
-STATIC uint32_t fill_appbuf_from_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
+static uint32_t fill_appbuf_from_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
// copy audio samples from DMA memory to the app buffer
// audio samples are read from DMA memory in chunks
@@ -256,7 +256,7 @@ STATIC uint32_t fill_appbuf_from_dma(machine_i2s_obj_t *self, mp_buffer_info_t *
return a_index;
}
-STATIC size_t copy_appbuf_to_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
+static size_t copy_appbuf_to_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) {
if ((self->bits == I2S_BITS_PER_SAMPLE_32BIT) && (self->format == STEREO)) {
swap_32_bit_stereo_channels(appbuf);
}
@@ -289,7 +289,7 @@ STATIC size_t copy_appbuf_to_dma(machine_i2s_obj_t *self, mp_buffer_info_t *appb
}
// FreeRTOS task used for non-blocking mode
-STATIC void task_for_non_blocking_mode(void *self_in) {
+static void task_for_non_blocking_mode(void *self_in) {
machine_i2s_obj_t *self = (machine_i2s_obj_t *)self_in;
non_blocking_descriptor_t descriptor;
@@ -306,7 +306,7 @@ STATIC void task_for_non_blocking_mode(void *self_in) {
}
}
-STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
+static void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
// are Pins valid?
int8_t sck = args[ARG_sck].u_obj == MP_OBJ_NULL ? -1 : machine_pin_get_id(args[ARG_sck].u_obj);
int8_t ws = args[ARG_ws].u_obj == MP_OBJ_NULL ? -1 : machine_pin_get_id(args[ARG_ws].u_obj);
@@ -398,7 +398,7 @@ STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *ar
check_esp_err(i2s_set_pin(self->i2s_id, &pin_config));
}
-STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
+static machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
if (i2s_id < 0 || i2s_id >= I2S_NUM_AUTO) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid id"));
}
@@ -416,7 +416,7 @@ STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
return self;
}
-STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
i2s_driver_uninstall(self->i2s_id);
if (self->non_blocking_mode_task != NULL) {
@@ -432,7 +432,7 @@ STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
self->i2s_event_queue = NULL;
}
-STATIC void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
if (self->io_mode == NON_BLOCKING) {
// create a queue linking the MicroPython task to a FreeRTOS task
// that manages the non blocking mode of operation
diff --git a/ports/esp32/machine_pin.c b/ports/esp32/machine_pin.c
index 34c6512c8d..1e7b86baeb 100644
--- a/ports/esp32/machine_pin.c
+++ b/ports/esp32/machine_pin.c
@@ -63,7 +63,7 @@
// Return the machine_pin_obj_t pointer corresponding to a machine_pin_irq_obj_t pointer.
#define PIN_OBJ_PTR_FROM_IRQ_OBJ_PTR(self) ((machine_pin_obj_t *)((uintptr_t)(self) - offsetof(machine_pin_obj_t, irq)))
-STATIC const machine_pin_obj_t *machine_pin_find_named(const mp_obj_dict_t *named_pins, mp_obj_t name) {
+static const machine_pin_obj_t *machine_pin_find_named(const mp_obj_dict_t *named_pins, mp_obj_t name) {
const mp_map_t *named_map = &named_pins->map;
mp_map_elem_t *named_elem = mp_map_lookup((mp_map_t *)named_map, name, MP_MAP_LOOKUP);
if (named_elem != NULL && named_elem->value != NULL) {
@@ -89,14 +89,14 @@ void machine_pins_deinit(void) {
}
}
-STATIC void machine_pin_isr_handler(void *arg) {
+static void machine_pin_isr_handler(void *arg) {
machine_pin_obj_t *self = arg;
mp_obj_t handler = MP_STATE_PORT(machine_pin_irq_handler)[PIN_OBJ_PTR_INDEX(self)];
mp_sched_schedule(handler, MP_OBJ_FROM_PTR(self));
mp_hal_wake_main_task_from_isr();
}
-STATIC const machine_pin_obj_t *machine_pin_find(mp_obj_t pin_in) {
+static const machine_pin_obj_t *machine_pin_find(mp_obj_t pin_in) {
if (mp_obj_is_type(pin_in, &machine_pin_type)) {
return pin_in;
}
@@ -128,13 +128,13 @@ gpio_num_t machine_pin_get_id(mp_obj_t pin_in) {
return PIN_OBJ_PTR_INDEX(self);
}
-STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pin_obj_t *self = self_in;
mp_printf(print, "Pin(%u)", PIN_OBJ_PTR_INDEX(self));
}
// pin.init(mode=None, pull=-1, *, value, drive, hold)
-STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_pull, ARG_value, ARG_drive, ARG_hold };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = mp_const_none}},
@@ -241,7 +241,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
}
// fast method for getting/setting pin value
-STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
machine_pin_obj_t *self = self_in;
gpio_num_t index = PIN_OBJ_PTR_INDEX(self);
@@ -256,35 +256,35 @@ STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, c
}
// pin.init(mode, pull)
-STATIC mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_init_obj, 1, machine_pin_obj_init);
// pin.value([value])
-STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
return machine_pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
// pin.off()
-STATIC mp_obj_t machine_pin_off(mp_obj_t self_in) {
+static mp_obj_t machine_pin_off(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
gpio_set_level(PIN_OBJ_PTR_INDEX(self), 0);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_off_obj, machine_pin_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_off_obj, machine_pin_off);
// pin.on()
-STATIC mp_obj_t machine_pin_on(mp_obj_t self_in) {
+static mp_obj_t machine_pin_on(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
gpio_set_level(PIN_OBJ_PTR_INDEX(self), 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_on_obj, machine_pin_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_on_obj, machine_pin_on);
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING)
-STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_wake };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -347,7 +347,7 @@ STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
// return the irq object
return MP_OBJ_FROM_PTR(&self->irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_board_pins_obj_type,
@@ -356,7 +356,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &machine_pin_board_pins_locals_dict
);
-STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&machine_pin_value_obj) },
@@ -383,7 +383,7 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_DRIVE_3), MP_ROM_INT(GPIO_DRIVE_CAP_3) },
};
-STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_pin_obj_t *self = self_in;
gpio_num_t index = PIN_OBJ_PTR_INDEX(self);
@@ -400,9 +400,9 @@ STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, i
return -1;
}
-STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
-STATIC const mp_pin_p_t pin_pin_p = {
+static const mp_pin_p_t pin_pin_p = {
.ioctl = pin_ioctl,
};
@@ -420,14 +420,14 @@ MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
// Pin IRQ object
-STATIC mp_obj_t machine_pin_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_pin_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
machine_pin_irq_obj_t *self = self_in;
mp_arg_check_num(n_args, n_kw, 0, 0, false);
machine_pin_isr_handler((void *)PIN_OBJ_PTR_FROM_IRQ_OBJ_PTR(self));
return mp_const_none;
}
-STATIC mp_obj_t machine_pin_irq_trigger(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pin_irq_trigger(size_t n_args, const mp_obj_t *args) {
machine_pin_irq_obj_t *self = args[0];
gpio_num_t index = PIN_OBJ_PTR_INDEX(PIN_OBJ_PTR_FROM_IRQ_OBJ_PTR(self));
uint32_t orig_trig = GPIO.pin[index].int_type;
@@ -438,12 +438,12 @@ STATIC mp_obj_t machine_pin_irq_trigger(size_t n_args, const mp_obj_t *args) {
// return original trigger value
return MP_OBJ_NEW_SMALL_INT(orig_trig);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_irq_trigger_obj, 1, 2, machine_pin_irq_trigger);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_irq_trigger_obj, 1, 2, machine_pin_irq_trigger);
-STATIC const mp_rom_map_elem_t machine_pin_irq_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pin_irq_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_trigger), MP_ROM_PTR(&machine_pin_irq_trigger_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_pin_irq_locals_dict, machine_pin_irq_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pin_irq_locals_dict, machine_pin_irq_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_pin_irq_type,
diff --git a/ports/esp32/machine_pwm.c b/ports/esp32/machine_pwm.c
index 03ef2d77fd..e5d8986c8a 100644
--- a/ports/esp32/machine_pwm.c
+++ b/ports/esp32/machine_pwm.c
@@ -52,7 +52,7 @@ typedef struct _chan_t {
} chan_t;
// List of PWM channels
-STATIC chan_t chans[PWM_CHANNEL_MAX];
+static chan_t chans[PWM_CHANNEL_MAX];
// channel_idx is an index (end-to-end sequential numbering) for all channels
// available on the chip and described in chans[]
@@ -64,7 +64,7 @@ STATIC chan_t chans[PWM_CHANNEL_MAX];
#define PWM_TIMER_MAX (LEDC_SPEED_MODE_MAX * LEDC_TIMER_MAX)
// List of timer configs
-STATIC ledc_timer_config_t timers[PWM_TIMER_MAX];
+static ledc_timer_config_t timers[PWM_TIMER_MAX];
// timer_idx is an index (end-to-end sequential numbering) for all timers
// available on the chip and configured in timers[]
@@ -104,7 +104,7 @@ STATIC ledc_timer_config_t timers[PWM_TIMER_MAX];
#endif
// Config of timer upon which we run all PWM'ed GPIO pins
-STATIC bool pwm_inited = false;
+static bool pwm_inited = false;
// MicroPython PWM object struct
typedef struct _machine_pwm_obj_t {
@@ -120,12 +120,12 @@ typedef struct _machine_pwm_obj_t {
int duty_ns; // - / -
} machine_pwm_obj_t;
-STATIC bool is_timer_in_use(int current_channel_idx, int timer_idx);
-STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty);
-STATIC void set_duty_u10(machine_pwm_obj_t *self, int duty);
-STATIC void set_duty_ns(machine_pwm_obj_t *self, int ns);
+static bool is_timer_in_use(int current_channel_idx, int timer_idx);
+static void set_duty_u16(machine_pwm_obj_t *self, int duty);
+static void set_duty_u10(machine_pwm_obj_t *self, int duty);
+static void set_duty_ns(machine_pwm_obj_t *self, int ns);
-STATIC void pwm_init(void) {
+static void pwm_init(void) {
// Initial condition: no channels assigned
for (int i = 0; i < PWM_CHANNEL_MAX; ++i) {
chans[i].pin = -1;
@@ -145,7 +145,7 @@ STATIC void pwm_init(void) {
}
// Deinit channel and timer if the timer is unused
-STATIC void pwm_deinit(int channel_idx) {
+static void pwm_deinit(int channel_idx) {
// Valid channel?
if ((channel_idx >= 0) && (channel_idx < PWM_CHANNEL_MAX)) {
// Clean up timer if necessary
@@ -193,7 +193,7 @@ void machine_pwm_deinit_all(void) {
}
}
-STATIC void configure_channel(machine_pwm_obj_t *self) {
+static void configure_channel(machine_pwm_obj_t *self) {
ledc_channel_config_t cfg = {
.channel = self->channel,
.duty = (1 << (timers[TIMER_IDX(self->mode, self->timer)].duty_resolution)) / 2,
@@ -207,7 +207,7 @@ STATIC void configure_channel(machine_pwm_obj_t *self) {
}
}
-STATIC void set_freq(machine_pwm_obj_t *self, unsigned int freq, ledc_timer_config_t *timer) {
+static void set_freq(machine_pwm_obj_t *self, unsigned int freq, ledc_timer_config_t *timer) {
if (freq != timer->freq_hz) {
// Find the highest bit resolution for the requested frequency
unsigned int i = APB_CLK_FREQ; // 80 MHz
@@ -274,7 +274,7 @@ STATIC void set_freq(machine_pwm_obj_t *self, unsigned int freq, ledc_timer_conf
}
// Calculate the duty parameters based on an ns value
-STATIC int ns_to_duty(machine_pwm_obj_t *self, int ns) {
+static int ns_to_duty(machine_pwm_obj_t *self, int ns) {
ledc_timer_config_t timer = timers[TIMER_IDX(self->mode, self->timer)];
int64_t duty = ((int64_t)ns * UI_MAX_DUTY * timer.freq_hz + 500000000LL) / 1000000000LL;
if ((ns > 0) && (duty == 0)) {
@@ -285,7 +285,7 @@ STATIC int ns_to_duty(machine_pwm_obj_t *self, int ns) {
return duty;
}
-STATIC int duty_to_ns(machine_pwm_obj_t *self, int duty) {
+static int duty_to_ns(machine_pwm_obj_t *self, int duty) {
ledc_timer_config_t timer = timers[TIMER_IDX(self->mode, self->timer)];
int64_t ns = ((int64_t)duty * 1000000000LL + (int64_t)timer.freq_hz * UI_MAX_DUTY / 2) / ((int64_t)timer.freq_hz * UI_MAX_DUTY);
return ns;
@@ -293,13 +293,13 @@ STATIC int duty_to_ns(machine_pwm_obj_t *self, int duty) {
#define get_duty_raw(self) ledc_get_duty(self->mode, self->channel)
-STATIC void pwm_is_active(machine_pwm_obj_t *self) {
+static void pwm_is_active(machine_pwm_obj_t *self) {
if (self->active == false) {
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("PWM inactive"));
}
}
-STATIC uint32_t get_duty_u16(machine_pwm_obj_t *self) {
+static uint32_t get_duty_u16(machine_pwm_obj_t *self) {
pwm_is_active(self);
int resolution = timers[TIMER_IDX(self->mode, self->timer)].duty_resolution;
int duty = ledc_get_duty(self->mode, self->channel);
@@ -311,17 +311,17 @@ STATIC uint32_t get_duty_u16(machine_pwm_obj_t *self) {
return duty;
}
-STATIC uint32_t get_duty_u10(machine_pwm_obj_t *self) {
+static uint32_t get_duty_u10(machine_pwm_obj_t *self) {
pwm_is_active(self);
return get_duty_u16(self) >> 6; // Scale down from 16 bit to 10 bit resolution
}
-STATIC uint32_t get_duty_ns(machine_pwm_obj_t *self) {
+static uint32_t get_duty_ns(machine_pwm_obj_t *self) {
pwm_is_active(self);
return duty_to_ns(self, get_duty_u16(self));
}
-STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) {
+static void set_duty_u16(machine_pwm_obj_t *self, int duty) {
pwm_is_active(self);
if ((duty < 0) || (duty > UI_MAX_DUTY)) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty_u16 must be from 0 to %d"), UI_MAX_DUTY);
@@ -360,7 +360,7 @@ STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) {
self->duty_u16 = duty;
}
-STATIC void set_duty_u10(machine_pwm_obj_t *self, int duty) {
+static void set_duty_u10(machine_pwm_obj_t *self, int duty) {
pwm_is_active(self);
if ((duty < 0) || (duty > MAX_DUTY_U10)) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty must be from 0 to %u"), MAX_DUTY_U10);
@@ -370,7 +370,7 @@ STATIC void set_duty_u10(machine_pwm_obj_t *self, int duty) {
self->duty_u10 = duty;
}
-STATIC void set_duty_ns(machine_pwm_obj_t *self, int ns) {
+static void set_duty_ns(machine_pwm_obj_t *self, int ns) {
pwm_is_active(self);
if ((ns < 0) || (ns > duty_to_ns(self, UI_MAX_DUTY))) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty_ns must be from 0 to %d ns"), duty_to_ns(self, UI_MAX_DUTY));
@@ -387,7 +387,7 @@ STATIC void set_duty_ns(machine_pwm_obj_t *self, int ns) {
#define ANY_MODE (-1)
// Return timer_idx. Use TIMER_IDX_TO_MODE(timer_idx) and TIMER_IDX_TO_TIMER(timer_idx) to get mode and timer
-STATIC int find_timer(unsigned int freq, bool same_freq_only, int mode) {
+static int find_timer(unsigned int freq, bool same_freq_only, int mode) {
int free_timer_idx_found = -1;
// Find a free PWM Timer using the same freq
for (int timer_idx = 0; timer_idx < PWM_TIMER_MAX; ++timer_idx) {
@@ -407,7 +407,7 @@ STATIC int find_timer(unsigned int freq, bool same_freq_only, int mode) {
}
// Return true if the timer is in use in addition to current channel
-STATIC bool is_timer_in_use(int current_channel_idx, int timer_idx) {
+static bool is_timer_in_use(int current_channel_idx, int timer_idx) {
for (int i = 0; i < PWM_CHANNEL_MAX; ++i) {
if ((i != current_channel_idx) && (chans[i].timer_idx == timer_idx)) {
return true;
@@ -419,7 +419,7 @@ STATIC bool is_timer_in_use(int current_channel_idx, int timer_idx) {
// Find a free PWM channel, also spot if our pin is already mentioned.
// Return channel_idx. Use CHANNEL_IDX_TO_MODE(channel_idx) and CHANNEL_IDX_TO_CHANNEL(channel_idx) to get mode and channel
-STATIC int find_channel(int pin, int mode) {
+static int find_channel(int pin, int mode) {
int avail_idx = -1;
int channel_idx;
for (channel_idx = 0; channel_idx < PWM_CHANNEL_MAX; ++channel_idx) {
@@ -441,7 +441,7 @@ STATIC int find_channel(int pin, int mode) {
/******************************************************************************/
// MicroPython bindings for PWM
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "PWM(Pin(%u)", self->pin);
if (self->active) {
@@ -465,7 +465,7 @@ STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_p
}
// This called from pwm.init() method
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq, ARG_duty, ARG_duty_u16, ARG_duty_ns };
static const mp_arg_t allowed_args[] = {
@@ -563,7 +563,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
}
// This called from PWM() constructor
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type,
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type,
size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 2, true);
gpio_num_t pin_id = machine_pin_get_id(args[0]);
@@ -592,7 +592,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type,
}
// This called from pwm.deinit() method
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
int channel_idx = CHANNEL_IDX(self->mode, self->channel);
pwm_deinit(channel_idx);
self->active = false;
@@ -604,12 +604,12 @@ STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
// Set and get methods of PWM class
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
pwm_is_active(self);
return MP_OBJ_NEW_SMALL_INT(ledc_get_freq(self->mode, self->timer));
}
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
pwm_is_active(self);
if ((freq <= 0) || (freq > 40000000)) {
mp_raise_ValueError(MP_ERROR_TEXT("frequency must be from 1Hz to 40MHz"));
@@ -658,26 +658,26 @@ STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
set_freq(self, freq, &timers[current_timer_idx]);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT(get_duty_u10(self));
}
-STATIC void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
set_duty_u10(self, duty);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT(get_duty_u16(self));
}
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
set_duty_u16(self, duty_u16);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT(get_duty_ns(self));
}
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
set_duty_ns(self, duty_ns);
}
diff --git a/ports/esp32/machine_rtc.c b/ports/esp32/machine_rtc.c
index cbbfb4b84c..087ba9d69e 100644
--- a/ports/esp32/machine_rtc.c
+++ b/ports/esp32/machine_rtc.c
@@ -79,14 +79,14 @@ _USER_MEM_ATTR uint8_t rtc_user_mem_data[MICROPY_HW_RTC_USER_MEM_MAX];
#undef _USER_MEM_ATTR
// singleton RTC object
-STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
+static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
machine_rtc_config_t machine_rtc_config = {
.ext1_pins = 0,
.ext0_pin = -1
};
-STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -101,7 +101,7 @@ STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, s
return (mp_obj_t)&machine_rtc_obj;
}
-STATIC mp_obj_t machine_rtc_datetime_helper(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_datetime_helper(mp_uint_t n_args, const mp_obj_t *args) {
if (n_args == 1) {
// Get time
@@ -138,21 +138,21 @@ STATIC mp_obj_t machine_rtc_datetime_helper(mp_uint_t n_args, const mp_obj_t *ar
return mp_const_none;
}
}
-STATIC mp_obj_t machine_rtc_datetime(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_datetime(size_t n_args, const mp_obj_t *args) {
return machine_rtc_datetime_helper(n_args, args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
-STATIC mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) {
+static mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) {
mp_obj_t args[2] = {self_in, date};
machine_rtc_datetime_helper(2, args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init);
#if MICROPY_HW_RTC_USER_MEM_MAX > 0
-STATIC mp_obj_t machine_rtc_memory(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_memory(size_t n_args, const mp_obj_t *args) {
if (n_args == 1) {
// read RTC memory
uint8_t rtcram[MICROPY_HW_RTC_USER_MEM_MAX];
@@ -171,17 +171,17 @@ STATIC mp_obj_t machine_rtc_memory(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_memory_obj, 1, 2, machine_rtc_memory);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_memory_obj, 1, 2, machine_rtc_memory);
#endif
-STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_rtc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) },
#if MICROPY_HW_RTC_USER_MEM_MAX > 0
{ MP_ROM_QSTR(MP_QSTR_memory), MP_ROM_PTR(&machine_rtc_memory_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
diff --git a/ports/esp32/machine_sdcard.c b/ports/esp32/machine_sdcard.c
index 8cc6452ddc..92c6e64698 100644
--- a/ports/esp32/machine_sdcard.c
+++ b/ports/esp32/machine_sdcard.c
@@ -135,7 +135,7 @@ static const sdspi_device_config_t spi_dev_defaults[2] = {
if (arg_vals[arg_id].u_obj != mp_const_none) \
config.pin_var = machine_pin_get_id(arg_vals[arg_id].u_obj)
-STATIC esp_err_t sdcard_ensure_card_init(sdcard_card_obj_t *self, bool force) {
+static esp_err_t sdcard_ensure_card_init(sdcard_card_obj_t *self, bool force) {
if (force || !(self->flags & SDCARD_CARD_FLAGS_CARD_INIT_DONE)) {
DEBUG_printf(" Calling card init");
@@ -166,7 +166,7 @@ STATIC esp_err_t sdcard_ensure_card_init(sdcard_card_obj_t *self, bool force) {
// transfers. Only 1-bit is supported on the SPI interfaces.
// card = SDCard(slot=1, width=None, present_pin=None, wp_pin=None)
-STATIC mp_obj_t machine_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
enum {
ARG_slot,
@@ -179,7 +179,7 @@ STATIC mp_obj_t machine_sdcard_make_new(const mp_obj_type_t *type, size_t n_args
ARG_cs,
ARG_freq,
};
- STATIC const mp_arg_t allowed_args[] = {
+ static const mp_arg_t allowed_args[] = {
{ MP_QSTR_slot, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_width, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_cd, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -315,7 +315,7 @@ STATIC mp_obj_t machine_sdcard_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t sd_deinit(mp_obj_t self_in) {
+static mp_obj_t sd_deinit(mp_obj_t self_in) {
sdcard_card_obj_t *self = self_in;
DEBUG_printf("De-init host\n");
@@ -335,9 +335,9 @@ STATIC mp_obj_t sd_deinit(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(sd_deinit_obj, sd_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(sd_deinit_obj, sd_deinit);
-STATIC mp_obj_t sd_info(mp_obj_t self_in) {
+static mp_obj_t sd_info(mp_obj_t self_in) {
sdcard_card_obj_t *self = self_in;
// We could potential return a great deal more SD card data but it
// is not clear that it is worth the extra code space to do
@@ -355,9 +355,9 @@ STATIC mp_obj_t sd_info(mp_obj_t self_in) {
};
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(sd_info_obj, sd_info);
+static MP_DEFINE_CONST_FUN_OBJ_1(sd_info_obj, sd_info);
-STATIC mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
sdcard_card_obj_t *self = self_in;
mp_buffer_info_t bufinfo;
esp_err_t err;
@@ -372,9 +372,9 @@ STATIC mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num,
return mp_obj_new_bool(err == ESP_OK);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_readblocks_obj, machine_sdcard_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_readblocks_obj, machine_sdcard_readblocks);
-STATIC mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
sdcard_card_obj_t *self = self_in;
mp_buffer_info_t bufinfo;
esp_err_t err;
@@ -389,9 +389,9 @@ STATIC mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num,
return mp_obj_new_bool(err == ESP_OK);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_writeblocks_obj, machine_sdcard_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_writeblocks_obj, machine_sdcard_writeblocks);
-STATIC mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
sdcard_card_obj_t *self = self_in;
esp_err_t err = ESP_OK;
mp_int_t cmd = mp_obj_get_int(cmd_in);
@@ -428,9 +428,9 @@ STATIC mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t
return MP_OBJ_NEW_SMALL_INT(-1); // error
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_ioctl_obj, machine_sdcard_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_ioctl_obj, machine_sdcard_ioctl);
-STATIC const mp_rom_map_elem_t machine_sdcard_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&sd_info_obj) },
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&sd_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&sd_deinit_obj) },
@@ -440,7 +440,7 @@ STATIC const mp_rom_map_elem_t machine_sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&machine_sdcard_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_sdcard_locals_dict, machine_sdcard_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_sdcard_locals_dict, machine_sdcard_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_sdcard_type,
diff --git a/ports/esp32/machine_timer.c b/ports/esp32/machine_timer.c
index aba3db1983..5e249e46e6 100644
--- a/ports/esp32/machine_timer.c
+++ b/ports/esp32/machine_timer.c
@@ -66,8 +66,8 @@ typedef struct _machine_timer_obj_t {
const mp_obj_type_t machine_timer_type;
-STATIC void machine_timer_disable(machine_timer_obj_t *self);
-STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static void machine_timer_disable(machine_timer_obj_t *self);
+static mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
void machine_timer_deinit_all(void) {
// Disable, deallocate and remove all timers from list
@@ -80,14 +80,14 @@ void machine_timer_deinit_all(void) {
}
}
-STATIC void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_timer_obj_t *self = self_in;
qstr mode = self->repeat ? MP_QSTR_PERIODIC : MP_QSTR_ONE_SHOT;
uint64_t period = self->period / (TIMER_SCALE / 1000); // convert to ms
mp_printf(print, "Timer(%u, mode=%q, period=%lu)", (self->group << 1) | self->index, mode, period);
}
-STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
mp_uint_t group = (mp_obj_get_int(args[0]) >> 1) & 1;
mp_uint_t index = mp_obj_get_int(args[0]) & 1;
@@ -121,7 +121,7 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
return self;
}
-STATIC void machine_timer_disable(machine_timer_obj_t *self) {
+static void machine_timer_disable(machine_timer_obj_t *self) {
if (self->hal_context.dev != NULL) {
// Disable the counter and alarm.
timer_ll_enable_counter(self->hal_context.dev, self->index, false);
@@ -138,7 +138,7 @@ STATIC void machine_timer_disable(machine_timer_obj_t *self) {
// referenced elsewhere
}
-STATIC void machine_timer_isr(void *self_in) {
+static void machine_timer_isr(void *self_in) {
machine_timer_obj_t *self = self_in;
uint32_t intr_status = timer_ll_get_intr_status(self->hal_context.dev);
@@ -153,7 +153,7 @@ STATIC void machine_timer_isr(void *self_in) {
}
}
-STATIC void machine_timer_enable(machine_timer_obj_t *self) {
+static void machine_timer_enable(machine_timer_obj_t *self) {
// Initialise the timer.
timer_hal_init(&self->hal_context, self->group, self->index);
timer_ll_enable_counter(self->hal_context.dev, self->index, false);
@@ -183,7 +183,7 @@ STATIC void machine_timer_enable(machine_timer_obj_t *self) {
timer_ll_enable_counter(self->hal_context.dev, self->index, true);
}
-STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {
ARG_mode,
ARG_callback,
@@ -230,26 +230,26 @@ STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n
return mp_const_none;
}
-STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
machine_timer_disable(self_in);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
-STATIC mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return machine_timer_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
-STATIC mp_obj_t machine_timer_value(mp_obj_t self_in) {
+static mp_obj_t machine_timer_value(mp_obj_t self_in) {
machine_timer_obj_t *self = self_in;
uint64_t result = timer_ll_get_counter_value(self->hal_context.dev, self->index);
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)(result / (TIMER_SCALE / 1000))); // value in ms
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_value_obj, machine_timer_value);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_value_obj, machine_timer_value);
-STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&machine_timer_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_timer_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_timer_init_obj) },
@@ -257,7 +257,7 @@ STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(false) },
{ MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(true) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
diff --git a/ports/esp32/machine_touchpad.c b/ports/esp32/machine_touchpad.c
index d9f4ef3ebc..7612063e51 100644
--- a/ports/esp32/machine_touchpad.c
+++ b/ports/esp32/machine_touchpad.c
@@ -43,7 +43,7 @@ typedef struct _mtp_obj_t {
touch_pad_t touchpad_id;
} mtp_obj_t;
-STATIC const mtp_obj_t touchpad_obj[] = {
+static const mtp_obj_t touchpad_obj[] = {
#if CONFIG_IDF_TARGET_ESP32
{{&machine_touchpad_type}, GPIO_NUM_4, TOUCH_PAD_NUM0},
{{&machine_touchpad_type}, GPIO_NUM_0, TOUCH_PAD_NUM1},
@@ -73,7 +73,7 @@ STATIC const mtp_obj_t touchpad_obj[] = {
#endif
};
-STATIC mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
+static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, true);
gpio_num_t pin_id = machine_pin_get_id(args[0]);
@@ -108,7 +108,7 @@ STATIC mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
}
-STATIC mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
+static mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
mtp_obj_t *self = self_in;
#if CONFIG_IDF_TARGET_ESP32
uint16_t value = mp_obj_get_int(value_in);
@@ -123,7 +123,7 @@ STATIC mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mtp_config_obj, mtp_config);
-STATIC mp_obj_t mtp_read(mp_obj_t self_in) {
+static mp_obj_t mtp_read(mp_obj_t self_in) {
mtp_obj_t *self = self_in;
#if CONFIG_IDF_TARGET_ESP32
uint16_t value;
@@ -139,13 +139,13 @@ STATIC mp_obj_t mtp_read(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mtp_read_obj, mtp_read);
-STATIC const mp_rom_map_elem_t mtp_locals_dict_table[] = {
+static const mp_rom_map_elem_t mtp_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&mtp_config_obj) },
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mtp_read_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mtp_locals_dict, mtp_locals_dict_table);
+static MP_DEFINE_CONST_DICT(mtp_locals_dict, mtp_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_touchpad_type,
diff --git a/ports/esp32/machine_uart.c b/ports/esp32/machine_uart.c
index 0e384dc07a..b7adbf81c7 100644
--- a/ports/esp32/machine_uart.c
+++ b/ports/esp32/machine_uart.c
@@ -68,7 +68,7 @@ typedef struct _machine_uart_obj_t {
uint32_t invert; // lines to invert
} machine_uart_obj_t;
-STATIC const char *_parity_name[] = {"None", "1", "0"};
+static const char *_parity_name[] = {"None", "1", "0"};
/******************************************************************************/
// MicroPython bindings for UART
@@ -81,7 +81,7 @@ STATIC const char *_parity_name[] = {"None", "1", "0"};
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_INT(UART_HW_FLOWCTRL_RTS) }, \
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_INT(UART_HW_FLOWCTRL_CTS) }, \
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint32_t baudrate;
check_esp_err(uart_get_baudrate(self->uart_num, &baudrate));
@@ -133,7 +133,7 @@ STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_
mp_printf(print, ")");
}
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_rts, ARG_cts, ARG_txbuf, ARG_rxbuf, ARG_timeout, ARG_timeout_char, ARG_invert, ARG_flow };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 0} },
@@ -309,7 +309,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
check_esp_err(uart_set_hw_flow_ctrl(self->uart_num, self->flowcontrol, UART_FIFO_LEN - UART_FIFO_LEN / 4));
}
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// get uart id
@@ -386,21 +386,21 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
check_esp_err(uart_driver_delete(self->uart_num));
}
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
size_t rxbufsize;
check_esp_err(uart_get_buffered_data_len(self->uart_num, &rxbufsize));
return rxbufsize;
}
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
return uart_wait_tx_done(self->uart_num, 0) == ESP_OK;
}
-STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
+static void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
// Save settings
uint32_t baudrate;
check_esp_err(uart_get_baudrate(self->uart_num, &baudrate));
@@ -417,7 +417,7 @@ STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
check_esp_err(uart_set_baudrate(self->uart_num, baudrate));
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
// make sure we want at least 1 char
@@ -451,7 +451,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
return bytes_read;
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
int bytes_written = uart_write_bytes(self->uart_num, buf_in, size);
@@ -465,7 +465,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
return bytes_written;
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = self_in;
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
diff --git a/ports/esp32/machine_wdt.c b/ports/esp32/machine_wdt.c
index cee761f265..06bdc9d101 100644
--- a/ports/esp32/machine_wdt.c
+++ b/ports/esp32/machine_wdt.c
@@ -35,11 +35,11 @@ typedef struct _machine_wdt_obj_t {
esp_task_wdt_user_handle_t twdt_user_handle;
} machine_wdt_obj_t;
-STATIC machine_wdt_obj_t wdt_default = {
+static machine_wdt_obj_t wdt_default = {
{&machine_wdt_type}, 0
};
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
if (id != 0) {
mp_raise_ValueError(NULL);
}
@@ -68,7 +68,7 @@ STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t
return &wdt_default;
}
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
(void)self;
mp_int_t rs_code = esp_task_wdt_reset_user(wdt_default.twdt_user_handle);
if (rs_code != ESP_OK) {
diff --git a/ports/esp32/modesp.c b/ports/esp32/modesp.c
index f51ba6ab34..d3cefbe219 100644
--- a/ports/esp32/modesp.c
+++ b/ports/esp32/modesp.c
@@ -36,7 +36,7 @@
#include "py/mperrno.h"
#include "py/mphal.h"
-STATIC mp_obj_t esp_osdebug(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_osdebug(size_t n_args, const mp_obj_t *args) {
esp_log_level_t level = LOG_LOCAL_LEVEL; // Maximum available level
if (n_args == 2) {
level = mp_obj_get_int(args[1]);
@@ -51,9 +51,9 @@ STATIC mp_obj_t esp_osdebug(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_osdebug_obj, 1, 2, esp_osdebug);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_osdebug_obj, 1, 2, esp_osdebug);
-STATIC mp_obj_t esp_flash_read_(mp_obj_t offset_in, mp_obj_t buf_in) {
+static mp_obj_t esp_flash_read_(mp_obj_t offset_in, mp_obj_t buf_in) {
mp_int_t offset = mp_obj_get_int(offset_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE);
@@ -63,9 +63,9 @@ STATIC mp_obj_t esp_flash_read_(mp_obj_t offset_in, mp_obj_t buf_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read_);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read_);
-STATIC mp_obj_t esp_flash_write_(mp_obj_t offset_in, mp_obj_t buf_in) {
+static mp_obj_t esp_flash_write_(mp_obj_t offset_in, mp_obj_t buf_in) {
mp_int_t offset = mp_obj_get_int(offset_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
@@ -75,9 +75,9 @@ STATIC mp_obj_t esp_flash_write_(mp_obj_t offset_in, mp_obj_t buf_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write_);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write_);
-STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
+static mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
mp_int_t sector = mp_obj_get_int(sector_in);
esp_err_t res = esp_flash_erase_region(NULL, sector * 4096, 4096);
if (res != ESP_OK) {
@@ -85,34 +85,34 @@ STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
-STATIC mp_obj_t esp_flash_size(void) {
+static mp_obj_t esp_flash_size(void) {
uint32_t size;
esp_flash_get_size(NULL, &size);
return mp_obj_new_int_from_uint(size);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
-STATIC mp_obj_t esp_flash_user_start(void) {
+static mp_obj_t esp_flash_user_start(void) {
return MP_OBJ_NEW_SMALL_INT(0x200000);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj, esp_flash_user_start);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj, esp_flash_user_start);
-STATIC mp_obj_t esp_gpio_matrix_in(mp_obj_t pin, mp_obj_t sig, mp_obj_t inv) {
+static mp_obj_t esp_gpio_matrix_in(mp_obj_t pin, mp_obj_t sig, mp_obj_t inv) {
esp_rom_gpio_connect_in_signal(mp_obj_get_int(pin), mp_obj_get_int(sig), mp_obj_get_int(inv));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_gpio_matrix_in_obj, esp_gpio_matrix_in);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp_gpio_matrix_in_obj, esp_gpio_matrix_in);
-STATIC mp_obj_t esp_gpio_matrix_out(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_gpio_matrix_out(size_t n_args, const mp_obj_t *args) {
(void)n_args;
esp_rom_gpio_connect_out_signal(mp_obj_get_int(args[0]), mp_obj_get_int(args[1]), mp_obj_get_int(args[2]), mp_obj_get_int(args[3]));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_gpio_matrix_out_obj, 4, 4, esp_gpio_matrix_out);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_gpio_matrix_out_obj, 4, 4, esp_gpio_matrix_out);
-STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
+static const mp_rom_map_elem_t esp_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp) },
{ MP_ROM_QSTR(MP_QSTR_osdebug), MP_ROM_PTR(&esp_osdebug_obj) },
@@ -135,7 +135,7 @@ STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_LOG_VERBOSE), MP_ROM_INT((mp_uint_t)ESP_LOG_VERBOSE)},
};
-STATIC MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);
+static MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);
const mp_obj_module_t esp_module = {
.base = { &mp_type_module },
diff --git a/ports/esp32/modesp32.c b/ports/esp32/modesp32.c
index ef3ad0b76d..f363939483 100644
--- a/ports/esp32/modesp32.c
+++ b/ports/esp32/modesp32.c
@@ -49,7 +49,7 @@
#include "../multi_heap_platform.h"
#include "../heap_private.h"
-STATIC mp_obj_t esp32_wake_on_touch(const mp_obj_t wake) {
+static mp_obj_t esp32_wake_on_touch(const mp_obj_t wake) {
if (machine_rtc_config.ext0_pin != -1) {
mp_raise_ValueError(MP_ERROR_TEXT("no resources"));
@@ -59,9 +59,9 @@ STATIC mp_obj_t esp32_wake_on_touch(const mp_obj_t wake) {
machine_rtc_config.wake_on_touch = mp_obj_is_true(wake);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_wake_on_touch_obj, esp32_wake_on_touch);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_wake_on_touch_obj, esp32_wake_on_touch);
-STATIC mp_obj_t esp32_wake_on_ext0(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t esp32_wake_on_ext0(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
if (machine_rtc_config.wake_on_touch) {
mp_raise_ValueError(MP_ERROR_TEXT("no resources"));
@@ -91,9 +91,9 @@ STATIC mp_obj_t esp32_wake_on_ext0(size_t n_args, const mp_obj_t *pos_args, mp_m
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext0_obj, 0, esp32_wake_on_ext0);
+static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext0_obj, 0, esp32_wake_on_ext0);
-STATIC mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_pins, ARG_level};
const mp_arg_t allowed_args[] = {
{ MP_QSTR_pins, MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -127,18 +127,18 @@ STATIC mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_m
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext1_obj, 0, esp32_wake_on_ext1);
+static MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext1_obj, 0, esp32_wake_on_ext1);
-STATIC mp_obj_t esp32_wake_on_ulp(const mp_obj_t wake) {
+static mp_obj_t esp32_wake_on_ulp(const mp_obj_t wake) {
if (machine_rtc_config.ext0_pin != -1) {
mp_raise_ValueError(MP_ERROR_TEXT("no resources"));
}
machine_rtc_config.wake_on_ulp = mp_obj_is_true(wake);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_wake_on_ulp_obj, esp32_wake_on_ulp);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_wake_on_ulp_obj, esp32_wake_on_ulp);
-STATIC mp_obj_t esp32_gpio_deep_sleep_hold(const mp_obj_t enable) {
+static mp_obj_t esp32_gpio_deep_sleep_hold(const mp_obj_t enable) {
if (mp_obj_is_true(enable)) {
gpio_deep_sleep_hold_en();
} else {
@@ -146,13 +146,13 @@ STATIC mp_obj_t esp32_gpio_deep_sleep_hold(const mp_obj_t enable) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_gpio_deep_sleep_hold_obj, esp32_gpio_deep_sleep_hold);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_gpio_deep_sleep_hold_obj, esp32_gpio_deep_sleep_hold);
#if CONFIG_IDF_TARGET_ESP32
#include "soc/sens_reg.h"
-STATIC mp_obj_t esp32_raw_temperature(void) {
+static mp_obj_t esp32_raw_temperature(void) {
SET_PERI_REG_BITS(SENS_SAR_MEAS_WAIT2_REG, SENS_FORCE_XPD_SAR, 3, SENS_FORCE_XPD_SAR_S);
SET_PERI_REG_BITS(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_CLK_DIV, 10, SENS_TSENS_CLK_DIV_S);
CLEAR_PERI_REG_MASK(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_POWER_UP);
@@ -166,11 +166,11 @@ STATIC mp_obj_t esp32_raw_temperature(void) {
return mp_obj_new_int(res);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp32_raw_temperature_obj, esp32_raw_temperature);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp32_raw_temperature_obj, esp32_raw_temperature);
#endif
-STATIC mp_obj_t esp32_idf_heap_info(const mp_obj_t cap_in) {
+static mp_obj_t esp32_idf_heap_info(const mp_obj_t cap_in) {
mp_int_t cap = mp_obj_get_int(cap_in);
multi_heap_info_t info;
heap_t *heap;
@@ -190,9 +190,9 @@ STATIC mp_obj_t esp32_idf_heap_info(const mp_obj_t cap_in) {
}
return heap_list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_idf_heap_info_obj, esp32_idf_heap_info);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp32_idf_heap_info_obj, esp32_idf_heap_info);
-STATIC const mp_rom_map_elem_t esp32_module_globals_table[] = {
+static const mp_rom_map_elem_t esp32_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp32) },
{ MP_ROM_QSTR(MP_QSTR_wake_on_touch), MP_ROM_PTR(&esp32_wake_on_touch_obj) },
@@ -219,7 +219,7 @@ STATIC const mp_rom_map_elem_t esp32_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_HEAP_EXEC), MP_ROM_INT(MALLOC_CAP_EXEC) },
};
-STATIC MP_DEFINE_CONST_DICT(esp32_module_globals, esp32_module_globals_table);
+static MP_DEFINE_CONST_DICT(esp32_module_globals, esp32_module_globals_table);
const mp_obj_module_t esp32_module = {
.base = { &mp_type_module },
diff --git a/ports/esp32/modespnow.c b/ports/esp32/modespnow.c
index 77dc970f51..e7e51ee57e 100644
--- a/ports/esp32/modespnow.c
+++ b/ports/esp32/modespnow.c
@@ -149,7 +149,7 @@ static esp_espnow_obj_t *_get_singleton_initialised() {
// Allocate and initialise the ESPNow module as a singleton.
// Returns the initialised espnow_singleton.
-STATIC mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args,
+static mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args,
size_t n_kw, const mp_obj_t *all_args) {
// The espnow_singleton must be defined in MICROPY_PORT_ROOT_POINTERS
@@ -180,9 +180,9 @@ STATIC mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args,
}
// Forward declare the send and recv ESPNow callbacks
-STATIC void send_cb(const uint8_t *mac_addr, esp_now_send_status_t status);
+static void send_cb(const uint8_t *mac_addr, esp_now_send_status_t status);
-STATIC void recv_cb(const esp_now_recv_info_t *recv_info, const uint8_t *msg, int msg_len);
+static void recv_cb(const esp_now_recv_info_t *recv_info, const uint8_t *msg, int msg_len);
// ESPNow.init(): Initialise the data buffers and ESP-NOW functions.
// Initialise the Espressif ESPNOW software stack, register callbacks and
@@ -205,7 +205,7 @@ static mp_obj_t espnow_init(mp_obj_t _) {
// ESPNow.deinit(): De-initialise the ESPNOW software stack, disable callbacks
// and deallocate the recv data buffers.
// Note: this function is called from main.c:mp_task() to cleanup before soft
-// reset, so cannot be declared STATIC and must guard against self == NULL;.
+// reset, so cannot be declared static and must guard against self == NULL;.
mp_obj_t espnow_deinit(mp_obj_t _) {
esp_espnow_obj_t *self = _get_singleton();
if (self != NULL && self->recv_buffer != NULL) {
@@ -220,7 +220,7 @@ mp_obj_t espnow_deinit(mp_obj_t _) {
return mp_const_none;
}
-STATIC mp_obj_t espnow_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_active(size_t n_args, const mp_obj_t *args) {
esp_espnow_obj_t *self = _get_singleton();
if (n_args > 1) {
if (mp_obj_is_true(args[1])) {
@@ -231,13 +231,13 @@ STATIC mp_obj_t espnow_active(size_t n_args, const mp_obj_t *args) {
}
return self->recv_buffer != NULL ? mp_const_true : mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_active_obj, 1, 2, espnow_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_active_obj, 1, 2, espnow_active);
// ESPNow.config(['param'|param=value, ..])
// Get or set configuration values. Supported config params:
// buffer: size of buffer for rx packets (default=514 bytes)
// timeout: Default read timeout (default=300,000 milliseconds)
-STATIC mp_obj_t espnow_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t espnow_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
esp_espnow_obj_t *self = _get_singleton();
enum { ARG_get, ARG_rxbuf, ARG_timeout_ms, ARG_rate };
static const mp_arg_t allowed_args[] = {
@@ -278,11 +278,11 @@ STATIC mp_obj_t espnow_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espnow_config_obj, 1, espnow_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(espnow_config_obj, 1, espnow_config);
// ESPNow.irq(recv_cb)
// Set callback function to be invoked when a message is received.
-STATIC mp_obj_t espnow_irq(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_irq(size_t n_args, const mp_obj_t *args) {
esp_espnow_obj_t *self = _get_singleton();
mp_obj_t recv_cb = args[1];
if (recv_cb != mp_const_none && !mp_obj_is_callable(recv_cb)) {
@@ -292,12 +292,12 @@ STATIC mp_obj_t espnow_irq(size_t n_args, const mp_obj_t *args) {
self->recv_cb_arg = (n_args > 2) ? args[2] : mp_const_none;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_irq_obj, 2, 3, espnow_irq);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_irq_obj, 2, 3, espnow_irq);
// ESPnow.stats(): Provide some useful stats.
// Returns a tuple of:
// (tx_pkts, tx_responses, tx_failures, rx_pkts, dropped_rx_pkts)
-STATIC mp_obj_t espnow_stats(mp_obj_t _) {
+static mp_obj_t espnow_stats(mp_obj_t _) {
const esp_espnow_obj_t *self = _get_singleton();
return NEW_TUPLE(
mp_obj_new_int(self->tx_packets),
@@ -306,7 +306,7 @@ STATIC mp_obj_t espnow_stats(mp_obj_t _) {
mp_obj_new_int(self->rx_packets),
mp_obj_new_int(self->dropped_rx_pkts));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(espnow_stats_obj, espnow_stats);
+static MP_DEFINE_CONST_FUN_OBJ_1(espnow_stats_obj, espnow_stats);
#if MICROPY_PY_ESPNOW_RSSI
// ### Maintaining the peer table and reading RSSI values
@@ -401,7 +401,7 @@ static int ringbuf_get_bytes_wait(ringbuf_t *r, uint8_t *data, size_t len, mp_in
// loaded into the 3rd and 4th elements.
// Default timeout is set with ESPNow.config(timeout=milliseconds).
// Return (None, None) on timeout.
-STATIC mp_obj_t espnow_recvinto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_recvinto(size_t n_args, const mp_obj_t *args) {
esp_espnow_obj_t *self = _get_singleton_initialised();
mp_int_t timeout_ms = ((n_args > 2 && args[2] != mp_const_none)
@@ -456,15 +456,15 @@ STATIC mp_obj_t espnow_recvinto(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_NEW_SMALL_INT(msg_len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_recvinto_obj, 2, 3, espnow_recvinto);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_recvinto_obj, 2, 3, espnow_recvinto);
// Test if data is available to read from the buffers
-STATIC mp_obj_t espnow_any(const mp_obj_t _) {
+static mp_obj_t espnow_any(const mp_obj_t _) {
esp_espnow_obj_t *self = _get_singleton_initialised();
return ringbuf_avail(self->recv_buffer) ? mp_const_true : mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(espnow_any_obj, espnow_any);
+static MP_DEFINE_CONST_FUN_OBJ_1(espnow_any_obj, espnow_any);
// Used by espnow_send() for sends() with sync==True.
// Wait till all pending sent packet responses have been received.
@@ -494,7 +494,7 @@ static void _wait_for_pending_responses(esp_espnow_obj_t *self) {
// True if sync==True and message is received successfully by all recipients
// False if sync==True and message is not received by at least one recipient
// Raises: EAGAIN if the internal espnow buffers are full.
-STATIC mp_obj_t espnow_send(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_send(size_t n_args, const mp_obj_t *args) {
esp_espnow_obj_t *self = _get_singleton_initialised();
// Check the various combinations of input arguments
const uint8_t *peer = (n_args > 2) ? _get_peer(args[1]) : NULL;
@@ -532,7 +532,7 @@ STATIC mp_obj_t espnow_send(size_t n_args, const mp_obj_t *args) {
// Return False if sync and any peers did not respond.
return mp_obj_new_bool(!(sync && self->tx_failures != saved_failures));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_send_obj, 2, 4, espnow_send);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_send_obj, 2, 4, espnow_send);
// ### The ESP_Now send and recv callback routines
//
@@ -540,7 +540,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_send_obj, 2, 4, espnow_send);
// Callback triggered when a sent packet is acknowledged by the peer (or not).
// Just count the number of responses and number of failures.
// These are used in the send() logic.
-STATIC void send_cb(const uint8_t *mac_addr, esp_now_send_status_t status) {
+static void send_cb(const uint8_t *mac_addr, esp_now_send_status_t status) {
esp_espnow_obj_t *self = _get_singleton();
self->tx_responses++;
if (status != ESP_NOW_SEND_SUCCESS) {
@@ -553,7 +553,7 @@ STATIC void send_cb(const uint8_t *mac_addr, esp_now_send_status_t status) {
// ESPNow packet.
// If the buffer is full, drop the message and increment the dropped count.
// Schedules the user callback if one has been registered (ESPNow.config()).
-STATIC void recv_cb(const esp_now_recv_info_t *recv_info, const uint8_t *msg, int msg_len) {
+static void recv_cb(const esp_now_recv_info_t *recv_info, const uint8_t *msg, int msg_len) {
esp_espnow_obj_t *self = _get_singleton();
ringbuf_t *buf = self->recv_buffer;
// TODO: Test this works with ">".
@@ -584,17 +584,17 @@ STATIC void recv_cb(const esp_now_recv_info_t *recv_info, const uint8_t *msg, in
// Set the ESP-NOW Primary Master Key (pmk) (for encrypted communications).
// Raise OSError if ESP-NOW functions are not initialised.
// Raise ValueError if key is not a bytes-like object exactly 16 bytes long.
-STATIC mp_obj_t espnow_set_pmk(mp_obj_t _, mp_obj_t key) {
+static mp_obj_t espnow_set_pmk(mp_obj_t _, mp_obj_t key) {
check_esp_err(esp_now_set_pmk(_get_bytes_len(key, ESP_NOW_KEY_LEN)));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(espnow_set_pmk_obj, espnow_set_pmk);
+static MP_DEFINE_CONST_FUN_OBJ_2(espnow_set_pmk_obj, espnow_set_pmk);
// Common code for add_peer() and mod_peer() to process the args and kw_args:
// Raise ValueError if the LMK is not a bytes-like object of exactly 16 bytes.
// Raise TypeError if invalid keyword args or too many positional args.
// Return true if all args parsed correctly.
-STATIC bool _update_peer_info(
+static bool _update_peer_info(
esp_now_peer_info_t *peer, size_t n_args,
const mp_obj_t *pos_args, mp_map_t *kw_args) {
@@ -630,7 +630,7 @@ STATIC bool _update_peer_info(
// Update the cached peer count in self->peer_count;
// The peer_count ignores broadcast and multicast addresses and is used for the
// send() logic and is updated from add_peer(), mod_peer() and del_peer().
-STATIC void _update_peer_count() {
+static void _update_peer_count() {
esp_espnow_obj_t *self = _get_singleton_initialised();
esp_now_peer_info_t peer = {0};
@@ -654,7 +654,7 @@ STATIC void _update_peer_count() {
// Raise ValueError if mac or LMK are not bytes-like objects or wrong length.
// Raise TypeError if invalid keyword args or too many positional args.
// Return None.
-STATIC mp_obj_t espnow_add_peer(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t espnow_add_peer(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
esp_now_peer_info_t peer = {0};
memcpy(peer.peer_addr, _get_peer(args[1]), ESP_NOW_ETH_ALEN);
_update_peer_info(&peer, n_args - 2, args + 2, kw_args);
@@ -664,13 +664,13 @@ STATIC mp_obj_t espnow_add_peer(size_t n_args, const mp_obj_t *args, mp_map_t *k
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espnow_add_peer_obj, 2, espnow_add_peer);
+static MP_DEFINE_CONST_FUN_OBJ_KW(espnow_add_peer_obj, 2, espnow_add_peer);
// ESPNow.del_peer(peer_mac): Unregister peer_mac.
// Raise OSError if ESPNow.init() has not been called.
// Raise ValueError if peer is not a bytes-like objects or wrong length.
// Return None.
-STATIC mp_obj_t espnow_del_peer(mp_obj_t _, mp_obj_t peer) {
+static mp_obj_t espnow_del_peer(mp_obj_t _, mp_obj_t peer) {
uint8_t peer_addr[ESP_NOW_ETH_ALEN];
memcpy(peer_addr, _get_peer(peer), ESP_NOW_ETH_ALEN);
@@ -679,7 +679,7 @@ STATIC mp_obj_t espnow_del_peer(mp_obj_t _, mp_obj_t peer) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(espnow_del_peer_obj, espnow_del_peer);
+static MP_DEFINE_CONST_FUN_OBJ_2(espnow_del_peer_obj, espnow_del_peer);
// Convert a peer_info struct to python tuple
// Used by espnow_get_peer() and espnow_get_peers()
@@ -697,7 +697,7 @@ static mp_obj_t _peer_info_to_tuple(const esp_now_peer_info_t *peer) {
// Return a tuple of tuples:
// ((peer_addr, lmk, channel, ifidx, encrypt),
// (peer_addr, lmk, channel, ifidx, encrypt), ...)
-STATIC mp_obj_t espnow_get_peers(mp_obj_t _) {
+static mp_obj_t espnow_get_peers(mp_obj_t _) {
esp_espnow_obj_t *self = _get_singleton_initialised();
// Build and initialise the peer info tuple.
@@ -711,14 +711,14 @@ STATIC mp_obj_t espnow_get_peers(mp_obj_t _) {
return peerinfo_tuple;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(espnow_get_peers_obj, espnow_get_peers);
+static MP_DEFINE_CONST_FUN_OBJ_1(espnow_get_peers_obj, espnow_get_peers);
#if MICROPY_PY_ESPNOW_EXTRA_PEER_METHODS
// ESPNow.get_peer(peer_mac): Get the peer info for peer_mac as a tuple.
// Raise OSError if ESPNow.init() has not been called.
// Raise ValueError if mac or LMK are not bytes-like objects or wrong length.
// Return a tuple of (peer_addr, lmk, channel, ifidx, encrypt).
-STATIC mp_obj_t espnow_get_peer(mp_obj_t _, mp_obj_t arg1) {
+static mp_obj_t espnow_get_peer(mp_obj_t _, mp_obj_t arg1) {
esp_now_peer_info_t peer = {0};
memcpy(peer.peer_addr, _get_peer(arg1), ESP_NOW_ETH_ALEN);
@@ -726,7 +726,7 @@ STATIC mp_obj_t espnow_get_peer(mp_obj_t _, mp_obj_t arg1) {
return _peer_info_to_tuple(&peer);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(espnow_get_peer_obj, espnow_get_peer);
+static MP_DEFINE_CONST_FUN_OBJ_2(espnow_get_peer_obj, espnow_get_peer);
// ESPNow.mod_peer(peer_mac, [lmk, [channel, [ifidx, [encrypt]]]]) or
// ESPNow.mod_peer(peer_mac, [lmk=b'0123456789abcdef'|b''|None|False],
@@ -736,7 +736,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(espnow_get_peer_obj, espnow_get_peer);
// Raise ValueError if mac or LMK are not bytes-like objects or wrong length.
// Raise TypeError if invalid keyword args or too many positional args.
// Return None.
-STATIC mp_obj_t espnow_mod_peer(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t espnow_mod_peer(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
esp_now_peer_info_t peer = {0};
memcpy(peer.peer_addr, _get_peer(args[1]), ESP_NOW_ETH_ALEN);
check_esp_err(esp_now_get_peer(peer.peer_addr, &peer));
@@ -748,12 +748,12 @@ STATIC mp_obj_t espnow_mod_peer(size_t n_args, const mp_obj_t *args, mp_map_t *k
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espnow_mod_peer_obj, 2, espnow_mod_peer);
+static MP_DEFINE_CONST_FUN_OBJ_KW(espnow_mod_peer_obj, 2, espnow_mod_peer);
// ESPNow.espnow_peer_count(): Get the number of registered peers.
// Raise OSError if ESPNow.init() has not been called.
// Return a tuple of (num_total_peers, num_encrypted_peers).
-STATIC mp_obj_t espnow_peer_count(mp_obj_t _) {
+static mp_obj_t espnow_peer_count(mp_obj_t _) {
esp_now_peer_num_t peer_num = {0};
check_esp_err(esp_now_get_peer_num(&peer_num));
@@ -761,10 +761,10 @@ STATIC mp_obj_t espnow_peer_count(mp_obj_t _) {
mp_obj_new_int(peer_num.total_num),
mp_obj_new_int(peer_num.encrypt_num));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(espnow_peer_count_obj, espnow_peer_count);
+static MP_DEFINE_CONST_FUN_OBJ_1(espnow_peer_count_obj, espnow_peer_count);
#endif
-STATIC const mp_rom_map_elem_t esp_espnow_locals_dict_table[] = {
+static const mp_rom_map_elem_t esp_espnow_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&espnow_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&espnow_config_obj) },
{ MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&espnow_irq_obj) },
@@ -786,9 +786,9 @@ STATIC const mp_rom_map_elem_t esp_espnow_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_peer_count), MP_ROM_PTR(&espnow_peer_count_obj) },
#endif // MICROPY_PY_ESPNOW_EXTRA_PEER_METHODS
};
-STATIC MP_DEFINE_CONST_DICT(esp_espnow_locals_dict, esp_espnow_locals_dict_table);
+static MP_DEFINE_CONST_DICT(esp_espnow_locals_dict, esp_espnow_locals_dict_table);
-STATIC const mp_rom_map_elem_t espnow_globals_dict_table[] = {
+static const mp_rom_map_elem_t espnow_globals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__espnow) },
{ MP_ROM_QSTR(MP_QSTR_ESPNowBase), MP_ROM_PTR(&esp_espnow_type) },
{ MP_ROM_QSTR(MP_QSTR_MAX_DATA_LEN), MP_ROM_INT(ESP_NOW_MAX_DATA_LEN)},
@@ -797,13 +797,13 @@ STATIC const mp_rom_map_elem_t espnow_globals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_MAX_TOTAL_PEER_NUM), MP_ROM_INT(ESP_NOW_MAX_TOTAL_PEER_NUM)},
{ MP_ROM_QSTR(MP_QSTR_MAX_ENCRYPT_PEER_NUM), MP_ROM_INT(ESP_NOW_MAX_ENCRYPT_PEER_NUM)},
};
-STATIC MP_DEFINE_CONST_DICT(espnow_globals_dict, espnow_globals_dict_table);
+static MP_DEFINE_CONST_DICT(espnow_globals_dict, espnow_globals_dict_table);
// ### Dummy Buffer Protocol support
// ...so asyncio can poll.ipoll() on this device
// Support ioctl(MP_STREAM_POLL, ) for asyncio
-STATIC mp_uint_t espnow_stream_ioctl(
+static mp_uint_t espnow_stream_ioctl(
mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
if (request != MP_STREAM_POLL) {
*errcode = MP_EINVAL;
@@ -818,7 +818,7 @@ STATIC mp_uint_t espnow_stream_ioctl(
((self->tx_responses < self->tx_packets) ? MP_STREAM_POLL_WR : 0));
}
-STATIC const mp_stream_p_t espnow_stream_p = {
+static const mp_stream_p_t espnow_stream_p = {
.ioctl = espnow_stream_ioctl,
};
@@ -830,7 +830,7 @@ STATIC const mp_stream_p_t espnow_stream_p = {
// rssi is the wifi signal strength from the last msg received
// (in dBm from -127 to 0)
// time_sec is the time in milliseconds since device last booted.
-STATIC void espnow_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void espnow_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
esp_espnow_obj_t *self = _get_singleton();
if (dest[0] != MP_OBJ_NULL) { // Only allow "Load" operation
return;
diff --git a/ports/esp32/modmachine.c b/ports/esp32/modmachine.c
index 145ae9341c..6e6a578968 100755
--- a/ports/esp32/modmachine.c
+++ b/ports/esp32/modmachine.c
@@ -88,17 +88,17 @@ typedef enum {
MP_SOFT_RESET
} reset_reason_t;
-STATIC bool is_soft_reset = 0;
+static bool is_soft_reset = 0;
#if CONFIG_IDF_TARGET_ESP32C3
int esp_clk_cpu_freq(void);
#endif
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
return mp_obj_new_int(esp_rom_get_cpu_ticks_per_us() * 1000000);
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_int_t freq = mp_obj_get_int(args[0]) / 1000000;
if (freq != 20 && freq != 40 && freq != 80 && freq != 160
#if !CONFIG_IDF_TARGET_ESP32C3
@@ -136,7 +136,7 @@ STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
}
}
-STATIC void machine_sleep_helper(wake_type_t wake_type, size_t n_args, const mp_obj_t *args) {
+static void machine_sleep_helper(wake_type_t wake_type, size_t n_args, const mp_obj_t *args) {
// First, disable any previously set wake-up source
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
@@ -182,16 +182,16 @@ STATIC void machine_sleep_helper(wake_type_t wake_type, size_t n_args, const mp_
}
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
machine_sleep_helper(MACHINE_WAKE_SLEEP, n_args, args);
};
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
machine_sleep_helper(MACHINE_WAKE_DEEPSLEEP, n_args, args);
mp_machine_reset();
};
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
if (is_soft_reset) {
return MP_SOFT_RESET;
}
@@ -235,22 +235,22 @@ void machine_deinit(void) {
is_soft_reset = 1;
}
-STATIC mp_obj_t machine_wake_reason(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_wake_reason(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return MP_OBJ_NEW_SMALL_INT(esp_sleep_get_wakeup_cause());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_wake_reason_obj, 0, machine_wake_reason);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_wake_reason_obj, 0, machine_wake_reason);
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
esp_restart();
}
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
uint8_t chipid[6];
esp_efuse_mac_get_default(chipid);
return mp_obj_new_bytes(chipid, 6);
}
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
MP_THREAD_GIL_EXIT();
taskYIELD();
MP_THREAD_GIL_ENTER();
diff --git a/ports/esp32/modos.c b/ports/esp32/modos.c
index 5b055eb979..d5ba611e88 100644
--- a/ports/esp32/modos.c
+++ b/ports/esp32/modos.c
@@ -36,7 +36,7 @@
#include "py/mphal.h"
#include "extmod/misc.h"
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -50,4 +50,4 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
diff --git a/ports/esp32/modsocket.c b/ports/esp32/modsocket.c
index 9280ab203d..507609dfef 100644
--- a/ports/esp32/modsocket.c
+++ b/ports/esp32/modsocket.c
@@ -83,7 +83,7 @@ typedef struct _socket_obj_t {
#endif
} socket_obj_t;
-STATIC const char *TAG = "modsocket";
+static const char *TAG = "modsocket";
void _socket_settimeout(socket_obj_t *sock, uint64_t timeout_ms);
@@ -93,21 +93,21 @@ void _socket_settimeout(socket_obj_t *sock, uint64_t timeout_ms);
// This divisor is used to reduce the load on the system, so it doesn't poll sockets too often
#define USOCKET_EVENTS_DIVISOR (8)
-STATIC uint8_t socket_events_divisor;
-STATIC socket_obj_t *socket_events_head;
+static uint8_t socket_events_divisor;
+static socket_obj_t *socket_events_head;
void socket_events_deinit(void) {
socket_events_head = NULL;
}
// Assumes the socket is not already in the linked list, and adds it
-STATIC void socket_events_add(socket_obj_t *sock) {
+static void socket_events_add(socket_obj_t *sock) {
sock->events_next = socket_events_head;
socket_events_head = sock;
}
// Assumes the socket is already in the linked list, and removes it
-STATIC void socket_events_remove(socket_obj_t *sock) {
+static void socket_events_remove(socket_obj_t *sock) {
for (socket_obj_t **s = &socket_events_head;; s = &(*s)->events_next) {
if (*s == sock) {
*s = (*s)->events_next;
@@ -158,7 +158,7 @@ static inline void check_for_exceptions(void) {
#if MICROPY_HW_ENABLE_MDNS_QUERIES
// This function mimics lwip_getaddrinfo, but makes an mDNS query
-STATIC int mdns_getaddrinfo(const char *host_str, const char *port_str,
+static int mdns_getaddrinfo(const char *host_str, const char *port_str,
const struct addrinfo *hints, struct addrinfo **res) {
int host_len = strlen(host_str);
const int local_len = sizeof(MDNS_LOCAL_SUFFIX) - 1;
@@ -261,13 +261,13 @@ static void _getaddrinfo_inner(const mp_obj_t host, const mp_obj_t portx,
assert(retval == 0 && *res != NULL);
}
-STATIC void _socket_getaddrinfo(const mp_obj_t addrtuple, struct addrinfo **resp) {
+static void _socket_getaddrinfo(const mp_obj_t addrtuple, struct addrinfo **resp) {
mp_obj_t *elem;
mp_obj_get_array_fixed_n(addrtuple, 2, &elem);
_getaddrinfo_inner(elem[0], elem[1], NULL, resp);
}
-STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t socket_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 3, false);
socket_obj_t *sock = mp_obj_malloc_with_finaliser(socket_obj_t, type_in);
@@ -302,7 +302,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type_in, size_t n_args, siz
return MP_OBJ_FROM_PTR(sock);
}
-STATIC mp_obj_t socket_bind(const mp_obj_t arg0, const mp_obj_t arg1) {
+static mp_obj_t socket_bind(const mp_obj_t arg0, const mp_obj_t arg1) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
struct addrinfo *res;
_socket_getaddrinfo(arg1, &res);
@@ -314,10 +314,10 @@ STATIC mp_obj_t socket_bind(const mp_obj_t arg0, const mp_obj_t arg1) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
// method socket.listen([backlog])
-STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
int backlog = MICROPY_PY_SOCKET_LISTEN_BACKLOG_DEFAULT;
@@ -333,9 +333,9 @@ STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
-STATIC mp_obj_t socket_accept(const mp_obj_t arg0) {
+static mp_obj_t socket_accept(const mp_obj_t arg0) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
struct sockaddr addr;
@@ -380,9 +380,9 @@ STATIC mp_obj_t socket_accept(const mp_obj_t arg0) {
return client;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
+static MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
-STATIC mp_obj_t socket_connect(const mp_obj_t arg0, const mp_obj_t arg1) {
+static mp_obj_t socket_connect(const mp_obj_t arg0, const mp_obj_t arg1) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
struct addrinfo *res;
bool blocking = false;
@@ -477,9 +477,9 @@ STATIC mp_obj_t socket_connect(const mp_obj_t arg0, const mp_obj_t arg1) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
-STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
(void)n_args; // always 4
socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
@@ -550,7 +550,7 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
void _socket_settimeout(socket_obj_t *sock, uint64_t timeout_ms) {
// Rather than waiting for the entire timeout specified, we wait sock->retries times
@@ -568,7 +568,7 @@ void _socket_settimeout(socket_obj_t *sock, uint64_t timeout_ms) {
lwip_fcntl(sock->fd, F_SETFL, timeout_ms ? 0 : O_NONBLOCK);
}
-STATIC mp_obj_t socket_settimeout(const mp_obj_t arg0, const mp_obj_t arg1) {
+static mp_obj_t socket_settimeout(const mp_obj_t arg0, const mp_obj_t arg1) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
if (arg1 == mp_const_none) {
_socket_settimeout(self, UINT64_MAX);
@@ -581,9 +581,9 @@ STATIC mp_obj_t socket_settimeout(const mp_obj_t arg0, const mp_obj_t arg1) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
-STATIC mp_obj_t socket_setblocking(const mp_obj_t arg0, const mp_obj_t arg1) {
+static mp_obj_t socket_setblocking(const mp_obj_t arg0, const mp_obj_t arg1) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
if (mp_obj_is_true(arg1)) {
_socket_settimeout(self, UINT64_MAX);
@@ -592,12 +592,12 @@ STATIC mp_obj_t socket_setblocking(const mp_obj_t arg0, const mp_obj_t arg1) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
// XXX this can end up waiting a very long time if the content is dribbled in one character
// at a time, as the timeout resets each time a recvfrom succeeds ... this is probably not
// good behaviour.
-STATIC mp_uint_t _socket_read_data(mp_obj_t self_in, void *buf, size_t size,
+static mp_uint_t _socket_read_data(mp_obj_t self_in, void *buf, size_t size,
struct sockaddr *from, socklen_t *from_len, int *errcode) {
socket_obj_t *sock = MP_OBJ_TO_PTR(self_in);
@@ -668,12 +668,12 @@ mp_obj_t _socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in,
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
return _socket_recvfrom(self_in, len_in, NULL, NULL);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
-STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
struct sockaddr from;
socklen_t fromlen = sizeof(from);
@@ -686,7 +686,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
int _socket_send(socket_obj_t *sock, const char *data, size_t datalen) {
int sentlen = 0;
@@ -709,16 +709,16 @@ int _socket_send(socket_obj_t *sock, const char *data, size_t datalen) {
return sentlen;
}
-STATIC mp_obj_t socket_send(const mp_obj_t arg0, const mp_obj_t arg1) {
+static mp_obj_t socket_send(const mp_obj_t arg0, const mp_obj_t arg1) {
socket_obj_t *sock = MP_OBJ_TO_PTR(arg0);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg1, &bufinfo, MP_BUFFER_READ);
int r = _socket_send(sock, bufinfo.buf, bufinfo.len);
return mp_obj_new_int(r);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
-STATIC mp_obj_t socket_sendall(const mp_obj_t arg0, const mp_obj_t arg1) {
+static mp_obj_t socket_sendall(const mp_obj_t arg0, const mp_obj_t arg1) {
// XXX behaviour when nonblocking (see extmod/modlwip.c)
// XXX also timeout behaviour.
socket_obj_t *sock = MP_OBJ_TO_PTR(arg0);
@@ -730,9 +730,9 @@ STATIC mp_obj_t socket_sendall(const mp_obj_t arg0, const mp_obj_t arg1) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_sendall_obj, socket_sendall);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_sendall_obj, socket_sendall);
-STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
+static mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
// get the buffer to send
@@ -760,25 +760,25 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
}
mp_raise_OSError(MP_ETIMEDOUT);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
+static MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
-STATIC mp_obj_t socket_fileno(const mp_obj_t arg0) {
+static mp_obj_t socket_fileno(const mp_obj_t arg0) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
return mp_obj_new_int(self->fd);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
+static MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
-STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return args[0];
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
-STATIC mp_uint_t socket_stream_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_stream_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
return _socket_read_data(self_in, buf, size, NULL, NULL, errcode);
}
-STATIC mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
socket_obj_t *sock = self_in;
for (int i = 0; i <= sock->retries; i++) {
MP_THREAD_GIL_EXIT();
@@ -798,7 +798,7 @@ STATIC mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_
return MP_STREAM_ERROR;
}
-STATIC mp_uint_t socket_stream_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t socket_stream_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
socket_obj_t *socket = self_in;
if (request == MP_STREAM_POLL) {
if (socket->fd == -1) {
@@ -867,7 +867,7 @@ STATIC mp_uint_t socket_stream_ioctl(mp_obj_t self_in, mp_uint_t request, uintpt
return MP_STREAM_ERROR;
}
-STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socket_bind_obj) },
@@ -890,15 +890,15 @@ STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
-STATIC const mp_stream_p_t socket_stream_p = {
+static const mp_stream_p_t socket_stream_p = {
.read = socket_stream_read,
.write = socket_stream_write,
.ioctl = socket_stream_ioctl
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
@@ -907,7 +907,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &socket_locals_dict
);
-STATIC mp_obj_t esp_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
struct addrinfo hints = { };
struct addrinfo *res = NULL;
@@ -963,9 +963,9 @@ STATIC mp_obj_t esp_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
lwip_freeaddrinfo(res);
return ret_list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_socket_getaddrinfo_obj, 2, 6, esp_socket_getaddrinfo);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_socket_getaddrinfo_obj, 2, 6, esp_socket_getaddrinfo);
-STATIC mp_obj_t esp_socket_initialize() {
+static mp_obj_t esp_socket_initialize() {
static int initialized = 0;
if (!initialized) {
ESP_LOGI(TAG, "Initializing");
@@ -974,9 +974,9 @@ STATIC mp_obj_t esp_socket_initialize() {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_socket_initialize_obj, esp_socket_initialize);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_socket_initialize_obj, esp_socket_initialize);
-STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) },
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&esp_socket_initialize_obj) },
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) },
@@ -997,7 +997,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
const mp_obj_module_t mp_module_socket = {
.base = { &mp_type_module },
diff --git a/ports/esp32/modtime.c b/ports/esp32/modtime.c
index 7a2b215086..4695dd23e7 100644
--- a/ports/esp32/modtime.c
+++ b/ports/esp32/modtime.c
@@ -32,7 +32,7 @@
#include "shared/timeutils/timeutils.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
struct timeval tv;
gettimeofday(&tv, NULL);
timeutils_struct_time_t tm;
@@ -51,7 +51,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Return the number of seconds since the Epoch.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
struct timeval tv;
gettimeofday(&tv, NULL);
return mp_obj_new_int(tv.tv_sec);
diff --git a/ports/esp32/mphalport.c b/ports/esp32/mphalport.c
index fb322dff6d..fd1cbcdb98 100644
--- a/ports/esp32/mphalport.c
+++ b/ports/esp32/mphalport.c
@@ -49,7 +49,7 @@
TaskHandle_t mp_main_task_handle;
-STATIC uint8_t stdin_ringbuf_array[260];
+static uint8_t stdin_ringbuf_array[260];
ringbuf_t stdin_ringbuf = {stdin_ringbuf_array, sizeof(stdin_ringbuf_array), 0, 0};
// Check the ESP-IDF error code and raise an OSError if it's not ESP_OK.
diff --git a/ports/esp32/mpnimbleport.c b/ports/esp32/mpnimbleport.c
index 5b57edf3c1..669aeb746a 100644
--- a/ports/esp32/mpnimbleport.c
+++ b/ports/esp32/mpnimbleport.c
@@ -38,7 +38,7 @@
#include "extmod/nimble/modbluetooth_nimble.h"
-STATIC void ble_host_task(void *param) {
+static void ble_host_task(void *param) {
DEBUG_printf("ble_host_task\n");
nimble_port_run(); // This function will return only when nimble_port_stop() is executed.
nimble_port_freertos_deinit();
diff --git a/ports/esp32/mpthreadport.c b/ports/esp32/mpthreadport.c
index 74dbc14797..1c13e928d9 100644
--- a/ports/esp32/mpthreadport.c
+++ b/ports/esp32/mpthreadport.c
@@ -52,9 +52,9 @@ typedef struct _mp_thread_t {
} mp_thread_t;
// the mutex controls access to the linked list
-STATIC mp_thread_mutex_t thread_mutex;
-STATIC mp_thread_t thread_entry0;
-STATIC mp_thread_t *thread = NULL; // root pointer, handled by mp_thread_gc_others
+static mp_thread_mutex_t thread_mutex;
+static mp_thread_t thread_entry0;
+static mp_thread_t *thread = NULL; // root pointer, handled by mp_thread_gc_others
void mp_thread_init(void *stack, uint32_t stack_len) {
mp_thread_set_state(&mp_state_ctx.thread);
@@ -113,9 +113,9 @@ void mp_thread_start(void) {
mp_thread_mutex_unlock(&thread_mutex);
}
-STATIC void *(*ext_thread_entry)(void *) = NULL;
+static void *(*ext_thread_entry)(void *) = NULL;
-STATIC void freertos_entry(void *arg) {
+static void freertos_entry(void *arg) {
if (ext_thread_entry) {
ext_thread_entry(arg);
}
diff --git a/ports/esp32/network_common.c b/ports/esp32/network_common.c
index 1c5979175d..fb51656817 100644
--- a/ports/esp32/network_common.c
+++ b/ports/esp32/network_common.c
@@ -81,7 +81,7 @@ NORETURN void esp_exceptions_helper(esp_err_t e) {
}
}
-STATIC mp_obj_t esp_initialize() {
+static mp_obj_t esp_initialize() {
static int initialized = 0;
if (!initialized) {
esp_exceptions(esp_netif_init());
@@ -91,7 +91,7 @@ STATIC mp_obj_t esp_initialize() {
}
MP_DEFINE_CONST_FUN_OBJ_0(esp_network_initialize_obj, esp_initialize);
-STATIC mp_obj_t esp_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_ifconfig(size_t n_args, const mp_obj_t *args) {
base_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
esp_netif_ip_info_t info;
esp_netif_dns_info_t dns_info;
@@ -163,7 +163,7 @@ mp_obj_t esp_ifname(esp_netif_t *netif) {
return ret;
}
-STATIC mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_network_phy_mode_obj, 0, 1, esp_phy_mode);
diff --git a/ports/esp32/network_lan.c b/ports/esp32/network_lan.c
index f66895f9e0..d7d9a9f7ac 100644
--- a/ports/esp32/network_lan.c
+++ b/ports/esp32/network_lan.c
@@ -61,8 +61,8 @@ typedef struct _lan_if_obj_t {
} lan_if_obj_t;
const mp_obj_type_t lan_if_type;
-STATIC lan_if_obj_t lan_obj = {{{&lan_if_type}, ESP_IF_ETH, NULL}, false, false};
-STATIC uint8_t eth_status = 0;
+static lan_if_obj_t lan_obj = {{{&lan_if_type}, ESP_IF_ETH, NULL}, false, false};
+static uint8_t eth_status = 0;
static void eth_event_handler(void *arg, esp_event_base_t event_base,
int32_t event_id, void *event_data) {
@@ -92,7 +92,7 @@ static void eth_event_handler(void *arg, esp_event_base_t event_base,
}
}
-STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
lan_if_obj_t *self = &lan_obj;
if (self->initialized) {
@@ -298,7 +298,7 @@ STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
}
MP_DEFINE_CONST_FUN_OBJ_KW(esp_network_get_lan_obj, 0, get_lan);
-STATIC mp_obj_t lan_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t lan_active(size_t n_args, const mp_obj_t *args) {
lan_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args > 1) {
@@ -318,20 +318,20 @@ STATIC mp_obj_t lan_active(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_bool(self->base.active);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lan_active_obj, 1, 2, lan_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lan_active_obj, 1, 2, lan_active);
-STATIC mp_obj_t lan_status(mp_obj_t self_in) {
+static mp_obj_t lan_status(mp_obj_t self_in) {
return MP_OBJ_NEW_SMALL_INT(eth_status);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(lan_status_obj, lan_status);
+static MP_DEFINE_CONST_FUN_OBJ_1(lan_status_obj, lan_status);
-STATIC mp_obj_t lan_isconnected(mp_obj_t self_in) {
+static mp_obj_t lan_isconnected(mp_obj_t self_in) {
lan_if_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(self->base.active && (eth_status == ETH_GOT_IP));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(lan_isconnected_obj, lan_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(lan_isconnected_obj, lan_isconnected);
-STATIC mp_obj_t lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
if (n_args != 1 && kwargs->used != 0) {
mp_raise_TypeError(MP_ERROR_TEXT("either pos or kw args are allowed"));
}
@@ -386,9 +386,9 @@ STATIC mp_obj_t lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
return val;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(lan_config_obj, 1, lan_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(lan_config_obj, 1, lan_config);
-STATIC const mp_rom_map_elem_t lan_if_locals_dict_table[] = {
+static const mp_rom_map_elem_t lan_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&lan_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&lan_isconnected_obj) },
{ MP_ROM_QSTR(MP_QSTR_status), MP_ROM_PTR(&lan_status_obj) },
@@ -396,7 +396,7 @@ STATIC const mp_rom_map_elem_t lan_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ifconfig), MP_ROM_PTR(&esp_network_ifconfig_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(lan_if_locals_dict, lan_if_locals_dict_table);
+static MP_DEFINE_CONST_DICT(lan_if_locals_dict, lan_if_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
lan_if_type,
diff --git a/ports/esp32/network_ppp.c b/ports/esp32/network_ppp.c
index cf644a6bd7..4e9b2a32ca 100644
--- a/ports/esp32/network_ppp.c
+++ b/ports/esp32/network_ppp.c
@@ -84,7 +84,7 @@ static void ppp_status_cb(ppp_pcb *pcb, int err_code, void *ctx) {
}
}
-STATIC mp_obj_t ppp_make_new(mp_obj_t stream) {
+static mp_obj_t ppp_make_new(mp_obj_t stream) {
mp_get_stream_raise(stream, MP_STREAM_OP_READ | MP_STREAM_OP_WRITE);
ppp_if_obj_t *self = mp_obj_malloc_with_finaliser(ppp_if_obj_t, &ppp_if_type);
@@ -123,7 +123,7 @@ static void pppos_client_task(void *self_in) {
}
}
-STATIC mp_obj_t ppp_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t ppp_active(size_t n_args, const mp_obj_t *args) {
ppp_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args > 1) {
@@ -169,9 +169,9 @@ STATIC mp_obj_t ppp_active(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_bool(self->active);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ppp_active_obj, 1, 2, ppp_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ppp_active_obj, 1, 2, ppp_active);
-STATIC mp_obj_t ppp_connect_py(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t ppp_connect_py(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
enum { ARG_authmode, ARG_username, ARG_password };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_authmode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = PPPAUTHTYPE_NONE} },
@@ -224,7 +224,7 @@ STATIC mp_obj_t ppp_connect_py(size_t n_args, const mp_obj_t *args, mp_map_t *kw
}
MP_DEFINE_CONST_FUN_OBJ_KW(ppp_connect_obj, 1, ppp_connect_py);
-STATIC mp_obj_t ppp_delete(mp_obj_t self_in) {
+static mp_obj_t ppp_delete(mp_obj_t self_in) {
ppp_if_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t args[] = {self, mp_const_false};
ppp_active(2, args);
@@ -232,7 +232,7 @@ STATIC mp_obj_t ppp_delete(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(ppp_delete_obj, ppp_delete);
-STATIC mp_obj_t ppp_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t ppp_ifconfig(size_t n_args, const mp_obj_t *args) {
ppp_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -266,18 +266,18 @@ STATIC mp_obj_t ppp_ifconfig(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ppp_ifconfig_obj, 1, 2, ppp_ifconfig);
-STATIC mp_obj_t ppp_status(mp_obj_t self_in) {
+static mp_obj_t ppp_status(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ppp_status_obj, ppp_status);
+static MP_DEFINE_CONST_FUN_OBJ_1(ppp_status_obj, ppp_status);
-STATIC mp_obj_t ppp_isconnected(mp_obj_t self_in) {
+static mp_obj_t ppp_isconnected(mp_obj_t self_in) {
ppp_if_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(self->connected);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ppp_isconnected_obj, ppp_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(ppp_isconnected_obj, ppp_isconnected);
-STATIC mp_obj_t ppp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t ppp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
if (n_args != 1 && kwargs->used != 0) {
mp_raise_TypeError(MP_ERROR_TEXT("either pos or kw args are allowed"));
}
@@ -319,9 +319,9 @@ STATIC mp_obj_t ppp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
return val;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ppp_config_obj, 1, ppp_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(ppp_config_obj, 1, ppp_config);
-STATIC const mp_rom_map_elem_t ppp_if_locals_dict_table[] = {
+static const mp_rom_map_elem_t ppp_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&ppp_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&ppp_connect_obj) },
{ MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&ppp_isconnected_obj) },
@@ -333,7 +333,7 @@ STATIC const mp_rom_map_elem_t ppp_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_AUTH_PAP), MP_ROM_INT(PPPAUTHTYPE_PAP) },
{ MP_ROM_QSTR(MP_QSTR_AUTH_CHAP), MP_ROM_INT(PPPAUTHTYPE_CHAP) },
};
-STATIC MP_DEFINE_CONST_DICT(ppp_if_locals_dict, ppp_if_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ppp_if_locals_dict, ppp_if_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ppp_if_type,
diff --git a/ports/esp32/network_wlan.c b/ports/esp32/network_wlan.c
index e8c75c619d..dfa3347c67 100644
--- a/ports/esp32/network_wlan.c
+++ b/ports/esp32/network_wlan.c
@@ -55,8 +55,8 @@
typedef base_if_obj_t wlan_if_obj_t;
-STATIC wlan_if_obj_t wlan_sta_obj;
-STATIC wlan_if_obj_t wlan_ap_obj;
+static wlan_if_obj_t wlan_sta_obj;
+static wlan_if_obj_t wlan_ap_obj;
// Set to "true" if esp_wifi_start() was called
static bool wifi_started = false;
@@ -183,7 +183,7 @@ static void network_wlan_ip_event_handler(void *event_handler_arg, esp_event_bas
}
}
-STATIC void require_if(mp_obj_t wlan_if, int if_no) {
+static void require_if(mp_obj_t wlan_if, int if_no) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(wlan_if);
if (self->if_id != if_no) {
mp_raise_msg(&mp_type_OSError, if_no == ESP_IF_WIFI_STA ? MP_ERROR_TEXT("STA required") : MP_ERROR_TEXT("AP required"));
@@ -233,7 +233,7 @@ void esp_initialise_wifi(void) {
}
}
-STATIC mp_obj_t network_wlan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t network_wlan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
esp_initialise_wifi();
@@ -248,7 +248,7 @@ STATIC mp_obj_t network_wlan_make_new(const mp_obj_type_t *type, size_t n_args,
}
}
-STATIC mp_obj_t network_wlan_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_wlan_active(size_t n_args, const mp_obj_t *args) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
wifi_mode_t mode;
@@ -284,9 +284,9 @@ STATIC mp_obj_t network_wlan_active(size_t n_args, const mp_obj_t *args) {
return (mode & bit) ? mp_const_true : mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_wlan_active_obj, 1, 2, network_wlan_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_wlan_active_obj, 1, 2, network_wlan_active);
-STATIC mp_obj_t network_wlan_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t network_wlan_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ssid, ARG_key, ARG_bssid };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_, MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -334,16 +334,16 @@ STATIC mp_obj_t network_wlan_connect(size_t n_args, const mp_obj_t *pos_args, mp
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_wlan_connect_obj, 1, network_wlan_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_wlan_connect_obj, 1, network_wlan_connect);
-STATIC mp_obj_t network_wlan_disconnect(mp_obj_t self_in) {
+static mp_obj_t network_wlan_disconnect(mp_obj_t self_in) {
wifi_sta_connect_requested = false;
esp_exceptions(esp_wifi_disconnect());
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_wlan_disconnect_obj, network_wlan_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_wlan_disconnect_obj, network_wlan_disconnect);
-STATIC mp_obj_t network_wlan_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_wlan_status(size_t n_args, const mp_obj_t *args) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
if (self->if_id == ESP_IF_WIFI_STA) {
@@ -405,9 +405,9 @@ STATIC mp_obj_t network_wlan_status(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_wlan_status_obj, 1, 2, network_wlan_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_wlan_status_obj, 1, 2, network_wlan_status);
-STATIC mp_obj_t network_wlan_scan(mp_obj_t self_in) {
+static mp_obj_t network_wlan_scan(mp_obj_t self_in) {
// check that STA mode is active
wifi_mode_t mode;
esp_exceptions(esp_wifi_get_mode(&mode));
@@ -448,9 +448,9 @@ STATIC mp_obj_t network_wlan_scan(mp_obj_t self_in) {
}
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_wlan_scan_obj, network_wlan_scan);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_wlan_scan_obj, network_wlan_scan);
-STATIC mp_obj_t network_wlan_isconnected(mp_obj_t self_in) {
+static mp_obj_t network_wlan_isconnected(mp_obj_t self_in) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->if_id == ESP_IF_WIFI_STA) {
return mp_obj_new_bool(wifi_sta_connected);
@@ -460,9 +460,9 @@ STATIC mp_obj_t network_wlan_isconnected(mp_obj_t self_in) {
return mp_obj_new_bool(sta.num != 0);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_wlan_isconnected_obj, network_wlan_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_wlan_isconnected_obj, network_wlan_isconnected);
-STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
if (n_args != 1 && kwargs->used != 0) {
mp_raise_TypeError(MP_ERROR_TEXT("either pos or kw args are allowed"));
}
@@ -697,7 +697,7 @@ unknown:
}
MP_DEFINE_CONST_FUN_OBJ_KW(network_wlan_config_obj, 1, network_wlan_config);
-STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
+static const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&network_wlan_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&network_wlan_connect_obj) },
{ MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&network_wlan_disconnect_obj) },
@@ -712,7 +712,7 @@ STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PM_PERFORMANCE), MP_ROM_INT(WIFI_PS_MIN_MODEM) },
{ MP_ROM_QSTR(MP_QSTR_PM_POWERSAVE), MP_ROM_INT(WIFI_PS_MAX_MODEM) },
};
-STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
+static MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
esp_network_wlan_type,
diff --git a/ports/esp32/uart.c b/ports/esp32/uart.c
index b82a638a5b..863301143d 100644
--- a/ports/esp32/uart.c
+++ b/ports/esp32/uart.c
@@ -37,7 +37,7 @@
#include "driver/uart.h" // For uart_get_sclk_freq()
#include "hal/uart_hal.h"
-STATIC void uart_irq_handler(void *arg);
+static void uart_irq_handler(void *arg);
// Declaring the HAL structure on the stack saves a tiny amount of static RAM
#define REPL_HAL_DEFN() { .dev = UART_LL_GET_HW(MICROPY_HW_UART_REPL) }
@@ -99,7 +99,7 @@ int uart_stdout_tx_strn(const char *str, size_t len) {
}
// all code executed in ISR must be in IRAM, and any const data must be in DRAM
-STATIC void IRAM_ATTR uart_irq_handler(void *arg) {
+static void IRAM_ATTR uart_irq_handler(void *arg) {
uint8_t rbuf[SOC_UART_FIFO_LEN];
int len;
uart_hal_context_t repl_hal = REPL_HAL_DEFN();
diff --git a/ports/esp8266/esp_mphal.c b/ports/esp8266/esp_mphal.c
index 6f158058d9..75588f73b7 100644
--- a/ports/esp8266/esp_mphal.c
+++ b/ports/esp8266/esp_mphal.c
@@ -36,7 +36,7 @@
#include "extmod/misc.h"
#include "shared/runtime/pyexec.h"
-STATIC byte stdin_ringbuf_array[256];
+static byte stdin_ringbuf_array[256];
ringbuf_t stdin_ringbuf = {stdin_ringbuf_array, sizeof(stdin_ringbuf_array), 0, 0};
void mp_hal_debug_tx_strn_cooked(void *env, const char *str, uint32_t len);
const mp_print_t mp_debug_print = {NULL, mp_hal_debug_tx_strn_cooked};
diff --git a/ports/esp8266/esppwm.c b/ports/esp8266/esppwm.c
index d7ac44a178..be11272c48 100644
--- a/ports/esp8266/esppwm.c
+++ b/ports/esp8266/esppwm.c
@@ -41,23 +41,23 @@ struct pwm_param {
uint16_t duty[PWM_CHANNEL];
};
-STATIC const uint8_t pin_num[PWM_CHANNEL] = {0, 2, 4, 5, 12, 13, 14, 15};
+static const uint8_t pin_num[PWM_CHANNEL] = {0, 2, 4, 5, 12, 13, 14, 15};
-STATIC struct pwm_single_param pwm_single_toggle[2][PWM_CHANNEL + 1];
-STATIC struct pwm_single_param *pwm_single;
+static struct pwm_single_param pwm_single_toggle[2][PWM_CHANNEL + 1];
+static struct pwm_single_param *pwm_single;
-STATIC struct pwm_param pwm;
+static struct pwm_param pwm;
-STATIC int8_t pwm_out_io_num[PWM_CHANNEL] = {-1, -1, -1, -1, -1, -1, -1, -1};
+static int8_t pwm_out_io_num[PWM_CHANNEL] = {-1, -1, -1, -1, -1, -1, -1, -1};
-STATIC uint8_t pwm_channel_toggle[2];
-STATIC uint8_t *pwm_channel;
-STATIC uint8_t pwm_toggle = 1;
-STATIC uint8_t pwm_timer_down = 1;
-STATIC uint8_t pwm_current_channel = 0;
-STATIC uint16_t pwm_gpio = 0;
-STATIC uint8_t pwm_channel_num = 0;
-STATIC volatile uint8_t pwm_toggle_request = 0;
+static uint8_t pwm_channel_toggle[2];
+static uint8_t *pwm_channel;
+static uint8_t pwm_toggle = 1;
+static uint8_t pwm_timer_down = 1;
+static uint8_t pwm_current_channel = 0;
+static uint16_t pwm_gpio = 0;
+static uint8_t pwm_channel_num = 0;
+static volatile uint8_t pwm_toggle_request = 0;
// XXX: 0xffffffff/(80000000/16)=35A
#define US_TO_RTC_TIMER_TICKS(t) \
@@ -81,7 +81,7 @@ typedef enum {
TM_EDGE_INT = 0,
} TIMER_INT_MODE;
-STATIC void ICACHE_FLASH_ATTR
+static void ICACHE_FLASH_ATTR
pwm_insert_sort(struct pwm_single_param pwm[], uint8 n) {
uint8 i;
@@ -106,7 +106,7 @@ pwm_insert_sort(struct pwm_single_param pwm[], uint8 n) {
}
}
-STATIC volatile uint8 critical = 0;
+static volatile uint8 critical = 0;
#define LOCK_PWM(c) do { \
while ((c) == 1); \
@@ -298,7 +298,7 @@ pwm_get_freq(uint8 channel) {
* Parameters : NONE
* Returns : NONE
*******************************************************************************/
-STATIC void ICACHE_RAM_ATTR
+static void ICACHE_RAM_ATTR
pwm_tim1_intr_handler(void *dummy) {
(void)dummy;
diff --git a/ports/esp8266/lexerstr32.c b/ports/esp8266/lexerstr32.c
index a921efbbdc..51d5658e43 100644
--- a/ports/esp8266/lexerstr32.c
+++ b/ports/esp8266/lexerstr32.c
@@ -35,7 +35,7 @@ typedef struct _mp_lexer_str32_buf_t {
uint8_t byte_off;
} mp_lexer_str32_buf_t;
-STATIC mp_uint_t str32_buf_next_byte(void *sb_in) {
+static mp_uint_t str32_buf_next_byte(void *sb_in) {
mp_lexer_str32_buf_t *sb = (mp_lexer_str32_buf_t *)sb_in;
byte c = sb->val & 0xff;
if (c == 0) {
@@ -52,7 +52,7 @@ STATIC mp_uint_t str32_buf_next_byte(void *sb_in) {
return c;
}
-STATIC void str32_buf_free(void *sb_in) {
+static void str32_buf_free(void *sb_in) {
mp_lexer_str32_buf_t *sb = (mp_lexer_str32_buf_t *)sb_in;
m_del_obj(mp_lexer_str32_buf_t, sb);
}
diff --git a/ports/esp8266/machine_adc.c b/ports/esp8266/machine_adc.c
index 83384eea97..840b5ac6cd 100644
--- a/ports/esp8266/machine_adc.c
+++ b/ports/esp8266/machine_adc.c
@@ -37,10 +37,10 @@ typedef struct _machine_adc_obj_t {
bool isvdd;
} machine_adc_obj_t;
-STATIC machine_adc_obj_t machine_adc_vdd3 = {{&machine_adc_type}, true};
-STATIC machine_adc_obj_t machine_adc_adc = {{&machine_adc_type}, false};
+static machine_adc_obj_t machine_adc_vdd3 = {{&machine_adc_type}, true};
+static machine_adc_obj_t machine_adc_adc = {{&machine_adc_type}, false};
-STATIC uint16_t adc_read(machine_adc_obj_t *self) {
+static uint16_t adc_read(machine_adc_obj_t *self) {
if (self->isvdd) {
return system_get_vdd33();
} else {
@@ -48,12 +48,12 @@ STATIC uint16_t adc_read(machine_adc_obj_t *self) {
}
}
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "ADC(%u)", self->isvdd);
}
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
mp_int_t chn = mp_obj_get_int(args[0]);
@@ -69,12 +69,12 @@ STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type_in, size_t n_a
}
// read_u16()
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
uint32_t value = adc_read(self);
return value * 65535 / 1024;
}
// Legacy method
-STATIC mp_int_t mp_machine_adc_read(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read(machine_adc_obj_t *self) {
return adc_read(self);
}
diff --git a/ports/esp8266/machine_pin.c b/ports/esp8266/machine_pin.c
index 344197da94..ec22c7c588 100644
--- a/ports/esp8266/machine_pin.c
+++ b/ports/esp8266/machine_pin.c
@@ -61,8 +61,8 @@ typedef struct _pin_irq_obj_t {
uint16_t phys_port;
} pin_irq_obj_t;
-STATIC void pin_intr_handler_part1(void *arg);
-STATIC void pin_intr_handler_part2(uint32_t status);
+static void pin_intr_handler_part1(void *arg);
+static void pin_intr_handler_part2(uint32_t status);
const pyb_pin_obj_t pyb_pin_obj[16 + 1] = {
{{&pyb_pin_type}, 0, FUNC_GPIO0, PERIPHS_IO_MUX_GPIO0_U},
@@ -89,7 +89,7 @@ const pyb_pin_obj_t pyb_pin_obj[16 + 1] = {
uint8_t pin_mode[16 + 1];
// forward declaration
-STATIC const pin_irq_obj_t pin_irq_obj[16];
+static const pin_irq_obj_t pin_irq_obj[16];
void pin_init0(void) {
ETS_GPIO_INTR_DISABLE();
@@ -242,7 +242,7 @@ void pin_set(uint pin, int value) {
}
}
-STATIC void pyb_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_pin_obj_t *self = self_in;
// pin name
@@ -250,7 +250,7 @@ STATIC void pyb_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
}
// pin.init(mode, pull=None, *, value)
-STATIC mp_obj_t pyb_pin_obj_init_helper(pyb_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_pin_obj_init_helper(pyb_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_pull, ARG_value };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT },
@@ -334,7 +334,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
}
// fast method for getting/setting pin value
-STATIC mp_obj_t pyb_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
pyb_pin_obj_t *self = self_in;
if (n_args == 0) {
@@ -348,33 +348,33 @@ STATIC mp_obj_t pyb_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
}
// pin.init(mode, pull)
-STATIC mp_obj_t pyb_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(pyb_pin_init_obj, 1, pyb_pin_obj_init);
// pin.value([value])
-STATIC mp_obj_t pyb_pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_pin_value(size_t n_args, const mp_obj_t *args) {
return pyb_pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_pin_value_obj, 1, 2, pyb_pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_pin_value_obj, 1, 2, pyb_pin_value);
-STATIC mp_obj_t pyb_pin_off(mp_obj_t self_in) {
+static mp_obj_t pyb_pin_off(mp_obj_t self_in) {
pyb_pin_obj_t *self = self_in;
pin_set(self->phys_port, 0);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_pin_off_obj, pyb_pin_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_pin_off_obj, pyb_pin_off);
-STATIC mp_obj_t pyb_pin_on(mp_obj_t self_in) {
+static mp_obj_t pyb_pin_on(mp_obj_t self_in) {
pyb_pin_obj_t *self = self_in;
pin_set(self->phys_port, 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_pin_on_obj, pyb_pin_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_pin_on_obj, pyb_pin_on);
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING, hard=False)
-STATIC mp_obj_t pyb_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -410,10 +410,10 @@ STATIC mp_obj_t pyb_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
// return the irq object
return MP_OBJ_FROM_PTR(&pin_irq_obj[self->phys_port]);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_pin_irq_obj, 1, pyb_pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_pin_irq_obj, 1, pyb_pin_irq);
-STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode);
-STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode);
+static mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
pyb_pin_obj_t *self = self_in;
@@ -429,7 +429,7 @@ STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, i
return -1;
}
-STATIC const mp_rom_map_elem_t pyb_pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pyb_pin_value_obj) },
@@ -449,9 +449,9 @@ STATIC const mp_rom_map_elem_t pyb_pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_PIN_INTR_NEGEDGE) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_pin_locals_dict, pyb_pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_pin_locals_dict, pyb_pin_locals_dict_table);
-STATIC const mp_pin_p_t pin_pin_p = {
+static const mp_pin_p_t pin_pin_p = {
.ioctl = pin_ioctl,
};
@@ -469,9 +469,9 @@ MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
// Pin IRQ object
-STATIC const mp_obj_type_t pin_irq_type;
+static const mp_obj_type_t pin_irq_type;
-STATIC const pin_irq_obj_t pin_irq_obj[16] = {
+static const pin_irq_obj_t pin_irq_obj[16] = {
{{&pin_irq_type}, 0},
{{&pin_irq_type}, 1},
{{&pin_irq_type}, 2},
@@ -490,14 +490,14 @@ STATIC const pin_irq_obj_t pin_irq_obj[16] = {
{{&pin_irq_type}, 15},
};
-STATIC mp_obj_t pin_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pin_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
pin_irq_obj_t *self = self_in;
mp_arg_check_num(n_args, n_kw, 0, 0, false);
pin_intr_handler_part2(1 << self->phys_port);
return mp_const_none;
}
-STATIC mp_obj_t pin_irq_trigger(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_irq_trigger(size_t n_args, const mp_obj_t *args) {
pin_irq_obj_t *self = args[0];
uint32_t orig_trig = GET_TRIGGER(self->phys_port);
if (n_args == 2) {
@@ -507,15 +507,15 @@ STATIC mp_obj_t pin_irq_trigger(size_t n_args, const mp_obj_t *args) {
// return original trigger value
return MP_OBJ_NEW_SMALL_INT(orig_trig);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_irq_trigger_obj, 1, 2, pin_irq_trigger);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_irq_trigger_obj, 1, 2, pin_irq_trigger);
-STATIC const mp_rom_map_elem_t pin_irq_locals_dict_table[] = {
+static const mp_rom_map_elem_t pin_irq_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_trigger), MP_ROM_PTR(&pin_irq_trigger_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pin_irq_locals_dict, pin_irq_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pin_irq_locals_dict, pin_irq_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
pin_irq_type,
MP_QSTR_IRQ,
MP_TYPE_FLAG_NONE,
diff --git a/ports/esp8266/machine_pwm.c b/ports/esp8266/machine_pwm.c
index b9e499d252..25a2d6898f 100644
--- a/ports/esp8266/machine_pwm.c
+++ b/ports/esp8266/machine_pwm.c
@@ -38,14 +38,14 @@ typedef struct _machine_pwm_obj_t {
int32_t duty_ns;
} machine_pwm_obj_t;
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty);
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty);
-STATIC bool pwm_inited = false;
+static bool pwm_inited = false;
/******************************************************************************/
// MicroPython bindings for PWM
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "PWM(%u", self->pin->phys_port);
if (self->active) {
@@ -55,7 +55,7 @@ STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_p
mp_printf(print, ")");
}
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq, ARG_duty, ARG_duty_u16, ARG_duty_ns };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_freq, MP_ARG_INT, {.u_int = -1} },
@@ -96,7 +96,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, c
pwm_start();
}
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
pyb_pin_obj_t *pin = mp_obj_get_pin_obj(args[0]);
@@ -121,17 +121,17 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
pwm_delete(self->channel);
self->active = 0;
pwm_start();
}
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT(pwm_get_freq(0));
}
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
pwm_set_freq(freq, 0);
if (self->duty_ns != -1) {
mp_machine_pwm_duty_set_ns(self, self->duty_ns);
@@ -140,7 +140,7 @@ STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
}
}
-STATIC void set_active(machine_pwm_obj_t *self, bool set_pin) {
+static void set_active(machine_pwm_obj_t *self, bool set_pin) {
if (!self->active) {
pwm_add(self->pin->phys_port, self->pin->periph, self->pin->func);
self->active = 1;
@@ -150,37 +150,37 @@ STATIC void set_active(machine_pwm_obj_t *self, bool set_pin) {
}
}
-STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
set_active(self, true);
return MP_OBJ_NEW_SMALL_INT(pwm_get_duty(self->channel));
}
-STATIC void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
set_active(self, false);
self->duty_ns = -1;
pwm_set_duty(duty, self->channel);
pwm_start();
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
set_active(self, true);
return MP_OBJ_NEW_SMALL_INT(pwm_get_duty(self->channel) * 65536 / 1024);
}
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty) {
set_active(self, false);
self->duty_ns = -1;
pwm_set_duty(duty * 1024 / 65536, self->channel);
pwm_start();
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
set_active(self, true);
uint32_t freq = pwm_get_freq(0);
return MP_OBJ_NEW_SMALL_INT(pwm_get_duty(self->channel) * 976563 / freq);
}
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
set_active(self, false);
self->duty_ns = duty;
uint32_t freq = pwm_get_freq(0);
diff --git a/ports/esp8266/machine_rtc.c b/ports/esp8266/machine_rtc.c
index d8cbb8f824..9c4d46f370 100644
--- a/ports/esp8266/machine_rtc.c
+++ b/ports/esp8266/machine_rtc.c
@@ -45,14 +45,14 @@ typedef struct _pyb_rtc_obj_t {
#define MEM_USER_MAXLEN (512 - (MEM_USER_DATA_ADDR - MEM_DELTA_ADDR) * 4)
// singleton RTC object
-STATIC const pyb_rtc_obj_t pyb_rtc_obj = {{&pyb_rtc_type}};
+static const pyb_rtc_obj_t pyb_rtc_obj = {{&pyb_rtc_type}};
// ALARM0 state
uint32_t pyb_rtc_alarm0_wake; // see MACHINE_WAKE_xxx constants
uint64_t pyb_rtc_alarm0_expiry; // in microseconds
// RTC overflow checking
-STATIC uint32_t rtc_last_ticks;
+static uint32_t rtc_last_ticks;
void mp_hal_rtc_init(void) {
uint32_t magic;
@@ -76,7 +76,7 @@ void mp_hal_rtc_init(void) {
pyb_rtc_alarm0_expiry = 0;
}
-STATIC mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -124,7 +124,7 @@ void rtc_prepare_deepsleep(uint64_t sleep_us) {
system_rtc_mem_write(MEM_DELTA_ADDR, &delta, sizeof(delta));
}
-STATIC mp_obj_t pyb_rtc_datetime(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_rtc_datetime(size_t n_args, const mp_obj_t *args) {
if (n_args == 1) {
// Get time
uint64_t msecs = pyb_rtc_get_us_since_epoch() / 1000;
@@ -161,9 +161,9 @@ STATIC mp_obj_t pyb_rtc_datetime(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_datetime_obj, 1, 2, pyb_rtc_datetime);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_datetime_obj, 1, 2, pyb_rtc_datetime);
-STATIC mp_obj_t pyb_rtc_memory(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_rtc_memory(size_t n_args, const mp_obj_t *args) {
uint8_t rtcram[MEM_USER_MAXLEN];
uint32_t len;
@@ -198,9 +198,9 @@ STATIC mp_obj_t pyb_rtc_memory(size_t n_args, const mp_obj_t *args) {
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_memory_obj, 1, 2, pyb_rtc_memory);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_memory_obj, 1, 2, pyb_rtc_memory);
-STATIC mp_obj_t pyb_rtc_alarm(mp_obj_t self_in, mp_obj_t alarm_id, mp_obj_t time_in) {
+static mp_obj_t pyb_rtc_alarm(mp_obj_t self_in, mp_obj_t alarm_id, mp_obj_t time_in) {
(void)self_in; // unused
// check we want alarm0
@@ -214,9 +214,9 @@ STATIC mp_obj_t pyb_rtc_alarm(mp_obj_t self_in, mp_obj_t alarm_id, mp_obj_t time
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_rtc_alarm_obj, pyb_rtc_alarm);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_rtc_alarm_obj, pyb_rtc_alarm);
-STATIC mp_obj_t pyb_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
// check we want alarm0
if (n_args > 1 && mp_obj_get_int(args[1]) != 0) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid alarm"));
@@ -229,9 +229,9 @@ STATIC mp_obj_t pyb_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_int((pyb_rtc_alarm0_expiry - now) / 1000);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_alarm_left_obj, 1, 2, pyb_rtc_alarm_left);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_alarm_left_obj, 1, 2, pyb_rtc_alarm_left);
-STATIC mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_trigger, ARG_wake };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_trigger, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -250,9 +250,9 @@ STATIC mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_irq_obj, 1, pyb_rtc_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_irq_obj, 1, pyb_rtc_irq);
-STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&pyb_rtc_datetime_obj) },
{ MP_ROM_QSTR(MP_QSTR_memory), MP_ROM_PTR(&pyb_rtc_memory_obj) },
{ MP_ROM_QSTR(MP_QSTR_alarm), MP_ROM_PTR(&pyb_rtc_alarm_obj) },
@@ -260,7 +260,7 @@ STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pyb_rtc_irq_obj) },
{ MP_ROM_QSTR(MP_QSTR_ALARM0), MP_ROM_INT(0) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_rtc_type,
diff --git a/ports/esp8266/machine_spi.c b/ports/esp8266/machine_spi.c
index b7f8ecf240..68a6b82ed3 100644
--- a/ports/esp8266/machine_spi.c
+++ b/ports/esp8266/machine_spi.c
@@ -48,7 +48,7 @@ typedef struct _machine_spi_obj_t {
uint8_t phase;
} machine_spi_obj_t;
-STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
(void)self_in;
if (dest == NULL) {
@@ -94,13 +94,13 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8
/******************************************************************************/
// MicroPython bindings for HSPI
-STATIC void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "HSPI(id=1, baudrate=%u, polarity=%u, phase=%u)",
self->baudrate, self->polarity, self->phase);
}
-STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_spi_obj_t *self = (machine_spi_obj_t *)self_in;
enum { ARG_baudrate, ARG_polarity, ARG_phase };
@@ -170,7 +170,7 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return MP_OBJ_FROM_PTR(self);
}
-STATIC const mp_machine_spi_p_t machine_spi_p = {
+static const mp_machine_spi_p_t machine_spi_p = {
.init = machine_spi_init,
.transfer = machine_spi_transfer,
};
diff --git a/ports/esp8266/machine_uart.c b/ports/esp8266/machine_uart.c
index eaaa8ac865..7c9b071a1a 100644
--- a/ports/esp8266/machine_uart.c
+++ b/ports/esp8266/machine_uart.c
@@ -47,7 +47,7 @@ typedef struct _machine_uart_obj_t {
uint16_t timeout_char; // timeout waiting between chars (in ms)
} machine_uart_obj_t;
-STATIC const char *_parity_name[] = {"None", "1", "0"};
+static const char *_parity_name[] = {"None", "1", "0"};
/******************************************************************************/
// MicroPython bindings for UART
@@ -55,14 +55,14 @@ STATIC const char *_parity_name[] = {"None", "1", "0"};
// The UART class doesn't have any constants for this port.
#define MICROPY_PY_MACHINE_UART_CLASS_CONSTANTS
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%u, rxbuf=%u, timeout=%u, timeout_char=%u)",
self->uart_id, self->baudrate, self->bits, _parity_name[self->parity],
self->stop, uart0_get_rxbuf_len() - 1, self->timeout, self->timeout_char);
}
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_rxbuf, ARG_timeout, ARG_timeout_char };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 0} },
@@ -190,7 +190,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
uart_setup(self->uart_id);
}
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// get uart id
@@ -217,19 +217,19 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
(void)self;
}
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
return uart_rx_any(self->uart_id);
}
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
return uart_txdone(self->uart_id);
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->uart_id == 1) {
@@ -258,7 +258,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
}
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
const byte *buf = buf_in;
@@ -279,7 +279,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
return size;
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = self_in;
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
diff --git a/ports/esp8266/machine_wdt.c b/ports/esp8266/machine_wdt.c
index 074ee56598..f9399e63ad 100644
--- a/ports/esp8266/machine_wdt.c
+++ b/ports/esp8266/machine_wdt.c
@@ -34,9 +34,9 @@ typedef struct _machine_wdt_obj_t {
mp_obj_base_t base;
} machine_wdt_obj_t;
-STATIC machine_wdt_obj_t wdt_default = {{&machine_wdt_type}};
+static machine_wdt_obj_t wdt_default = {{&machine_wdt_type}};
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
// The timeout on ESP8266 is fixed, so raise an exception if the argument is not the default.
if (timeout_ms != 5000) {
mp_raise_ValueError(NULL);
@@ -52,7 +52,7 @@ STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t
}
}
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
(void)self;
system_soft_wdt_feed();
}
diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c
index d774bbd35a..2dd7c1dece 100644
--- a/ports/esp8266/main.c
+++ b/ports/esp8266/main.c
@@ -47,9 +47,9 @@
#include "modespnow.h"
#endif
-STATIC char heap[38 * 1024];
+static char heap[38 * 1024];
-STATIC void mp_reset(void) {
+static void mp_reset(void) {
mp_stack_set_top((void *)0x40000000);
mp_stack_set_limit(8192);
mp_hal_init();
diff --git a/ports/esp8266/modesp.c b/ports/esp8266/modesp.c
index 95595faebc..f303da1a33 100644
--- a/ports/esp8266/modesp.c
+++ b/ports/esp8266/modesp.c
@@ -46,7 +46,7 @@ void error_check(bool status, mp_rom_error_text_t msg) {
}
}
-STATIC mp_obj_t esp_osdebug(mp_obj_t val) {
+static mp_obj_t esp_osdebug(mp_obj_t val) {
if (val == mp_const_none) {
uart_os_config(-1);
} else {
@@ -54,9 +54,9 @@ STATIC mp_obj_t esp_osdebug(mp_obj_t val) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_osdebug_obj, esp_osdebug);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_osdebug_obj, esp_osdebug);
-STATIC mp_obj_t esp_sleep_type(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_sleep_type(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
return mp_obj_new_int(wifi_get_sleep_type());
} else {
@@ -64,9 +64,9 @@ STATIC mp_obj_t esp_sleep_type(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_sleep_type_obj, 0, 1, esp_sleep_type);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_sleep_type_obj, 0, 1, esp_sleep_type);
-STATIC mp_obj_t esp_deepsleep(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_deepsleep(size_t n_args, const mp_obj_t *args) {
uint32_t sleep_us = n_args > 0 ? mp_obj_get_int(args[0]) : 0;
// prepare for RTC reset at wake up
rtc_prepare_deepsleep(sleep_us);
@@ -74,14 +74,14 @@ STATIC mp_obj_t esp_deepsleep(size_t n_args, const mp_obj_t *args) {
system_deep_sleep(sleep_us);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_deepsleep_obj, 0, 2, esp_deepsleep);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_deepsleep_obj, 0, 2, esp_deepsleep);
-STATIC mp_obj_t esp_flash_id() {
+static mp_obj_t esp_flash_id() {
return mp_obj_new_int(spi_flash_get_id());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_id_obj, esp_flash_id);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_id_obj, esp_flash_id);
-STATIC mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t len_or_buf_in) {
+static mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t len_or_buf_in) {
mp_int_t offset = mp_obj_get_int(offset_in);
mp_int_t len;
@@ -111,9 +111,9 @@ STATIC mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t len_or_buf_in) {
}
mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read);
-STATIC mp_obj_t esp_flash_write(mp_obj_t offset_in, const mp_obj_t buf_in) {
+static mp_obj_t esp_flash_write(mp_obj_t offset_in, const mp_obj_t buf_in) {
mp_int_t offset = mp_obj_get_int(offset_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
@@ -128,9 +128,9 @@ STATIC mp_obj_t esp_flash_write(mp_obj_t offset_in, const mp_obj_t buf_in) {
}
mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write);
-STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
+static mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
mp_int_t sector = mp_obj_get_int(sector_in);
ets_loop_iter(); // flash access takes time so run any pending tasks
SpiFlashOpResult res = spi_flash_erase_sector(sector);
@@ -140,9 +140,9 @@ STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) {
}
mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
-STATIC mp_obj_t esp_flash_size(void) {
+static mp_obj_t esp_flash_size(void) {
extern char flashchip;
// For SDK 1.5.2, either address has shifted and not mirrored in
// eagle.rom.addr.v6.ld, or extra initial member was added.
@@ -157,7 +157,7 @@ STATIC mp_obj_t esp_flash_size(void) {
#endif
return mp_obj_new_int_from_uint(flash->chip_size);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
// If there's just 1 loadable segment at the start of flash,
// we assume there's a yaota8266 bootloader.
@@ -165,12 +165,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
extern byte _firmware_size[];
-STATIC mp_obj_t esp_flash_user_start(void) {
+static mp_obj_t esp_flash_user_start(void) {
return MP_OBJ_NEW_SMALL_INT((uint32_t)_firmware_size);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj, esp_flash_user_start);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj, esp_flash_user_start);
-STATIC mp_obj_t esp_check_fw(void) {
+static mp_obj_t esp_check_fw(void) {
MD5_CTX ctx;
char *fw_start = (char *)0x40200000;
if (IS_OTA_FIRMWARE()) {
@@ -195,10 +195,10 @@ STATIC mp_obj_t esp_check_fw(void) {
printf("\n");
return mp_obj_new_bool(memcmp(digest, fw_start + size, sizeof(digest)) == 0);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_check_fw_obj, esp_check_fw);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_check_fw_obj, esp_check_fw);
#if MICROPY_ESP8266_APA102
-STATIC mp_obj_t esp_apa102_write_(mp_obj_t clockPin, mp_obj_t dataPin, mp_obj_t buf) {
+static mp_obj_t esp_apa102_write_(mp_obj_t clockPin, mp_obj_t dataPin, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
esp_apa102_write(mp_obj_get_pin(clockPin),
@@ -206,35 +206,35 @@ STATIC mp_obj_t esp_apa102_write_(mp_obj_t clockPin, mp_obj_t dataPin, mp_obj_t
(uint8_t *)bufinfo.buf, bufinfo.len);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_apa102_write_obj, esp_apa102_write_);
+static MP_DEFINE_CONST_FUN_OBJ_3(esp_apa102_write_obj, esp_apa102_write_);
#endif
-STATIC mp_obj_t esp_freemem() {
+static mp_obj_t esp_freemem() {
return MP_OBJ_NEW_SMALL_INT(system_get_free_heap_size());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_freemem_obj, esp_freemem);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_freemem_obj, esp_freemem);
-STATIC mp_obj_t esp_meminfo() {
+static mp_obj_t esp_meminfo() {
system_print_meminfo();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_meminfo_obj, esp_meminfo);
+static MP_DEFINE_CONST_FUN_OBJ_0(esp_meminfo_obj, esp_meminfo);
-STATIC mp_obj_t esp_malloc(mp_obj_t size_in) {
+static mp_obj_t esp_malloc(mp_obj_t size_in) {
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)os_malloc(mp_obj_get_int(size_in)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_malloc_obj, esp_malloc);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_malloc_obj, esp_malloc);
-STATIC mp_obj_t esp_free(mp_obj_t addr_in) {
+static mp_obj_t esp_free(mp_obj_t addr_in) {
os_free((void *)mp_obj_get_int(addr_in));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_free_obj, esp_free);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_free_obj, esp_free);
-STATIC mp_obj_t esp_esf_free_bufs(mp_obj_t idx_in) {
+static mp_obj_t esp_esf_free_bufs(mp_obj_t idx_in) {
return MP_OBJ_NEW_SMALL_INT(ets_esf_free_bufs(mp_obj_get_int(idx_in)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_esf_free_bufs_obj, esp_esf_free_bufs);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_esf_free_bufs_obj, esp_esf_free_bufs);
#if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA
@@ -257,11 +257,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_esf_free_bufs_obj, esp_esf_free_bufs);
#define ESP_NATIVE_CODE_FLASH (1)
extern uint32_t _lit4_end;
-STATIC uint32_t esp_native_code_location;
-STATIC uint32_t esp_native_code_start;
-STATIC uint32_t esp_native_code_end;
-STATIC uint32_t esp_native_code_cur;
-STATIC uint32_t esp_native_code_erased;
+static uint32_t esp_native_code_location;
+static uint32_t esp_native_code_start;
+static uint32_t esp_native_code_end;
+static uint32_t esp_native_code_cur;
+static uint32_t esp_native_code_erased;
void esp_native_code_init(void) {
esp_native_code_location = ESP_NATIVE_CODE_IRAM1;
@@ -317,7 +317,7 @@ void *esp_native_code_commit(void *buf, size_t len, void *reloc) {
return dest;
}
-STATIC mp_obj_t esp_set_native_code_location(mp_obj_t start_in, mp_obj_t len_in) {
+static mp_obj_t esp_set_native_code_location(mp_obj_t start_in, mp_obj_t len_in) {
if (start_in == mp_const_none && len_in == mp_const_none) {
// use end of iram1 region
esp_native_code_init();
@@ -335,11 +335,11 @@ STATIC mp_obj_t esp_set_native_code_location(mp_obj_t start_in, mp_obj_t len_in)
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_set_native_code_location_obj, esp_set_native_code_location);
+static MP_DEFINE_CONST_FUN_OBJ_2(esp_set_native_code_location_obj, esp_set_native_code_location);
#endif
-STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
+static const mp_rom_map_elem_t esp_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp) },
{ MP_ROM_QSTR(MP_QSTR_osdebug), MP_ROM_PTR(&esp_osdebug_obj) },
@@ -371,7 +371,7 @@ STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);
+static MP_DEFINE_CONST_DICT(esp_module_globals, esp_module_globals_table);
const mp_obj_module_t esp_module = {
.base = { &mp_type_module },
diff --git a/ports/esp8266/modespnow.c b/ports/esp8266/modespnow.c
index 170e488c10..91510a3f9d 100644
--- a/ports/esp8266/modespnow.c
+++ b/ports/esp8266/modespnow.c
@@ -142,21 +142,21 @@ static esp_espnow_obj_t *_get_singleton_initialised() {
// Allocate and initialise the ESPNow module as a singleton.
// Returns the initialised espnow_singleton.
-STATIC mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args,
+static mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args,
size_t n_kw, const mp_obj_t *all_args) {
return _get_singleton();
}
// Forward declare the send and recv ESPNow callbacks
-STATIC void send_cb(uint8_t *mac_addr, uint8_t status);
+static void send_cb(uint8_t *mac_addr, uint8_t status);
-STATIC void recv_cb(uint8_t *mac_addr, uint8_t *data, uint8_t len);
+static void recv_cb(uint8_t *mac_addr, uint8_t *data, uint8_t len);
// ESPNow.deinit(): De-initialise the ESPNOW software stack, disable callbacks
// and deallocate the recv data buffers.
// Note: this function is called from main.c:mp_task() to cleanup before soft
-// reset, so cannot be declared STATIC and must guard against self == NULL;.
+// reset, so cannot be declared static and must guard against self == NULL;.
mp_obj_t espnow_deinit(mp_obj_t _) {
esp_espnow_obj_t *self = _get_singleton();
if (self->recv_buffer != NULL) {
@@ -174,7 +174,7 @@ mp_obj_t espnow_deinit(mp_obj_t _) {
// Initialise the Espressif ESPNOW software stack, register callbacks and
// allocate the recv data buffers.
// Returns True if interface is active, else False.
-STATIC mp_obj_t espnow_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_active(size_t n_args, const mp_obj_t *args) {
esp_espnow_obj_t *self = args[0];
if (n_args > 1) {
if (mp_obj_is_true(args[1])) {
@@ -193,13 +193,13 @@ STATIC mp_obj_t espnow_active(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_bool(self->recv_buffer != NULL);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_active_obj, 1, 2, espnow_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_active_obj, 1, 2, espnow_active);
// ESPNow.config(): Initialise the data buffers and ESP-NOW functions.
// Initialise the Espressif ESPNOW software stack, register callbacks and
// allocate the recv data buffers.
// Returns True if interface is active, else False.
-STATIC mp_obj_t espnow_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t espnow_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
esp_espnow_obj_t *self = _get_singleton();
enum { ARG_rxbuf, ARG_timeout_ms };
static const mp_arg_t allowed_args[] = {
@@ -217,7 +217,7 @@ STATIC mp_obj_t espnow_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espnow_config_obj, 1, espnow_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(espnow_config_obj, 1, espnow_config);
// ### The ESP_Now send and recv callback routines
//
@@ -225,7 +225,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espnow_config_obj, 1, espnow_config);
// Callback triggered when a sent packet is acknowledged by the peer (or not).
// Just count the number of responses and number of failures.
// These are used in the send()/write() logic.
-STATIC void send_cb(uint8_t *mac_addr, uint8_t status) {
+static void send_cb(uint8_t *mac_addr, uint8_t status) {
esp_espnow_obj_t *self = _get_singleton();
self->tx_responses++;
if (status != ESP_NOW_SEND_SUCCESS) {
@@ -238,7 +238,7 @@ STATIC void send_cb(uint8_t *mac_addr, uint8_t status) {
// ESPNow packet.
// If the buffer is full, drop the message and increment the dropped count.
// Schedules the user callback if one has been registered (ESPNow.config()).
-STATIC void recv_cb(uint8_t *mac_addr, uint8_t *msg, uint8_t msg_len) {
+static void recv_cb(uint8_t *mac_addr, uint8_t *msg, uint8_t msg_len) {
esp_espnow_obj_t *self = _get_singleton();
ringbuf_t *buf = self->recv_buffer;
// TODO: Test this works with ">".
@@ -298,7 +298,7 @@ static int ringbuf_get_bytes_wait(ringbuf_t *r, uint8_t *data, size_t len, mp_in
// buffers: list of bytearrays to store values: [peer, message].
// Default timeout is set with ESPNow.config(timeout=milliseconds).
// Return (None, None) on timeout.
-STATIC mp_obj_t espnow_recvinto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_recvinto(size_t n_args, const mp_obj_t *args) {
esp_espnow_obj_t *self = _get_singleton_initialised();
size_t timeout_ms = ((n_args > 2 && args[2] != mp_const_none)
@@ -339,7 +339,7 @@ STATIC mp_obj_t espnow_recvinto(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_NEW_SMALL_INT(msg_len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_recvinto_obj, 2, 3, espnow_recvinto);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_recvinto_obj, 2, 3, espnow_recvinto);
// Used by espnow_send() for sends() with sync==True.
// Wait till all pending sent packet responses have been received.
@@ -365,7 +365,7 @@ static void _wait_for_pending_responses(esp_espnow_obj_t *self) {
// True if sync==True and message is received successfully by all recipients
// False if sync==True and message is not received by at least one recipient
// Raises: EAGAIN if the internal espnow buffers are full.
-STATIC mp_obj_t espnow_send(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_send(size_t n_args, const mp_obj_t *args) {
esp_espnow_obj_t *self = _get_singleton_initialised();
bool sync = n_args <= 3 || args[3] == mp_const_none || mp_obj_is_true(args[3]);
@@ -402,7 +402,7 @@ STATIC mp_obj_t espnow_send(size_t n_args, const mp_obj_t *args) {
// Return False if sync and any peers did not respond.
return mp_obj_new_bool(!(sync && self->tx_failures != saved_failures));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_send_obj, 3, 4, espnow_send);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_send_obj, 3, 4, espnow_send);
// ### Peer Management Functions
//
@@ -410,11 +410,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_send_obj, 3, 4, espnow_send);
// Set the ESP-NOW Primary Master Key (pmk) (for encrypted communications).
// Raise OSError if not initialised.
// Raise ValueError if key is not a bytes-like object exactly 16 bytes long.
-STATIC mp_obj_t espnow_set_pmk(mp_obj_t _, mp_obj_t key) {
+static mp_obj_t espnow_set_pmk(mp_obj_t _, mp_obj_t key) {
check_esp_err(esp_now_set_kok(_get_bytes_len(key, ESP_NOW_KEY_LEN), ESP_NOW_KEY_LEN));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(espnow_set_pmk_obj, espnow_set_pmk);
+static MP_DEFINE_CONST_FUN_OBJ_2(espnow_set_pmk_obj, espnow_set_pmk);
// ESPNow.add_peer(peer_mac, [lmk, [channel, [ifidx, [encrypt]]]])
// Positional args set to None will be left at defaults.
@@ -422,7 +422,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(espnow_set_pmk_obj, espnow_set_pmk);
// Raise ValueError if mac or LMK are not bytes-like objects or wrong length.
// Raise TypeError if invalid keyword args or too many positional args.
// Return None.
-STATIC mp_obj_t espnow_add_peer(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t espnow_add_peer(size_t n_args, const mp_obj_t *args) {
check_esp_err(
esp_now_add_peer(
_get_bytes_len(args[1], ESP_NOW_ETH_ALEN),
@@ -433,19 +433,19 @@ STATIC mp_obj_t espnow_add_peer(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_add_peer_obj, 2, 4, espnow_add_peer);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espnow_add_peer_obj, 2, 4, espnow_add_peer);
// ESPNow.del_peer(peer_mac): Unregister peer_mac.
// Raise OSError if not initialised.
// Raise ValueError if peer is not a bytes-like objects or wrong length.
// Return None.
-STATIC mp_obj_t espnow_del_peer(mp_obj_t _, mp_obj_t peer) {
+static mp_obj_t espnow_del_peer(mp_obj_t _, mp_obj_t peer) {
esp_now_del_peer(_get_bytes_len(peer, ESP_NOW_ETH_ALEN));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(espnow_del_peer_obj, espnow_del_peer);
+static MP_DEFINE_CONST_FUN_OBJ_2(espnow_del_peer_obj, espnow_del_peer);
-STATIC const mp_rom_map_elem_t esp_espnow_locals_dict_table[] = {
+static const mp_rom_map_elem_t esp_espnow_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&espnow_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&espnow_config_obj) },
{ MP_ROM_QSTR(MP_QSTR_recvinto), MP_ROM_PTR(&espnow_recvinto_obj) },
@@ -456,9 +456,9 @@ STATIC const mp_rom_map_elem_t esp_espnow_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_add_peer), MP_ROM_PTR(&espnow_add_peer_obj) },
{ MP_ROM_QSTR(MP_QSTR_del_peer), MP_ROM_PTR(&espnow_del_peer_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(esp_espnow_locals_dict, esp_espnow_locals_dict_table);
+static MP_DEFINE_CONST_DICT(esp_espnow_locals_dict, esp_espnow_locals_dict_table);
-STATIC const mp_rom_map_elem_t espnow_globals_dict_table[] = {
+static const mp_rom_map_elem_t espnow_globals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__espnow) },
{ MP_ROM_QSTR(MP_QSTR_ESPNowBase), MP_ROM_PTR(&esp_espnow_type) },
{ MP_ROM_QSTR(MP_QSTR_MAX_DATA_LEN), MP_ROM_INT(ESP_NOW_MAX_DATA_LEN)},
@@ -467,13 +467,13 @@ STATIC const mp_rom_map_elem_t espnow_globals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_MAX_TOTAL_PEER_NUM), MP_ROM_INT(ESP_NOW_MAX_TOTAL_PEER_NUM)},
{ MP_ROM_QSTR(MP_QSTR_MAX_ENCRYPT_PEER_NUM), MP_ROM_INT(ESP_NOW_MAX_ENCRYPT_PEER_NUM)},
};
-STATIC MP_DEFINE_CONST_DICT(espnow_globals_dict, espnow_globals_dict_table);
+static MP_DEFINE_CONST_DICT(espnow_globals_dict, espnow_globals_dict_table);
// ### Dummy Buffer Protocol support
// ...so asyncio can poll.ipoll() on this device
// Support ioctl(MP_STREAM_POLL, ) for asyncio
-STATIC mp_uint_t espnow_stream_ioctl(mp_obj_t self_in, mp_uint_t request,
+static mp_uint_t espnow_stream_ioctl(mp_obj_t self_in, mp_uint_t request,
uintptr_t arg, int *errcode) {
if (request != MP_STREAM_POLL) {
*errcode = MP_EINVAL;
@@ -484,7 +484,7 @@ STATIC mp_uint_t espnow_stream_ioctl(mp_obj_t self_in, mp_uint_t request,
arg ^ ((ringbuf_avail(self->recv_buffer) == 0) ? MP_STREAM_POLL_RD : 0);
}
-STATIC const mp_stream_p_t espnow_stream_p = {
+static const mp_stream_p_t espnow_stream_p = {
.ioctl = espnow_stream_ioctl,
};
diff --git a/ports/esp8266/modmachine.c b/ports/esp8266/modmachine.c
index 3cf5e3dd3b..23ccf8cebf 100644
--- a/ports/esp8266/modmachine.c
+++ b/ports/esp8266/modmachine.c
@@ -59,11 +59,11 @@
{ MP_ROM_QSTR(MP_QSTR_WDT_RESET), MP_ROM_INT(REASON_WDT_RST) }, \
{ MP_ROM_QSTR(MP_QSTR_SOFT_RESET), MP_ROM_INT(REASON_SOFT_RESTART) }, \
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
return mp_obj_new_int(system_get_cpu_freq() * 1000000);
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_int_t freq = mp_obj_get_int(args[0]) / 1000000;
if (freq != 80 && freq != 160) {
mp_raise_ValueError(MP_ERROR_TEXT("frequency can only be either 80Mhz or 160MHz"));
@@ -71,7 +71,7 @@ STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
system_update_cpu_freq(freq);
}
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
system_restart();
// we must not return
@@ -80,21 +80,21 @@ NORETURN STATIC void mp_machine_reset(void) {
}
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
return system_get_rst_info()->reason;
}
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
uint32_t id = system_get_chip_id();
return mp_obj_new_bytes((byte *)&id, sizeof(id));
}
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
asm ("waiti 0");
mp_event_handle_nowait(); // handle any events after possibly a long wait (eg feed WDT)
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
uint32_t max_us = 0xffffffff;
if (n_args == 1) {
mp_int_t max_ms = mp_obj_get_int(args[0]);
@@ -114,7 +114,7 @@ STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
}
}
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
// default to sleep forever
uint32_t sleep_us = 0;
@@ -172,7 +172,7 @@ typedef struct _esp_timer_obj_t {
mp_obj_t callback;
} esp_timer_obj_t;
-STATIC void esp_timer_arm_ms(esp_timer_obj_t *self, uint32_t ms, bool repeat) {
+static void esp_timer_arm_ms(esp_timer_obj_t *self, uint32_t ms, bool repeat) {
if (ms <= ESP_TIMER_MS_MAX) {
self->remain_ms = 0;
self->period_ms = 0;
@@ -189,7 +189,7 @@ STATIC void esp_timer_arm_ms(esp_timer_obj_t *self, uint32_t ms, bool repeat) {
os_timer_arm(&self->timer, ms, repeat);
}
-STATIC void esp_timer_arm_us(esp_timer_obj_t *self, uint32_t us, bool repeat) {
+static void esp_timer_arm_us(esp_timer_obj_t *self, uint32_t us, bool repeat) {
if (us < ESP_TIMER_US_MIN) {
us = ESP_TIMER_US_MIN;
}
@@ -204,18 +204,18 @@ STATIC void esp_timer_arm_us(esp_timer_obj_t *self, uint32_t us, bool repeat) {
const mp_obj_type_t esp_timer_type;
-STATIC void esp_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void esp_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
esp_timer_obj_t *self = self_in;
mp_printf(print, "Timer(%p)", &self->timer);
}
-STATIC mp_obj_t esp_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t esp_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
esp_timer_obj_t *tim = mp_obj_malloc(esp_timer_obj_t, &esp_timer_type);
return tim;
}
-STATIC void esp_timer_cb(void *arg) {
+static void esp_timer_cb(void *arg) {
esp_timer_obj_t *self = arg;
if (self->remain_ms != 0) {
// Handle periods larger than the maximum system period
@@ -234,7 +234,7 @@ STATIC void esp_timer_cb(void *arg) {
}
}
-STATIC mp_obj_t esp_timer_init_helper(esp_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t esp_timer_init_helper(esp_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {
ARG_mode,
ARG_callback,
@@ -298,26 +298,26 @@ STATIC mp_obj_t esp_timer_init_helper(esp_timer_obj_t *self, size_t n_args, cons
return mp_const_none;
}
-STATIC mp_obj_t esp_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t esp_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return esp_timer_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp_timer_init_obj, 1, esp_timer_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(esp_timer_init_obj, 1, esp_timer_init);
-STATIC mp_obj_t esp_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t esp_timer_deinit(mp_obj_t self_in) {
esp_timer_obj_t *self = self_in;
os_timer_disarm(&self->timer);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_timer_deinit_obj, esp_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_timer_deinit_obj, esp_timer_deinit);
-STATIC const mp_rom_map_elem_t esp_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t esp_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&esp_timer_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&esp_timer_init_obj) },
// { MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&esp_timer_callback_obj) },
{ MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(false) },
{ MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(true) },
};
-STATIC MP_DEFINE_CONST_DICT(esp_timer_locals_dict, esp_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(esp_timer_locals_dict, esp_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
esp_timer_type,
diff --git a/ports/esp8266/modos.c b/ports/esp8266/modos.c
index 32c6a06676..8149c087fd 100644
--- a/ports/esp8266/modos.c
+++ b/ports/esp8266/modos.c
@@ -31,11 +31,11 @@
#include "extmod/modmachine.h"
#include "user_interface.h"
-STATIC const char *mp_os_uname_release(void) {
+static const char *mp_os_uname_release(void) {
return system_get_sdk_version();
}
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -44,7 +44,7 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
void mp_os_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) {
if (mp_obj_get_type(stream_attached) == &machine_uart_type) {
diff --git a/ports/esp8266/modtime.c b/ports/esp8266/modtime.c
index 21dd3cbcd9..0903005597 100644
--- a/ports/esp8266/modtime.c
+++ b/ports/esp8266/modtime.c
@@ -30,7 +30,7 @@
#include "modmachine.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
mp_int_t seconds = pyb_rtc_get_us_since_epoch() / 1000 / 1000;
timeutils_struct_time_t tm;
timeutils_seconds_since_epoch_to_struct_time(seconds, &tm);
@@ -48,7 +48,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Returns the number of seconds, as an integer, since the Epoch.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
// get date and time
return mp_obj_new_int(pyb_rtc_get_us_since_epoch() / 1000 / 1000);
}
diff --git a/ports/esp8266/network_wlan.c b/ports/esp8266/network_wlan.c
index b0e6b3aeb1..5838cc8bc6 100644
--- a/ports/esp8266/network_wlan.c
+++ b/ports/esp8266/network_wlan.c
@@ -48,19 +48,19 @@ typedef struct _wlan_if_obj_t {
void error_check(bool status, const char *msg);
-STATIC const wlan_if_obj_t wlan_objs[] = {
+static const wlan_if_obj_t wlan_objs[] = {
{{&esp_network_wlan_type}, STATION_IF},
{{&esp_network_wlan_type}, SOFTAP_IF},
};
-STATIC void require_if(mp_obj_t wlan_if, int if_no) {
+static void require_if(mp_obj_t wlan_if, int if_no) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(wlan_if);
if (self->if_id != if_no) {
error_check(false, if_no == STATION_IF ? "STA required" : "AP required");
}
}
-STATIC mp_obj_t esp_wlan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t esp_wlan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
int idx = 0;
if (n_args > 0) {
@@ -72,7 +72,7 @@ STATIC mp_obj_t esp_wlan_make_new(const mp_obj_type_t *type, size_t n_args, size
return MP_OBJ_FROM_PTR(&wlan_objs[idx]);
}
-STATIC mp_obj_t esp_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_active(size_t n_args, const mp_obj_t *args) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t mode = wifi_get_opmode();
if (n_args > 1) {
@@ -105,9 +105,9 @@ STATIC mp_obj_t esp_active(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_bool(mode & SOFTAP_MODE);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_active_obj, 1, 2, esp_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_active_obj, 1, 2, esp_active);
-STATIC mp_obj_t esp_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t esp_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ssid, ARG_key, ARG_bssid };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_, MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -158,16 +158,16 @@ STATIC mp_obj_t esp_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp_connect_obj, 1, esp_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(esp_connect_obj, 1, esp_connect);
-STATIC mp_obj_t esp_disconnect(mp_obj_t self_in) {
+static mp_obj_t esp_disconnect(mp_obj_t self_in) {
require_if(self_in, STATION_IF);
error_check(wifi_station_disconnect(), "Cannot disconnect from AP");
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_disconnect_obj, esp_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_disconnect_obj, esp_disconnect);
-STATIC mp_obj_t esp_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_status(size_t n_args, const mp_obj_t *args) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// Get link status
@@ -186,11 +186,11 @@ STATIC mp_obj_t esp_status(size_t n_args, const mp_obj_t *args) {
mp_raise_ValueError(MP_ERROR_TEXT("unknown status param"));
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_status_obj, 1, 2, esp_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_status_obj, 1, 2, esp_status);
-STATIC mp_obj_t *esp_scan_list = NULL;
+static mp_obj_t *esp_scan_list = NULL;
-STATIC void esp_scan_cb(void *result, STATUS status) {
+static void esp_scan_cb(void *result, STATUS status) {
if (esp_scan_list == NULL) {
// called unexpectedly
return;
@@ -228,7 +228,7 @@ STATIC void esp_scan_cb(void *result, STATUS status) {
esp_scan_list = NULL;
}
-STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
+static mp_obj_t esp_scan(mp_obj_t self_in) {
require_if(self_in, STATION_IF);
if ((wifi_get_opmode() & STATION_MODE) == 0) {
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("STA must be active"));
@@ -252,12 +252,12 @@ STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
}
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_scan_obj, esp_scan);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_scan_obj, esp_scan);
/// \method isconnected()
/// Return True if connected to an AP and an IP address has been assigned,
/// false otherwise.
-STATIC mp_obj_t esp_isconnected(mp_obj_t self_in) {
+static mp_obj_t esp_isconnected(mp_obj_t self_in) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->if_id == STATION_IF) {
if (wifi_station_get_connect_status() == STATION_GOT_IP) {
@@ -271,9 +271,9 @@ STATIC mp_obj_t esp_isconnected(mp_obj_t self_in) {
return mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_isconnected_obj, esp_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(esp_isconnected_obj, esp_isconnected);
-STATIC mp_obj_t esp_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_ifconfig(size_t n_args, const mp_obj_t *args) {
wlan_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
struct ip_info info;
ip_addr_t dns_addr;
@@ -328,9 +328,9 @@ STATIC mp_obj_t esp_ifconfig(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_ifconfig_obj, 1, 2, esp_ifconfig);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_ifconfig_obj, 1, 2, esp_ifconfig);
-STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
if (n_args != 1 && kwargs->used != 0) {
mp_raise_TypeError(MP_ERROR_TEXT("either pos or kw args are allowed"));
}
@@ -503,9 +503,9 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
unknown:
mp_raise_ValueError(MP_ERROR_TEXT("unknown config param"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp_config_obj, 1, esp_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(esp_config_obj, 1, esp_config);
-STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
+static const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&esp_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&esp_connect_obj) },
{ MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&esp_disconnect_obj) },
@@ -521,7 +521,7 @@ STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PM_POWERSAVE), MP_ROM_INT(LIGHT_SLEEP_T) },
};
-STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
+static MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
esp_network_wlan_type,
@@ -531,7 +531,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &wlan_if_locals_dict
);
-STATIC mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
return mp_obj_new_int(wifi_get_phy_mode());
} else {
diff --git a/ports/mimxrt/dma_manager.c b/ports/mimxrt/dma_manager.c
index 2890a15586..d332c9a1c2 100644
--- a/ports/mimxrt/dma_manager.c
+++ b/ports/mimxrt/dma_manager.c
@@ -42,7 +42,7 @@ static bool channel_list[FSL_FEATURE_DMAMUX_MODULE_CHANNEL] = {
#endif
};
-STATIC bool dma_initialized = false;
+static bool dma_initialized = false;
// allocate_channel(): retrieve an available channel. Return the number or -1
int allocate_dma_channel(void) {
diff --git a/ports/mimxrt/eth.c b/ports/mimxrt/eth.c
index ed9db81298..3eb1a0cc35 100644
--- a/ports/mimxrt/eth.c
+++ b/ports/mimxrt/eth.c
@@ -177,7 +177,7 @@ static uint8_t hw_addr_1[6]; // The MAC address field
#define TRACE_ETH_RX (0x0004)
#define TRACE_ETH_FULL (0x0008)
-STATIC void eth_trace(eth_t *self, size_t len, const void *data, unsigned int flags) {
+static void eth_trace(eth_t *self, size_t len, const void *data, unsigned int flags) {
if (((flags & NETUTILS_TRACE_IS_TX) && (self->trace_flags & TRACE_ETH_TX))
|| (!(flags & NETUTILS_TRACE_IS_TX) && (self->trace_flags & TRACE_ETH_RX))) {
const uint8_t *buf;
@@ -197,7 +197,7 @@ STATIC void eth_trace(eth_t *self, size_t len, const void *data, unsigned int fl
}
}
-STATIC void eth_process_frame(eth_t *self, uint8_t *buf, size_t length) {
+static void eth_process_frame(eth_t *self, uint8_t *buf, size_t length) {
struct netif *netif = &self->netif;
if (netif->flags & NETIF_FLAG_LINK_UP) {
@@ -240,7 +240,7 @@ void eth_irq_handler(ENET_Type *base, enet_handle_t *handle,
}
// Configure the ethernet clock
-STATIC uint32_t eth_clock_init(int eth_id, bool phy_clock) {
+static uint32_t eth_clock_init(int eth_id, bool phy_clock) {
CLOCK_EnableClock(kCLOCK_Iomuxc);
@@ -282,7 +282,7 @@ STATIC uint32_t eth_clock_init(int eth_id, bool phy_clock) {
}
// eth_gpio_init: Configure the GPIO pins
-STATIC void eth_gpio_init(const iomux_table_t iomux_table[], size_t iomux_table_size,
+static void eth_gpio_init(const iomux_table_t iomux_table[], size_t iomux_table_size,
const machine_pin_obj_t *reset_pin, const machine_pin_obj_t *int_pin) {
gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 1, kGPIO_NoIntmode};
@@ -328,7 +328,7 @@ STATIC void eth_gpio_init(const iomux_table_t iomux_table[], size_t iomux_table_
}
// eth_phy_init: Initilaize the PHY interface
-STATIC void eth_phy_init(phy_handle_t *phyHandle, phy_config_t *phy_config,
+static void eth_phy_init(phy_handle_t *phyHandle, phy_config_t *phy_config,
phy_speed_t *speed, phy_duplex_t *duplex, uint32_t phy_settle_time) {
bool link = false;
@@ -471,12 +471,12 @@ void eth_init_1(eth_t *self, int eth_id, const phy_operations_t *phy_ops, int ph
#endif
// Initialize the phy interface
-STATIC int eth_mac_init(eth_t *self) {
+static int eth_mac_init(eth_t *self) {
return 0;
}
// Deinit the interface
-STATIC void eth_mac_deinit(eth_t *self) {
+static void eth_mac_deinit(eth_t *self) {
// Just as a reminder: Calling ENET_Deinit() twice causes the board to stall
// with a bus error. Reason unclear. So don't do that for now (or ever).
}
@@ -488,7 +488,7 @@ void eth_set_trace(eth_t *self, uint32_t value) {
/*******************************************************************************/
// ETH-LwIP bindings
-STATIC err_t eth_send_frame_blocking(ENET_Type *base, enet_handle_t *handle, uint8_t *buffer, int len) {
+static err_t eth_send_frame_blocking(ENET_Type *base, enet_handle_t *handle, uint8_t *buffer, int len) {
status_t status;
int i;
#define XMIT_LOOP 10
@@ -504,7 +504,7 @@ STATIC err_t eth_send_frame_blocking(ENET_Type *base, enet_handle_t *handle, uin
return status;
}
-STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) {
+static err_t eth_netif_output(struct netif *netif, struct pbuf *p) {
// This function should always be called from a context where PendSV-level IRQs are disabled
status_t status;
ENET_Type *enet = ENET;
@@ -536,7 +536,7 @@ STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) {
return status == kStatus_Success ? ERR_OK : ERR_BUF;
}
-STATIC err_t eth_netif_init(struct netif *netif) {
+static err_t eth_netif_init(struct netif *netif) {
netif->linkoutput = eth_netif_output;
netif->output = etharp_output;
netif->mtu = 1500;
@@ -552,7 +552,7 @@ STATIC err_t eth_netif_init(struct netif *netif) {
return ERR_OK;
}
-STATIC void eth_lwip_init(eth_t *self) {
+static void eth_lwip_init(eth_t *self) {
struct netif *n = &self->netif;
ip_addr_t ipconfig[4];
@@ -588,7 +588,7 @@ STATIC void eth_lwip_init(eth_t *self) {
MICROPY_PY_LWIP_EXIT
}
-STATIC void eth_lwip_deinit(eth_t *self) {
+static void eth_lwip_deinit(eth_t *self) {
MICROPY_PY_LWIP_ENTER
for (struct netif *netif = netif_list; netif != NULL; netif = netif->next) {
if (netif == &self->netif) {
diff --git a/ports/mimxrt/machine_adc.c b/ports/mimxrt/machine_adc.c
index 0be5f9a7d2..29b73a2065 100644
--- a/ports/mimxrt/machine_adc.c
+++ b/ports/mimxrt/machine_adc.c
@@ -49,9 +49,9 @@ typedef struct _machine_adc_obj_t {
uint16_t resolution;
} machine_adc_obj_t;
-STATIC ADC_Type *const adc_bases[] = ADC_BASE_PTRS;
+static ADC_Type *const adc_bases[] = ADC_BASE_PTRS;
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -64,7 +64,7 @@ STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_p
}
}
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// Unpack and check parameter
@@ -99,7 +99,7 @@ STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args
// read_u16()
#if defined(MIMXRT117x_SERIES)
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
lpadc_conv_command_config_t adc_config;
lpadc_conv_trigger_config_t trigger_config;
@@ -133,7 +133,7 @@ void machine_adc_init(void) {
#else
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
// Initiate conversion
adc_channel_config_t channel_config = {
.channelNumber = self->channel,
diff --git a/ports/mimxrt/machine_i2c.c b/ports/mimxrt/machine_i2c.c
index cef17272c4..89fe47dbf6 100644
--- a/ports/mimxrt/machine_i2c.c
+++ b/ports/mimxrt/machine_i2c.c
@@ -55,8 +55,8 @@ typedef struct _iomux_table_t {
uint32_t configRegister;
} iomux_table_t;
-STATIC const uint8_t i2c_index_table[] = MICROPY_HW_I2C_INDEX;
-STATIC LPI2C_Type *i2c_base_ptr_table[] = LPI2C_BASE_PTRS;
+static const uint8_t i2c_index_table[] = MICROPY_HW_I2C_INDEX;
+static LPI2C_Type *i2c_base_ptr_table[] = LPI2C_BASE_PTRS;
static const iomux_table_t iomux_table[] = { IOMUX_TABLE_I2C };
#define MICROPY_HW_I2C_NUM ARRAY_SIZE(i2c_index_table)
@@ -80,7 +80,7 @@ bool lpi2c_set_iomux(int8_t hw_i2c, uint8_t drive) {
}
}
-STATIC void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "I2C(%u, freq=%u)",
self->i2c_id, self->master_config->baudRate_Hz);
@@ -133,7 +133,7 @@ static void lpi2c_master_callback(LPI2C_Type *base, lpi2c_master_handle_t *handl
self->transfer_status = status;
}
-STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
+static int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
machine_i2c_obj_t *self = (machine_i2c_obj_t *)self_in;
status_t ret;
lpi2c_master_handle_t g_master_handle;
@@ -185,7 +185,7 @@ STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, si
}
}
-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,
};
diff --git a/ports/mimxrt/machine_i2s.c b/ports/mimxrt/machine_i2s.c
index 077c9e76fa..8553cb285b 100644
--- a/ports/mimxrt/machine_i2s.c
+++ b/ports/mimxrt/machine_i2s.c
@@ -126,12 +126,12 @@ typedef struct _i2s_clock_config_t {
uint32_t clock_divider;
} i2s_clock_config_t;
-STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
+static mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
// The frame map is used with the readinto() method to transform the audio sample data coming
// from DMA memory (32-bit stereo) to the format specified
// in the I2S constructor. e.g. 16-bit mono
-STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
+static const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
{-1, -1, 0, 1, -1, -1, -1, -1 }, // Mono, 16-bits
{ 0, 1, 2, 3, -1, -1, -1, -1 }, // Mono, 32-bits
{-1, -1, 0, 1, -1, -1, 2, 3 }, // Stereo, 16-bits
@@ -143,7 +143,7 @@ STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYT
// Configuration 1: for sampling frequencies [Hz]: 8000, 12000, 16000, 24000, 32000, 48000
// Clock frequency = 786,432,000 Hz = 48000 * 64 * 256
-STATIC const clock_audio_pll_config_t audioPllConfig_8000_48000 = {
+static const clock_audio_pll_config_t audioPllConfig_8000_48000 = {
.loopDivider = 32, // PLL loop divider. Valid range for DIV_SELECT divider value: 27~54
.postDivider = 1, // Divider after the PLL, should only be 1, 2, 4, 8, 16
.numerator = 76800, // 30 bit numerator of fractional loop divider
@@ -155,7 +155,7 @@ STATIC const clock_audio_pll_config_t audioPllConfig_8000_48000 = {
// Configuration 2: for sampling frequencies [Hz]: 11025, 22050, 44100
// Clock frequency = 722,534,400 = 44100 * 64 * 256
-STATIC const clock_audio_pll_config_t audioPllConfig_11025_44100 = {
+static const clock_audio_pll_config_t audioPllConfig_11025_44100 = {
.loopDivider = 30, // PLL loop divider. Valid range for DIV_SELECT divider value: 27~54
.postDivider = 1, // Divider after the PLL, should only be 1, 2, 4, 8, 16
.numerator = 10560, // 30 bit numerator of fractional loop divider
@@ -170,7 +170,7 @@ STATIC const clock_audio_pll_config_t audioPllConfig_11025_44100 = {
// which is 2**n: 0->1, 1->2, 2->4, 3->8, 4->16, 5->32
// The divider is 8 bit and must be given as n (not n-1)
// So the total division factor is given by (2**p) * d
-STATIC const i2s_clock_config_t clock_config_map[] = {
+static const i2s_clock_config_t clock_config_map[] = {
{kSAI_SampleRate8KHz, &audioPllConfig_8000_48000, 1, 192}, // 384
{kSAI_SampleRate11025Hz, &audioPllConfig_11025_44100, 1, 128}, // 256
{kSAI_SampleRate12KHz, &audioPllConfig_8000_48000, 1, 128}, // 256
@@ -182,10 +182,10 @@ STATIC const i2s_clock_config_t clock_config_map[] = {
{kSAI_SampleRate48KHz, &audioPllConfig_8000_48000, 0, 64} // 64
};
-STATIC const clock_root_t i2s_clock_mux[] = I2S_CLOCK_MUX;
+static const clock_root_t i2s_clock_mux[] = I2S_CLOCK_MUX;
#else
// for 10xx the total division factor is given by (p + 1) * (d + 1)
-STATIC const i2s_clock_config_t clock_config_map[] = {
+static const i2s_clock_config_t clock_config_map[] = {
{kSAI_SampleRate8KHz, &audioPllConfig_8000_48000, 5, 63}, // 384
{kSAI_SampleRate11025Hz, &audioPllConfig_11025_44100, 3, 63}, // 256
{kSAI_SampleRate12KHz, &audioPllConfig_8000_48000, 3, 63}, // 256
@@ -197,18 +197,18 @@ STATIC const i2s_clock_config_t clock_config_map[] = {
{kSAI_SampleRate48KHz, &audioPllConfig_8000_48000, 0, 63} // 64
};
-STATIC const clock_mux_t i2s_clock_mux[] = I2S_CLOCK_MUX;
-STATIC const clock_div_t i2s_clock_pre_div[] = I2S_CLOCK_PRE_DIV;
-STATIC const clock_div_t i2s_clock_div[] = I2S_CLOCK_DIV;
-STATIC const iomuxc_gpr_mode_t i2s_iomuxc_gpr_mode[] = I2S_IOMUXC_GPR_MODE;
+static const clock_mux_t i2s_clock_mux[] = I2S_CLOCK_MUX;
+static const clock_div_t i2s_clock_pre_div[] = I2S_CLOCK_PRE_DIV;
+static const clock_div_t i2s_clock_div[] = I2S_CLOCK_DIV;
+static const iomuxc_gpr_mode_t i2s_iomuxc_gpr_mode[] = I2S_IOMUXC_GPR_MODE;
#endif
-STATIC const I2S_Type *i2s_base_ptr[] = I2S_BASE_PTRS;
+static const I2S_Type *i2s_base_ptr[] = I2S_BASE_PTRS;
-STATIC const dma_request_source_t i2s_dma_req_src_tx[] = I2S_DMA_REQ_SRC_TX;
-STATIC const dma_request_source_t i2s_dma_req_src_rx[] = I2S_DMA_REQ_SRC_RX;
-STATIC const gpio_map_t i2s_gpio_map[] = I2S_GPIO_MAP;
-AT_NONCACHEABLE_SECTION_ALIGN(STATIC edma_tcd_t edmaTcd[MICROPY_HW_I2S_NUM], 32);
+static const dma_request_source_t i2s_dma_req_src_tx[] = I2S_DMA_REQ_SRC_TX;
+static const dma_request_source_t i2s_dma_req_src_rx[] = I2S_DMA_REQ_SRC_RX;
+static const gpio_map_t i2s_gpio_map[] = I2S_GPIO_MAP;
+AT_NONCACHEABLE_SECTION_ALIGN(edma_tcd_t edmaTcd[MICROPY_HW_I2S_NUM], 32);
// called on processor reset
void machine_i2s_init0() {
@@ -228,7 +228,7 @@ void machine_i2s_deinit_all(void) {
}
}
-STATIC int8_t get_frame_mapping_index(int8_t bits, format_t format) {
+static int8_t get_frame_mapping_index(int8_t bits, format_t format) {
if (format == MONO) {
if (bits == 16) {
return 0;
@@ -244,7 +244,7 @@ STATIC int8_t get_frame_mapping_index(int8_t bits, format_t format) {
}
}
-STATIC int8_t get_dma_bits(uint16_t mode, int8_t bits) {
+static int8_t get_dma_bits(uint16_t mode, int8_t bits) {
if (mode == TX) {
if (bits == 16) {
return 16;
@@ -258,7 +258,7 @@ STATIC int8_t get_dma_bits(uint16_t mode, int8_t bits) {
}
}
-STATIC bool lookup_gpio(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uint8_t hw_id, uint16_t *index) {
+static bool lookup_gpio(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uint8_t hw_id, uint16_t *index) {
for (uint16_t i = 0; i < ARRAY_SIZE(i2s_gpio_map); i++) {
if ((pin->name == i2s_gpio_map[i].name) &&
(i2s_gpio_map[i].fn == fn) &&
@@ -270,7 +270,7 @@ STATIC bool lookup_gpio(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uin
return false;
}
-STATIC bool set_iomux(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uint8_t hw_id) {
+static bool set_iomux(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uint8_t hw_id) {
uint16_t mapping_index;
if (lookup_gpio(pin, fn, hw_id, &mapping_index)) {
iomux_table_t iom = i2s_gpio_map[mapping_index].iomux;
@@ -283,7 +283,7 @@ STATIC bool set_iomux(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uint8
}
}
-STATIC bool is_rate_supported(int32_t rate) {
+static bool is_rate_supported(int32_t rate) {
for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) {
if (clock_config_map[i].rate == rate) {
return true;
@@ -292,7 +292,7 @@ STATIC bool is_rate_supported(int32_t rate) {
return false;
}
-STATIC const clock_audio_pll_config_t *get_pll_config(int32_t rate) {
+static const clock_audio_pll_config_t *get_pll_config(int32_t rate) {
for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) {
if (clock_config_map[i].rate == rate) {
return clock_config_map[i].pll_config;
@@ -301,7 +301,7 @@ STATIC const clock_audio_pll_config_t *get_pll_config(int32_t rate) {
return 0;
}
-STATIC const uint32_t get_clock_pre_divider(int32_t rate) {
+static const uint32_t get_clock_pre_divider(int32_t rate) {
for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) {
if (clock_config_map[i].rate == rate) {
return clock_config_map[i].clock_pre_divider;
@@ -310,7 +310,7 @@ STATIC const uint32_t get_clock_pre_divider(int32_t rate) {
return 0;
}
-STATIC const uint32_t get_clock_divider(int32_t rate) {
+static const uint32_t get_clock_divider(int32_t rate) {
for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) {
if (clock_config_map[i].rate == rate) {
return clock_config_map[i].clock_divider;
@@ -320,7 +320,7 @@ STATIC const uint32_t get_clock_divider(int32_t rate) {
}
// function is used in IRQ context
-STATIC void empty_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
+static void empty_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
uint16_t dma_buffer_offset = 0;
if (dma_ping_pong == TOP_HALF) {
@@ -343,7 +343,7 @@ STATIC void empty_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
}
// function is used in IRQ context
-STATIC void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
+static void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
uint16_t dma_buffer_offset = 0;
if (dma_ping_pong == TOP_HALF) {
@@ -387,7 +387,7 @@ STATIC void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
MP_HAL_CLEAN_DCACHE(dma_buffer_p, SIZEOF_HALF_DMA_BUFFER_IN_BYTES);
}
-STATIC void edma_i2s_callback(edma_handle_t *handle, void *userData, bool transferDone, uint32_t tcds) {
+static void edma_i2s_callback(edma_handle_t *handle, void *userData, bool transferDone, uint32_t tcds) {
machine_i2s_obj_t *self = userData;
if (self->mode == TX) {
@@ -423,7 +423,7 @@ STATIC void edma_i2s_callback(edma_handle_t *handle, void *userData, bool transf
}
}
-STATIC bool i2s_init(machine_i2s_obj_t *self) {
+static bool i2s_init(machine_i2s_obj_t *self) {
#if defined(MIMXRT117x_SERIES)
clock_audio_pll_config_t pll_config = *get_pll_config(self->rate);
@@ -570,7 +570,7 @@ STATIC bool i2s_init(machine_i2s_obj_t *self) {
return true;
}
-STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
+static void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
// is Mode valid?
uint16_t i2s_mode = args[ARG_mode].u_int;
if ((i2s_mode != (RX)) &&
@@ -667,7 +667,7 @@ STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *ar
}
}
-STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
+static machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
if (i2s_id < 1 || i2s_id > MICROPY_HW_I2S_NUM) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2S(%d) does not exist"), i2s_id);
}
@@ -694,7 +694,7 @@ STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
return self;
}
-STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
// use self->i2s_inst as in indication that I2S object has already been de-initialized
if (self->i2s_inst != NULL) {
EDMA_AbortTransfer(&self->edmaHandle);
@@ -718,7 +718,7 @@ STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
}
}
-STATIC void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
(void)self;
}
diff --git a/ports/mimxrt/machine_led.c b/ports/mimxrt/machine_led.c
index a927c570a2..2e9b17c883 100644
--- a/ports/mimxrt/machine_led.c
+++ b/ports/mimxrt/machine_led.c
@@ -30,13 +30,13 @@
#if defined(MICROPY_HW_LED1_PIN)
-STATIC void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
machine_led_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "LED(%u)", self->led_id);
}
-STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// Extract arguments
@@ -51,34 +51,34 @@ STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(&machine_led_obj[led_id - 1]);
}
-STATIC mp_obj_t led_obj_on(mp_obj_t self_in) {
+static mp_obj_t led_obj_on(mp_obj_t self_in) {
machine_led_obj_t *self = MP_OBJ_TO_PTR(self_in);
MICROPY_HW_LED_ON(self->led_pin);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
-STATIC mp_obj_t led_obj_off(mp_obj_t self_in) {
+static mp_obj_t led_obj_off(mp_obj_t self_in) {
machine_led_obj_t *self = MP_OBJ_TO_PTR(self_in);
MICROPY_HW_LED_OFF(self->led_pin);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
-STATIC mp_obj_t led_obj_toggle(mp_obj_t self_in) {
+static mp_obj_t led_obj_toggle(mp_obj_t self_in) {
machine_led_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_hal_pin_toggle(self->led_pin);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
-STATIC const mp_rom_map_elem_t led_locals_dict_table[] = {
+static const mp_rom_map_elem_t led_locals_dict_table[] = {
{MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&led_obj_on_obj)},
{MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&led_obj_off_obj)},
{MP_ROM_QSTR(MP_QSTR_toggle), MP_ROM_PTR(&led_obj_toggle_obj)},
};
-STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
+static MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_led_type,
diff --git a/ports/mimxrt/machine_pin.c b/ports/mimxrt/machine_pin.c
index 3ebccb1755..ad4158c6bd 100644
--- a/ports/mimxrt/machine_pin.c
+++ b/ports/mimxrt/machine_pin.c
@@ -39,18 +39,18 @@
#endif
// Local functions
-STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
// Class Methods
-STATIC void machine_pin_obj_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind);
-STATIC mp_obj_t machine_pin_obj_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
+static void machine_pin_obj_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind);
+static mp_obj_t machine_pin_obj_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
// Instance Methods
-STATIC mp_obj_t machine_pin_off(mp_obj_t self_in);
-STATIC mp_obj_t machine_pin_on(mp_obj_t self_in);
-STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args);
-STATIC mp_obj_t machine_pin_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args);
+static mp_obj_t machine_pin_off(mp_obj_t self_in);
+static mp_obj_t machine_pin_on(mp_obj_t self_in);
+static mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args);
+static mp_obj_t machine_pin_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args);
// Local data
enum {
@@ -75,12 +75,12 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &machine_pin_board_pins_locals_dict
);
-STATIC const mp_irq_methods_t machine_pin_irq_methods;
+static const mp_irq_methods_t machine_pin_irq_methods;
static GPIO_Type *gpiobases[] = GPIO_BASE_PTRS;
-STATIC const uint16_t GPIO_combined_low_irqs[] = GPIO_COMBINED_LOW_IRQS;
-STATIC const uint16_t GPIO_combined_high_irqs[] = GPIO_COMBINED_HIGH_IRQS;
-STATIC const uint16_t IRQ_mapping[] = {kGPIO_NoIntmode, kGPIO_IntRisingEdge, kGPIO_IntFallingEdge, kGPIO_IntRisingOrFallingEdge};
+static const uint16_t GPIO_combined_low_irqs[] = GPIO_COMBINED_LOW_IRQS;
+static const uint16_t GPIO_combined_high_irqs[] = GPIO_COMBINED_HIGH_IRQS;
+static const uint16_t IRQ_mapping[] = {kGPIO_NoIntmode, kGPIO_IntRisingEdge, kGPIO_IntFallingEdge, kGPIO_IntRisingOrFallingEdge};
#define GET_PIN_IRQ_INDEX(gpio_nr, pin) ((gpio_nr - 1) * 32 + pin)
int GPIO_get_instance(GPIO_Type *gpio) {
@@ -254,7 +254,7 @@ void machine_pin_config(const machine_pin_obj_t *self, uint8_t mode,
}
}
-STATIC mp_obj_t machine_pin_obj_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_pin_obj_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
machine_pin_obj_t *self = self_in;
@@ -266,7 +266,7 @@ STATIC mp_obj_t machine_pin_obj_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint
}
}
-STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
[PIN_INIT_ARG_MODE] { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT },
[PIN_INIT_ARG_PULL] { MP_QSTR_pull, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE}},
@@ -326,7 +326,7 @@ STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_
return mp_const_none;
}
-STATIC void machine_pin_obj_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void machine_pin_obj_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
(void)kind;
const machine_pin_obj_t *self = MP_OBJ_TO_PTR(o);
mp_printf(print, "Pin(%s)", qstr_str(self->name));
@@ -349,43 +349,43 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
}
// pin.off()
-STATIC mp_obj_t machine_pin_off(mp_obj_t self_in) {
+static mp_obj_t machine_pin_off(mp_obj_t self_in) {
machine_pin_obj_t *self = self_in;
mp_hal_pin_low(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_off_obj, machine_pin_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_off_obj, machine_pin_off);
// pin.on()
-STATIC mp_obj_t machine_pin_on(mp_obj_t self_in) {
+static mp_obj_t machine_pin_on(mp_obj_t self_in) {
machine_pin_obj_t *self = self_in;
mp_hal_pin_high(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_on_obj, machine_pin_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_on_obj, machine_pin_on);
// pin.toggle()
-STATIC mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
+static mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
machine_pin_obj_t *self = self_in;
mp_hal_pin_toggle(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_toggle_obj, machine_pin_toggle);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_toggle_obj, machine_pin_toggle);
// pin.value([value])
-STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
return machine_pin_obj_call(args[0], (n_args - 1), 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
// pin.init(mode, pull, [kwargs])
-STATIC mp_obj_t machine_pin_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_init_obj, 1, machine_pin_init);
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING, hard=False)
-STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -452,9 +452,9 @@ STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
return MP_OBJ_FROM_PTR(irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
-STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&machine_pin_off_obj) },
{ MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&machine_pin_on_obj) },
@@ -491,9 +491,9 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(2) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
-STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_pin_obj_t *self = self_in;
@@ -509,7 +509,7 @@ STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return -1;
}
-STATIC const mp_pin_p_t machine_pin_obj_protocol = {
+static const mp_pin_p_t machine_pin_obj_protocol = {
.ioctl = machine_pin_ioctl,
};
@@ -534,7 +534,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &machine_pin_locals_dict
);
-STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint32_t gpio_nr = GPIO_get_instance(self->gpio);
machine_pin_irq_obj_t *irq = MP_STATE_PORT(machine_pin_irq_objects[GET_PIN_IRQ_INDEX(gpio_nr, self->pin)]);
@@ -551,7 +551,7 @@ STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger
return 0;
}
-STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint32_t gpio_nr = GPIO_get_instance(self->gpio);
machine_pin_irq_obj_t *irq = MP_STATE_PORT(machine_pin_irq_objects[GET_PIN_IRQ_INDEX(gpio_nr, self->pin)]);
@@ -563,7 +563,7 @@ STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
return 0;
}
-STATIC const mp_irq_methods_t machine_pin_irq_methods = {
+static const mp_irq_methods_t machine_pin_irq_methods = {
.trigger = machine_pin_irq_trigger,
.info = machine_pin_irq_info,
};
diff --git a/ports/mimxrt/machine_pwm.c b/ports/mimxrt/machine_pwm.c
index 98545eec95..f9ae5e22ed 100644
--- a/ports/mimxrt/machine_pwm.c
+++ b/ports/mimxrt/machine_pwm.c
@@ -70,9 +70,9 @@ static char *ERRMSG_FREQ = "PWM frequency too low";
static char *ERRMSG_INIT = "PWM set-up failed";
static char *ERRMSG_VALUE = "value larger than period";
-STATIC void mp_machine_pwm_start(machine_pwm_obj_t *self);
+static void mp_machine_pwm_start(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->is_flexpwm) {
mp_printf(print, "<FLEXPWM module=%u submodule=%u ", self->module, self->submodule);
@@ -103,7 +103,7 @@ STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_p
// Utility functions for decoding and converting
//
-STATIC uint32_t duty_ns_to_duty_u16(uint32_t freq, uint32_t duty_ns) {
+static uint32_t duty_ns_to_duty_u16(uint32_t freq, uint32_t duty_ns) {
uint64_t duty = (uint64_t)duty_ns * freq * PWM_FULL_SCALE / 1000000000ULL;
if (duty > PWM_FULL_SCALE) {
mp_raise_ValueError(MP_ERROR_TEXT(ERRMSG_VALUE));
@@ -111,7 +111,7 @@ STATIC uint32_t duty_ns_to_duty_u16(uint32_t freq, uint32_t duty_ns) {
return (uint32_t)duty;
}
-STATIC uint8_t module_decode(char channel) {
+static uint8_t module_decode(char channel) {
switch (channel) {
case '0':
return kPWM_Module_0;
@@ -126,7 +126,7 @@ STATIC uint8_t module_decode(char channel) {
}
}
-STATIC uint8_t channel_decode(char channel) {
+static uint8_t channel_decode(char channel) {
switch (channel) {
case 'A':
return kPWM_PwmA;
@@ -140,7 +140,7 @@ STATIC uint8_t channel_decode(char channel) {
}
// decode the AF objects module and Port number. Returns NULL if it is not a FLEXPWM object
-STATIC const machine_pin_af_obj_t *af_name_decode_flexpwm(const machine_pin_af_obj_t *af_obj,
+static const machine_pin_af_obj_t *af_name_decode_flexpwm(const machine_pin_af_obj_t *af_obj,
uint8_t *module, uint8_t *submodule, uint8_t *channel) {
const char *str;
size_t len;
@@ -158,7 +158,7 @@ STATIC const machine_pin_af_obj_t *af_name_decode_flexpwm(const machine_pin_af_o
}
#ifdef FSL_FEATURE_SOC_TMR_COUNT
-STATIC uint8_t qtmr_decode(char channel) {
+static uint8_t qtmr_decode(char channel) {
switch (channel) {
case '0':
return kQTMR_Channel_0;
@@ -174,7 +174,7 @@ STATIC uint8_t qtmr_decode(char channel) {
}
// decode the AF objects module and Port number. Returns NULL if it is not a QTMR object
-STATIC const machine_pin_af_obj_t *af_name_decode_qtmr(const machine_pin_af_obj_t *af_obj, uint8_t *module, uint8_t *channel) {
+static const machine_pin_af_obj_t *af_name_decode_qtmr(const machine_pin_af_obj_t *af_obj, uint8_t *module, uint8_t *channel) {
const char *str;
size_t len;
str = (char *)qstr_data(af_obj->name, &len);
@@ -190,7 +190,7 @@ STATIC const machine_pin_af_obj_t *af_name_decode_qtmr(const machine_pin_af_obj_
}
#endif
-STATIC bool is_board_pin(const machine_pin_obj_t *pin) {
+static bool is_board_pin(const machine_pin_obj_t *pin) {
const mp_map_t *board_map = &machine_pin_board_pins_locals_dict.map;
for (uint i = 0; i < board_map->alloc; i++) {
if (pin == MP_OBJ_TO_PTR(board_map->table[i].value)) {
@@ -202,7 +202,7 @@ STATIC bool is_board_pin(const machine_pin_obj_t *pin) {
// Functions for configuring the PWM Device
//
-STATIC int calc_prescaler(uint32_t clock, uint32_t freq) {
+static int calc_prescaler(uint32_t clock, uint32_t freq) {
float temp = (float)clock / (float)PWM_FULL_SCALE / (float)freq;
for (int prescale = 0; prescale < 8; prescale++, temp /= 2) {
if (temp <= 1) {
@@ -213,7 +213,7 @@ STATIC int calc_prescaler(uint32_t clock, uint32_t freq) {
return -1;
}
-STATIC void configure_flexpwm(machine_pwm_obj_t *self) {
+static void configure_flexpwm(machine_pwm_obj_t *self) {
pwm_signal_param_u16_t pwmSignal;
// Initialize PWM module.
@@ -300,7 +300,7 @@ STATIC void configure_flexpwm(machine_pwm_obj_t *self) {
}
#ifdef FSL_FEATURE_SOC_TMR_COUNT
-STATIC void configure_qtmr(machine_pwm_obj_t *self) {
+static void configure_qtmr(machine_pwm_obj_t *self) {
qtmr_config_t qtmrConfig;
int prescale;
#if defined(MIMXRT117x_SERIES)
@@ -331,7 +331,7 @@ STATIC void configure_qtmr(machine_pwm_obj_t *self) {
}
#endif // FSL_FEATURE_SOC_TMR_COUNT
-STATIC void configure_pwm(machine_pwm_obj_t *self) {
+static void configure_pwm(machine_pwm_obj_t *self) {
// Set the clock frequencies
// Freq range is 15Hz to ~ 3 MHz.
static bool set_frequency = true;
@@ -360,7 +360,7 @@ STATIC void configure_pwm(machine_pwm_obj_t *self) {
// Micropython API functions
//
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq, ARG_duty_u16, ARG_duty_ns, ARG_center, ARG_align,
ARG_invert, ARG_sync, ARG_xor, ARG_deadtime };
@@ -444,7 +444,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
}
// PWM(pin | pin-tuple, freq, [args])
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// Check number of arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -580,7 +580,7 @@ void machine_pwm_deinit_all(void) {
#endif
}
-STATIC void mp_machine_pwm_start(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_start(machine_pwm_obj_t *self) {
if (self->is_flexpwm) {
PWM_StartTimer(self->instance, 1 << self->submodule);
#ifdef FSL_FEATURE_SOC_TMR_COUNT
@@ -590,7 +590,7 @@ STATIC void mp_machine_pwm_start(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
if (self->is_flexpwm) {
PWM_StopTimer(self->instance, 1 << self->submodule);
#ifdef FSL_FEATURE_SOC_TMR_COUNT
diff --git a/ports/mimxrt/machine_rtc.c b/ports/mimxrt/machine_rtc.c
index 61b410a652..294942cf5a 100644
--- a/ports/mimxrt/machine_rtc.c
+++ b/ports/mimxrt/machine_rtc.c
@@ -35,7 +35,7 @@
#include "fsl_snvs_lp.h"
#include "fsl_snvs_hp.h"
-STATIC mp_int_t timeout = 0;
+static mp_int_t timeout = 0;
void machine_rtc_alarm_clear_en(void) {
SNVS_LP_SRTC_DisableInterrupts(SNVS, SNVS_LPCR_LPTA_EN_MASK);
@@ -103,7 +103,7 @@ typedef struct _machine_rtc_irq_obj_t {
mp_irq_obj_t base;
} machine_rtc_irq_obj_t;
-STATIC mp_uint_t machine_rtc_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t machine_rtc_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
new_trigger /= 1000;
if (!new_trigger) {
machine_rtc_alarm_off(true);
@@ -113,11 +113,11 @@ STATIC mp_uint_t machine_rtc_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger
return 0;
}
-STATIC mp_uint_t machine_rtc_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t machine_rtc_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
return 0;
}
-STATIC const mp_irq_methods_t machine_rtc_irq_methods = {
+static const mp_irq_methods_t machine_rtc_irq_methods = {
.trigger = machine_rtc_irq_trigger,
.info = machine_rtc_irq_info,
};
@@ -148,7 +148,7 @@ typedef struct _machine_rtc_obj_t {
} machine_rtc_obj_t;
// Singleton RTC object.
-STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
+static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
// Start the RTC Timer.
void machine_rtc_start(void) {
@@ -177,7 +177,7 @@ void machine_rtc_start(void) {
}
}
-STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// Check arguments.
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -185,7 +185,7 @@ STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, s
return (mp_obj_t)&machine_rtc_obj;
}
-STATIC mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args) {
if (n_args == 1) {
// Get date and time.
snvs_lp_srtc_datetime_t srtc_date;
@@ -225,12 +225,12 @@ STATIC mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args)
}
}
-STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
return machine_rtc_datetime_helper(n_args, args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
-STATIC mp_obj_t machine_rtc_now(mp_obj_t self_in) {
+static mp_obj_t machine_rtc_now(mp_obj_t self_in) {
// Get date and time in CPython order.
snvs_lp_srtc_datetime_t srtc_date;
SNVS_LP_SRTC_GetDatetime(SNVS, &srtc_date);
@@ -247,18 +247,18 @@ STATIC mp_obj_t machine_rtc_now(mp_obj_t self_in) {
};
return mp_obj_new_tuple(8, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_now_obj, machine_rtc_now);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_now_obj, machine_rtc_now);
-STATIC mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) {
+static mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) {
mp_obj_t args[2] = {self_in, date};
machine_rtc_datetime_helper(2, args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init);
// calibration(cal)
// When the argument is a number in the range [-16 to 15], set the calibration value.
-STATIC mp_obj_t machine_rtc_calibration(mp_obj_t self_in, mp_obj_t cal_in) {
+static mp_obj_t machine_rtc_calibration(mp_obj_t self_in, mp_obj_t cal_in) {
mp_int_t cal = 0;
snvs_lp_srtc_config_t snvsSrtcConfig;
cal = mp_obj_get_int(cal_in);
@@ -271,10 +271,10 @@ STATIC mp_obj_t machine_rtc_calibration(mp_obj_t self_in, mp_obj_t cal_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_calibration_obj, machine_rtc_calibration);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_calibration_obj, machine_rtc_calibration);
-STATIC mp_obj_t machine_rtc_alarm(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- STATIC const mp_arg_t allowed_args[] = {
+static mp_obj_t machine_rtc_alarm(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_time, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_repeat, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
@@ -321,9 +321,9 @@ STATIC mp_obj_t machine_rtc_alarm(size_t n_args, const mp_obj_t *pos_args, mp_ma
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_rtc_alarm_obj, 1, machine_rtc_alarm);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_rtc_alarm_obj, 1, machine_rtc_alarm);
-STATIC mp_obj_t machine_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
// only alarm id 0 is available
if (n_args > 1 && mp_obj_get_int(args[1]) != 0) {
mp_raise_OSError(MP_ENODEV);
@@ -332,9 +332,9 @@ STATIC mp_obj_t machine_rtc_alarm_left(size_t n_args, const mp_obj_t *args) {
uint32_t alarmSeconds = SNVS->LPTAR;
return mp_obj_new_int((alarmSeconds >= seconds) ? ((alarmSeconds - seconds) * 1000) : 0);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_alarm_left_obj, 1, 2, machine_rtc_alarm_left);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_alarm_left_obj, 1, 2, machine_rtc_alarm_left);
-STATIC mp_obj_t machine_rtc_alarm_cancel(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_alarm_cancel(size_t n_args, const mp_obj_t *args) {
// only alarm id 0 is available
if (n_args > 1 && mp_obj_get_int(args[1]) != 0) {
mp_raise_OSError(MP_ENODEV);
@@ -342,9 +342,9 @@ STATIC mp_obj_t machine_rtc_alarm_cancel(size_t n_args, const mp_obj_t *args) {
machine_rtc_alarm_off(true);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_alarm_cancel_obj, 1, 2, machine_rtc_alarm_cancel);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_alarm_cancel_obj, 1, 2, machine_rtc_alarm_cancel);
-STATIC mp_obj_t machine_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_trigger, ARG_handler, ARG_wake, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_trigger, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -384,9 +384,9 @@ STATIC mp_obj_t machine_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
return MP_OBJ_FROM_PTR(irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_rtc_irq_obj, 1, machine_rtc_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_rtc_irq_obj, 1, machine_rtc_irq);
-STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_rtc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) },
{ MP_ROM_QSTR(MP_QSTR_now), MP_ROM_PTR(&machine_rtc_now_obj) },
@@ -398,7 +398,7 @@ STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&machine_rtc_irq_obj) },
{ MP_ROM_QSTR(MP_QSTR_ALARM0), MP_ROM_INT(0) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
diff --git a/ports/mimxrt/machine_sdcard.c b/ports/mimxrt/machine_sdcard.c
index b0bf8613c2..c938fdf2e5 100644
--- a/ports/mimxrt/machine_sdcard.c
+++ b/ports/mimxrt/machine_sdcard.c
@@ -44,19 +44,19 @@
enum { SDCARD_INIT_ARG_ID };
-STATIC const mp_arg_t sdcard_init_allowed_args[] = {
+static const mp_arg_t sdcard_init_allowed_args[] = {
[SDCARD_INIT_ARG_ID] = { MP_QSTR_id, MP_ARG_INT, {.u_int = 1} },
};
-STATIC void machine_sdcard_init_helper(mimxrt_sdcard_obj_t *self) {
+static void machine_sdcard_init_helper(mimxrt_sdcard_obj_t *self) {
sdcard_init(self, 198000000UL); // Initialize SDCard Host with 198MHz base clock
sdcard_init_pins(self);
ticks_delay_us64(2ULL * 1000ULL); // Wait 2ms to allow USDHC signals to settle/debounce
}
-STATIC mp_obj_t sdcard_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t sdcard_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
@@ -81,7 +81,7 @@ STATIC mp_obj_t sdcard_obj_make_new(const mp_obj_type_t *type, size_t n_args, si
}
// init()
-STATIC mp_obj_t machine_sdcard_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_sdcard_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mimxrt_sdcard_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
if (!sdcard_state_initialized(self)) {
@@ -89,18 +89,18 @@ STATIC mp_obj_t machine_sdcard_init(size_t n_args, const mp_obj_t *pos_args, mp_
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_sdcard_init_obj, 1, machine_sdcard_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_sdcard_init_obj, 1, machine_sdcard_init);
// deinit()
-STATIC mp_obj_t machine_sdcard_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_sdcard_deinit(mp_obj_t self_in) {
mimxrt_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
sdcard_deinit(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_deinit_obj, machine_sdcard_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_deinit_obj, machine_sdcard_deinit);
// readblocks(block_num, buf)
-STATIC mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mimxrt_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
@@ -111,16 +111,16 @@ STATIC mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num,
return MP_OBJ_NEW_SMALL_INT(-MP_EIO);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_readblocks_obj, machine_sdcard_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_readblocks_obj, machine_sdcard_readblocks);
// present()
-STATIC mp_obj_t machine_sdcard_present(mp_obj_t self_in) {
+static mp_obj_t machine_sdcard_present(mp_obj_t self_in) {
mimxrt_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(sdcard_detect(self));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_present_obj, machine_sdcard_present);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_present_obj, machine_sdcard_present);
-STATIC mp_obj_t machine_sdcard_info(mp_obj_t self_in) {
+static mp_obj_t machine_sdcard_info(mp_obj_t self_in) {
mimxrt_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (sdcard_detect(self) && sdcard_state_initialized(self)) {
@@ -136,10 +136,10 @@ STATIC mp_obj_t machine_sdcard_info(mp_obj_t self_in) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_info_obj, machine_sdcard_info);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_info_obj, machine_sdcard_info);
// writeblocks(block_num, buf)
-STATIC mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mimxrt_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
@@ -150,10 +150,10 @@ STATIC mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num,
return MP_OBJ_NEW_SMALL_INT(-MP_EIO);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_writeblocks_obj, machine_sdcard_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_writeblocks_obj, machine_sdcard_writeblocks);
// ioctl(op, arg)
-STATIC mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
mimxrt_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
@@ -200,9 +200,9 @@ STATIC mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t
}
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_ioctl_obj, machine_sdcard_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_ioctl_obj, machine_sdcard_ioctl);
-STATIC const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
+static const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_sdcard_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_sdcard_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_present), MP_ROM_PTR(&machine_sdcard_present_obj) },
@@ -212,7 +212,7 @@ STATIC const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&machine_sdcard_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&machine_sdcard_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(sdcard_locals_dict, sdcard_locals_dict_table);
+static MP_DEFINE_CONST_DICT(sdcard_locals_dict, sdcard_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_sdcard_type,
diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c
index 35deaa7ae6..56e155ff22 100644
--- a/ports/mimxrt/machine_spi.c
+++ b/ports/mimxrt/machine_spi.c
@@ -78,8 +78,8 @@ typedef struct _iomux_table_t {
uint32_t configRegister;
} iomux_table_t;
-STATIC const uint8_t spi_index_table[] = MICROPY_HW_SPI_INDEX;
-STATIC LPSPI_Type *spi_base_ptr_table[] = LPSPI_BASE_PTRS;
+static const uint8_t spi_index_table[] = MICROPY_HW_SPI_INDEX;
+static LPSPI_Type *spi_base_ptr_table[] = LPSPI_BASE_PTRS;
static const iomux_table_t iomux_table[] = {
IOMUX_TABLE_SPI
};
@@ -118,7 +118,7 @@ bool lpspi_set_iomux(int8_t spi, uint8_t drive, int8_t cs) {
}
}
-STATIC void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
static const char *firstbit_str[] = {"MSB", "LSB"};
machine_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "SPI(%u, baudrate=%u, polarity=%u, phase=%u, bits=%u, firstbit=%s, gap_ns=%d)",
@@ -193,7 +193,7 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return MP_OBJ_FROM_PTR(self);
}
-STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_gap_ns };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
@@ -236,7 +236,7 @@ STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj
LPSPI_MasterInit(self->spi_inst, self->master_config, BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT);
}
-STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
machine_spi_obj_t *self = (machine_spi_obj_t *)self_in;
if (len > 0) {
@@ -255,7 +255,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8
}
}
-STATIC const mp_machine_spi_p_t machine_spi_p = {
+static const mp_machine_spi_p_t machine_spi_p = {
.init = machine_spi_init,
.transfer = machine_spi_transfer,
};
diff --git a/ports/mimxrt/machine_uart.c b/ports/mimxrt/machine_uart.c
index 4dbe1d2e5e..7ae584fdd7 100644
--- a/ports/mimxrt/machine_uart.c
+++ b/ports/mimxrt/machine_uart.c
@@ -73,8 +73,8 @@ typedef struct _iomux_table_t {
uint32_t configRegister;
} iomux_table_t;
-STATIC const uint8_t uart_index_table[] = MICROPY_HW_UART_INDEX;
-STATIC LPUART_Type *uart_base_ptr_table[] = LPUART_BASE_PTRS;
+static const uint8_t uart_index_table[] = MICROPY_HW_UART_INDEX;
+static LPUART_Type *uart_base_ptr_table[] = LPUART_BASE_PTRS;
static const iomux_table_t iomux_table_uart[] = {
IOMUX_TABLE_UART
};
@@ -82,9 +82,9 @@ static const iomux_table_t iomux_table_uart_cts_rts[] = {
IOMUX_TABLE_UART_CTS_RTS
};
-STATIC const char *_parity_name[] = {"None", "", "0", "1"}; // Is defined as 0, 2, 3
-STATIC const char *_invert_name[] = {"None", "INV_TX", "INV_RX", "INV_TX|INV_RX"};
-STATIC const char *_flow_name[] = {"None", "RTS", "CTS", "RTS|CTS"};
+static const char *_parity_name[] = {"None", "", "0", "1"}; // Is defined as 0, 2, 3
+static const char *_invert_name[] = {"None", "INV_TX", "INV_RX", "INV_TX|INV_RX"};
+static const char *_flow_name[] = {"None", "RTS", "CTS", "RTS|CTS"};
#define RX (iomux_table_uart[index + 1])
#define TX (iomux_table_uart[index])
@@ -171,7 +171,7 @@ void machine_uart_set_baudrate(mp_obj_t uart_in, uint32_t baudrate) {
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_INT(UART_HWCONTROL_CTS) }, \
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_INT(UART_HWCONTROL_RTS) }, \
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%u, flow=%s, "
"rxbuf=%d, txbuf=%d, timeout=%u, timeout_char=%u, invert=%s)",
@@ -182,7 +182,7 @@ STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_
_invert_name[self->invert]);
}
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_flow,
ARG_timeout, ARG_timeout_char, ARG_invert, ARG_rxbuf, ARG_txbuf};
static const mp_arg_t allowed_args[] = {
@@ -338,7 +338,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
}
}
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// Get UART bus.
@@ -372,21 +372,21 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
}
// uart.deinit()
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
LPUART_SoftwareReset(self->lpuart);
}
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
machine_uart_ensure_active(self);
size_t count = LPUART_TransferGetRxRingBufferLength(self->lpuart, &self->handle);
return count;
}
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
return self->tx_status == kStatus_LPUART_TxIdle;
}
-STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
+static void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
machine_uart_ensure_active(self);
self->lpuart->CTRL |= 1 << LPUART_CTRL_SBK_SHIFT; // Set SBK bit
self->lpuart->CTRL &= ~LPUART_CTRL_SBK_MASK; // Clear SBK bit
@@ -401,7 +401,7 @@ void machine_uart_deinit_all(void) {
}
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint64_t t = ticks_us64() + (uint64_t)self->timeout * 1000;
uint64_t timeout_char_us = (uint64_t)self->timeout_char * 1000;
@@ -436,7 +436,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
return size;
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
lpuart_transfer_t xfer;
uint64_t t;
@@ -496,7 +496,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
return size;
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = self_in;
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
diff --git a/ports/mimxrt/machine_wdt.c b/ports/mimxrt/machine_wdt.c
index 176e114f72..24945efbfb 100644
--- a/ports/mimxrt/machine_wdt.c
+++ b/ports/mimxrt/machine_wdt.c
@@ -36,9 +36,9 @@ typedef struct _machine_wdt_obj_t {
mp_obj_base_t base;
} machine_wdt_obj_t;
-STATIC const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
+static const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
// Verify the WDT id.
if (id != 0) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("WDT(%d) doesn't exist"), id);
@@ -59,12 +59,12 @@ STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t
return (machine_wdt_obj_t *)&machine_wdt;
}
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
(void)self;
WDOG_Refresh(WDOG1);
}
-STATIC void mp_machine_wdt_timeout_ms_set(machine_wdt_obj_t *self, mp_int_t timeout_ms) {
+static void mp_machine_wdt_timeout_ms_set(machine_wdt_obj_t *self, mp_int_t timeout_ms) {
(void)self;
// confine to the valid range
diff --git a/ports/mimxrt/mimxrt_flash.c b/ports/mimxrt/mimxrt_flash.c
index d229367e81..fdd48e280b 100644
--- a/ports/mimxrt/mimxrt_flash.c
+++ b/ports/mimxrt/mimxrt_flash.c
@@ -42,11 +42,11 @@ typedef struct _mimxrt_flash_obj_t {
uint32_t flash_size;
} mimxrt_flash_obj_t;
-STATIC mimxrt_flash_obj_t mimxrt_flash_obj = {
+static mimxrt_flash_obj_t mimxrt_flash_obj = {
.base = { &mimxrt_flash_type }
};
-STATIC mp_obj_t mimxrt_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mimxrt_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Check args.
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -62,7 +62,7 @@ STATIC mp_obj_t mimxrt_flash_make_new(const mp_obj_type_t *type, size_t n_args,
// readblocks(block_num, buf, [offset])
// read size of buffer number of bytes from block (with offset) into buffer
-STATIC mp_obj_t mimxrt_flash_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mimxrt_flash_readblocks(size_t n_args, const mp_obj_t *args) {
mimxrt_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_WRITE);
@@ -76,13 +76,13 @@ STATIC mp_obj_t mimxrt_flash_readblocks(size_t n_args, const mp_obj_t *args) {
flash_read_block((self->flash_base + offset), (uint8_t *)bufinfo.buf, (uint32_t)bufinfo.len);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mimxrt_flash_readblocks_obj, 3, 4, mimxrt_flash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mimxrt_flash_readblocks_obj, 3, 4, mimxrt_flash_readblocks);
// writeblocks(block_num, buf, [offset])
// Erase block based on block_num and write buffer size number of bytes from buffer into block. If additional offset
// parameter is provided only write operation at block start + offset will be performed.
// This requires a prior erase operation of the block!
-STATIC mp_obj_t mimxrt_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mimxrt_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
status_t status;
mimxrt_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_buffer_info_t bufinfo;
@@ -110,10 +110,10 @@ STATIC mp_obj_t mimxrt_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_NEW_SMALL_INT(status != kStatus_Success);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mimxrt_flash_writeblocks_obj, 3, 4, mimxrt_flash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mimxrt_flash_writeblocks_obj, 3, 4, mimxrt_flash_writeblocks);
// ioctl(op, arg)
-STATIC mp_obj_t mimxrt_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t mimxrt_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
mimxrt_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
status_t status;
@@ -137,14 +137,14 @@ STATIC mp_obj_t mimxrt_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t a
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(mimxrt_flash_ioctl_obj, mimxrt_flash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(mimxrt_flash_ioctl_obj, mimxrt_flash_ioctl);
-STATIC const mp_rom_map_elem_t mimxrt_flash_locals_dict_table[] = {
+static const mp_rom_map_elem_t mimxrt_flash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&mimxrt_flash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&mimxrt_flash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&mimxrt_flash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mimxrt_flash_locals_dict, mimxrt_flash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(mimxrt_flash_locals_dict, mimxrt_flash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mimxrt_flash_type,
diff --git a/ports/mimxrt/modmachine.c b/ports/mimxrt/modmachine.c
index e01703af8c..1212914d3b 100644
--- a/ports/mimxrt/modmachine.c
+++ b/ports/mimxrt/modmachine.c
@@ -76,20 +76,20 @@ typedef enum {
MP_SOFT_RESET
} reset_reason_t;
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
unsigned char id[8];
mp_hal_get_unique_id(id);
return mp_obj_new_bytes(id, sizeof(id));
}
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
WDOG_TriggerSystemSoftwareReset(WDOG1);
while (true) {
;
}
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
#ifdef MIMXRT117x_SERIES
uint32_t user_reset_flag = kSRC_M7CoreIppUserResetFlag;
#else
@@ -110,23 +110,23 @@ STATIC mp_int_t mp_machine_reset_cause(void) {
return reset_cause;
}
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_get_cpu_freq());
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_raise_NotImplementedError(NULL);
}
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
MICROPY_EVENT_POLL_HOOK;
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
mp_raise_NotImplementedError(NULL);
}
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
if (n_args != 0) {
mp_int_t seconds = mp_obj_get_int(args[0]) / 1000;
if (seconds > 0) {
diff --git a/ports/mimxrt/modmimxrt.c b/ports/mimxrt/modmimxrt.c
index 4756efc0a2..0f67538ce0 100644
--- a/ports/mimxrt/modmimxrt.c
+++ b/ports/mimxrt/modmimxrt.c
@@ -28,11 +28,11 @@
#include "py/runtime.h"
#include "modmimxrt.h"
-STATIC const mp_rom_map_elem_t mimxrt_module_globals_table[] = {
+static const mp_rom_map_elem_t mimxrt_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_mimxrt) },
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&mimxrt_flash_type) },
};
-STATIC MP_DEFINE_CONST_DICT(mimxrt_module_globals, mimxrt_module_globals_table);
+static MP_DEFINE_CONST_DICT(mimxrt_module_globals, mimxrt_module_globals_table);
const mp_obj_module_t mp_module_mimxrt = {
.base = { &mp_type_module },
diff --git a/ports/mimxrt/modos.c b/ports/mimxrt/modos.c
index 2ee8418152..0eb32afba3 100644
--- a/ports/mimxrt/modos.c
+++ b/ports/mimxrt/modos.c
@@ -43,8 +43,8 @@
static bool initialized = false;
#if defined(MIMXRT117x_SERIES)
-STATIC caam_handle_t caam_handle;
-STATIC caam_rng_state_handle_t caam_state_handle = kCAAM_RngStateHandle0;
+static caam_handle_t caam_handle;
+static caam_rng_state_handle_t caam_state_handle = kCAAM_RngStateHandle0;
#if defined(FSL_FEATURE_HAS_L1CACHE) || defined(__DCACHE_PRESENT)
AT_NONCACHEABLE_SECTION(static caam_job_ring_interface_t s_jrif0);
@@ -52,7 +52,7 @@ AT_NONCACHEABLE_SECTION(static caam_job_ring_interface_t s_jrif0);
static caam_job_ring_interface_t s_jrif0;
#endif
-STATIC void trng_start(void) {
+static void trng_start(void) {
caam_config_t config;
if (!initialized) {
@@ -71,7 +71,7 @@ void trng_random_data(unsigned char *output, size_t len) {
#else
-STATIC void trng_start(void) {
+static void trng_start(void) {
trng_config_t trngConfig;
if (!initialized) {
@@ -99,7 +99,7 @@ uint32_t trng_random_u32(void) {
}
#if MICROPY_PY_OS_URANDOM
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -109,5 +109,5 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
#endif
diff --git a/ports/mimxrt/modtime.c b/ports/mimxrt/modtime.c
index b0c927899f..a2ccf1b273 100644
--- a/ports/mimxrt/modtime.c
+++ b/ports/mimxrt/modtime.c
@@ -30,7 +30,7 @@
#include "fsl_snvs_lp.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
// Get current date and time.
snvs_lp_srtc_datetime_t t;
SNVS_LP_SRTC_GetDatetime(SNVS, &t);
@@ -48,7 +48,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Return the number of seconds since the Epoch.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
snvs_lp_srtc_datetime_t t;
SNVS_LP_SRTC_GetDatetime(SNVS, &t);
// EPOCH is 1970 for this port, which leads to the following trouble:
diff --git a/ports/mimxrt/mpbthciport.c b/ports/mimxrt/mpbthciport.c
index 2b0bcd2cf6..45f7296717 100644
--- a/ports/mimxrt/mpbthciport.c
+++ b/ports/mimxrt/mpbthciport.c
@@ -46,10 +46,10 @@
uint8_t mp_bluetooth_hci_cmd_buf[4 + 256];
-STATIC mp_sched_node_t mp_bluetooth_hci_sched_node;
-STATIC soft_timer_entry_t mp_bluetooth_hci_soft_timer;
+static mp_sched_node_t mp_bluetooth_hci_sched_node;
+static soft_timer_entry_t mp_bluetooth_hci_soft_timer;
-STATIC void mp_bluetooth_hci_soft_timer_callback(soft_timer_entry_t *self) {
+static void mp_bluetooth_hci_soft_timer_callback(soft_timer_entry_t *self) {
mp_bluetooth_hci_poll_now();
}
@@ -62,7 +62,7 @@ void mp_bluetooth_hci_init(void) {
);
}
-STATIC void mp_bluetooth_hci_start_polling(void) {
+static void mp_bluetooth_hci_start_polling(void) {
mp_bluetooth_hci_poll_now();
}
@@ -71,7 +71,7 @@ void mp_bluetooth_hci_poll_in_ms(uint32_t ms) {
}
// For synchronous mode, we run all BLE stack code inside a scheduled task.
-STATIC void run_events_scheduled_task(mp_sched_node_t *node) {
+static void run_events_scheduled_task(mp_sched_node_t *node) {
// This will process all buffered HCI UART data, and run any callouts or events.
mp_bluetooth_hci_poll();
}
diff --git a/ports/mimxrt/mphalport.c b/ports/mimxrt/mphalport.c
index be4b1d8b5c..6e982b8c8e 100644
--- a/ports/mimxrt/mphalport.c
+++ b/ports/mimxrt/mphalport.c
@@ -41,7 +41,7 @@
#include CPU_HEADER_H
-STATIC uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
+static uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
ringbuf_t stdin_ringbuf = {stdin_ringbuf_array, sizeof(stdin_ringbuf_array), 0, 0};
uint8_t cdc_itf_pending; // keep track of cdc interfaces which need attention to poll
diff --git a/ports/mimxrt/mpnetworkport.c b/ports/mimxrt/mpnetworkport.c
index 2ca3426197..aa8eef3ee2 100644
--- a/ports/mimxrt/mpnetworkport.c
+++ b/ports/mimxrt/mpnetworkport.c
@@ -55,7 +55,7 @@ u32_t sys_now(void) {
return mp_hal_ticks_ms();
}
-STATIC void pyb_lwip_poll(void) {
+static void pyb_lwip_poll(void) {
// Run the lwIP internal updates
sys_check_timeouts();
}
diff --git a/ports/mimxrt/network_lan.c b/ports/mimxrt/network_lan.c
index 355698e0b5..e01079cbf3 100644
--- a/ports/mimxrt/network_lan.c
+++ b/ports/mimxrt/network_lan.c
@@ -55,12 +55,12 @@ typedef struct _network_lan_obj_t {
} network_lan_obj_t;
-STATIC const network_lan_obj_t network_lan_eth0 = { { &network_lan_type }, &eth_instance0 };
+static const network_lan_obj_t network_lan_eth0 = { { &network_lan_type }, &eth_instance0 };
#if defined(ENET_DUAL_PORT)
-STATIC const network_lan_obj_t network_lan_eth1 = { { &network_lan_type }, &eth_instance1 };
+static const network_lan_obj_t network_lan_eth1 = { { &network_lan_type }, &eth_instance1 };
#endif
-STATIC void network_lan_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void network_lan_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(self_in);
struct netif *netif = eth_netif(self->eth);
int status = eth_link_status(self->eth);
@@ -74,7 +74,7 @@ STATIC void network_lan_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
);
}
-STATIC mp_obj_t network_lan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t network_lan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_id, ARG_phy_type, ARG_phy_addr, ARG_ref_clk_mode};
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
@@ -148,7 +148,7 @@ STATIC mp_obj_t network_lan_make_new(const mp_obj_type_t *type, size_t n_args, s
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t network_lan_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_lan_active(size_t n_args, const mp_obj_t *args) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
return mp_obj_new_bool(eth_link_status(self->eth));
@@ -165,21 +165,21 @@ STATIC mp_obj_t network_lan_active(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_active_obj, 1, 2, network_lan_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_active_obj, 1, 2, network_lan_active);
-STATIC mp_obj_t network_lan_isconnected(mp_obj_t self_in) {
+static mp_obj_t network_lan_isconnected(mp_obj_t self_in) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(eth_link_status(self->eth) == 3);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_lan_isconnected_obj, network_lan_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_lan_isconnected_obj, network_lan_isconnected);
-STATIC mp_obj_t network_lan_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_lan_ifconfig(size_t n_args, const mp_obj_t *args) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
return mod_network_nic_ifconfig(eth_netif(self->eth), n_args - 1, args + 1);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_ifconfig_obj, 1, 2, network_lan_ifconfig);
-STATIC mp_obj_t network_lan_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_lan_status(size_t n_args, const mp_obj_t *args) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
(void)self;
@@ -190,9 +190,9 @@ STATIC mp_obj_t network_lan_status(size_t n_args, const mp_obj_t *args) {
mp_raise_ValueError(MP_ERROR_TEXT("unknown status param"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_status_obj, 1, 2, network_lan_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_status_obj, 1, 2, network_lan_status);
-STATIC mp_obj_t network_lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t network_lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (kwargs->used == 0) {
@@ -235,9 +235,9 @@ STATIC mp_obj_t network_lan_config(size_t n_args, const mp_obj_t *args, mp_map_t
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_lan_config_obj, 1, network_lan_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_lan_config_obj, 1, network_lan_config);
-STATIC const mp_rom_map_elem_t network_lan_locals_dict_table[] = {
+static const mp_rom_map_elem_t network_lan_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&network_lan_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&network_lan_isconnected_obj) },
{ MP_ROM_QSTR(MP_QSTR_ifconfig), MP_ROM_PTR(&network_lan_ifconfig_obj) },
@@ -252,7 +252,7 @@ STATIC const mp_rom_map_elem_t network_lan_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IN), MP_ROM_INT(PHY_TX_CLK_IN) },
{ MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_INT(PHY_TX_CLK_OUT) },
};
-STATIC MP_DEFINE_CONST_DICT(network_lan_locals_dict, network_lan_locals_dict_table);
+static MP_DEFINE_CONST_DICT(network_lan_locals_dict, network_lan_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
network_lan_type,
diff --git a/ports/nrf/boards/MICROBIT/modules/microbitdisplay.c b/ports/nrf/boards/MICROBIT/modules/microbitdisplay.c
index ff3c499fa3..dea12faf42 100644
--- a/ports/nrf/boards/MICROBIT/modules/microbitdisplay.c
+++ b/ports/nrf/boards/MICROBIT/modules/microbitdisplay.c
@@ -135,7 +135,7 @@ bool microbit_display_active_animation(void) {
return async_mode == ASYNC_MODE_ANIMATION;
}
-STATIC void async_stop(void) {
+static void async_stop(void) {
async_iterator = NULL;
async_mode = ASYNC_MODE_STOPPED;
async_tick = 0;
@@ -146,7 +146,7 @@ STATIC void async_stop(void) {
wakeup_event = true;
}
-STATIC void wait_for_event(void) {
+static void wait_for_event(void) {
while (!wakeup_event) {
// allow CTRL-C to stop the animation
if (MP_STATE_THREAD(mp_pending_exception) != MP_OBJ_NULL) {
@@ -508,7 +508,7 @@ void microbit_display_set_pixel(microbit_display_obj_t *display, mp_int_t x, mp_
display->brightnesses |= (1 << bright);
}
-STATIC mp_obj_t microbit_display_set_pixel_func(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t microbit_display_set_pixel_func(mp_uint_t n_args, const mp_obj_t *args) {
(void)n_args;
microbit_display_obj_t *self = (microbit_display_obj_t*)args[0];
microbit_display_set_pixel(self, mp_obj_get_int(args[1]), mp_obj_get_int(args[2]), mp_obj_get_int(args[3]));
@@ -523,13 +523,13 @@ mp_int_t microbit_display_get_pixel(microbit_display_obj_t *display, mp_int_t x,
return display->image_buffer[x][y];
}
-STATIC mp_obj_t microbit_display_get_pixel_func(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
+static mp_obj_t microbit_display_get_pixel_func(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
microbit_display_obj_t *self = (microbit_display_obj_t*)self_in;
return MP_OBJ_NEW_SMALL_INT(microbit_display_get_pixel(self, mp_obj_get_int(x_in), mp_obj_get_int(y_in)));
}
MP_DEFINE_CONST_FUN_OBJ_3(microbit_display_get_pixel_obj, microbit_display_get_pixel_func);
-STATIC const mp_rom_map_elem_t microbit_display_locals_dict_table[] = {
+static const mp_rom_map_elem_t microbit_display_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_get_pixel), MP_ROM_PTR(&microbit_display_get_pixel_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_pixel), MP_ROM_PTR(&microbit_display_set_pixel_obj) },
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&microbit_display_show_obj) },
@@ -540,7 +540,7 @@ STATIC const mp_rom_map_elem_t microbit_display_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_is_on), MP_ROM_PTR(&microbit_display_is_on_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(microbit_display_locals_dict, microbit_display_locals_dict_table);
+static MP_DEFINE_CONST_DICT(microbit_display_locals_dict, microbit_display_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
microbit_display_type,
diff --git a/ports/nrf/boards/MICROBIT/modules/microbitimage.c b/ports/nrf/boards/MICROBIT/modules/microbitimage.c
index b3505c20a3..43fae777c7 100644
--- a/ports/nrf/boards/MICROBIT/modules/microbitimage.c
+++ b/ports/nrf/boards/MICROBIT/modules/microbitimage.c
@@ -40,7 +40,7 @@ const monochrome_5by5_t microbit_blank_image = {
{ 0, 0, 0 }
};
-STATIC void microbit_image_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void microbit_image_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
microbit_image_obj_t *self = (microbit_image_obj_t*)self_in;
mp_printf(print, "Image(");
if (kind == PRINT_STR)
@@ -112,7 +112,7 @@ mp_int_t imageHeight(microbit_image_obj_t * p_image) {
return p_image->greyscale.height;
}
-STATIC greyscale_t *greyscale_new(mp_int_t w, mp_int_t h) {
+static greyscale_t *greyscale_new(mp_int_t w, mp_int_t h) {
greyscale_t *result = mp_obj_malloc_var(greyscale_t, byte_data, uint8_t, (w*h+1)>>1, &microbit_image_type);
result->five = 0;
result->width = w;
@@ -144,7 +144,7 @@ greyscale_t * imageInvert(microbit_image_obj_t * p_image) {
return result;
}
-STATIC microbit_image_obj_t *image_from_parsed_str(const char *s, mp_int_t len) {
+static microbit_image_obj_t *image_from_parsed_str(const char *s, mp_int_t len) {
mp_int_t w = 0;
mp_int_t h = 0;
mp_int_t line_len = 0;
@@ -201,7 +201,7 @@ STATIC microbit_image_obj_t *image_from_parsed_str(const char *s, mp_int_t len)
}
-STATIC mp_obj_t microbit_image_make_new(const mp_obj_type_t *type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+static mp_obj_t microbit_image_make_new(const mp_obj_type_t *type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 3, false);
@@ -270,7 +270,7 @@ static void clear_rect(greyscale_t *img, mp_int_t x0, mp_int_t y0,mp_int_t x1, m
}
}
-STATIC void image_blit(microbit_image_obj_t *src, greyscale_t *dest, mp_int_t x, mp_int_t y, mp_int_t w, mp_int_t h, mp_int_t xdest, mp_int_t ydest) {
+static void image_blit(microbit_image_obj_t *src, greyscale_t *dest, mp_int_t x, mp_int_t y, mp_int_t w, mp_int_t h, mp_int_t xdest, mp_int_t ydest) {
if (w < 0)
w = 0;
if (h < 0)
@@ -323,7 +323,7 @@ greyscale_t *image_shift(microbit_image_obj_t *self, mp_int_t x, mp_int_t y) {
return result;
}
-STATIC microbit_image_obj_t *image_crop(microbit_image_obj_t *img, mp_int_t x, mp_int_t y, mp_int_t w, mp_int_t h) {
+static microbit_image_obj_t *image_crop(microbit_image_obj_t *img, mp_int_t x, mp_int_t y, mp_int_t w, mp_int_t h) {
if (w < 0)
w = 0;
if (h < 0)
@@ -483,7 +483,7 @@ mp_obj_t microbit_image_invert(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(microbit_image_invert_obj, microbit_image_invert);
-STATIC const mp_rom_map_elem_t microbit_image_locals_dict_table[] = {
+static const mp_rom_map_elem_t microbit_image_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&microbit_image_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&microbit_image_height_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_pixel), MP_ROM_PTR(&microbit_image_get_pixel_obj) },
@@ -565,14 +565,14 @@ STATIC const mp_rom_map_elem_t microbit_image_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SNAKE), MP_ROM_PTR(&microbit_const_image_snake_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(microbit_image_locals_dict, microbit_image_locals_dict_table);
+static MP_DEFINE_CONST_DICT(microbit_image_locals_dict, microbit_image_locals_dict_table);
#define THE_FONT font_pendolino3_5x5_pad3msb
#define ASCII_START 32
#define ASCII_END 126
-STATIC const unsigned char *get_font_data_from_char(char c) {
+static const unsigned char *get_font_data_from_char(char c) {
if (c < ASCII_START || c > ASCII_END) {
c = '?';
}
@@ -580,7 +580,7 @@ STATIC const unsigned char *get_font_data_from_char(char c) {
return THE_FONT + offset;
}
-STATIC mp_int_t get_pixel_from_font_data(const unsigned char *data, int x, int y) {
+static mp_int_t get_pixel_from_font_data(const unsigned char *data, int x, int y) {
/* The following logic belongs in MicroBitFont */
return ((data[y]>>(4-x))&1);
}
@@ -645,7 +645,7 @@ microbit_image_obj_t *microbit_image_sum(microbit_image_obj_t *lhs, microbit_ima
return (microbit_image_obj_t *)result;
}
-STATIC mp_obj_t image_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t image_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
if (mp_obj_get_type(lhs_in) != &microbit_image_type) {
return MP_OBJ_NULL; // op not supported
}
@@ -724,7 +724,7 @@ mp_obj_t scrolling_string_image_iterable(const char* str, mp_uint_t len, mp_obj_
return result;
}
-STATIC int font_column_non_blank(const unsigned char *font_data, unsigned int col) {
+static int font_column_non_blank(const unsigned char *font_data, unsigned int col) {
for (int y = 0; y < 5; ++y) {
if (get_pixel_from_font_data(font_data, col, y)) {
return 1;
@@ -734,7 +734,7 @@ STATIC int font_column_non_blank(const unsigned char *font_data, unsigned int co
}
/* Not strictly the rightmost non-blank column, but the rightmost in columns 2,3 or 4. */
-STATIC unsigned int rightmost_non_blank_column(const unsigned char *font_data) {
+static unsigned int rightmost_non_blank_column(const unsigned char *font_data) {
if (font_column_non_blank(font_data, 4)) {
return 4;
}
@@ -760,7 +760,7 @@ static void restart(scrolling_string_iterator_t *iter) {
}
}
-STATIC mp_obj_t get_microbit_scrolling_string_iter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t get_microbit_scrolling_string_iter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
(void)iter_buf;
scrolling_string_t *str = (scrolling_string_t *)o_in;
scrolling_string_iterator_t *result = mp_obj_malloc(scrolling_string_iterator_t, &microbit_scrolling_string_iterator_type);
@@ -774,7 +774,7 @@ STATIC mp_obj_t get_microbit_scrolling_string_iter(mp_obj_t o_in, mp_obj_iter_bu
return result;
}
-STATIC mp_obj_t microbit_scrolling_string_iter_next(mp_obj_t o_in) {
+static mp_obj_t microbit_scrolling_string_iter_next(mp_obj_t o_in) {
scrolling_string_iterator_t *iter = (scrolling_string_iterator_t *)o_in;
if (iter->next_char == iter->end && iter->offset == 5) {
if (iter->repeat) {
diff --git a/ports/nrf/boards/MICROBIT/modules/modmicrobit.c b/ports/nrf/boards/MICROBIT/modules/modmicrobit.c
index 06b3e5f6ab..e56f644159 100644
--- a/ports/nrf/boards/MICROBIT/modules/modmicrobit.c
+++ b/ports/nrf/boards/MICROBIT/modules/modmicrobit.c
@@ -35,13 +35,13 @@
extern uint32_t ticks;
-STATIC mp_obj_t microbit_reset_(void) {
+static mp_obj_t microbit_reset_(void) {
NVIC_SystemReset();
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(microbit_reset_obj, microbit_reset_);
-STATIC mp_obj_t microbit_sleep(mp_obj_t ms_in) {
+static mp_obj_t microbit_sleep(mp_obj_t ms_in) {
mp_int_t ms = 0;
if (mp_obj_is_integer(ms_in)) {
ms = mp_obj_get_int(ms_in);
@@ -57,7 +57,7 @@ STATIC mp_obj_t microbit_sleep(mp_obj_t ms_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(microbit_sleep_obj, microbit_sleep);
-STATIC mp_obj_t microbit_running_time(void) {
+static mp_obj_t microbit_running_time(void) {
return MP_OBJ_NEW_SMALL_INT(ticks);
}
MP_DEFINE_CONST_FUN_OBJ_0(microbit_running_time_obj, microbit_running_time);
@@ -70,7 +70,7 @@ static const monochrome_5by5_t panic = SMALL_IMAGE(
1,0,0,0,1
);
-STATIC mp_obj_t microbit_panic(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t microbit_panic(mp_uint_t n_args, const mp_obj_t *args) {
while(true) {
microbit_display_show(&microbit_display_obj, (microbit_image_obj_t*)&panic);
mp_hal_delay_ms(1000);
@@ -95,7 +95,7 @@ STATIC mp_obj_t microbit_panic(mp_uint_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(microbit_panic_obj, 0, 1, microbit_panic);
-STATIC mp_obj_t microbit_temperature(void) {
+static mp_obj_t microbit_temperature(void) {
int temp = temp_read();
#if MICROPY_PY_BUILTINS_FLOAT
return mp_obj_new_float((mp_float_t)temp / MICROPY_FLOAT_CONST(100.0));
@@ -109,7 +109,7 @@ void board_modules_init0(void) {
ticker_register_low_pri_callback(microbit_display_tick);
}
-STATIC const mp_rom_map_elem_t microbit_module_globals_table[] = {
+static const mp_rom_map_elem_t microbit_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_Image), MP_ROM_PTR(&microbit_image_type) },
{ MP_ROM_QSTR(MP_QSTR_display), MP_ROM_PTR(&microbit_display_obj) },
@@ -150,7 +150,7 @@ STATIC const mp_rom_map_elem_t microbit_module_globals_table[] = {
*/
};
-STATIC MP_DEFINE_CONST_DICT(microbit_module_globals, microbit_module_globals_table);
+static MP_DEFINE_CONST_DICT(microbit_module_globals, microbit_module_globals_table);
const mp_obj_module_t microbit_module = {
.base = { &mp_type_module },
diff --git a/ports/nrf/boards/make-pins.py b/ports/nrf/boards/make-pins.py
index 57e815a43d..30da035589 100644
--- a/ports/nrf/boards/make-pins.py
+++ b/ports/nrf/boards/make-pins.py
@@ -241,7 +241,7 @@ class Pins(object):
def print_named(self, label, named_pins, out_source):
print(
- "STATIC const mp_rom_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{".format(label),
+ "static const mp_rom_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{".format(label),
file=out_source,
)
for named_pin in named_pins:
diff --git a/ports/nrf/drivers/bluetooth/ble_uart.c b/ports/nrf/drivers/bluetooth/ble_uart.c
index 4ea8115725..a342a1e006 100644
--- a/ports/nrf/drivers/bluetooth/ble_uart.c
+++ b/ports/nrf/drivers/bluetooth/ble_uart.c
@@ -173,7 +173,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) {
}
#endif
-STATIC void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn_handle, uint16_t length, uint8_t * data) {
+static void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn_handle, uint16_t length, uint8_t * data) {
ubluepy_peripheral_obj_t * self = MP_OBJ_TO_PTR(self_in);
if (event_id == 16) { // connect event
@@ -187,7 +187,7 @@ STATIC void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn
}
}
-STATIC void gatts_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t attr_handle, uint16_t length, uint8_t * data) {
+static void gatts_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t attr_handle, uint16_t length, uint8_t * data) {
ubluepy_peripheral_obj_t * self = MP_OBJ_TO_PTR(self_in);
(void)self;
diff --git a/ports/nrf/drivers/flash.c b/ports/nrf/drivers/flash.c
index 85e5f71d63..74a7794ee8 100644
--- a/ports/nrf/drivers/flash.c
+++ b/ports/nrf/drivers/flash.c
@@ -33,13 +33,13 @@
#include "nrf_soc.h"
// Rotates bits in `value` left `shift` times.
-STATIC inline uint32_t rotate_left(uint32_t value, uint32_t shift) {
+static inline uint32_t rotate_left(uint32_t value, uint32_t shift) {
return (value << shift) | (value >> (32 - shift));
}
-STATIC volatile flash_state_t flash_operation_state = FLASH_STATE_BUSY;
+static volatile flash_state_t flash_operation_state = FLASH_STATE_BUSY;
-STATIC void operation_init(void) {
+static void operation_init(void) {
flash_operation_state = FLASH_STATE_BUSY;
}
@@ -47,7 +47,7 @@ void flash_operation_finished(flash_state_t result) {
flash_operation_state = result;
}
-STATIC bool operation_wait(uint32_t result) {
+static bool operation_wait(uint32_t result) {
if (ble_drv_stack_enabled() != 1) {
// SoftDevice is not enabled, no event will be generated.
return result == NRF_SUCCESS;
diff --git a/ports/nrf/modules/ble/modble.c b/ports/nrf/modules/ble/modble.c
index 3a9c6b20da..7a9b55523e 100644
--- a/ports/nrf/modules/ble/modble.c
+++ b/ports/nrf/modules/ble/modble.c
@@ -81,12 +81,12 @@ mp_obj_t ble_obj_address(void) {
return mac_str;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_enable_obj, ble_obj_enable);
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_disable_obj, ble_obj_disable);
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_enabled_obj, ble_obj_enabled);
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_address_obj, ble_obj_address);
+static MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_enable_obj, ble_obj_enable);
+static MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_disable_obj, ble_obj_disable);
+static MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_enabled_obj, ble_obj_enabled);
+static MP_DEFINE_CONST_FUN_OBJ_0(ble_obj_address_obj, ble_obj_address);
-STATIC const mp_rom_map_elem_t ble_module_globals_table[] = {
+static const mp_rom_map_elem_t ble_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ble) },
{ MP_ROM_QSTR(MP_QSTR_enable), MP_ROM_PTR(&ble_obj_enable_obj) },
{ MP_ROM_QSTR(MP_QSTR_disable), MP_ROM_PTR(&ble_obj_disable_obj) },
@@ -95,7 +95,7 @@ STATIC const mp_rom_map_elem_t ble_module_globals_table[] = {
};
-STATIC MP_DEFINE_CONST_DICT(ble_module_globals, ble_module_globals_table);
+static MP_DEFINE_CONST_DICT(ble_module_globals, ble_module_globals_table);
const mp_obj_module_t ble_module = {
.base = { &mp_type_module },
diff --git a/ports/nrf/modules/board/led.c b/ports/nrf/modules/board/led.c
index 57065a4851..6c0df56526 100644
--- a/ports/nrf/modules/board/led.c
+++ b/ports/nrf/modules/board/led.c
@@ -142,7 +142,7 @@ void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t ki
/// Create an LED object associated with the given LED:
///
/// - `id` is the LED number, 1-4.
-STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -182,17 +182,17 @@ mp_obj_t led_obj_toggle(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
-STATIC const mp_rom_map_elem_t led_locals_dict_table[] = {
+static const mp_rom_map_elem_t led_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&led_obj_on_obj) },
{ MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&led_obj_off_obj) },
{ MP_ROM_QSTR(MP_QSTR_toggle), MP_ROM_PTR(&led_obj_toggle_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
+static MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
board_led_type,
diff --git a/ports/nrf/modules/board/modboard.c b/ports/nrf/modules/board/modboard.c
index 1fe3dcc5c9..7675a254f4 100644
--- a/ports/nrf/modules/board/modboard.c
+++ b/ports/nrf/modules/board/modboard.c
@@ -38,7 +38,7 @@
#define PYB_LED_MODULE
#endif
-STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+static const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_board) },
#if MICROPY_REPL_INFO
{ MP_ROM_QSTR(MP_QSTR_repl_info), MP_ROM_PTR(&pyb_set_repl_info_obj) },
@@ -47,7 +47,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
};
-STATIC MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
+static MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
const mp_obj_module_t board_module = {
.base = { &mp_type_module },
diff --git a/ports/nrf/modules/machine/adc.c b/ports/nrf/modules/machine/adc.c
index 9bebcbe086..c45d0ba5ff 100644
--- a/ports/nrf/modules/machine/adc.c
+++ b/ports/nrf/modules/machine/adc.c
@@ -44,7 +44,7 @@ typedef struct _machine_adc_obj_t {
#endif
} machine_adc_obj_t;
-STATIC const machine_adc_obj_t machine_adc_obj[] = {
+static const machine_adc_obj_t machine_adc_obj[] = {
#if NRF51
{{&machine_adc_type}, .id = 0, .ain = NRF_ADC_CONFIG_INPUT_0},
{{&machine_adc_type}, .id = 1, .ain = NRF_ADC_CONFIG_INPUT_1},
@@ -73,7 +73,7 @@ void adc_init0(void) {
#endif
}
-STATIC int adc_find(mp_obj_t id) {
+static int adc_find(mp_obj_t id) {
int adc_idx;
if (mp_obj_is_int(id)) {
// Given an integer id
@@ -104,14 +104,14 @@ STATIC int adc_find(mp_obj_t id) {
{ MP_ROM_QSTR(MP_QSTR_battery_level), MP_ROM_PTR(&mp_machine_adc_battery_level_obj) }, /* class method */ \
// Return a string describing the ADC object.
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
machine_adc_obj_t *self = o;
mp_printf(print, "ADC(%u)", self->id);
}
// for make_new
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_id };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1) } },
@@ -171,7 +171,7 @@ int16_t machine_adc_value_read(machine_adc_obj_t * adc_obj) {
}
// read_u16()
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
int16_t raw = machine_adc_value_read(self);
#if defined(NRF52_SERIES)
// raw is signed but the channel is in single-ended mode and this method cannot return negative values
@@ -192,7 +192,7 @@ mp_obj_t machine_adc_value(mp_obj_t self_in) {
return MP_OBJ_NEW_SMALL_INT(value);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_machine_adc_value_obj, machine_adc_value);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_machine_adc_value_obj, machine_adc_value);
#if NRF51
@@ -278,4 +278,4 @@ mp_obj_t machine_adc_battery_level(void) {
return MP_OBJ_NEW_SMALL_INT(batt_in_percent);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_machine_adc_battery_level_obj, machine_adc_battery_level);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_machine_adc_battery_level_obj, machine_adc_battery_level);
diff --git a/ports/nrf/modules/machine/i2c.c b/ports/nrf/modules/machine/i2c.c
index 6d2b83a454..7e488366d7 100644
--- a/ports/nrf/modules/machine/i2c.c
+++ b/ports/nrf/modules/machine/i2c.c
@@ -71,7 +71,7 @@ typedef struct _machine_hard_i2c_obj_t {
nrfx_twi_t p_twi; // Driver instance
} machine_hard_i2c_obj_t;
-STATIC const machine_hard_i2c_obj_t machine_hard_i2c_obj[] = {
+static const machine_hard_i2c_obj_t machine_hard_i2c_obj[] = {
{{&machine_i2c_type}, .p_twi = NRFX_TWI_INSTANCE(0)},
{{&machine_i2c_type}, .p_twi = NRFX_TWI_INSTANCE(1)},
};
@@ -79,7 +79,7 @@ STATIC const machine_hard_i2c_obj_t machine_hard_i2c_obj[] = {
void i2c_init0(void) {
}
-STATIC int i2c_find(mp_obj_t id) {
+static int i2c_find(mp_obj_t id) {
// given an integer id
int i2c_id = mp_obj_get_int(id);
if (i2c_id >= 0 && i2c_id < MP_ARRAY_SIZE(machine_hard_i2c_obj)) {
@@ -88,7 +88,7 @@ STATIC int i2c_find(mp_obj_t id) {
mp_raise_ValueError(MP_ERROR_TEXT("I2C doesn't exist"));
}
-STATIC void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_i2c_obj_t *self = self_in;
mp_printf(print, "I2C(%u)", self->p_twi.drv_inst_idx);
}
@@ -171,7 +171,7 @@ int machine_hard_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size
return transfer_ret;
}
-STATIC const mp_machine_i2c_p_t machine_hard_i2c_p = {
+static const mp_machine_i2c_p_t machine_hard_i2c_p = {
.transfer = mp_machine_i2c_transfer_adaptor,
.transfer_single = machine_hard_i2c_transfer_single,
};
diff --git a/ports/nrf/modules/machine/modmachine.c b/ports/nrf/modules/machine/modmachine.c
index 7cdeb78c0a..9ad8d606a2 100644
--- a/ports/nrf/modules/machine/modmachine.c
+++ b/ports/nrf/modules/machine/modmachine.c
@@ -102,7 +102,7 @@
{ MP_ROM_QSTR(MP_QSTR_DEBUG_IF_RESET), MP_ROM_INT(PYB_RESET_DIF) }, \
MICROPY_PY_MACHINE_NFC_RESET_ENTRY \
-STATIC uint32_t reset_cause;
+static uint32_t reset_cause;
void machine_init(void) {
uint32_t state = NRF_POWER->RESETREAS;
@@ -134,7 +134,7 @@ void machine_init(void) {
// machine.info([dump_alloc_table])
// Print out lots of information about the board.
-STATIC mp_obj_t machine_info(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_info(mp_uint_t n_args, const mp_obj_t *args) {
// to print info about memory
{
printf("_etext=%p\n", &_etext);
@@ -174,14 +174,14 @@ STATIC mp_obj_t machine_info(mp_uint_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info);
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
return mp_const_empty_bytes;
}
// Resets the board in a manner similar to pushing the external RESET button.
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
NVIC_SystemReset();
}
@@ -191,31 +191,31 @@ NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
}
}
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
MICROPY_EVENT_POLL_HOOK;
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
__WFE();
}
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
mp_machine_reset();
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
return reset_cause;
}
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
mp_raise_NotImplementedError(NULL);
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_raise_NotImplementedError(NULL);
}
-STATIC mp_obj_t machine_enable_irq(void) {
+static mp_obj_t machine_enable_irq(void) {
#ifndef BLUETOOTH_SD
__enable_irq();
#else
@@ -226,7 +226,7 @@ STATIC mp_obj_t machine_enable_irq(void) {
MP_DEFINE_CONST_FUN_OBJ_0(machine_enable_irq_obj, machine_enable_irq);
// Resets the board in a manner similar to pushing the external RESET button.
-STATIC mp_obj_t machine_disable_irq(void) {
+static mp_obj_t machine_disable_irq(void) {
#ifndef BLUETOOTH_SD
__disable_irq();
#else
diff --git a/ports/nrf/modules/machine/pin.c b/ports/nrf/modules/machine/pin.c
index 974074fc91..e72a16eee7 100644
--- a/ports/nrf/modules/machine/pin.c
+++ b/ports/nrf/modules/machine/pin.c
@@ -107,7 +107,7 @@ extern const uint8_t machine_pin_num_of_board_pins;
// Pin class variables
#if PIN_DEBUG
-STATIC bool pin_class_debug;
+static bool pin_class_debug;
#else
#define pin_class_debug (0)
#endif
@@ -218,7 +218,7 @@ const pin_obj_t *pin_find(mp_obj_t user_obj) {
/// \method __str__()
/// Return a string describing the pin object.
-STATIC void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pin_obj_t *self = self_in;
char *pull = "PULL_DISABLED";
@@ -239,12 +239,12 @@ STATIC void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
pull);
}
-STATIC mp_obj_t pin_obj_init_helper(const pin_obj_t *pin, mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args);
+static mp_obj_t pin_obj_init_helper(const pin_obj_t *pin, mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args);
/// \classmethod \constructor(id, ...)
/// Create a new Pin object associated with the id. If additional arguments are given,
/// they are used to initialise the pin. See `init`.
-STATIC mp_obj_t pin_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pin_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// Run an argument through the mapper and return the result.
@@ -261,7 +261,7 @@ STATIC mp_obj_t pin_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp_uin
}
// fast method for getting/setting pin value
-STATIC mp_obj_t pin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
pin_obj_t *self = self_in;
if (n_args == 0) {
@@ -274,47 +274,47 @@ STATIC mp_obj_t pin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, con
}
}
-STATIC mp_obj_t pin_off(mp_obj_t self_in) {
+static mp_obj_t pin_off(mp_obj_t self_in) {
pin_obj_t *self = self_in;
mp_hal_pin_low(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_off_obj, pin_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_off_obj, pin_off);
-STATIC mp_obj_t pin_on(mp_obj_t self_in) {
+static mp_obj_t pin_on(mp_obj_t self_in) {
pin_obj_t *self = self_in;
mp_hal_pin_high(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_on_obj, pin_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_on_obj, pin_on);
/// \classmethod mapper([fun])
/// Get or set the pin mapper function.
-STATIC mp_obj_t pin_mapper(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_mapper(mp_uint_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
MP_STATE_PORT(pin_class_mapper) = args[1];
return mp_const_none;
}
return MP_STATE_PORT(pin_class_mapper);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_mapper_fun_obj, 1, 2, pin_mapper);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_mapper_obj, (mp_obj_t)&pin_mapper_fun_obj);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_mapper_fun_obj, 1, 2, pin_mapper);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_mapper_obj, (mp_obj_t)&pin_mapper_fun_obj);
/// \classmethod dict([dict])
/// Get or set the pin mapper dictionary.
-STATIC mp_obj_t pin_map_dict(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_map_dict(mp_uint_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
MP_STATE_PORT(pin_class_map_dict) = args[1];
return mp_const_none;
}
return MP_STATE_PORT(pin_class_map_dict);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_map_dict_fun_obj, 1, 2, pin_map_dict);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_map_dict_obj, (mp_obj_t)&pin_map_dict_fun_obj);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_map_dict_fun_obj, 1, 2, pin_map_dict);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_map_dict_obj, (mp_obj_t)&pin_map_dict_fun_obj);
/// \classmethod af_list()
/// Returns an array of alternate functions available for this pin.
-STATIC mp_obj_t pin_af_list(mp_obj_t self_in) {
+static mp_obj_t pin_af_list(mp_obj_t self_in) {
pin_obj_t *self = self_in;
mp_obj_t result = mp_obj_new_list(0, NULL);
@@ -324,24 +324,24 @@ STATIC mp_obj_t pin_af_list(mp_obj_t self_in) {
}
return result;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_list_obj, pin_af_list);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_list_obj, pin_af_list);
#if PIN_DEBUG
/// \classmethod debug([state])
/// Get or set the debugging state (`True` or `False` for on or off).
-STATIC mp_obj_t pin_debug(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_debug(mp_uint_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
pin_class_debug = mp_obj_is_true(args[1]);
return mp_const_none;
}
return mp_obj_new_bool(pin_class_debug);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_debug_fun_obj, 1, 2, pin_debug);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_debug_obj, (mp_obj_t)&pin_debug_fun_obj);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_debug_fun_obj, 1, 2, pin_debug);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_debug_obj, (mp_obj_t)&pin_debug_fun_obj);
#endif
// init(mode, pull=None, af=-1, *, value, alt)
-STATIC mp_obj_t pin_obj_init_helper(const pin_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pin_obj_init_helper(const pin_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_pull, MP_ARG_OBJ, {.u_obj = mp_const_none}},
@@ -387,7 +387,7 @@ STATIC mp_obj_t pin_obj_init_helper(const pin_obj_t *self, mp_uint_t n_args, con
return mp_const_none;
}
-STATIC mp_obj_t pin_obj_init(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pin_obj_init(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(pin_init_obj, 1, pin_obj_init);
@@ -399,40 +399,40 @@ MP_DEFINE_CONST_FUN_OBJ_KW(pin_init_obj, 1, pin_obj_init);
/// - With `value` given, set the logic level of the pin. `value` can be
/// anything that converts to a boolean. If it converts to `True`, the pin
/// is set high, otherwise it is set low.
-STATIC mp_obj_t pin_value(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_value(mp_uint_t n_args, const mp_obj_t *args) {
return pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_value_obj, 1, 2, pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_value_obj, 1, 2, pin_value);
/// \method low()
/// Set the pin to a low logic level.
-STATIC mp_obj_t pin_low(mp_obj_t self_in) {
+static mp_obj_t pin_low(mp_obj_t self_in) {
pin_obj_t *self = self_in;
mp_hal_pin_low(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_low_obj, pin_low);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_low_obj, pin_low);
/// \method high()
/// Set the pin to a high logic level.
-STATIC mp_obj_t pin_high(mp_obj_t self_in) {
+static mp_obj_t pin_high(mp_obj_t self_in) {
pin_obj_t *self = self_in;
mp_hal_pin_high(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_high_obj, pin_high);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_high_obj, pin_high);
/// \method name()
/// Get the pin name.
-STATIC mp_obj_t pin_name(mp_obj_t self_in) {
+static mp_obj_t pin_name(mp_obj_t self_in) {
pin_obj_t *self = self_in;
return MP_OBJ_NEW_QSTR(self->name);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_name_obj, pin_name);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_name_obj, pin_name);
/// \method names()
/// Returns the cpu and board names for this pin.
-STATIC mp_obj_t pin_names(mp_obj_t self_in) {
+static mp_obj_t pin_names(mp_obj_t self_in) {
pin_obj_t *self = self_in;
mp_obj_t result = mp_obj_new_list(0, NULL);
mp_obj_list_append(result, MP_OBJ_NEW_QSTR(self->name));
@@ -447,53 +447,53 @@ STATIC mp_obj_t pin_names(mp_obj_t self_in) {
}
return result;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_names_obj, pin_names);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_names_obj, pin_names);
/// \method port()
/// Get the pin port.
-STATIC mp_obj_t pin_port(mp_obj_t self_in) {
+static mp_obj_t pin_port(mp_obj_t self_in) {
pin_obj_t *self = self_in;
return MP_OBJ_NEW_SMALL_INT(self->pin / 32);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_port_obj, pin_port);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_port_obj, pin_port);
/// \method pin()
/// Get the pin number.
-STATIC mp_obj_t pin_pin(mp_obj_t self_in) {
+static mp_obj_t pin_pin(mp_obj_t self_in) {
pin_obj_t *self = self_in;
return MP_OBJ_NEW_SMALL_INT(self->pin);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_pin_obj, pin_pin);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_pin_obj, pin_pin);
/// \method mode()
/// Returns the currently configured mode of the pin. The integer returned
/// will match one of the allowed constants for the mode argument to the init
/// function.
-STATIC mp_obj_t pin_mode(mp_obj_t self_in) {
+static mp_obj_t pin_mode(mp_obj_t self_in) {
return mp_const_none; // TODO: MP_OBJ_NEW_SMALL_INT(pin_get_mode(self_in));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_mode_obj, pin_mode);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_mode_obj, pin_mode);
/// \method pull()
/// Returns the currently configured pull of the pin. The integer returned
/// will match one of the allowed constants for the pull argument to the init
/// function.
-STATIC mp_obj_t pin_pull(mp_obj_t self_in) {
+static mp_obj_t pin_pull(mp_obj_t self_in) {
return mp_const_none; // TODO: MP_OBJ_NEW_SMALL_INT(pin_get_pull(self_in));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_pull_obj, pin_pull);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_pull_obj, pin_pull);
/// \method af()
/// Returns the currently configured alternate-function of the pin. The
/// integer returned will match one of the allowed constants for the af
/// argument to the init function.
-STATIC mp_obj_t pin_af(mp_obj_t self_in) {
+static mp_obj_t pin_af(mp_obj_t self_in) {
return mp_const_none; // TODO: MP_OBJ_NEW_SMALL_INT(pin_get_af(self_in));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_obj, pin_af);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_obj, pin_af);
-STATIC void pin_common_irq_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {
+static void pin_common_irq_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {
mp_obj_t pin_handler = MP_STATE_PORT(pin_irq_handlers)[pin];
mp_obj_t pin_number = MP_OBJ_NEW_SMALL_INT(pin);
const pin_obj_t *pin_obj = pin_find(pin_number);
@@ -501,7 +501,7 @@ STATIC void pin_common_irq_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t
mp_call_function_1(pin_handler, (mp_obj_t)pin_obj);
}
-STATIC mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_handler, ARG_trigger, ARG_wake};
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = mp_const_none} },
@@ -536,9 +536,9 @@ STATIC mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
// return the irq object
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pin_irq_obj, 1, pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pin_irq_obj, 1, pin_irq);
-STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pin_value_obj) },
@@ -594,7 +594,7 @@ STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
#include "genhdr/pins_af_const.h"
};
-STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pin_type,
@@ -635,42 +635,42 @@ MP_DEFINE_CONST_OBJ_TYPE(
/// \method __str__()
/// Return a string describing the alternate function.
-STATIC void pin_af_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pin_af_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pin_af_obj_t *self = self_in;
mp_printf(print, "Pin.%q", self->name);
}
/// \method index()
/// Return the alternate function index.
-STATIC mp_obj_t pin_af_index(mp_obj_t self_in) {
+static mp_obj_t pin_af_index(mp_obj_t self_in) {
pin_af_obj_t *af = self_in;
return MP_OBJ_NEW_SMALL_INT(af->idx);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_index_obj, pin_af_index);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_index_obj, pin_af_index);
/// \method name()
/// Return the name of the alternate function.
-STATIC mp_obj_t pin_af_name(mp_obj_t self_in) {
+static mp_obj_t pin_af_name(mp_obj_t self_in) {
pin_af_obj_t *af = self_in;
return MP_OBJ_NEW_QSTR(af->name);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_name_obj, pin_af_name);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_name_obj, pin_af_name);
/// \method reg()
/// Return the base register associated with the peripheral assigned to this
/// alternate function.
-STATIC mp_obj_t pin_af_reg(mp_obj_t self_in) {
+static mp_obj_t pin_af_reg(mp_obj_t self_in) {
pin_af_obj_t *af = self_in;
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)af->reg);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_reg_obj, pin_af_reg);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_reg_obj, pin_af_reg);
-STATIC const mp_rom_map_elem_t pin_af_locals_dict_table[] = {
+static const mp_rom_map_elem_t pin_af_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&pin_af_index_obj) },
{ MP_ROM_QSTR(MP_QSTR_name), MP_ROM_PTR(&pin_af_name_obj) },
{ MP_ROM_QSTR(MP_QSTR_reg), MP_ROM_PTR(&pin_af_reg_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pin_af_locals_dict, pin_af_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pin_af_locals_dict, pin_af_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pin_af_type,
diff --git a/ports/nrf/modules/machine/pwm.c b/ports/nrf/modules/machine/pwm.c
index f0c11fa8fc..393d106179 100644
--- a/ports/nrf/modules/machine/pwm.c
+++ b/ports/nrf/modules/machine/pwm.c
@@ -81,7 +81,7 @@ typedef struct _machine_pwm_obj_t {
uint8_t channel;
} machine_pwm_obj_t;
-STATIC const nrfx_pwm_t machine_hard_pwm_instances[] = {
+static const nrfx_pwm_t machine_hard_pwm_instances[] = {
#if defined(NRF52_SERIES)
NRFX_PWM_INSTANCE(0),
NRFX_PWM_INSTANCE(1),
@@ -92,9 +92,9 @@ STATIC const nrfx_pwm_t machine_hard_pwm_instances[] = {
#endif
};
-STATIC machine_pwm_config_t hard_configs[MP_ARRAY_SIZE(machine_hard_pwm_instances)];
+static machine_pwm_config_t hard_configs[MP_ARRAY_SIZE(machine_hard_pwm_instances)];
-STATIC const machine_pwm_obj_t machine_hard_pwm_obj[] = {
+static const machine_pwm_obj_t machine_hard_pwm_obj[] = {
#if defined(NRF52_SERIES)
{{&machine_pwm_type}, .p_pwm = &machine_hard_pwm_instances[0], .p_config = &hard_configs[0], 0, 0},
{{&machine_pwm_type}, .p_pwm = &machine_hard_pwm_instances[0], .p_config = &hard_configs[0], 0, 1},
@@ -127,7 +127,7 @@ void pwm_init0(void) {
}
// Find a free PWM object
-STATIC int hard_pwm_find() {
+static int hard_pwm_find() {
// look for a free module.
for (int j = 0; j < MP_ARRAY_SIZE(hard_configs); j++) {
if (hard_configs[j].active == FREE) {
@@ -137,7 +137,7 @@ STATIC int hard_pwm_find() {
mp_raise_ValueError(MP_ERROR_TEXT("all PWM devices in use"));
}
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = self_in;
static char *duty_suffix[] = { "", "", "_u16", "_ns" };
mp_printf(print, "<PWM: Pin=%u freq=%dHz duty%s=%d invert=%d id=%u channel=%u>",
@@ -149,7 +149,7 @@ STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_p
/******************************************************************************/
/* MicroPython bindings for machine API */
-STATIC void machine_hard_pwm_start(const machine_pwm_obj_t *self);
+static void machine_hard_pwm_start(const machine_pwm_obj_t *self);
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_pin, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -162,7 +162,7 @@ static const mp_arg_t allowed_args[] = {
{ MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
};
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_pin, ARG_freq, ARG_duty, ARG_duty_u16, ARG_duty_ns, ARG_invert, ARG_device, ARG_channel };
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
@@ -190,7 +190,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, c
}
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_pin, ARG_freq, ARG_duty, ARG_duty_u16, ARG_duty_ns, ARG_invert, ARG_device, ARG_channel };
// parse args
@@ -250,17 +250,17 @@ void pwm_deinit_all(void) {
}
// Stop the PWM module, but do not release it.
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
self->p_config->active = STOPPED;
nrfx_pwm_stop(self->p_pwm, true);
nrfx_pwm_uninit(self->p_pwm);
}
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT(self->p_config->freq);
}
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
uint8_t div = 0;
if (freq > (PWM_MAX_BASE_FREQ / 3) || freq <= (PWM_MIN_BASE_FREQ / PWM_MAX_PERIOD)) {
@@ -276,7 +276,7 @@ STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
machine_hard_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
if (self->p_config->duty_mode[self->channel] == DUTY_PERCENT) {
return MP_OBJ_NEW_SMALL_INT(self->p_config->duty[self->channel]);
} else if (self->p_config->duty_mode[self->channel] == DUTY_U16) {
@@ -286,13 +286,13 @@ STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
self->p_config->duty[self->channel] = duty;
self->p_config->duty_mode[self->channel] = DUTY_PERCENT;
machine_hard_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
if (self->p_config->duty_mode[self->channel] == DUTY_U16) {
return MP_OBJ_NEW_SMALL_INT(self->p_config->duty[self->channel]);
} else if (self->p_config->duty_mode[self->channel] == DUTY_PERCENT) {
@@ -302,13 +302,13 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty) {
self->p_config->duty[self->channel] = duty;
self->p_config->duty_mode[self->channel] = DUTY_U16;
machine_hard_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
if (self->p_config->duty_mode[self->channel] == DUTY_NS) {
return MP_OBJ_NEW_SMALL_INT(self->p_config->duty[self->channel]);
} else {
@@ -316,7 +316,7 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
self->p_config->duty[self->channel] = duty;
self->p_config->duty_mode[self->channel] = DUTY_NS;
machine_hard_pwm_start(self);
@@ -324,7 +324,7 @@ STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
/* code for hard implementation ***********************************************/
-STATIC void machine_hard_pwm_start(const machine_pwm_obj_t *self) {
+static void machine_hard_pwm_start(const machine_pwm_obj_t *self) {
nrfx_pwm_config_t config;
diff --git a/ports/nrf/modules/machine/rtcounter.c b/ports/nrf/modules/machine/rtcounter.c
index d52ca3e9a3..d85db9b9b7 100644
--- a/ports/nrf/modules/machine/rtcounter.c
+++ b/ports/nrf/modules/machine/rtcounter.c
@@ -55,7 +55,7 @@ typedef struct _machine_rtc_obj_t {
machine_rtc_config_t * config; // pointer to volatile part
} machine_rtc_obj_t;
-STATIC const nrfx_rtc_t machine_rtc_instances[] = {
+static const nrfx_rtc_t machine_rtc_instances[] = {
NRFX_RTC_INSTANCE(0),
NRFX_RTC_INSTANCE(1),
#if defined(NRF52_SERIES)
@@ -63,15 +63,15 @@ STATIC const nrfx_rtc_t machine_rtc_instances[] = {
#endif
};
-STATIC machine_rtc_config_t configs[MP_ARRAY_SIZE(machine_rtc_instances)];
+static machine_rtc_config_t configs[MP_ARRAY_SIZE(machine_rtc_instances)];
-STATIC void interrupt_handler0(nrfx_rtc_int_type_t int_type);
-STATIC void interrupt_handler1(nrfx_rtc_int_type_t int_type);
+static void interrupt_handler0(nrfx_rtc_int_type_t int_type);
+static void interrupt_handler1(nrfx_rtc_int_type_t int_type);
#if defined(NRF52_SERIES)
-STATIC void interrupt_handler2(nrfx_rtc_int_type_t int_type);
+static void interrupt_handler2(nrfx_rtc_int_type_t int_type);
#endif
-STATIC const machine_rtc_obj_t machine_rtc_obj[] = {
+static const machine_rtc_obj_t machine_rtc_obj[] = {
{{&machine_rtcounter_type}, .p_rtc = &machine_rtc_instances[0], .handler=interrupt_handler0, .config=&configs[0]},
{{&machine_rtcounter_type}, .p_rtc = &machine_rtc_instances[1], .handler=interrupt_handler1, .config=&configs[1]},
#if defined(NRF52_SERIES)
@@ -79,7 +79,7 @@ STATIC const machine_rtc_obj_t machine_rtc_obj[] = {
#endif
};
-STATIC void interrupt_handler(size_t instance_id) {
+static void interrupt_handler(size_t instance_id) {
const machine_rtc_obj_t * self = &machine_rtc_obj[instance_id];
machine_rtc_config_t *config = self->config;
if (config->callback != NULL) {
@@ -93,16 +93,16 @@ STATIC void interrupt_handler(size_t instance_id) {
}
}
-STATIC void interrupt_handler0(nrfx_rtc_int_type_t int_type) {
+static void interrupt_handler0(nrfx_rtc_int_type_t int_type) {
interrupt_handler(0);
}
-STATIC void interrupt_handler1(nrfx_rtc_int_type_t int_type) {
+static void interrupt_handler1(nrfx_rtc_int_type_t int_type) {
interrupt_handler(1);
}
#if defined(NRF52_SERIES)
-STATIC void interrupt_handler2(nrfx_rtc_int_type_t int_type) {
+static void interrupt_handler2(nrfx_rtc_int_type_t int_type) {
interrupt_handler(2);
}
#endif
@@ -110,7 +110,7 @@ STATIC void interrupt_handler2(nrfx_rtc_int_type_t int_type) {
void rtc_init0(void) {
}
-STATIC int rtc_find(mp_obj_t id) {
+static int rtc_find(mp_obj_t id) {
// given an integer id
int rtc_id = mp_obj_get_int(id);
if (rtc_id >= 0 && rtc_id < MP_ARRAY_SIZE(machine_rtc_obj)) {
@@ -119,7 +119,7 @@ STATIC int rtc_find(mp_obj_t id) {
mp_raise_ValueError(MP_ERROR_TEXT("RTCounter doesn't exist"));
}
-STATIC void rtc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void rtc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_rtc_obj_t *self = self_in;
mp_printf(print, "RTCounter(%u)", self->p_rtc->instance_id);
}
@@ -138,7 +138,7 @@ const nrfx_rtc_config_t machine_rtc_config = {
#endif
};
-STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_id, ARG_period, ARG_mode, ARG_callback };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)} },
@@ -201,54 +201,54 @@ STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, s
/// Start the RTCounter. Timeout occurs after number of periods
/// in the configured frequency has been reached.
///
-STATIC mp_obj_t machine_rtc_start(mp_obj_t self_in) {
+static mp_obj_t machine_rtc_start(mp_obj_t self_in) {
machine_rtc_obj_t * self = MP_OBJ_TO_PTR(self_in);
nrfx_rtc_enable(self->p_rtc);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_start_obj, machine_rtc_start);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_start_obj, machine_rtc_start);
/// \method stop()
/// Stop the RTCounter.
///
-STATIC mp_obj_t machine_rtc_stop(mp_obj_t self_in) {
+static mp_obj_t machine_rtc_stop(mp_obj_t self_in) {
machine_rtc_obj_t * self = MP_OBJ_TO_PTR(self_in);
nrfx_rtc_disable(self->p_rtc);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_stop_obj, machine_rtc_stop);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_stop_obj, machine_rtc_stop);
/// \method counter()
/// Return the current counter value. Wraps around after about 24 days
/// with the current prescaler (2^24 / 8 = 2097152 seconds).
///
-STATIC mp_obj_t machine_rtc_counter(mp_obj_t self_in) {
+static mp_obj_t machine_rtc_counter(mp_obj_t self_in) {
machine_rtc_obj_t * self = MP_OBJ_TO_PTR(self_in);
uint32_t counter = nrfx_rtc_counter_get(self->p_rtc);
return MP_OBJ_NEW_SMALL_INT(counter);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_counter_obj, machine_rtc_counter);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_counter_obj, machine_rtc_counter);
/// \method deinit()
/// Free resources associated with this RTC.
///
-STATIC mp_obj_t machine_rtc_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_rtc_deinit(mp_obj_t self_in) {
machine_rtc_obj_t * self = MP_OBJ_TO_PTR(self_in);
nrfx_rtc_uninit(self->p_rtc);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_deinit_obj, machine_rtc_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_deinit_obj, machine_rtc_deinit);
-STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_start), MP_ROM_PTR(&machine_rtc_start_obj) },
{ MP_ROM_QSTR(MP_QSTR_stop), MP_ROM_PTR(&machine_rtc_stop_obj) },
{ MP_ROM_QSTR(MP_QSTR_counter), MP_ROM_PTR(&machine_rtc_counter_obj) },
@@ -260,7 +260,7 @@ STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_FREQUENCY), MP_ROM_INT(RTC_FREQUENCY) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_rtcounter_type,
diff --git a/ports/nrf/modules/machine/soft_pwm.c b/ports/nrf/modules/machine/soft_pwm.c
index c69b5f0bbe..c61e1f86ba 100644
--- a/ports/nrf/modules/machine/soft_pwm.c
+++ b/ports/nrf/modules/machine/soft_pwm.c
@@ -49,7 +49,7 @@ typedef struct _machine_pwm_obj_t {
#define SOFT_PWM_BASE_FREQ (1000000)
#define DUTY_FULL_SCALE (1024)
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = self_in;
static char *duty_suffix[] = { "", "", "_u16", "_ns" };
mp_printf(print, "<PWM: Pin=%u freq=%dHz duty%s=%d>",
@@ -59,9 +59,9 @@ STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_p
// MicroPython bindings for machine API
-STATIC void machine_soft_pwm_start(machine_pwm_obj_t *self);
+static void machine_soft_pwm_start(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq, ARG_duty, ARG_duty_u16, ARG_duty_ns };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_freq, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
@@ -91,7 +91,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, c
machine_soft_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
enum { ARG_pin, ARG_freq, ARG_duty, ARG_duty_u16, ARG_duty_ns, ARG_id };
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -117,15 +117,15 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
pwm_release(self->pwm_pin);
}
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT(self->freq);
}
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
if (freq > (SOFT_PWM_BASE_FREQ / 256)) {
mp_raise_ValueError(MP_ERROR_TEXT("frequency out of range"));
@@ -134,7 +134,7 @@ STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
machine_soft_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
if (self->duty_mode) {
return MP_OBJ_NEW_SMALL_INT(self->duty);
} else if (self->duty_mode == DUTY_U16) {
@@ -144,13 +144,13 @@ STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
self->duty = duty;
self->duty_mode = DUTY;
machine_soft_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
if (self->duty_mode == DUTY_U16) {
return MP_OBJ_NEW_SMALL_INT(self->duty);
} else if (self->duty_mode == DUTY) {
@@ -160,13 +160,13 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty) {
self->duty = duty;
self->duty_mode = DUTY_U16;
machine_soft_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
if (self->duty_mode == DUTY_NS) {
return MP_OBJ_NEW_SMALL_INT(self->duty);
} else {
@@ -174,7 +174,7 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
self->duty = duty;
self->duty_mode = DUTY_NS;
machine_soft_pwm_start(self);
@@ -182,7 +182,7 @@ STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty) {
/* Interface for the implementation */
-STATIC void machine_soft_pwm_start(machine_pwm_obj_t *self) {
+static void machine_soft_pwm_start(machine_pwm_obj_t *self) {
// check if ready to go
if (self->defer_start == true || self->freq == 0 || self->duty_mode == DUTY_NOT_SET) {
diff --git a/ports/nrf/modules/machine/spi.c b/ports/nrf/modules/machine/spi.c
index cb09a23491..4baee39d01 100644
--- a/ports/nrf/modules/machine/spi.c
+++ b/ports/nrf/modules/machine/spi.c
@@ -103,7 +103,7 @@ typedef struct _machine_hard_spi_obj_t {
nrfx_spi_config_t * p_config; // pointer to volatile part
} machine_hard_spi_obj_t;
-STATIC const nrfx_spi_t machine_spi_instances[] = {
+static const nrfx_spi_t machine_spi_instances[] = {
NRFX_SPI_INSTANCE(0),
NRFX_SPI_INSTANCE(1),
#if defined(NRF52_SERIES)
@@ -114,9 +114,9 @@ STATIC const nrfx_spi_t machine_spi_instances[] = {
#endif // NRF52_SERIES
};
-STATIC nrfx_spi_config_t configs[MP_ARRAY_SIZE(machine_spi_instances)];
+static nrfx_spi_config_t configs[MP_ARRAY_SIZE(machine_spi_instances)];
-STATIC const machine_hard_spi_obj_t machine_hard_spi_obj[] = {
+static const machine_hard_spi_obj_t machine_hard_spi_obj[] = {
{{&machine_spi_type}, .p_spi = &machine_spi_instances[0], .p_config = &configs[0]},
{{&machine_spi_type}, .p_spi = &machine_spi_instances[1], .p_config = &configs[1]},
#if defined(NRF52_SERIES)
@@ -130,7 +130,7 @@ STATIC const machine_hard_spi_obj_t machine_hard_spi_obj[] = {
void spi_init0(void) {
}
-STATIC int spi_find(mp_obj_t id) {
+static int spi_find(mp_obj_t id) {
if (mp_obj_is_str(id)) {
// given a string id
const char *port = mp_obj_str_get_str(id);
@@ -187,14 +187,14 @@ enum {
ARG_INIT_firstbit
};
-STATIC void machine_hard_spi_init_helper(const machine_hard_spi_obj_t *self, mp_arg_val_t *args);
+static void machine_hard_spi_init_helper(const machine_hard_spi_obj_t *self, mp_arg_val_t *args);
-STATIC void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_spi_obj_t *self = self_in;
mp_printf(print, "SPI(%u)", self->p_spi->drv_inst_idx);
}
-STATIC mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)} },
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 1000000} },
@@ -243,7 +243,7 @@ STATIC mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
-STATIC void machine_hard_spi_init_helper(const machine_hard_spi_obj_t *self, mp_arg_val_t *args) {
+static void machine_hard_spi_init_helper(const machine_hard_spi_obj_t *self, mp_arg_val_t *args) {
int baudrate = args[ARG_INIT_baudrate].u_int;
if (baudrate <= 125000) {
@@ -304,7 +304,7 @@ STATIC void machine_hard_spi_init_helper(const machine_hard_spi_obj_t *self, mp_
}
}
-STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1000000} },
{ MP_QSTR_polarity, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -321,17 +321,17 @@ STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const m
machine_hard_spi_init_helper(self, args);
}
-STATIC void machine_hard_spi_deinit(mp_obj_base_t *self_in) {
+static void machine_hard_spi_deinit(mp_obj_base_t *self_in) {
const machine_hard_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
nrfx_spi_uninit(self->p_spi);
}
-STATIC void machine_hard_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_hard_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
const machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t*)self_in;
spi_transfer(self, len, src, dest);
}
-STATIC const mp_machine_spi_p_t machine_hard_spi_p = {
+static const mp_machine_spi_p_t machine_hard_spi_p = {
.init = machine_hard_spi_init,
.deinit = machine_hard_spi_deinit,
.transfer = machine_hard_spi_transfer,
diff --git a/ports/nrf/modules/machine/temp.c b/ports/nrf/modules/machine/temp.c
index dff15a9d14..0d206fee47 100644
--- a/ports/nrf/modules/machine/temp.c
+++ b/ports/nrf/modules/machine/temp.c
@@ -50,7 +50,7 @@ typedef struct _machine_temp_obj_t {
/// \method __str__()
/// Return a string describing the Temp object.
-STATIC void machine_temp_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void machine_temp_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
machine_temp_obj_t *self = o;
(void)self;
@@ -61,7 +61,7 @@ STATIC void machine_temp_print(const mp_print_t *print, mp_obj_t o, mp_print_kin
/******************************************************************************/
/* MicroPython bindings for machine API */
-STATIC mp_obj_t machine_temp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t machine_temp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
static const mp_arg_t allowed_args[] = {
{ },
};
@@ -89,7 +89,7 @@ int32_t temp_read(void) {
/// \method read()
/// Get temperature.
-STATIC mp_obj_t machine_temp_read(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_temp_read(mp_uint_t n_args, const mp_obj_t *args) {
#if BLUETOOTH_SD
if (BLUETOOTH_STACK_ENABLED() == 1) {
@@ -102,15 +102,15 @@ STATIC mp_obj_t machine_temp_read(mp_uint_t n_args, const mp_obj_t *args) {
return MP_OBJ_NEW_SMALL_INT(temp_read());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_machine_temp_read_obj, 0, 1, machine_temp_read);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_machine_temp_read_obj, 0, 1, machine_temp_read);
-STATIC const mp_rom_map_elem_t machine_temp_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_temp_locals_dict_table[] = {
// instance methods
// class methods
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_machine_temp_read_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_temp_locals_dict, machine_temp_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_temp_locals_dict, machine_temp_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_temp_type,
diff --git a/ports/nrf/modules/machine/timer.c b/ports/nrf/modules/machine/timer.c
index db9f04c2fa..3c2a039b84 100644
--- a/ports/nrf/modules/machine/timer.c
+++ b/ports/nrf/modules/machine/timer.c
@@ -41,7 +41,7 @@ typedef struct _machine_timer_obj_t {
nrfx_timer_t p_instance;
} machine_timer_obj_t;
-STATIC mp_obj_t machine_timer_callbacks[] = {
+static mp_obj_t machine_timer_callbacks[] = {
NULL,
NULL,
NULL,
@@ -51,7 +51,7 @@ STATIC mp_obj_t machine_timer_callbacks[] = {
#endif
};
-STATIC const machine_timer_obj_t machine_timer_obj[] = {
+static const machine_timer_obj_t machine_timer_obj[] = {
{{&machine_timer_type}, NRFX_TIMER_INSTANCE(0)},
#if MICROPY_PY_MACHINE_SOFT_PWM
{ },
@@ -71,7 +71,7 @@ void timer_init0(void) {
}
}
-STATIC int timer_find(mp_obj_t id) {
+static int timer_find(mp_obj_t id) {
// given an integer id
int timer_id = mp_obj_get_int(id);
if (timer_id >= 0 && timer_id < MP_ARRAY_SIZE(machine_timer_obj)) {
@@ -80,12 +80,12 @@ STATIC int timer_find(mp_obj_t id) {
mp_raise_ValueError(MP_ERROR_TEXT("Timer doesn't exist"));
}
-STATIC void timer_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void timer_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
machine_timer_obj_t *self = o;
mp_printf(print, "Timer(%u)", self->p_instance.instance_id);
}
-STATIC void timer_event_handler(nrf_timer_event_t event_type, void *p_context) {
+static void timer_event_handler(nrf_timer_event_t event_type, void *p_context) {
machine_timer_obj_t *self = p_context;
mp_obj_t callback = machine_timer_callbacks[self->p_instance.instance_id];
if (callback != NULL) {
@@ -96,7 +96,7 @@ STATIC void timer_event_handler(nrf_timer_event_t event_type, void *p_context) {
/******************************************************************************/
/* MicroPython bindings for machine API */
-STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_id, ARG_period, ARG_mode, ARG_callback };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)} },
@@ -175,52 +175,52 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
/// \method period()
/// Return counter value, which is currently in us.
///
-STATIC mp_obj_t machine_timer_period(mp_obj_t self_in) {
+static mp_obj_t machine_timer_period(mp_obj_t self_in) {
machine_timer_obj_t * self = MP_OBJ_TO_PTR(self_in);
uint32_t period = nrfx_timer_capture(&self->p_instance, NRF_TIMER_CC_CHANNEL1);
return MP_OBJ_NEW_SMALL_INT(period);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_period_obj, machine_timer_period);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_period_obj, machine_timer_period);
/// \method start()
/// Start the timer.
///
-STATIC mp_obj_t machine_timer_start(mp_obj_t self_in) {
+static mp_obj_t machine_timer_start(mp_obj_t self_in) {
machine_timer_obj_t * self = MP_OBJ_TO_PTR(self_in);
nrfx_timer_enable(&self->p_instance);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_start_obj, machine_timer_start);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_start_obj, machine_timer_start);
/// \method stop()
/// Stop the timer.
///
-STATIC mp_obj_t machine_timer_stop(mp_obj_t self_in) {
+static mp_obj_t machine_timer_stop(mp_obj_t self_in) {
machine_timer_obj_t * self = MP_OBJ_TO_PTR(self_in);
nrfx_timer_disable(&self->p_instance);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_stop_obj, machine_timer_stop);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_stop_obj, machine_timer_stop);
/// \method deinit()
/// Free resources associated with the timer.
///
-STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
machine_timer_obj_t * self = MP_OBJ_TO_PTR(self_in);
nrfx_timer_uninit(&self->p_instance);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
-STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&machine_timer_period_obj) }, // alias
{ MP_ROM_QSTR(MP_QSTR_period), MP_ROM_PTR(&machine_timer_period_obj) },
{ MP_ROM_QSTR(MP_QSTR_start), MP_ROM_PTR(&machine_timer_start_obj) },
@@ -232,7 +232,7 @@ STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(TIMER_MODE_PERIODIC) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
diff --git a/ports/nrf/modules/machine/uart.c b/ports/nrf/modules/machine/uart.c
index e0b56e8310..6da797df1f 100644
--- a/ports/nrf/modules/machine/uart.c
+++ b/ports/nrf/modules/machine/uart.c
@@ -97,14 +97,14 @@ typedef struct _machine_uart_obj_t {
static const nrfx_uart_t instance0 = NRFX_UART_INSTANCE(0);
-STATIC machine_uart_obj_t machine_uart_obj[] = {
+static machine_uart_obj_t machine_uart_obj[] = {
{{&machine_uart_type}, .p_uart = &instance0}
};
void uart_init0(void) {
}
-STATIC int uart_find(mp_obj_t id) {
+static int uart_find(mp_obj_t id) {
// given an integer id
int uart_id = mp_obj_get_int(id);
if (uart_id >= 0 && uart_id < MP_ARRAY_SIZE(machine_uart_obj)) {
@@ -113,7 +113,7 @@ STATIC int uart_find(mp_obj_t id) {
mp_raise_ValueError(MP_ERROR_TEXT("UART doesn't exist"));
}
-STATIC void uart_event_handler(nrfx_uart_event_t const *p_event, void *p_context) {
+static void uart_event_handler(nrfx_uart_event_t const *p_event, void *p_context) {
machine_uart_obj_t *self = p_context;
if (p_event->type == NRFX_UART_EVT_RX_DONE) {
nrfx_uart_rx(self->p_uart, &self->buf.rx_buf[0], 1);
@@ -142,7 +142,7 @@ int uart_rx_char(machine_uart_obj_t *self) {
return ringbuf_get((ringbuf_t *)&self->buf.rx_ringbuf);
}
-STATIC nrfx_err_t uart_tx_char(machine_uart_obj_t *self, int c) {
+static nrfx_err_t uart_tx_char(machine_uart_obj_t *self, int c) {
while (nrfx_uart_tx_in_progress(self->p_uart)) {
;
}
@@ -172,11 +172,11 @@ void uart_tx_strn_cooked(machine_uart_obj_t *uart_obj, const char *str, uint len
// The UART class doesn't have any constants for this port.
#define MICROPY_PY_MACHINE_UART_CLASS_CONSTANTS
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_printf(print, "UART(0)");
}
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// Parse args (none supported at this stage).
mp_arg_parse_all(n_args, pos_args, kw_args, 0, NULL, NULL);
}
@@ -186,7 +186,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
// Initialise the UART bus with the given parameters:
// - `id`is bus id.
// - `baudrate` is the clock rate.
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_id, ARG_baudrate, ARG_timeout, ARG_timeout_char };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_OBJ },
@@ -266,12 +266,12 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
(void)self;
}
// Write a single character on the bus. `data` is an integer to write.
-STATIC void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
+static void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
nrfx_err_t err = uart_tx_char(self, data);
if (err != NRFX_SUCCESS) {
mp_hal_raise(err);
@@ -280,21 +280,21 @@ STATIC void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
// Receive a single character on the bus.
// Return value: The character read, as an integer. Returns -1 on timeout.
-STATIC mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
return uart_rx_char(self);
}
// uart.any()
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
return ringbuf_avail((ringbuf_t *)&self->buf.rx_ringbuf);
}
// uart.txdone()
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
return !nrfx_uart_tx_in_progress(self->p_uart);
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = self_in;
byte *buf = buf_in;
uint32_t t = self->timeout + mp_hal_ticks_ms();
@@ -319,7 +319,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
return size;
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = self_in;
nrfx_err_t err = nrfx_uart_tx(self->p_uart, buf_in, size);
@@ -335,7 +335,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
}
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = self_in;
(void)self;
mp_uint_t ret = 0;
diff --git a/ports/nrf/modules/music/modmusic.c b/ports/nrf/modules/music/modmusic.c
index a0ae7f7c8e..2c63497565 100644
--- a/ports/nrf/modules/music/modmusic.c
+++ b/ports/nrf/modules/music/modmusic.c
@@ -74,7 +74,7 @@ enum {
extern volatile uint32_t ticks;
-STATIC uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_t *pin);
+static uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_t *pin);
void microbit_music_init0(void) {
ticker_register_low_pri_callback(microbit_music_tick);
@@ -136,7 +136,7 @@ void microbit_music_tick(void) {
}
}
-STATIC void wait_async_music_idle(void) {
+static void wait_async_music_idle(void) {
// wait for the async music state to become idle
while (music_data->async_state != ASYNC_MUSIC_STATE_IDLE) {
// allow CTRL-C to stop the music
@@ -148,7 +148,7 @@ STATIC void wait_async_music_idle(void) {
}
}
-STATIC uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_t *pin) {
+static uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_t *pin) {
pwm_set_duty_cycle(pin->pin, 128); // TODO: remove pin setting.
// [NOTE](#|b)(octave)(:length)
@@ -157,9 +157,9 @@ STATIC uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_
// array of us periods
// these are the periods of note4 (the octave ascending from middle c) from A->B then C->G
- STATIC uint16_t periods_us[] = {2273, 2025, 3822, 3405, 3034, 2863, 2551};
+ static uint16_t periods_us[] = {2273, 2025, 3822, 3405, 3034, 2863, 2551};
// A#, -, C#, D#, -, F#, G#
- STATIC uint16_t periods_sharps_us[] = {2145, 0, 3608, 3214, 0, 2703, 2408};
+ static uint16_t periods_sharps_us[] = {2145, 0, 3608, 3214, 0, 2703, 2408};
// we'll represent the note as an integer (A=0, G=6)
// TODO: validate the note
@@ -258,7 +258,7 @@ STATIC uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_
return gap_ms;
}
-STATIC mp_obj_t microbit_music_reset(void) {
+static mp_obj_t microbit_music_reset(void) {
music_data->bpm = DEFAULT_BPM;
music_data->ticks = DEFAULT_TICKS;
music_data->last_octave = DEFAULT_OCTAVE;
@@ -268,7 +268,7 @@ STATIC mp_obj_t microbit_music_reset(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(microbit_music_reset_obj, microbit_music_reset);
-STATIC mp_obj_t microbit_music_get_tempo(void) {
+static mp_obj_t microbit_music_get_tempo(void) {
mp_obj_t tempo_tuple[2];
tempo_tuple[0] = mp_obj_new_int(music_data->bpm);
@@ -278,7 +278,7 @@ STATIC mp_obj_t microbit_music_get_tempo(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(microbit_music_get_tempo_obj, microbit_music_get_tempo);
-STATIC mp_obj_t microbit_music_stop(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t microbit_music_stop(mp_uint_t n_args, const mp_obj_t *args) {
const pin_obj_t *pin;
if (n_args == 0) {
#ifdef MICROPY_HW_MUSIC_PIN
@@ -301,7 +301,7 @@ STATIC mp_obj_t microbit_music_stop(mp_uint_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(microbit_music_stop_obj, 0, 1, microbit_music_stop);
-STATIC mp_obj_t microbit_music_play(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t microbit_music_play(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_music, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_pin, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -370,7 +370,7 @@ STATIC mp_obj_t microbit_music_play(mp_uint_t n_args, const mp_obj_t *pos_args,
}
MP_DEFINE_CONST_FUN_OBJ_KW(microbit_music_play_obj, 0, microbit_music_play);
-STATIC mp_obj_t microbit_music_pitch(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t microbit_music_pitch(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_frequency, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_duration, MP_ARG_INT, {.u_int = -1} },
@@ -433,7 +433,7 @@ STATIC mp_obj_t microbit_music_pitch(mp_uint_t n_args, const mp_obj_t *pos_args,
}
MP_DEFINE_CONST_FUN_OBJ_KW(microbit_music_pitch_obj, 0, microbit_music_pitch);
-STATIC mp_obj_t microbit_music_set_tempo(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t microbit_music_set_tempo(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_ticks, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_bpm, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -469,7 +469,7 @@ static mp_obj_t music_init(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(music___init___obj, music_init);
-STATIC const mp_rom_map_elem_t microbit_music_locals_dict_table[] = {
+static const mp_rom_map_elem_t microbit_music_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&music___init___obj) },
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&microbit_music_reset_obj) },
@@ -502,7 +502,7 @@ STATIC const mp_rom_map_elem_t microbit_music_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_POWER_DOWN), MP_ROM_PTR(&microbit_music_tune_power_down_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(microbit_music_locals_dict, microbit_music_locals_dict_table);
+static MP_DEFINE_CONST_DICT(microbit_music_locals_dict, microbit_music_locals_dict_table);
const mp_obj_module_t music_module = {
.base = { &mp_type_module },
diff --git a/ports/nrf/modules/nrf/flashbdev.c b/ports/nrf/modules/nrf/flashbdev.c
index e92919cac5..e490dc53dd 100644
--- a/ports/nrf/modules/nrf/flashbdev.c
+++ b/ports/nrf/modules/nrf/flashbdev.c
@@ -74,7 +74,7 @@ mp_obj_t nrf_flashbdev_readblocks(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_NEW_SMALL_INT(0);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(nrf_flashbdev_readblocks_obj, 3, 4, nrf_flashbdev_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(nrf_flashbdev_readblocks_obj, 3, 4, nrf_flashbdev_readblocks);
mp_obj_t nrf_flashbdev_writeblocks(size_t n_args, const mp_obj_t *args) {
nrf_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
@@ -95,7 +95,7 @@ mp_obj_t nrf_flashbdev_writeblocks(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_NEW_SMALL_INT(0);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(nrf_flashbdev_writeblocks_obj, 3, 4, nrf_flashbdev_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(nrf_flashbdev_writeblocks_obj, 3, 4, nrf_flashbdev_writeblocks);
mp_obj_t nrf_flashbdev_ioctl(mp_obj_t self_in, mp_obj_t op_in, mp_obj_t arg_in) {
nrf_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -137,21 +137,21 @@ mp_obj_t nrf_flashbdev_ioctl(mp_obj_t self_in, mp_obj_t op_in, mp_obj_t arg_in)
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(nrf_flashbdev_ioctl_obj, nrf_flashbdev_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(nrf_flashbdev_ioctl_obj, nrf_flashbdev_ioctl);
-STATIC const mp_rom_map_elem_t nrf_flashbdev_locals_dict_table[] = {
+static const mp_rom_map_elem_t nrf_flashbdev_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&nrf_flashbdev_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&nrf_flashbdev_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&nrf_flashbdev_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(nrf_flashbdev_locals_dict, nrf_flashbdev_locals_dict_table);
+static MP_DEFINE_CONST_DICT(nrf_flashbdev_locals_dict, nrf_flashbdev_locals_dict_table);
-STATIC void nrf_flashbdev_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void nrf_flashbdev_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
nrf_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "Flash(start=0x%08x, len=%u)", self->start, self->len);
}
-STATIC mp_obj_t nrf_flashbdev_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t nrf_flashbdev_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Parse arguments
enum { ARG_start, ARG_len };
static const mp_arg_t allowed_args[] = {
diff --git a/ports/nrf/modules/nrf/modnrf.c b/ports/nrf/modules/nrf/modnrf.c
index 6533fa121e..ce75635c76 100644
--- a/ports/nrf/modules/nrf/modnrf.c
+++ b/ports/nrf/modules/nrf/modnrf.c
@@ -45,7 +45,7 @@ extern uint32_t _unused_flash_start;
extern uint32_t _unused_flash_len;
#if NRF_POWER_HAS_DCDCEN
-STATIC mp_obj_t dcdc(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t dcdc(size_t n_args, const mp_obj_t *args) {
if (n_args > 0) {
bool dcdc_state = mp_obj_is_true(args[0]);
#if BLUETOOTH_SD
@@ -59,14 +59,14 @@ STATIC mp_obj_t dcdc(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_bool(nrf_power_dcdcen_get(NRF_POWER));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dcdc_obj, 0, 1, dcdc);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dcdc_obj, 0, 1, dcdc);
#endif
#if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
mp_obj_t nrf_modnrf_freeflash_start_aligned(void) {
return mp_obj_new_int_from_uint(FLASH_PAGE_ALIGN_UP((uint32_t)&_unused_flash_start));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(nrf_modnrf_freeflash_start_aligned_obj, nrf_modnrf_freeflash_start_aligned);
+static MP_DEFINE_CONST_FUN_OBJ_0(nrf_modnrf_freeflash_start_aligned_obj, nrf_modnrf_freeflash_start_aligned);
mp_obj_t nrf_modnrf_freeflash_length_aligned(void) {
uint32_t align_diff = FLASH_PAGE_ALIGN_UP((uint32_t)&_unused_flash_start) - ((uint32_t)&_unused_flash_start);
@@ -74,10 +74,10 @@ mp_obj_t nrf_modnrf_freeflash_length_aligned(void) {
uint32_t len_page_aligned = (temp_len / FLASH_PAGESIZE) * FLASH_PAGESIZE;
return mp_obj_new_int_from_uint(len_page_aligned);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(nrf_modnrf_freeflash_length_aligned_obj, nrf_modnrf_freeflash_length_aligned);
+static MP_DEFINE_CONST_FUN_OBJ_0(nrf_modnrf_freeflash_length_aligned_obj, nrf_modnrf_freeflash_length_aligned);
#endif
-STATIC const mp_rom_map_elem_t nrf_module_globals_table[] = {
+static const mp_rom_map_elem_t nrf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_nrf) },
#if NRF_POWER_HAS_DCDCEN
{ MP_ROM_QSTR(MP_QSTR_dcdc), MP_ROM_PTR(&dcdc_obj) },
@@ -88,7 +88,7 @@ STATIC const mp_rom_map_elem_t nrf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_unused_flash_length), MP_ROM_PTR(&nrf_modnrf_freeflash_length_aligned_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(nrf_module_globals, nrf_module_globals_table);
+static MP_DEFINE_CONST_DICT(nrf_module_globals, nrf_module_globals_table);
const mp_obj_module_t nrf_module = {
.base = { &mp_type_module },
diff --git a/ports/nrf/modules/os/microbitfs.c b/ports/nrf/modules/os/microbitfs.c
index bc007c161f..f549e6f32e 100644
--- a/ports/nrf/modules/os/microbitfs.c
+++ b/ports/nrf/modules/os/microbitfs.c
@@ -121,13 +121,13 @@ extern const mp_obj_type_t os_mbfs_fileio_type;
extern const mp_obj_type_t os_mbfs_textio_type;
// Page indexes count down from the end of ROM.
-STATIC uint8_t first_page_index;
-STATIC uint8_t last_page_index;
+static uint8_t first_page_index;
+static uint8_t last_page_index;
// The number of usable chunks in the file system.
-STATIC uint8_t chunks_in_file_system;
+static uint8_t chunks_in_file_system;
// Index of chunk to start searches. This is randomised to even out wear.
-STATIC uint8_t start_index;
-STATIC file_chunk *file_system_chunks;
+static uint8_t start_index;
+static file_chunk *file_system_chunks;
// Defined by the linker
extern byte _fs_start[];
@@ -136,25 +136,25 @@ extern byte _fs_end[];
STATIC_ASSERT((sizeof(file_chunk) == CHUNK_SIZE));
// From micro:bit memory.h
-STATIC inline byte *rounddown(byte *addr, uint32_t align) {
+static inline byte *rounddown(byte *addr, uint32_t align) {
return (byte*)(((uint32_t)addr)&(-align));
}
// From micro:bit memory.h
-STATIC inline byte *roundup(byte *addr, uint32_t align) {
+static inline byte *roundup(byte *addr, uint32_t align) {
return (byte*)((((uint32_t)addr)+align-1)&(-align));
}
-STATIC inline void *first_page(void) {
+static inline void *first_page(void) {
return _fs_end - FLASH_PAGESIZE * first_page_index;
}
-STATIC inline void *last_page(void) {
+static inline void *last_page(void) {
return _fs_end - FLASH_PAGESIZE * last_page_index;
}
-STATIC void init_limits(void) {
+static void init_limits(void) {
// First determine where to end
byte *end = _fs_end;
end = rounddown(end, FLASH_PAGESIZE)-FLASH_PAGESIZE;
@@ -169,7 +169,7 @@ STATIC void init_limits(void) {
chunks_in_file_system = (end-start)>>MBFS_LOG_CHUNK_SIZE;
}
-STATIC void randomise_start_index(void) {
+static void randomise_start_index(void) {
start_index = rng_generate_random_word() % chunks_in_file_system + 1;
}
@@ -187,7 +187,7 @@ void microbit_filesystem_init(void) {
}
}
-STATIC void copy_page(void *dest, void *src) {
+static void copy_page(void *dest, void *src) {
DEBUG(("FILE DEBUG: Copying page from %lx to %lx.\r\n", (uint32_t)src, (uint32_t)dest));
flash_page_erase((uint32_t)dest);
file_chunk *src_chunk = src;
@@ -210,7 +210,7 @@ STATIC void copy_page(void *dest, void *src) {
// Then all the pages are copied, one by one, into the adjacent newly unused page.
// Finally, the persistent data is saved back to the opposite end of the filesystem from whence it came.
//
-STATIC void filesystem_sweep(void) {
+static void filesystem_sweep(void) {
persistent_config_t config;
uint8_t *page;
uint8_t *end_page;
@@ -240,11 +240,11 @@ STATIC void filesystem_sweep(void) {
}
-STATIC inline byte *seek_address(file_descriptor_obj *self) {
+static inline byte *seek_address(file_descriptor_obj *self) {
return (byte*)&(file_system_chunks[self->seek_chunk].data[self->seek_offset]);
}
-STATIC uint8_t microbit_find_file(const char *name, int name_len) {
+static uint8_t microbit_find_file(const char *name, int name_len) {
for (uint8_t index = 1; index <= chunks_in_file_system; index++) {
const file_chunk *p = &file_system_chunks[index];
if (p->marker != FILE_START)
@@ -268,7 +268,7 @@ STATIC uint8_t microbit_find_file(const char *name, int name_len) {
// 3a. Sweep the filesystem and restart.
// 3b. Otherwise, fail and return FILE_NOT_FOUND.
//
-STATIC uint8_t find_chunk_and_erase(void) {
+static uint8_t find_chunk_and_erase(void) {
// Start search at a random chunk to spread the wear more evenly.
// Search for unused chunk
uint8_t index = start_index;
@@ -316,13 +316,13 @@ STATIC uint8_t find_chunk_and_erase(void) {
return find_chunk_and_erase();
}
-STATIC mp_obj_t microbit_file_name(file_descriptor_obj *fd) {
+static mp_obj_t microbit_file_name(file_descriptor_obj *fd) {
return mp_obj_new_str(&(file_system_chunks[fd->start_chunk].header.filename[0]), file_system_chunks[fd->start_chunk].header.name_len);
}
-STATIC file_descriptor_obj *microbit_file_descriptor_new(uint8_t start_chunk, bool write, bool binary);
+static file_descriptor_obj *microbit_file_descriptor_new(uint8_t start_chunk, bool write, bool binary);
-STATIC void clear_file(uint8_t chunk) {
+static void clear_file(uint8_t chunk) {
do {
flash_write_byte((uint32_t)&(file_system_chunks[chunk].marker), FREED_CHUNK);
DEBUG(("FILE DEBUG: Freeing chunk %d.\n", chunk));
@@ -330,7 +330,7 @@ STATIC void clear_file(uint8_t chunk) {
} while (chunk <= chunks_in_file_system);
}
-STATIC file_descriptor_obj *microbit_file_open(const char *name, size_t name_len, bool write, bool binary) {
+static file_descriptor_obj *microbit_file_open(const char *name, size_t name_len, bool write, bool binary) {
if (name_len > MAX_FILENAME_LENGTH) {
return NULL;
}
@@ -355,7 +355,7 @@ STATIC file_descriptor_obj *microbit_file_open(const char *name, size_t name_len
return microbit_file_descriptor_new(index, write, binary);
}
-STATIC file_descriptor_obj *microbit_file_descriptor_new(uint8_t start_chunk, bool write, bool binary) {
+static file_descriptor_obj *microbit_file_descriptor_new(uint8_t start_chunk, bool write, bool binary) {
file_descriptor_obj *res = mp_obj_malloc(file_descriptor_obj, binary ? &os_mbfs_fileio_type : &os_mbfs_textio_type);
res->start_chunk = start_chunk;
res->seek_chunk = start_chunk;
@@ -366,7 +366,7 @@ STATIC file_descriptor_obj *microbit_file_descriptor_new(uint8_t start_chunk, bo
return res;
}
-STATIC mp_obj_t microbit_remove(mp_obj_t filename) {
+static mp_obj_t microbit_remove(mp_obj_t filename) {
size_t name_len;
const char *name = mp_obj_str_get_data(filename, &name_len);
mp_uint_t index = microbit_find_file(name, name_len);
@@ -377,13 +377,13 @@ STATIC mp_obj_t microbit_remove(mp_obj_t filename) {
return mp_const_none;
}
-STATIC void check_file_open(file_descriptor_obj *self) {
+static void check_file_open(file_descriptor_obj *self) {
if (!self->open) {
mp_raise_ValueError(MP_ERROR_TEXT("I/O operation on closed file"));
}
}
-STATIC int advance(file_descriptor_obj *self, uint32_t n, bool write) {
+static int advance(file_descriptor_obj *self, uint32_t n, bool write) {
DEBUG(("FILE DEBUG: Advancing from chunk %d, offset %d.\r\n", self->seek_chunk, self->seek_offset));
self->seek_offset += n;
if (self->seek_offset == DATA_PER_CHUNK) {
@@ -405,7 +405,7 @@ STATIC int advance(file_descriptor_obj *self, uint32_t n, bool write) {
return 0;
}
-STATIC mp_uint_t microbit_file_read(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t microbit_file_read(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) {
file_descriptor_obj *self = (file_descriptor_obj *)obj;
check_file_open(self);
if (self->writable || file_system_chunks[self->start_chunk].marker == FREED_CHUNK) {
@@ -435,7 +435,7 @@ STATIC mp_uint_t microbit_file_read(mp_obj_t obj, void *buf, mp_uint_t size, int
return bytes_read;
}
-STATIC mp_uint_t microbit_file_write(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t microbit_file_write(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode) {
file_descriptor_obj *self = (file_descriptor_obj *)obj;
check_file_open(self);
if (!self->writable || file_system_chunks[self->start_chunk].marker == FREED_CHUNK) {
@@ -458,14 +458,14 @@ STATIC mp_uint_t microbit_file_write(mp_obj_t obj, const void *buf, mp_uint_t si
return size;
}
-STATIC void microbit_file_close(file_descriptor_obj *fd) {
+static void microbit_file_close(file_descriptor_obj *fd) {
if (fd->writable) {
flash_write_byte((uint32_t)&(file_system_chunks[fd->start_chunk].header.end_offset), fd->seek_offset);
}
fd->open = false;
}
-STATIC mp_obj_t microbit_file_list(void) {
+static mp_obj_t microbit_file_list(void) {
mp_obj_t res = mp_obj_new_list(0, NULL);
for (uint8_t index = 1; index <= chunks_in_file_system; index++) {
if (file_system_chunks[index].marker == FILE_START) {
@@ -476,7 +476,7 @@ STATIC mp_obj_t microbit_file_list(void) {
return res;
}
-STATIC mp_obj_t microbit_file_size(mp_obj_t filename) {
+static mp_obj_t microbit_file_size(mp_obj_t filename) {
size_t name_len;
const char *name = mp_obj_str_get_data(filename, &name_len);
uint8_t chunk = microbit_find_file(name, name_len);
@@ -495,7 +495,7 @@ STATIC mp_obj_t microbit_file_size(mp_obj_t filename) {
return mp_obj_new_int(len);
}
-STATIC mp_uint_t file_read_byte(file_descriptor_obj *fd) {
+static mp_uint_t file_read_byte(file_descriptor_obj *fd) {
if (file_system_chunks[fd->seek_chunk].next_chunk == UNUSED_CHUNK) {
uint8_t end_offset = file_system_chunks[fd->start_chunk].header.end_offset;
if (end_offset == UNUSED_CHUNK || fd->seek_offset == end_offset) {
@@ -530,29 +530,29 @@ mp_import_stat_t os_mbfs_import_stat(const char *path) {
}
}
-STATIC mp_obj_t os_mbfs_file_name(mp_obj_t self) {
+static mp_obj_t os_mbfs_file_name(mp_obj_t self) {
file_descriptor_obj *fd = (file_descriptor_obj*)self;
return microbit_file_name(fd);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_mbfs_file_name_obj, os_mbfs_file_name);
+static MP_DEFINE_CONST_FUN_OBJ_1(os_mbfs_file_name_obj, os_mbfs_file_name);
-STATIC mp_obj_t os_mbfs_file_close(mp_obj_t self) {
+static mp_obj_t os_mbfs_file_close(mp_obj_t self) {
file_descriptor_obj *fd = (file_descriptor_obj*)self;
microbit_file_close(fd);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_mbfs_file_close_obj, os_mbfs_file_close);
+static MP_DEFINE_CONST_FUN_OBJ_1(os_mbfs_file_close_obj, os_mbfs_file_close);
-STATIC mp_obj_t os_mbfs_remove(mp_obj_t name) {
+static mp_obj_t os_mbfs_remove(mp_obj_t name) {
return microbit_remove(name);
}
MP_DEFINE_CONST_FUN_OBJ_1(os_mbfs_remove_obj, os_mbfs_remove);
-STATIC mp_obj_t os_mbfs_file___exit__(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t os_mbfs_file___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return os_mbfs_file_close(args[0]);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_mbfs_file___exit___obj, 4, 4, os_mbfs_file___exit__);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_mbfs_file___exit___obj, 4, 4, os_mbfs_file___exit__);
typedef struct {
mp_obj_base_t base;
@@ -560,7 +560,7 @@ typedef struct {
uint8_t index;
} os_mbfs_ilistdir_it_t;
-STATIC mp_obj_t os_mbfs_ilistdir_it_iternext(mp_obj_t self_in) {
+static mp_obj_t os_mbfs_ilistdir_it_iternext(mp_obj_t self_in) {
os_mbfs_ilistdir_it_t *self = MP_OBJ_TO_PTR(self_in);
// Read until the next FILE_START chunk.
@@ -585,7 +585,7 @@ STATIC mp_obj_t os_mbfs_ilistdir_it_iternext(mp_obj_t self_in) {
return MP_OBJ_STOP_ITERATION;
}
-STATIC mp_obj_t os_mbfs_ilistdir(void) {
+static mp_obj_t os_mbfs_ilistdir(void) {
os_mbfs_ilistdir_it_t *iter = mp_obj_malloc(os_mbfs_ilistdir_it_t, &mp_type_polymorph_iter);
iter->iternext = os_mbfs_ilistdir_it_iternext;
iter->index = 1;
@@ -596,12 +596,12 @@ MP_DEFINE_CONST_FUN_OBJ_0(os_mbfs_ilistdir_obj, os_mbfs_ilistdir);
MP_DEFINE_CONST_FUN_OBJ_0(os_mbfs_listdir_obj, microbit_file_list);
-STATIC mp_obj_t microbit_file_writable(mp_obj_t self) {
+static mp_obj_t microbit_file_writable(mp_obj_t self) {
return mp_obj_new_bool(((file_descriptor_obj *)self)->writable);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(microbit_file_writable_obj, microbit_file_writable);
+static MP_DEFINE_CONST_FUN_OBJ_1(microbit_file_writable_obj, microbit_file_writable);
-STATIC const mp_map_elem_t os_mbfs_file_locals_dict_table[] = {
+static const mp_map_elem_t os_mbfs_file_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&os_mbfs_file_close_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_name), (mp_obj_t)&os_mbfs_file_name_obj },
{ MP_ROM_QSTR(MP_QSTR___enter__), (mp_obj_t)&mp_identity_obj },
@@ -613,10 +613,10 @@ STATIC const mp_map_elem_t os_mbfs_file_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_readline), (mp_obj_t)&mp_stream_unbuffered_readline_obj},
{ MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj},
};
-STATIC MP_DEFINE_CONST_DICT(os_mbfs_file_locals_dict, os_mbfs_file_locals_dict_table);
+static MP_DEFINE_CONST_DICT(os_mbfs_file_locals_dict, os_mbfs_file_locals_dict_table);
-STATIC const mp_stream_p_t textio_stream_p = {
+static const mp_stream_p_t textio_stream_p = {
.read = microbit_file_read,
.write = microbit_file_write,
.is_text = true,
@@ -631,7 +631,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
);
-STATIC const mp_stream_p_t fileio_stream_p = {
+static const mp_stream_p_t fileio_stream_p = {
.read = microbit_file_read,
.write = microbit_file_write,
};
@@ -679,7 +679,7 @@ mode_error:
mp_raise_ValueError(MP_ERROR_TEXT("illegal mode"));
}
-STATIC mp_obj_t os_mbfs_stat(mp_obj_t filename) {
+static mp_obj_t os_mbfs_stat(mp_obj_t filename) {
mp_obj_t file_size = microbit_file_size(filename);
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
diff --git a/ports/nrf/modules/os/modos.c b/ports/nrf/modules/os/modos.c
index 31bf1b2920..f000e1eeb6 100644
--- a/ports/nrf/modules/os/modos.c
+++ b/ports/nrf/modules/os/modos.c
@@ -33,7 +33,7 @@
#if MICROPY_PY_OS_URANDOM
// Return a bytes object with n random bytes, generated by the hardware random number generator.
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -42,7 +42,7 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
#endif
#if MICROPY_PY_OS_DUPTERM
diff --git a/ports/nrf/modules/ubluepy/modubluepy.c b/ports/nrf/modules/ubluepy/modubluepy.c
index fd42c4940b..e84c2ebd6d 100644
--- a/ports/nrf/modules/ubluepy/modubluepy.c
+++ b/ports/nrf/modules/ubluepy/modubluepy.c
@@ -37,7 +37,7 @@ extern const mp_obj_type_t ubluepy_constants_type;
extern const mp_obj_type_t ubluepy_scanner_type;
extern const mp_obj_type_t ubluepy_scan_entry_type;
-STATIC const mp_rom_map_elem_t mp_module_ubluepy_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_ubluepy_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ubluepy) },
#if MICROPY_PY_UBLUEPY_PERIPHERAL
{ MP_ROM_QSTR(MP_QSTR_Peripheral), MP_ROM_PTR(&ubluepy_peripheral_type) },
@@ -60,7 +60,7 @@ STATIC const mp_rom_map_elem_t mp_module_ubluepy_globals_table[] = {
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_ubluepy_globals, mp_module_ubluepy_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_ubluepy_globals, mp_module_ubluepy_globals_table);
const mp_obj_module_t mp_module_ubluepy = {
.base = { &mp_type_module },
diff --git a/ports/nrf/modules/ubluepy/ubluepy_characteristic.c b/ports/nrf/modules/ubluepy/ubluepy_characteristic.c
index 7b9e3af6a3..074cf0396e 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_characteristic.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_characteristic.c
@@ -32,14 +32,14 @@
#include "modubluepy.h"
#include "ble_drv.h"
-STATIC void ubluepy_characteristic_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_characteristic_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_characteristic_obj_t * self = (ubluepy_characteristic_obj_t *)o;
mp_printf(print, "Characteristic(handle: 0x" HEX2_FMT ", conn_handle: " HEX2_FMT ")",
self->handle, self->p_service->p_periph->conn_handle);
}
-STATIC mp_obj_t ubluepy_characteristic_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t ubluepy_characteristic_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_uuid, MP_ARG_REQUIRED| MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_props, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UBLUEPY_PROP_READ | UBLUEPY_PROP_WRITE} },
@@ -90,7 +90,7 @@ void char_data_callback(mp_obj_t self_in, uint16_t length, uint8_t * p_data) {
/// \method read()
/// Read Characteristic value.
///
-STATIC mp_obj_t char_read(mp_obj_t self_in) {
+static mp_obj_t char_read(mp_obj_t self_in) {
ubluepy_characteristic_obj_t * self = MP_OBJ_TO_PTR(self_in);
#if MICROPY_PY_UBLUEPY_CENTRAL
@@ -107,12 +107,12 @@ STATIC mp_obj_t char_read(mp_obj_t self_in) {
return mp_const_none;
#endif
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_characteristic_read_obj, char_read);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_characteristic_read_obj, char_read);
/// \method write(data, [with_response=False])
/// Write Characteristic value.
///
-STATIC mp_obj_t char_write(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t char_write(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
ubluepy_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_obj_t data = pos_args[1];
@@ -155,28 +155,28 @@ STATIC mp_obj_t char_write(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ubluepy_characteristic_write_obj, 2, char_write);
+static MP_DEFINE_CONST_FUN_OBJ_KW(ubluepy_characteristic_write_obj, 2, char_write);
/// \method properties()
/// Read Characteristic value properties.
///
-STATIC mp_obj_t char_properties(mp_obj_t self_in) {
+static mp_obj_t char_properties(mp_obj_t self_in) {
ubluepy_characteristic_obj_t * self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(self->props);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_characteristic_get_properties_obj, char_properties);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_characteristic_get_properties_obj, char_properties);
/// \method uuid()
/// Get UUID instance of the characteristic.
///
-STATIC mp_obj_t char_uuid(mp_obj_t self_in) {
+static mp_obj_t char_uuid(mp_obj_t self_in) {
ubluepy_characteristic_obj_t * self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_FROM_PTR(self->p_uuid);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_characteristic_get_uuid_obj, char_uuid);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_characteristic_get_uuid_obj, char_uuid);
-STATIC const mp_rom_map_elem_t ubluepy_characteristic_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_characteristic_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&ubluepy_characteristic_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&ubluepy_characteristic_write_obj) },
#if 0
@@ -207,7 +207,7 @@ STATIC const mp_rom_map_elem_t ubluepy_characteristic_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_characteristic_locals_dict, ubluepy_characteristic_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_characteristic_locals_dict, ubluepy_characteristic_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_characteristic_type,
diff --git a/ports/nrf/modules/ubluepy/ubluepy_constants.c b/ports/nrf/modules/ubluepy/ubluepy_constants.c
index cad9adbb03..d102c41da3 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_constants.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_constants.c
@@ -31,7 +31,7 @@
#include "modubluepy.h"
-STATIC const mp_rom_map_elem_t ubluepy_constants_ad_types_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_constants_ad_types_locals_dict_table[] = {
// GAP AD Types
{ MP_ROM_QSTR(MP_QSTR_AD_TYPE_FLAGS), MP_ROM_INT(0x01) },
{ MP_ROM_QSTR(MP_QSTR_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE), MP_ROM_INT(0x02) },
@@ -67,7 +67,7 @@ STATIC const mp_rom_map_elem_t ubluepy_constants_ad_types_locals_dict_table[] =
{ MP_ROM_QSTR(MP_QSTR_AD_TYPE_MANUFACTURER_SPECIFIC_DATA), MP_ROM_INT(0xFF) },
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_constants_ad_types_locals_dict, ubluepy_constants_ad_types_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_constants_ad_types_locals_dict, ubluepy_constants_ad_types_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_constants_ad_types_type,
@@ -76,7 +76,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &ubluepy_constants_ad_types_locals_dict
);
-STATIC const mp_rom_map_elem_t ubluepy_constants_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_constants_locals_dict_table[] = {
// GAP events
{ MP_ROM_QSTR(MP_QSTR_EVT_GAP_CONNECTED), MP_ROM_INT(16) },
{ MP_ROM_QSTR(MP_QSTR_EVT_GAP_DISCONNECTED), MP_ROM_INT(17) },
@@ -89,7 +89,7 @@ STATIC const mp_rom_map_elem_t ubluepy_constants_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ad_types), MP_ROM_PTR(&ubluepy_constants_ad_types_type) },
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_constants_locals_dict, ubluepy_constants_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_constants_locals_dict, ubluepy_constants_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_constants_type,
diff --git a/ports/nrf/modules/ubluepy/ubluepy_delegate.c b/ports/nrf/modules/ubluepy/ubluepy_delegate.c
index 43720b4186..3aa06d83bf 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_delegate.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_delegate.c
@@ -31,13 +31,13 @@
#include "modubluepy.h"
-STATIC void ubluepy_delegate_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_delegate_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_delegate_obj_t * self = (ubluepy_delegate_obj_t *)o;
(void)self;
mp_printf(print, "DefaultDelegate()");
}
-STATIC mp_obj_t ubluepy_delegate_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t ubluepy_delegate_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
ubluepy_delegate_obj_t *s = mp_obj_malloc(ubluepy_delegate_obj_t, type);
return MP_OBJ_FROM_PTR(s);
@@ -46,28 +46,28 @@ STATIC mp_obj_t ubluepy_delegate_make_new(const mp_obj_type_t *type, size_t n_ar
/// \method handleConnection()
/// Handle connection events.
///
-STATIC mp_obj_t delegate_handle_conn(mp_obj_t self_in) {
+static mp_obj_t delegate_handle_conn(mp_obj_t self_in) {
ubluepy_delegate_obj_t *self = MP_OBJ_TO_PTR(self_in);
(void)self;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_delegate_handle_conn_obj, delegate_handle_conn);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_delegate_handle_conn_obj, delegate_handle_conn);
/// \method handleNotification()
/// Handle notification events.
///
-STATIC mp_obj_t delegate_handle_notif(mp_obj_t self_in) {
+static mp_obj_t delegate_handle_notif(mp_obj_t self_in) {
ubluepy_delegate_obj_t *self = MP_OBJ_TO_PTR(self_in);
(void)self;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_delegate_handle_notif_obj, delegate_handle_notif);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_delegate_handle_notif_obj, delegate_handle_notif);
-STATIC const mp_rom_map_elem_t ubluepy_delegate_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_delegate_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_handleConnection), MP_ROM_PTR(&ubluepy_delegate_handle_conn_obj) },
{ MP_ROM_QSTR(MP_QSTR_handleNotification), MP_ROM_PTR(&ubluepy_delegate_handle_notif_obj) },
#if 0
@@ -75,7 +75,7 @@ STATIC const mp_rom_map_elem_t ubluepy_delegate_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_delegate_locals_dict, ubluepy_delegate_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_delegate_locals_dict, ubluepy_delegate_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_delegate_type,
diff --git a/ports/nrf/modules/ubluepy/ubluepy_descriptor.c b/ports/nrf/modules/ubluepy/ubluepy_descriptor.c
index 062b421094..d2a256d5c3 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_descriptor.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_descriptor.c
@@ -34,14 +34,14 @@
#include "modubluepy.h"
#include "ble_drv.h"
-STATIC void ubluepy_descriptor_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_descriptor_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_descriptor_obj_t * self = (ubluepy_descriptor_obj_t *)o;
mp_printf(print, "Descriptor(uuid: 0x" HEX2_FMT HEX2_FMT ")",
self->p_uuid->value[1], self->p_uuid->value[0]);
}
-STATIC mp_obj_t ubluepy_descriptor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t ubluepy_descriptor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_NEW_UUID };
@@ -62,13 +62,13 @@ STATIC mp_obj_t ubluepy_descriptor_make_new(const mp_obj_type_t *type, size_t n_
return MP_OBJ_FROM_PTR(s);
}
-STATIC const mp_rom_map_elem_t ubluepy_descriptor_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_descriptor_locals_dict_table[] = {
#if 0
{ MP_ROM_QSTR(MP_QSTR_binVal), MP_ROM_PTR(&ubluepy_descriptor_bin_val_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_descriptor_locals_dict, ubluepy_descriptor_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_descriptor_locals_dict, ubluepy_descriptor_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_descriptor_type,
diff --git a/ports/nrf/modules/ubluepy/ubluepy_peripheral.c b/ports/nrf/modules/ubluepy/ubluepy_peripheral.c
index 7de9aa26bb..4433450429 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_peripheral.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_peripheral.c
@@ -34,14 +34,14 @@
#include "ble_drv.h"
-STATIC void ubluepy_peripheral_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_peripheral_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_peripheral_obj_t * self = (ubluepy_peripheral_obj_t *)o;
(void)self;
mp_printf(print, "Peripheral(conn_handle: " HEX2_FMT ")",
self->conn_handle);
}
-STATIC void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn_handle, uint16_t length, uint8_t * data) {
+static void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn_handle, uint16_t length, uint8_t * data) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (event_id == 16) { // connect event
@@ -68,7 +68,7 @@ STATIC void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn
(void)self;
}
-STATIC void gatts_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t attr_handle, uint16_t length, uint8_t * data) {
+static void gatts_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t attr_handle, uint16_t length, uint8_t * data) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->conn_handler != mp_const_none) {
@@ -92,14 +92,14 @@ STATIC void gatts_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t at
static volatile bool m_disc_evt_received;
-STATIC void gattc_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t attr_handle, uint16_t length, uint8_t * data) {
+static void gattc_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t attr_handle, uint16_t length, uint8_t * data) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
(void)self;
m_disc_evt_received = true;
}
#endif
-STATIC mp_obj_t ubluepy_peripheral_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t ubluepy_peripheral_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum {
ARG_NEW_DEVICE_ADDR,
ARG_NEW_ADDR_TYPE
@@ -129,45 +129,45 @@ STATIC mp_obj_t ubluepy_peripheral_make_new(const mp_obj_type_t *type, size_t n_
/// \method withDelegate(DefaultDelegate)
/// Set delegate instance for handling Bluetooth LE events.
///
-STATIC mp_obj_t peripheral_with_delegate(mp_obj_t self_in, mp_obj_t delegate) {
+static mp_obj_t peripheral_with_delegate(mp_obj_t self_in, mp_obj_t delegate) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
self->delegate = delegate;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_with_delegate_obj, peripheral_with_delegate);
+static MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_with_delegate_obj, peripheral_with_delegate);
/// \method setNotificationHandler(func)
/// Set handler for Bluetooth LE notification events.
///
-STATIC mp_obj_t peripheral_set_notif_handler(mp_obj_t self_in, mp_obj_t func) {
+static mp_obj_t peripheral_set_notif_handler(mp_obj_t self_in, mp_obj_t func) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
self->notif_handler = func;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_set_notif_handler_obj, peripheral_set_notif_handler);
+static MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_set_notif_handler_obj, peripheral_set_notif_handler);
/// \method setConnectionHandler(func)
/// Set handler for Bluetooth LE connection events.
///
-STATIC mp_obj_t peripheral_set_conn_handler(mp_obj_t self_in, mp_obj_t func) {
+static mp_obj_t peripheral_set_conn_handler(mp_obj_t self_in, mp_obj_t func) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
self->conn_handler = func;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_set_conn_handler_obj, peripheral_set_conn_handler);
+static MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_set_conn_handler_obj, peripheral_set_conn_handler);
#if MICROPY_PY_UBLUEPY_PERIPHERAL
/// \method advertise(device_name, [service=[service1, service2, ...]], [data=bytearray], [connectable=True])
/// Start advertising. Connectable advertisement type by default.
///
-STATIC mp_obj_t peripheral_advertise(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t peripheral_advertise(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_device_name, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_services, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
@@ -231,12 +231,12 @@ STATIC mp_obj_t peripheral_advertise(mp_uint_t n_args, const mp_obj_t *pos_args,
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ubluepy_peripheral_advertise_obj, 0, peripheral_advertise);
+static MP_DEFINE_CONST_FUN_OBJ_KW(ubluepy_peripheral_advertise_obj, 0, peripheral_advertise);
/// \method advertise_stop()
/// Stop advertisement if any onging advertisement.
///
-STATIC mp_obj_t peripheral_advertise_stop(mp_obj_t self_in) {
+static mp_obj_t peripheral_advertise_stop(mp_obj_t self_in) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
(void)self;
@@ -245,26 +245,26 @@ STATIC mp_obj_t peripheral_advertise_stop(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_peripheral_advertise_stop_obj, peripheral_advertise_stop);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_peripheral_advertise_stop_obj, peripheral_advertise_stop);
#endif // MICROPY_PY_UBLUEPY_PERIPHERAL
/// \method disconnect()
/// disconnect connection.
///
-STATIC mp_obj_t peripheral_disconnect(mp_obj_t self_in) {
+static mp_obj_t peripheral_disconnect(mp_obj_t self_in) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
(void)self;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_peripheral_disconnect_obj, peripheral_disconnect);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_peripheral_disconnect_obj, peripheral_disconnect);
/// \method addService(Service)
/// Add service to the Peripheral.
///
-STATIC mp_obj_t peripheral_add_service(mp_obj_t self_in, mp_obj_t service) {
+static mp_obj_t peripheral_add_service(mp_obj_t self_in, mp_obj_t service) {
ubluepy_peripheral_obj_t * self = MP_OBJ_TO_PTR(self_in);
ubluepy_service_obj_t * p_service = MP_OBJ_TO_PTR(service);
@@ -274,17 +274,17 @@ STATIC mp_obj_t peripheral_add_service(mp_obj_t self_in, mp_obj_t service) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_add_service_obj, peripheral_add_service);
+static MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_add_service_obj, peripheral_add_service);
/// \method getServices()
/// Return list with all service registered in the Peripheral.
///
-STATIC mp_obj_t peripheral_get_services(mp_obj_t self_in) {
+static mp_obj_t peripheral_get_services(mp_obj_t self_in) {
ubluepy_peripheral_obj_t * self = MP_OBJ_TO_PTR(self_in);
return self->service_list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_peripheral_get_services_obj, peripheral_get_services);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_peripheral_get_services_obj, peripheral_get_services);
#if MICROPY_PY_UBLUEPY_CENTRAL
@@ -337,7 +337,7 @@ void static disc_add_char(mp_obj_t service_in, ble_drv_char_data_t * p_desc_data
/// addr_type can be either ADDR_TYPE_PUBLIC (default) or
/// ADDR_TYPE_RANDOM_STATIC.
///
-STATIC mp_obj_t peripheral_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t peripheral_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_obj_t dev_addr = pos_args[1];
@@ -439,11 +439,11 @@ STATIC mp_obj_t peripheral_connect(mp_uint_t n_args, const mp_obj_t *pos_args, m
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ubluepy_peripheral_connect_obj, 2, peripheral_connect);
+static MP_DEFINE_CONST_FUN_OBJ_KW(ubluepy_peripheral_connect_obj, 2, peripheral_connect);
#endif
-STATIC const mp_rom_map_elem_t ubluepy_peripheral_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_peripheral_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_withDelegate), MP_ROM_PTR(&ubluepy_peripheral_with_delegate_obj) },
{ MP_ROM_QSTR(MP_QSTR_setNotificationHandler), MP_ROM_PTR(&ubluepy_peripheral_set_notif_handler_obj) },
{ MP_ROM_QSTR(MP_QSTR_setConnectionHandler), MP_ROM_PTR(&ubluepy_peripheral_set_conn_handler_obj) },
@@ -480,7 +480,7 @@ STATIC const mp_rom_map_elem_t ubluepy_peripheral_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_peripheral_locals_dict, ubluepy_peripheral_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_peripheral_locals_dict, ubluepy_peripheral_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_peripheral_type,
diff --git a/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c b/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c
index 626578360a..cf329ddd9d 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_scan_entry.c
@@ -37,7 +37,7 @@
#include "ble_drv.h"
-STATIC void ubluepy_scan_entry_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_scan_entry_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_scan_entry_obj_t * self = (ubluepy_scan_entry_obj_t *)o;
(void)self;
mp_printf(print, "ScanEntry");
@@ -46,34 +46,34 @@ STATIC void ubluepy_scan_entry_print(const mp_print_t *print, mp_obj_t o, mp_pri
/// \method addr()
/// Return address as text string.
///
-STATIC mp_obj_t scan_entry_get_addr(mp_obj_t self_in) {
+static mp_obj_t scan_entry_get_addr(mp_obj_t self_in) {
ubluepy_scan_entry_obj_t *self = MP_OBJ_TO_PTR(self_in);
return self->addr;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scan_entry_get_addr_obj, scan_entry_get_addr);
+static MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scan_entry_get_addr_obj, scan_entry_get_addr);
/// \method addr_type()
/// Return address type value.
///
-STATIC mp_obj_t scan_entry_get_addr_type(mp_obj_t self_in) {
+static mp_obj_t scan_entry_get_addr_type(mp_obj_t self_in) {
ubluepy_scan_entry_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(self->addr_type);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scan_entry_get_addr_type_obj, scan_entry_get_addr_type);
+static MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scan_entry_get_addr_type_obj, scan_entry_get_addr_type);
/// \method rssi()
/// Return RSSI value.
///
-STATIC mp_obj_t scan_entry_get_rssi(mp_obj_t self_in) {
+static mp_obj_t scan_entry_get_rssi(mp_obj_t self_in) {
ubluepy_scan_entry_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(self->rssi);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scan_entry_get_rssi_obj, scan_entry_get_rssi);
+static MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scan_entry_get_rssi_obj, scan_entry_get_rssi);
/// \method getScanData()
/// Return list of the scan data tuples (ad_type, description, value)
///
-STATIC mp_obj_t scan_entry_get_scan_data(mp_obj_t self_in) {
+static mp_obj_t scan_entry_get_scan_data(mp_obj_t self_in) {
ubluepy_scan_entry_obj_t * self = MP_OBJ_TO_PTR(self_in);
mp_obj_t retval_list = mp_obj_new_list(0, NULL);
@@ -125,16 +125,16 @@ STATIC mp_obj_t scan_entry_get_scan_data(mp_obj_t self_in) {
return retval_list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_scan_entry_get_scan_data_obj, scan_entry_get_scan_data);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_scan_entry_get_scan_data_obj, scan_entry_get_scan_data);
-STATIC const mp_rom_map_elem_t ubluepy_scan_entry_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_scan_entry_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_addr), MP_ROM_PTR(&bluepy_scan_entry_get_addr_obj) },
{ MP_ROM_QSTR(MP_QSTR_addr_type), MP_ROM_PTR(&bluepy_scan_entry_get_addr_type_obj) },
{ MP_ROM_QSTR(MP_QSTR_rssi), MP_ROM_PTR(&bluepy_scan_entry_get_rssi_obj) },
{ MP_ROM_QSTR(MP_QSTR_getScanData), MP_ROM_PTR(&ubluepy_scan_entry_get_scan_data_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_scan_entry_locals_dict, ubluepy_scan_entry_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_scan_entry_locals_dict, ubluepy_scan_entry_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_scan_entry_type,
diff --git a/ports/nrf/modules/ubluepy/ubluepy_scanner.c b/ports/nrf/modules/ubluepy/ubluepy_scanner.c
index ffb7e94671..17d697b86e 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_scanner.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_scanner.c
@@ -35,7 +35,7 @@
#include "ble_drv.h"
#include "mphalport.h"
-STATIC void adv_event_handler(mp_obj_t self_in, uint16_t event_id, ble_drv_adv_data_t * data) {
+static void adv_event_handler(mp_obj_t self_in, uint16_t event_id, ble_drv_adv_data_t * data) {
ubluepy_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
ubluepy_scan_entry_obj_t * item = mp_obj_malloc(ubluepy_scan_entry_obj_t, &ubluepy_scan_entry_type);
@@ -62,13 +62,13 @@ STATIC void adv_event_handler(mp_obj_t self_in, uint16_t event_id, ble_drv_adv_d
ble_drv_scan_start(true);
}
-STATIC void ubluepy_scanner_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_scanner_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_scanner_obj_t * self = (ubluepy_scanner_obj_t *)o;
(void)self;
mp_printf(print, "Scanner");
}
-STATIC mp_obj_t ubluepy_scanner_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t ubluepy_scanner_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
static const mp_arg_t allowed_args[] = {
};
@@ -86,7 +86,7 @@ STATIC mp_obj_t ubluepy_scanner_make_new(const mp_obj_type_t *type, size_t n_arg
/// Scan for devices. Timeout is in milliseconds and will set the duration
/// of the scanning.
///
-STATIC mp_obj_t scanner_scan(mp_obj_t self_in, mp_obj_t timeout_in) {
+static mp_obj_t scanner_scan(mp_obj_t self_in, mp_obj_t timeout_in) {
ubluepy_scanner_obj_t * self = MP_OBJ_TO_PTR(self_in);
mp_int_t timeout = mp_obj_get_int(timeout_in);
@@ -105,13 +105,13 @@ STATIC mp_obj_t scanner_scan(mp_obj_t self_in, mp_obj_t timeout_in) {
return self->adv_reports;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_scanner_scan_obj, scanner_scan);
+static MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_scanner_scan_obj, scanner_scan);
-STATIC const mp_rom_map_elem_t ubluepy_scanner_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_scanner_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&ubluepy_scanner_scan_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_scanner_locals_dict, ubluepy_scanner_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_scanner_locals_dict, ubluepy_scanner_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
diff --git a/ports/nrf/modules/ubluepy/ubluepy_service.c b/ports/nrf/modules/ubluepy/ubluepy_service.c
index bf336d04c5..3c72c02c4a 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_service.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_service.c
@@ -33,13 +33,13 @@
#include "modubluepy.h"
#include "ble_drv.h"
-STATIC void ubluepy_service_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_service_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_service_obj_t * self = (ubluepy_service_obj_t *)o;
mp_printf(print, "Service(handle: 0x" HEX2_FMT ")", self->handle);
}
-STATIC mp_obj_t ubluepy_service_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t ubluepy_service_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_NEW_UUID, ARG_NEW_TYPE };
@@ -86,7 +86,7 @@ STATIC mp_obj_t ubluepy_service_make_new(const mp_obj_type_t *type, size_t n_arg
/// \method addCharacteristic(Characteristic)
/// Add Characteristic to the Service.
///
-STATIC mp_obj_t service_add_characteristic(mp_obj_t self_in, mp_obj_t characteristic) {
+static mp_obj_t service_add_characteristic(mp_obj_t self_in, mp_obj_t characteristic) {
ubluepy_service_obj_t * self = MP_OBJ_TO_PTR(self_in);
ubluepy_characteristic_obj_t * p_char = MP_OBJ_TO_PTR(characteristic);
@@ -103,22 +103,22 @@ STATIC mp_obj_t service_add_characteristic(mp_obj_t self_in, mp_obj_t characteri
// return mp_obj_new_bool(retval);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_service_add_char_obj, service_add_characteristic);
+static MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_service_add_char_obj, service_add_characteristic);
/// \method getCharacteristics()
/// Return list with all characteristics registered in the Service.
///
-STATIC mp_obj_t service_get_chars(mp_obj_t self_in) {
+static mp_obj_t service_get_chars(mp_obj_t self_in) {
ubluepy_service_obj_t * self = MP_OBJ_TO_PTR(self_in);
return self->char_list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_service_get_chars_obj, service_get_chars);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_service_get_chars_obj, service_get_chars);
/// \method getCharacteristic(UUID)
/// Return Characteristic with the given UUID.
///
-STATIC mp_obj_t service_get_characteristic(mp_obj_t self_in, mp_obj_t uuid) {
+static mp_obj_t service_get_characteristic(mp_obj_t self_in, mp_obj_t uuid) {
ubluepy_service_obj_t * self = MP_OBJ_TO_PTR(self_in);
ubluepy_uuid_obj_t * p_uuid = MP_OBJ_TO_PTR(uuid);
@@ -145,18 +145,18 @@ STATIC mp_obj_t service_get_characteristic(mp_obj_t self_in, mp_obj_t uuid) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_service_get_char_obj, service_get_characteristic);
+static MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_service_get_char_obj, service_get_characteristic);
/// \method uuid()
/// Get UUID instance of the Service.
///
-STATIC mp_obj_t service_uuid(mp_obj_t self_in) {
+static mp_obj_t service_uuid(mp_obj_t self_in) {
ubluepy_service_obj_t * self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_FROM_PTR(self->p_uuid);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_service_get_uuid_obj, service_uuid);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_service_get_uuid_obj, service_uuid);
-STATIC const mp_rom_map_elem_t ubluepy_service_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_service_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_getCharacteristic), MP_ROM_PTR(&ubluepy_service_get_char_obj) },
{ MP_ROM_QSTR(MP_QSTR_addCharacteristic), MP_ROM_PTR(&ubluepy_service_add_char_obj) },
{ MP_ROM_QSTR(MP_QSTR_getCharacteristics), MP_ROM_PTR(&ubluepy_service_get_chars_obj) },
@@ -169,7 +169,7 @@ STATIC const mp_rom_map_elem_t ubluepy_service_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SECONDARY), MP_ROM_INT(UBLUEPY_SERVICE_SECONDARY) },
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_service_locals_dict, ubluepy_service_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_service_locals_dict, ubluepy_service_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_service_type,
diff --git a/ports/nrf/modules/ubluepy/ubluepy_uuid.c b/ports/nrf/modules/ubluepy/ubluepy_uuid.c
index abfe3cadd5..06313e8da2 100644
--- a/ports/nrf/modules/ubluepy/ubluepy_uuid.c
+++ b/ports/nrf/modules/ubluepy/ubluepy_uuid.c
@@ -34,7 +34,7 @@
#include "modubluepy.h"
#include "ble_drv.h"
-STATIC void ubluepy_uuid_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
+static void ubluepy_uuid_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind) {
ubluepy_uuid_obj_t * self = (ubluepy_uuid_obj_t *)o;
if (self->type == UBLUEPY_UUID_16_BIT) {
mp_printf(print, "UUID(uuid: 0x" HEX2_FMT HEX2_FMT ")",
@@ -45,7 +45,7 @@ STATIC void ubluepy_uuid_print(const mp_print_t *print, mp_obj_t o, mp_print_kin
}
}
-STATIC mp_obj_t ubluepy_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t ubluepy_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_NEW_UUID };
@@ -140,7 +140,7 @@ STATIC mp_obj_t ubluepy_uuid_make_new(const mp_obj_type_t *type, size_t n_args,
/// \method binVal()
/// Get binary value of the 16 or 128 bit UUID. Returned as bytearray type.
///
-STATIC mp_obj_t uuid_bin_val(mp_obj_t self_in) {
+static mp_obj_t uuid_bin_val(mp_obj_t self_in) {
ubluepy_uuid_obj_t * self = MP_OBJ_TO_PTR(self_in);
// TODO: Extend the uint16 byte value to 16 byte if 128-bit,
@@ -148,9 +148,9 @@ STATIC mp_obj_t uuid_bin_val(mp_obj_t self_in) {
// the uint16_t field of the UUID.
return MP_OBJ_NEW_SMALL_INT(self->value[0] | self->value[1] << 8);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_uuid_bin_val_obj, uuid_bin_val);
+static MP_DEFINE_CONST_FUN_OBJ_1(ubluepy_uuid_bin_val_obj, uuid_bin_val);
-STATIC const mp_rom_map_elem_t ubluepy_uuid_locals_dict_table[] = {
+static const mp_rom_map_elem_t ubluepy_uuid_locals_dict_table[] = {
#if 0
{ MP_ROM_QSTR(MP_QSTR_getCommonName), MP_ROM_PTR(&ubluepy_uuid_get_common_name_obj) },
#endif
@@ -158,7 +158,7 @@ STATIC const mp_rom_map_elem_t ubluepy_uuid_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_binVal), MP_ROM_PTR(&ubluepy_uuid_bin_val_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ubluepy_uuid_locals_dict, ubluepy_uuid_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ubluepy_uuid_locals_dict, ubluepy_uuid_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ubluepy_uuid_type,
diff --git a/ports/nrf/mphalport.c b/ports/nrf/mphalport.c
index c964a26c2e..2a1a4cb13b 100644
--- a/ports/nrf/mphalport.c
+++ b/ports/nrf/mphalport.c
@@ -86,7 +86,7 @@ const nrfx_rtc_config_t rtc_config_time_ticks = {
#endif
};
-STATIC void rtc_irq_time(nrfx_rtc_int_type_t event) {
+static void rtc_irq_time(nrfx_rtc_int_type_t event) {
// irq handler for overflow
if (event == NRFX_RTC_INT_OVERFLOW) {
rtc_overflows += 1;
diff --git a/ports/nrf/pin_named_pins.c b/ports/nrf/pin_named_pins.c
index 30e60692f7..6fbe75c757 100644
--- a/ports/nrf/pin_named_pins.c
+++ b/ports/nrf/pin_named_pins.c
@@ -31,7 +31,7 @@
#include "py/mphal.h"
#include "pin.h"
-STATIC void pin_named_pins_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pin_named_pins_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pin_named_pins_obj_t *self = self_in;
mp_printf(print, "<Pin.%q>", self->name);
}
diff --git a/ports/pic16bit/modpyb.c b/ports/pic16bit/modpyb.c
index 9774105d66..5e31eb8af8 100644
--- a/ports/pic16bit/modpyb.c
+++ b/ports/pic16bit/modpyb.c
@@ -30,28 +30,28 @@
#include "py/mphal.h"
#include "modpyb.h"
-STATIC mp_obj_t pyb_millis(void) {
+static mp_obj_t pyb_millis(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
+static MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
-STATIC mp_obj_t pyb_elapsed_millis(mp_obj_t start) {
+static mp_obj_t pyb_elapsed_millis(mp_obj_t start) {
uint32_t startMillis = mp_obj_get_int(start);
uint32_t currMillis = mp_hal_ticks_ms();
return MP_OBJ_NEW_SMALL_INT((currMillis - startMillis) & 0x1fff);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);
-STATIC mp_obj_t pyb_delay(mp_obj_t ms_in) {
+static mp_obj_t pyb_delay(mp_obj_t ms_in) {
mp_int_t ms = mp_obj_get_int(ms_in);
if (ms >= 0) {
mp_hal_delay_ms(ms);
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_delay_obj, pyb_delay);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_delay_obj, pyb_delay);
-STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
+static const mp_rom_map_elem_t pyb_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pyb) },
{ MP_ROM_QSTR(MP_QSTR_millis), MP_ROM_PTR(&pyb_millis_obj) },
@@ -62,7 +62,7 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_Switch), MP_ROM_PTR(&pyb_switch_type) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_module_globals, pyb_module_globals_table);
+static MP_DEFINE_CONST_DICT(pyb_module_globals, pyb_module_globals_table);
const mp_obj_module_t pyb_module = {
.base = { &mp_type_module },
diff --git a/ports/pic16bit/modpybled.c b/ports/pic16bit/modpybled.c
index 47e83e0409..34d41caec2 100644
--- a/ports/pic16bit/modpybled.c
+++ b/ports/pic16bit/modpybled.c
@@ -32,7 +32,7 @@ typedef struct _pyb_led_obj_t {
mp_obj_base_t base;
} pyb_led_obj_t;
-STATIC const pyb_led_obj_t pyb_led_obj[] = {
+static const pyb_led_obj_t pyb_led_obj[] = {
{{&pyb_led_type}},
{{&pyb_led_type}},
{{&pyb_led_type}},
@@ -46,7 +46,7 @@ void pyb_led_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t ki
mp_printf(print, "LED(%u)", LED_ID(self));
}
-STATIC mp_obj_t pyb_led_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_led_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
mp_int_t led_id = mp_obj_get_int(args[0]);
if (!(1 <= led_id && led_id <= NUM_LED)) {
@@ -60,29 +60,29 @@ mp_obj_t pyb_led_on(mp_obj_t self_in) {
led_state(LED_ID(self), 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_led_on_obj, pyb_led_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_led_on_obj, pyb_led_on);
mp_obj_t pyb_led_off(mp_obj_t self_in) {
pyb_led_obj_t *self = self_in;
led_state(LED_ID(self), 0);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_led_off_obj, pyb_led_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_led_off_obj, pyb_led_off);
mp_obj_t pyb_led_toggle(mp_obj_t self_in) {
pyb_led_obj_t *self = self_in;
led_toggle(LED_ID(self));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_led_toggle_obj, pyb_led_toggle);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_led_toggle_obj, pyb_led_toggle);
-STATIC const mp_rom_map_elem_t pyb_led_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_led_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&pyb_led_on_obj) },
{ MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&pyb_led_off_obj) },
{ MP_ROM_QSTR(MP_QSTR_toggle), MP_ROM_PTR(&pyb_led_toggle_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_led_locals_dict, pyb_led_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_led_locals_dict, pyb_led_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_led_type,
diff --git a/ports/pic16bit/modpybswitch.c b/ports/pic16bit/modpybswitch.c
index b7192c5bba..3e319f01b6 100644
--- a/ports/pic16bit/modpybswitch.c
+++ b/ports/pic16bit/modpybswitch.c
@@ -32,7 +32,7 @@ typedef struct _pyb_switch_obj_t {
mp_obj_base_t base;
} pyb_switch_obj_t;
-STATIC const pyb_switch_obj_t pyb_switch_obj[] = {
+static const pyb_switch_obj_t pyb_switch_obj[] = {
{{&pyb_switch_type}},
{{&pyb_switch_type}},
};
@@ -45,7 +45,7 @@ void pyb_switch_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
mp_printf(print, "Switch(%u)", SWITCH_ID(self));
}
-STATIC mp_obj_t pyb_switch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_switch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
mp_int_t sw_id = mp_obj_get_int(args[0]);
if (!(1 <= sw_id && sw_id <= NUM_SWITCH)) {
@@ -58,18 +58,18 @@ mp_obj_t pyb_switch_value(mp_obj_t self_in) {
pyb_switch_obj_t *self = self_in;
return switch_get(SWITCH_ID(self)) ? mp_const_true : mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_switch_value_obj, pyb_switch_value);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_switch_value_obj, pyb_switch_value);
mp_obj_t pyb_switch_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
return pyb_switch_value(self_in);
}
-STATIC const mp_rom_map_elem_t pyb_switch_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_switch_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pyb_switch_value_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_switch_locals_dict, pyb_switch_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_switch_locals_dict, pyb_switch_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_switch_type,
diff --git a/ports/qemu-arm/modmachine.c b/ports/qemu-arm/modmachine.c
index 72eaad6eab..5f6db937c3 100644
--- a/ports/qemu-arm/modmachine.c
+++ b/ports/qemu-arm/modmachine.c
@@ -30,6 +30,6 @@
// This variable is needed for machine.soft_reset(), but the variable is otherwise unused.
int pyexec_system_exit = 0;
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
// Do nothing.
}
diff --git a/ports/renesas-ra/boardctrl.c b/ports/renesas-ra/boardctrl.c
index b6f0a90938..6459c029a7 100644
--- a/ports/renesas-ra/boardctrl.c
+++ b/ports/renesas-ra/boardctrl.c
@@ -32,7 +32,7 @@
#include "led.h"
#include "usrsw.h"
-STATIC void flash_error(int n) {
+static void flash_error(int n) {
for (int i = 0; i < n; i++) {
led_state(RA_LED1, 1);
mp_hal_delay_ms(250);
@@ -42,7 +42,7 @@ STATIC void flash_error(int n) {
}
#if !MICROPY_HW_USES_BOOTLOADER
-STATIC uint update_reset_mode(uint reset_mode) {
+static uint update_reset_mode(uint reset_mode) {
#if MICROPY_HW_HAS_SWITCH
bool press_status;
diff --git a/ports/renesas-ra/extint.c b/ports/renesas-ra/extint.c
index 915c23e3cd..f1d445346d 100644
--- a/ports/renesas-ra/extint.c
+++ b/ports/renesas-ra/extint.c
@@ -91,8 +91,8 @@ typedef struct {
mp_int_t irq_no;
} extint_obj_t;
-STATIC uint8_t pyb_extint_mode[EXTI_NUM_VECTORS];
-STATIC bool pyb_extint_hard_irq[EXTI_NUM_VECTORS];
+static uint8_t pyb_extint_mode[EXTI_NUM_VECTORS];
+static bool pyb_extint_hard_irq[EXTI_NUM_VECTORS];
// The callback arg is a small-int or a ROM Pin object, so no need to scan by GC
mp_obj_t pyb_extint_callback_arg[EXTI_NUM_VECTORS];
@@ -270,7 +270,7 @@ void extint_trigger_mode(uint line, uint32_t mode) {
/// \method irq_no()
/// Return the irq_no number that the pin is mapped to.
-STATIC mp_obj_t extint_obj_irq_no(mp_obj_t self_in) {
+static mp_obj_t extint_obj_irq_no(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t irq_no;
bool find = ra_icu_find_irq_no(self->pin_idx, &irq_no);
@@ -280,45 +280,45 @@ STATIC mp_obj_t extint_obj_irq_no(mp_obj_t self_in) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_irq_no_obj, extint_obj_irq_no);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_irq_no_obj, extint_obj_irq_no);
/// \method enable()
/// Enable a disabled interrupt.
-STATIC mp_obj_t extint_obj_enable(mp_obj_t self_in) {
+static mp_obj_t extint_obj_enable(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
ra_icu_enable_pin(self->pin_idx);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_enable_obj, extint_obj_enable);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_enable_obj, extint_obj_enable);
/// \method disable()
/// Disable the interrupt associated with the ExtInt object.
/// This could be useful for debouncing.
-STATIC mp_obj_t extint_obj_disable(mp_obj_t self_in) {
+static mp_obj_t extint_obj_disable(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
ra_icu_disable_pin(self->pin_idx);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_disable_obj, extint_obj_disable);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_disable_obj, extint_obj_disable);
/// \method swint()
/// Trigger the callback from software.
-STATIC mp_obj_t extint_obj_swint(mp_obj_t self_in) {
+static mp_obj_t extint_obj_swint(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
ra_icu_swint(self->irq_no);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_swint_obj, extint_obj_swint);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_swint_obj, extint_obj_swint);
// TODO document as a staticmethod
/// \classmethod regs()
/// Dump the values of the EXTI registers.
-STATIC mp_obj_t extint_regs(void) {
+static mp_obj_t extint_regs(void) {
printf("Not Implemented\n");
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(extint_regs_fun_obj, extint_regs);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(extint_regs_obj, MP_ROM_PTR(&extint_regs_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_0(extint_regs_fun_obj, extint_regs);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(extint_regs_obj, MP_ROM_PTR(&extint_regs_fun_obj));
/// \classmethod \constructor(pin, mode, pull, callback)
/// Create an ExtInt object:
@@ -335,7 +335,7 @@ STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(extint_regs_obj, MP_ROM_PTR(&extint_regs
/// - `callback` is the function to call when the interrupt triggers. The
/// callback function must accept exactly 1 argument, which is the irq_no that
/// triggered the interrupt.
-STATIC const mp_arg_t pyb_extint_make_new_args[] = {
+static const mp_arg_t pyb_extint_make_new_args[] = {
{ MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_pull, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
@@ -343,7 +343,7 @@ STATIC const mp_arg_t pyb_extint_make_new_args[] = {
};
#define PYB_EXTINT_MAKE_NEW_NUM_ARGS MP_ARRAY_SIZE(pyb_extint_make_new_args)
-STATIC mp_obj_t extint_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t extint_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// type_in == extint_obj_type
// parse args
@@ -358,12 +358,12 @@ STATIC mp_obj_t extint_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(self);
}
-STATIC void extint_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void extint_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<ExtInt irq_no=%u>", self->irq_no);
}
-STATIC const mp_rom_map_elem_t extint_locals_dict_table[] = {
+static const mp_rom_map_elem_t extint_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_irq_no), MP_ROM_PTR(&extint_obj_irq_no_obj) },
{ MP_ROM_QSTR(MP_QSTR_line), MP_ROM_PTR(&extint_obj_irq_no_obj) },
{ MP_ROM_QSTR(MP_QSTR_enable), MP_ROM_PTR(&extint_obj_enable_obj) },
@@ -372,7 +372,7 @@ STATIC const mp_rom_map_elem_t extint_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_regs), MP_ROM_PTR(&extint_regs_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(extint_locals_dict, extint_locals_dict_table);
+static MP_DEFINE_CONST_DICT(extint_locals_dict, extint_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
extint_type,
diff --git a/ports/renesas-ra/flashbdev.c b/ports/renesas-ra/flashbdev.c
index c213ed8f9b..c3c252232c 100644
--- a/ports/renesas-ra/flashbdev.c
+++ b/ports/renesas-ra/flashbdev.c
@@ -66,7 +66,7 @@ extern uint8_t _micropy_hw_internal_flash_storage_end;
#error "no internal flash storage support for this MCU"
#endif
-STATIC byte flash_cache_mem[FLASH_SECTOR_SIZE_MAX] __attribute__((aligned(16)));
+static byte flash_cache_mem[FLASH_SECTOR_SIZE_MAX] __attribute__((aligned(16)));
#define CACHE_MEM_START_ADDR (&flash_cache_mem[0])
#if !defined(FLASH_MEM_SEG2_START_ADDR)
diff --git a/ports/renesas-ra/irq.c b/ports/renesas-ra/irq.c
index fdaf2385cc..3bef1712fc 100644
--- a/ports/renesas-ra/irq.c
+++ b/ports/renesas-ra/irq.c
@@ -36,7 +36,7 @@ uint32_t irq_stats[IRQ_STATS_MAX] = {0};
// disable_irq()
// Disable interrupt requests.
// Returns the previous IRQ state which can be passed to enable_irq.
-STATIC mp_obj_t machine_disable_irq(void) {
+static mp_obj_t machine_disable_irq(void) {
return mp_obj_new_bool(disable_irq() == IRQ_STATE_ENABLED);
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
@@ -44,7 +44,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
// enable_irq(state=True)
// Enable interrupt requests, based on the argument, which is usually the
// value returned by a previous call to disable_irq.
-STATIC mp_obj_t machine_enable_irq(uint n_args, const mp_obj_t *arg) {
+static mp_obj_t machine_enable_irq(uint n_args, const mp_obj_t *arg) {
enable_irq((n_args == 0 || mp_obj_is_true(arg[0])) ? IRQ_STATE_ENABLED : IRQ_STATE_DISABLED);
return mp_const_none;
}
@@ -52,7 +52,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_enable_irq_obj, 0, 1, machine_enable
#if IRQ_ENABLE_STATS
// return a memoryview of the irq statistics array
-STATIC mp_obj_t pyb_irq_stats(void) {
+static mp_obj_t pyb_irq_stats(void) {
return mp_obj_new_memoryview(0x80 | 'I', MP_ARRAY_SIZE(irq_stats), &irq_stats[0]);
}
MP_DEFINE_CONST_FUN_OBJ_0(pyb_irq_stats_obj, pyb_irq_stats);
diff --git a/ports/renesas-ra/led.c b/ports/renesas-ra/led.c
index a2284c5339..c52cd50e78 100644
--- a/ports/renesas-ra/led.c
+++ b/ports/renesas-ra/led.c
@@ -51,7 +51,7 @@ typedef struct _ra_led_obj_t {
const machine_pin_obj_t *led_pin;
} ra_led_obj_t;
-STATIC const ra_led_obj_t ra_led_obj[] = {
+static const ra_led_obj_t ra_led_obj[] = {
{{&ra_led_type}, 1, MICROPY_HW_LED1},
#if defined(MICROPY_HW_LED2)
{{&ra_led_type}, 2, MICROPY_HW_LED2},
@@ -118,7 +118,7 @@ void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t ki
/// Create an LED object associated with the given LED:
///
/// - `id` is the LED number, 1-4.
-STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -158,17 +158,17 @@ mp_obj_t led_obj_toggle(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
-STATIC const mp_rom_map_elem_t led_locals_dict_table[] = {
+static const mp_rom_map_elem_t led_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&led_obj_on_obj) },
{ MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&led_obj_off_obj) },
{ MP_ROM_QSTR(MP_QSTR_toggle), MP_ROM_PTR(&led_obj_toggle_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
+static MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
ra_led_type,
diff --git a/ports/renesas-ra/machine_adc.c b/ports/renesas-ra/machine_adc.c
index 4ba30dff01..c617b69658 100644
--- a/ports/renesas-ra/machine_adc.c
+++ b/ports/renesas-ra/machine_adc.c
@@ -70,14 +70,14 @@ typedef struct _machine_adc_obj_t {
uint32_t sample_time;
} machine_adc_obj_t;
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t resolution = (uint8_t)ra_adc_get_resolution();
mp_printf(print, "<ADC%u channel=%u>", resolution, self->channel);
}
// ADC(id)
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Check number of arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -110,11 +110,11 @@ STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_int_t mp_machine_adc_read(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read(machine_adc_obj_t *self) {
return ra_adc_read((uint32_t)(self->pin));
}
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
mp_uint_t raw = (mp_uint_t)ra_adc_read((uint32_t)(self->pin));
mp_int_t bits = (mp_int_t)ra_adc_get_resolution();
// Scale raw reading to 16 bit value using a Taylor expansion (for 8 <= bits <= 16)
diff --git a/ports/renesas-ra/machine_dac.c b/ports/renesas-ra/machine_dac.c
index 0d9c779497..5889fca1c2 100644
--- a/ports/renesas-ra/machine_dac.c
+++ b/ports/renesas-ra/machine_dac.c
@@ -43,7 +43,7 @@ typedef struct _machine_dac_obj_t {
mp_hal_pin_obj_t dac;
} machine_dac_obj_t;
-STATIC machine_dac_obj_t machine_dac_obj[] = {
+static machine_dac_obj_t machine_dac_obj[] = {
#if defined(MICROPY_HW_DAC0)
{{&machine_dac_type}, 0, 0, 0, MICROPY_HW_DAC0},
#endif
@@ -52,12 +52,12 @@ STATIC machine_dac_obj_t machine_dac_obj[] = {
#endif
};
-STATIC void machine_dac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_dac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_dac_obj_t *self = MP_OBJ_TO_PTR(self_in); // const char *qstr_str(qstr q);
mp_printf(print, "DAC(DA%d [#%d], active=%u, out=%u mV)", self->ch, self->dac->pin, self->active, self->mv);
}
-STATIC mp_obj_t machine_dac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_dac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_hal_pin_obj_t pin_id = MP_OBJ_NULL;
machine_dac_obj_t *self = MP_OBJ_NULL;
@@ -99,7 +99,7 @@ STATIC mp_obj_t machine_dac_make_new(const mp_obj_type_t *type, size_t n_args, s
}
// DAC.deinit()
-STATIC mp_obj_t machine_dac_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_dac_deinit(mp_obj_t self_in) {
machine_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
ra_dac_deinit(self->dac->pin, self->ch);
@@ -108,10 +108,10 @@ STATIC mp_obj_t machine_dac_deinit(mp_obj_t self_in) {
self->mv = 0;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_dac_deinit_obj, machine_dac_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_dac_deinit_obj, machine_dac_deinit);
// DAC.write(value)
-STATIC mp_obj_t machine_dac_write(mp_obj_t self_in, mp_obj_t data) { // mp_obj_t value_in
+static mp_obj_t machine_dac_write(mp_obj_t self_in, mp_obj_t data) { // mp_obj_t value_in
machine_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t value = mp_obj_get_int(data);
@@ -124,18 +124,18 @@ STATIC mp_obj_t machine_dac_write(mp_obj_t self_in, mp_obj_t data) { // mp_obj_t
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_dac_write_obj, machine_dac_write);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_dac_write_obj, machine_dac_write);
// DAC.read()
-STATIC mp_obj_t machine_dac_read(mp_obj_t self_in) {
+static mp_obj_t machine_dac_read(mp_obj_t self_in) {
machine_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(ra_dac_read(self->ch));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_dac_read_obj, machine_dac_read);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_dac_read_obj, machine_dac_read);
// DAC.write_mv(Vout)
-STATIC mp_obj_t machine_dac_write_mv(mp_obj_t self_in, mp_obj_t data) { // mp_obj_t self_in, mp_obj_t value_in
+static mp_obj_t machine_dac_write_mv(mp_obj_t self_in, mp_obj_t data) { // mp_obj_t self_in, mp_obj_t value_in
machine_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t Vout = mp_obj_get_int(data);
@@ -149,19 +149,19 @@ STATIC mp_obj_t machine_dac_write_mv(mp_obj_t self_in, mp_obj_t data) { // mp_o
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_dac_write_mv_obj, machine_dac_write_mv);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_dac_write_mv_obj, machine_dac_write_mv);
// DAC.read_mv()
-STATIC mp_obj_t machine_dac_read_mv(mp_obj_t self_in) {
+static mp_obj_t machine_dac_read_mv(mp_obj_t self_in) {
machine_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(self->mv);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_dac_read_mv_obj, machine_dac_read_mv);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_dac_read_mv_obj, machine_dac_read_mv);
// MP_DEFINE_CONST_FUN_OBJ_2(mp_machine_dac_write_obj, mp_machine_dac_write);
-STATIC const mp_rom_map_elem_t machine_dac_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_dac_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_dac_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&machine_dac_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&machine_dac_write_obj) },
@@ -169,7 +169,7 @@ STATIC const mp_rom_map_elem_t machine_dac_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write_mv), MP_ROM_PTR(&machine_dac_write_mv_obj) }
};
-STATIC MP_DEFINE_CONST_DICT(machine_dac_locals_dict, machine_dac_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_dac_locals_dict, machine_dac_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_dac_type,
diff --git a/ports/renesas-ra/machine_i2c.c b/ports/renesas-ra/machine_i2c.c
index dc14be9594..63bc4a4ec4 100644
--- a/ports/renesas-ra/machine_i2c.c
+++ b/ports/renesas-ra/machine_i2c.c
@@ -49,7 +49,7 @@ typedef struct _machine_i2c_obj_t {
uint32_t freq;
} machine_i2c_obj_t;
-STATIC machine_i2c_obj_t machine_i2c_obj[] = {
+static machine_i2c_obj_t machine_i2c_obj[] = {
#if defined(MICROPY_HW_I2C0_SCL)
{{&machine_i2c_type}, R_IIC0, 0, MICROPY_HW_I2C0_SCL, MICROPY_HW_I2C0_SDA, 0},
#endif
@@ -61,10 +61,10 @@ STATIC machine_i2c_obj_t machine_i2c_obj[] = {
#endif
};
-STATIC int i2c_read(machine_i2c_obj_t *self, uint16_t addr, uint8_t *dest, size_t len, bool stop);
-STATIC int i2c_write(machine_i2c_obj_t *self, uint16_t addr, const uint8_t *src, size_t len, bool stop);
+static int i2c_read(machine_i2c_obj_t *self, uint16_t addr, uint8_t *dest, size_t len, bool stop);
+static int i2c_write(machine_i2c_obj_t *self, uint16_t addr, const uint8_t *src, size_t len, bool stop);
-STATIC int i2c_read(machine_i2c_obj_t *self, uint16_t addr, uint8_t *dest, size_t len, bool stop) {
+static int i2c_read(machine_i2c_obj_t *self, uint16_t addr, uint8_t *dest, size_t len, bool stop) {
bool flag;
xaction_t action;
xaction_unit_t unit;
@@ -74,7 +74,7 @@ STATIC int i2c_read(machine_i2c_obj_t *self, uint16_t addr, uint8_t *dest, size_
return flag? len:-1;
}
-STATIC int i2c_write(machine_i2c_obj_t *self, uint16_t addr, const uint8_t *src, size_t len, bool stop) {
+static int i2c_write(machine_i2c_obj_t *self, uint16_t addr, const uint8_t *src, size_t len, bool stop) {
bool flag;
xaction_t action;
xaction_unit_t unit;
@@ -86,18 +86,18 @@ STATIC int i2c_write(machine_i2c_obj_t *self, uint16_t addr, const uint8_t *src,
// MicroPython bindings for machine API
-STATIC void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "I2C(%u, freq=%u, scl=%q, sda=%q)",
self->i2c_id, self->freq, self->scl->name, self->sda->name);
}
-STATIC void machine_i2c_init(mp_obj_base_t *obj, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_i2c_init(mp_obj_base_t *obj, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_raise_NotImplementedError(MP_ERROR_TEXT("init is not supported."));
return;
}
-STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// parse args
enum { ARG_id, ARG_freq, ARG_scl, ARG_sda };
static const mp_arg_t allowed_args[] = {
@@ -136,7 +136,7 @@ STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, s
return MP_OBJ_FROM_PTR(self);
}
-STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
+static int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
int ret;
bool stop;
@@ -149,7 +149,7 @@ STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, si
return ret;
}
-STATIC const mp_machine_i2c_p_t machine_i2c_p = {
+static const mp_machine_i2c_p_t machine_i2c_p = {
.init = machine_i2c_init,
.transfer = mp_machine_i2c_transfer_adaptor,
.transfer_single = machine_i2c_transfer_single,
diff --git a/ports/renesas-ra/machine_pin.c b/ports/renesas-ra/machine_pin.c
index e11188118c..e8802b2e7a 100644
--- a/ports/renesas-ra/machine_pin.c
+++ b/ports/renesas-ra/machine_pin.c
@@ -71,7 +71,7 @@ const machine_pin_obj_t *machine_pin_find(mp_obj_t user_obj) {
}
/// Return a string describing the pin object.
-STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
// pin name
@@ -142,7 +142,7 @@ STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
}
// pin.init(mode=-1, pull=-1, *, value=None, drive=0, alt=-1)
-STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_pull, ARG_value, ARG_drive, ARG_alt };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE}},
@@ -222,7 +222,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
}
// fast method for getting/setting pin value
-STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (n_args == 0) {
@@ -236,35 +236,35 @@ STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, c
}
// pin.init(mode, pull)
-STATIC mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_init_obj, 1, machine_pin_obj_init);
// pin.value([value])
-STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
return machine_pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
// pin.low()
-STATIC mp_obj_t machine_pin_low(mp_obj_t self_in) {
+static mp_obj_t machine_pin_low(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_hal_pin_write(self, false);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_low_obj, machine_pin_low);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_low_obj, machine_pin_low);
// pin.high()
-STATIC mp_obj_t machine_pin_high(mp_obj_t self_in) {
+static mp_obj_t machine_pin_high(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_hal_pin_write(self, true);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_high_obj, machine_pin_high);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_high_obj, machine_pin_high);
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING, hard=False)
-STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -288,9 +288,9 @@ STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
// TODO should return an IRQ object
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
-STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&machine_pin_value_obj) },
@@ -323,9 +323,9 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_LOW_LEVEL), MP_ROM_INT(MP_HAL_PIN_TRIGGER_LOWLEVEL) },
{ MP_ROM_QSTR(MP_QSTR_IRQ_HIGH_LEVEL), MP_ROM_INT(MP_HAL_PIN_TRIGGER_HIGHLEVEL) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
-STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -341,7 +341,7 @@ STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return -1;
}
-STATIC const mp_pin_p_t machine_pin_pin_p = {
+static const mp_pin_p_t machine_pin_pin_p = {
.ioctl = machine_pin_ioctl,
};
diff --git a/ports/renesas-ra/machine_pwm.c b/ports/renesas-ra/machine_pwm.c
index 69dc5bad59..3044367a2e 100644
--- a/ports/renesas-ra/machine_pwm.c
+++ b/ports/renesas-ra/machine_pwm.c
@@ -44,7 +44,7 @@ typedef struct _machine_pwm_obj_t {
mp_hal_pin_obj_t pwm;
} machine_pwm_obj_t;
-STATIC machine_pwm_obj_t machine_pwm_obj[] = {
+static machine_pwm_obj_t machine_pwm_obj[] = {
#if defined(MICROPY_HW_PWM_0A)
{{&machine_pwm_type}, R_GPT0, 0, 0, 'A', 0, 0ul, MICROPY_HW_PWM_0A},
#endif
@@ -134,12 +134,12 @@ STATIC machine_pwm_obj_t machine_pwm_obj[] = {
/******************************************************************************/
// MicroPython bindings for PWM
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "PWM(GTIOC %d%c[#%d], active=%u, freq=%u, duty=%u)", self->ch, self->id, self->pwm->pin, self->active, self->freq, self->duty);
}
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
uint32_t D = 0ul;
enum { ARG_freq, ARG_duty };
@@ -178,7 +178,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, c
}
}
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_hal_pin_obj_t pin_id = MP_OBJ_NULL;
machine_pwm_obj_t *self = MP_OBJ_NULL;
@@ -223,7 +223,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
ra_gpt_timer_deinit(self->pwm->pin, self->ch, self->id);
self->active = 0;
self->ch = 0;
@@ -232,11 +232,11 @@ STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
self->freq = 0;
}
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT((uint32_t)ra_gpt_timer_get_freq(self->ch));
}
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
if (freq) {
ra_gpt_timer_set_freq(self->ch, (float)freq);
self->freq = (uint32_t)ra_gpt_timer_get_freq(self->ch);
@@ -255,13 +255,13 @@ STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
}
}
-STATIC mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get(machine_pwm_obj_t *self) {
// give the result in %
uint64_t Dc = ra_gpt_timer_get_duty(self->ch, self->id) * 100;
return MP_OBJ_NEW_SMALL_INT(Dc / ra_gpt_timer_get_period(self->ch));
}
-STATIC void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
+static void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
// assume duty is in %
if (duty < 0 || duty > 100) {
mp_raise_ValueError(MP_ERROR_TEXT("duty should be 0-100"));
@@ -286,13 +286,13 @@ STATIC void mp_machine_pwm_duty_set(machine_pwm_obj_t *self, mp_int_t duty) {
}
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
// give the result in ratio (u16 / 65535)
uint64_t Dc = ra_gpt_timer_get_duty(self->ch, self->id) * 65535;
return MP_OBJ_NEW_SMALL_INT(Dc / ra_gpt_timer_get_period(self->ch));
}
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
// assume duty is a ratio (u16 / 65535)
if (duty_u16 < 0 || duty_u16 > 65535) {
mp_raise_ValueError(MP_ERROR_TEXT("duty should be 0-65535"));
@@ -317,14 +317,14 @@ STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u
}
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
// give the result in ns
float ns = ra_gpt_timer_tick_time(self->ch);
ns *= (float)ra_gpt_timer_get_duty(self->ch, self->id);
return MP_OBJ_NEW_SMALL_INT(ns);
}
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
// assume duty is ns
uint32_t ns_min = (uint32_t)ra_gpt_timer_tick_time(self->ch);
uint32_t ns_max = ns_min * ra_gpt_timer_get_period(self->ch);
diff --git a/ports/renesas-ra/machine_rtc.c b/ports/renesas-ra/machine_rtc.c
index 6637ea44cc..853b0e8fcb 100644
--- a/ports/renesas-ra/machine_rtc.c
+++ b/ports/renesas-ra/machine_rtc.c
@@ -62,11 +62,11 @@
// it's a bit of a hack at the moment
static mp_uint_t rtc_info;
-STATIC uint32_t rtc_startup_tick;
-STATIC bool rtc_need_init_finalise = false;
-STATIC uint32_t rtc_wakeup_param;
+static uint32_t rtc_startup_tick;
+static bool rtc_need_init_finalise = false;
+static uint32_t rtc_wakeup_param;
-STATIC void rtc_calendar_config(void) {
+static void rtc_calendar_config(void) {
ra_rtc_t tm;
tm.year = RTC_INIT_YEAR - 2000;
tm.month = RTC_INIT_MONTH;
@@ -155,11 +155,11 @@ typedef struct _machine_rtc_obj_t {
mp_obj_base_t base;
} machine_rtc_obj_t;
-STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
+static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
/// \classmethod \constructor()
/// Create an RTC object.
-STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -333,14 +333,14 @@ mp_obj_t machine_rtc_calibration(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_calibration_obj, 1, 2, machine_rtc_calibration);
-STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_rtc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&machine_rtc_info_obj) },
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) },
{ MP_ROM_QSTR(MP_QSTR_wakeup), MP_ROM_PTR(&machine_rtc_wakeup_obj) },
{ MP_ROM_QSTR(MP_QSTR_calibration), MP_ROM_PTR(&machine_rtc_calibration_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
diff --git a/ports/renesas-ra/machine_sdcard.c b/ports/renesas-ra/machine_sdcard.c
index 2ed0d66535..ec3033a8a3 100644
--- a/ports/renesas-ra/machine_sdcard.c
+++ b/ports/renesas-ra/machine_sdcard.c
@@ -47,7 +47,7 @@ typedef struct _machine_sdcard_obj_t {
uint32_t block_count;
} machine_sdcard_obj_t;
-STATIC machine_sdcard_obj_t machine_sdcard_objs[] = {
+static machine_sdcard_obj_t machine_sdcard_objs[] = {
{{&machine_sdcard_type}, {false, false, false}, 0, 0}
};
@@ -78,7 +78,7 @@ void sdhi_ISR(sdmmc_callback_args_t *p_args) {
}
}
-STATIC mp_obj_t machine_sdcard_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_sdcard_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
fsp_err_t err = FSP_SUCCESS;
machine_sdcard_obj_t *self = mp_const_none;
@@ -117,9 +117,9 @@ STATIC mp_obj_t machine_sdcard_init(size_t n_args, const mp_obj_t *pos_args, mp_
return MP_OBJ_FROM_PTR(self);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_sdcard_init_obj, 1, machine_sdcard_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_sdcard_init_obj, 1, machine_sdcard_init);
-STATIC mp_obj_t sdcard_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t sdcard_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
mp_map_t kw_args;
mp_arg_check_num(n_args, n_kw, 0, 0, true);
@@ -128,17 +128,17 @@ STATIC mp_obj_t sdcard_obj_make_new(const mp_obj_type_t *type, size_t n_args, si
}
// deinit()
-STATIC mp_obj_t machine_sdcard_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_sdcard_deinit(mp_obj_t self_in) {
machine_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
R_SDHI_Close(&g_sdmmc0_ctrl);
self->block_count = self->block_len = 0;
self->status.card_inserted = self->status.initialized = self->status.transfer_in_progress = false;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_deinit_obj, machine_sdcard_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_deinit_obj, machine_sdcard_deinit);
// present()
-STATIC mp_obj_t machine_sdcard_present(mp_obj_t self_in) {
+static mp_obj_t machine_sdcard_present(mp_obj_t self_in) {
fsp_err_t err = FSP_SUCCESS;
machine_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
if ((err = R_SDHI_StatusGet(&g_sdmmc0_ctrl, &self->status)) == FSP_SUCCESS) {
@@ -147,9 +147,9 @@ STATIC mp_obj_t machine_sdcard_present(mp_obj_t self_in) {
mp_raise_msg_varg(&mp_type_OSError, MP_ERROR_TEXT("can't get SDHI Status, %d"), err);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_present_obj, machine_sdcard_present);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_present_obj, machine_sdcard_present);
-STATIC mp_obj_t machine_sdcard_info(mp_obj_t self_in) {
+static mp_obj_t machine_sdcard_info(mp_obj_t self_in) {
machine_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->status.card_inserted && self->status.initialized) {
@@ -165,10 +165,10 @@ STATIC mp_obj_t machine_sdcard_info(mp_obj_t self_in) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_info_obj, machine_sdcard_info);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_sdcard_info_obj, machine_sdcard_info);
// readblocks(block_num, buf)
-STATIC mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
machine_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
@@ -188,10 +188,10 @@ STATIC mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num,
return MP_OBJ_NEW_SMALL_INT(-MP_EIO);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_readblocks_obj, machine_sdcard_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_readblocks_obj, machine_sdcard_readblocks);
// writeblocks(block_num, buf)
-STATIC mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
machine_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
@@ -211,10 +211,10 @@ STATIC mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num,
return MP_OBJ_NEW_SMALL_INT(-MP_EIO);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_writeblocks_obj, machine_sdcard_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_writeblocks_obj, machine_sdcard_writeblocks);
// ioctl(op, arg)
-STATIC mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
machine_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
@@ -313,9 +313,9 @@ STATIC mp_obj_t machine_sdcard_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t
break;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_ioctl_obj, machine_sdcard_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(machine_sdcard_ioctl_obj, machine_sdcard_ioctl);
-STATIC const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
+static const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_sdcard_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_sdcard_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_present), MP_ROM_PTR(&machine_sdcard_present_obj) },
@@ -325,7 +325,7 @@ STATIC const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&machine_sdcard_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&machine_sdcard_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(sdcard_locals_dict, sdcard_locals_dict_table);
+static MP_DEFINE_CONST_DICT(sdcard_locals_dict, sdcard_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_sdcard_type,
diff --git a/ports/renesas-ra/machine_spi.c b/ports/renesas-ra/machine_spi.c
index 04505178da..06a5a8fc4f 100644
--- a/ports/renesas-ra/machine_spi.c
+++ b/ports/renesas-ra/machine_spi.c
@@ -66,7 +66,7 @@ typedef struct _machine_hard_spi_obj_t {
/******************************************************************************/
// Implementation of hard SPI for machine module
-STATIC machine_hard_spi_obj_t machine_hard_spi_obj[] = {
+static machine_hard_spi_obj_t machine_hard_spi_obj[] = {
#if defined(MICROPY_HW_SPI0_RSPCK)
{
{&machine_spi_type}, 0,
@@ -85,7 +85,7 @@ STATIC machine_hard_spi_obj_t machine_hard_spi_obj[] = {
#endif
};
-STATIC void spi_init(machine_hard_spi_obj_t *self) {
+static void spi_init(machine_hard_spi_obj_t *self) {
const machine_pin_obj_t *pins[4] = { NULL, NULL, NULL, NULL };
if (0) {
@@ -126,7 +126,7 @@ STATIC void spi_init(machine_hard_spi_obj_t *self) {
ra_spi_init(self->spi_id, pins[3]->pin, pins[2]->pin, pins[1]->pin, pins[0]->pin, self->baudrate, self->bits, self->polarity, self->phase, self->firstbit);
}
-STATIC void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "SPI(%u, baudrate=%u, polarity=%u, phase=%u, bits=%u, firstbit=%u, sck=%q, mosi=%q, miso=%q)",
self->spi_id, self->baudrate, self->polarity, self->phase, self->bits,
@@ -233,7 +233,7 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t *)self_in;
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_sck, ARG_mosi, ARG_miso };
@@ -315,17 +315,17 @@ STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const m
spi_init(self);
}
-STATIC void machine_hard_spi_deinit(mp_obj_base_t *self_in) {
+static void machine_hard_spi_deinit(mp_obj_base_t *self_in) {
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t *)self_in;
spi_deinit(self->spi_id);
}
-STATIC void machine_hard_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_hard_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t *)self_in;
spi_transfer(self->spi_id, self->bits, len, src, dest, SPI_TRANSFER_TIMEOUT(len));
}
-STATIC const mp_machine_spi_p_t machine_hard_spi_p = {
+static const mp_machine_spi_p_t machine_hard_spi_p = {
.init = machine_hard_spi_init,
.deinit = machine_hard_spi_deinit,
.transfer = machine_hard_spi_transfer,
diff --git a/ports/renesas-ra/machine_uart.c b/ports/renesas-ra/machine_uart.c
index 6c520f941f..26ed625404 100644
--- a/ports/renesas-ra/machine_uart.c
+++ b/ports/renesas-ra/machine_uart.c
@@ -42,9 +42,9 @@
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_INT(UART_HWCONTROL_RTS) }, \
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_INT(UART_HWCONTROL_CTS) }, \
-STATIC const char *_parity_name[] = {"None", "ODD", "EVEN"};
+static const char *_parity_name[] = {"None", "ODD", "EVEN"};
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (!self->is_enabled) {
mp_printf(print, "UART(%u)", self->uart_id);
@@ -82,7 +82,7 @@ STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_
/// - `timeout_char` is the timeout in milliseconds to wait between characters.
/// - `flow` is RTS | CTS where RTS == 256, CTS == 512
/// - `read_buf_len` is the character length of the read buffer (0 to disable).
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_INT | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_bits, MP_ARG_INT, {.u_int = 8} },
@@ -221,7 +221,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
/// - `UART(6)` is on `YA`: `(TX, RX) = (Y1, Y2) = (PC6, PC7)`
/// - `UART(3)` is on `YB`: `(TX, RX) = (Y9, Y10) = (PB10, PB11)`
/// - `UART(2)` is on: `(TX, RX) = (X3, X4) = (PA2, PA3)`
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -306,27 +306,27 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
}
// Turn off the UART bus.
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
uart_deinit(self);
}
// Return number of characters waiting.
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
return uart_rx_any(self);
}
// Return `true` if all characters have been sent.
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
return !uart_tx_busy(self);
}
// Send a break condition.
-STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
+static void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
ra_sci_tx_break((uint32_t)self->uart_id);
}
// Write a single character on the bus. `data` is an integer to write.
-STATIC void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
+static void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
int errcode;
if (uart_tx_wait(self, self->timeout)) {
uart_tx_data(self, &data, 1, &errcode);
@@ -341,7 +341,7 @@ STATIC void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
// Receive a single character on the bus.
// Return value: The character read, as an integer. Returns -1 on timeout.
-STATIC mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
if (uart_rx_wait(self, self->timeout)) {
return uart_rx_char(self);
} else {
@@ -350,7 +350,7 @@ STATIC mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
}
}
-STATIC mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args, mp_arg_val_t *args) {
+static mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args, mp_arg_val_t *args) {
if (self->mp_irq_obj == NULL) {
self->mp_irq_trigger = 0;
self->mp_irq_obj = mp_irq_new(&uart_irq_methods, MP_OBJ_FROM_PTR(self));
@@ -381,7 +381,7 @@ STATIC mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args
return self->mp_irq_obj;
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
byte *buf = buf_in;
@@ -423,7 +423,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
}
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
const byte *buf = buf_in;
@@ -452,7 +452,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
}
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
diff --git a/ports/renesas-ra/main.c b/ports/renesas-ra/main.c
index 5925606f9c..febb7b6d7a 100644
--- a/ports/renesas-ra/main.c
+++ b/ports/renesas-ra/main.c
@@ -77,15 +77,15 @@
#define RA_EARLY_PRINT 1 /* for enabling mp_print in boardctrl. */
#if MICROPY_PY_THREAD
-STATIC pyb_thread_t pyb_thread_main;
+static pyb_thread_t pyb_thread_main;
#endif
#if defined(MICROPY_HW_UART_REPL)
#ifndef MICROPY_HW_UART_REPL_RXBUF
#define MICROPY_HW_UART_REPL_RXBUF (260)
#endif
-STATIC machine_uart_obj_t machine_uart_repl_obj;
-STATIC uint8_t machine_uart_repl_rxbuf[MICROPY_HW_UART_REPL_RXBUF];
+static machine_uart_obj_t machine_uart_repl_obj;
+static uint8_t machine_uart_repl_rxbuf[MICROPY_HW_UART_REPL_RXBUF];
#endif
void NORETURN __fatal_error(const char *msg) {
@@ -126,7 +126,7 @@ void MP_WEAK __assert_func(const char *file, int line, const char *func, const c
}
#endif
-STATIC mp_obj_t pyb_main(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_main(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_opt, MP_ARG_INT, {.u_int = 0} }
};
@@ -147,7 +147,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(pyb_main_obj, 1, pyb_main);
#if MICROPY_HW_FLASH_MOUNT_AT_BOOT
// avoid inlining to avoid stack usage within main()
-MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
+MP_NOINLINE static bool init_flash_fs(uint reset_mode) {
if (reset_mode == BOARDCTRL_RESET_MODE_FACTORY_FILESYSTEM) {
// Asked by user to reset filesystem
factory_reset_create_filesystem();
diff --git a/ports/renesas-ra/modmachine.c b/ports/renesas-ra/modmachine.c
index 5bfbb919f4..dc38d809dd 100644
--- a/ports/renesas-ra/modmachine.c
+++ b/ports/renesas-ra/modmachine.c
@@ -79,7 +79,7 @@
{ MP_ROM_QSTR(MP_QSTR_DEEPSLEEP_RESET), MP_ROM_INT(PYB_RESET_DEEPSLEEP) }, \
{ MP_ROM_QSTR(MP_QSTR_SOFT_RESET), MP_ROM_INT(PYB_RESET_SOFT) }, \
-STATIC uint32_t reset_cause;
+static uint32_t reset_cause;
void get_unique_id(uint8_t *id) {
uint32_t *p = (uint32_t *)id;
@@ -100,7 +100,7 @@ void machine_deinit(void) {
// machine.info([dump_alloc_table])
// Print out lots of information about the board.
-STATIC mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) {
// get and print unique id; 128 bits
{
uint8_t id[16];
@@ -177,14 +177,14 @@ STATIC mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info);
// Returns a string of 16 bytes (128 bits), which is the unique ID for the MCU.
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
uint8_t id[16];
get_unique_id((uint8_t *)&id);
return mp_obj_new_bytes(id, 16);
}
// Resets the pyboard in a manner similar to pushing the external RESET button.
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
powerctrl_mcu_reset();
}
@@ -209,22 +209,22 @@ NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
}
// get or set the MCU frequencies
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
return mp_obj_new_int(SystemCoreClock);
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_raise_NotImplementedError(MP_ERROR_TEXT("machine.freq set not supported yet"));
}
// idle()
// This executies a wfi machine instruction which reduces power consumption
// of the MCU until an interrupt occurs, at which point execution continues.
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
__WFI();
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
if (n_args != 0) {
mp_obj_t args2[2] = {MP_OBJ_NULL, args[0]};
machine_rtc_wakeup(2, args2);
@@ -232,7 +232,7 @@ STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
powerctrl_enter_stop_mode();
}
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
if (n_args != 0) {
mp_obj_t args2[2] = {MP_OBJ_NULL, args[0]};
machine_rtc_wakeup(2, args2);
@@ -240,6 +240,6 @@ NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
powerctrl_enter_standby_mode();
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
return reset_cause;
}
diff --git a/ports/renesas-ra/modos.c b/ports/renesas-ra/modos.c
index 8fd11007ea..2051e9420f 100644
--- a/ports/renesas-ra/modos.c
+++ b/ports/renesas-ra/modos.c
@@ -46,7 +46,7 @@ void mp_os_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t s
}
#if MICROPY_PY_OS_URANDOM
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -55,5 +55,5 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
#endif
diff --git a/ports/renesas-ra/modtime.c b/ports/renesas-ra/modtime.c
index 1ab51e336d..cbd639721f 100644
--- a/ports/renesas-ra/modtime.c
+++ b/ports/renesas-ra/modtime.c
@@ -29,7 +29,7 @@
#include "rtc.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
// get current date and time
rtc_init_finalise();
ra_rtc_t time;
@@ -48,7 +48,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Returns the number of seconds, as an integer, since the Epoch.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
// get date and time
rtc_init_finalise();
ra_rtc_t time;
diff --git a/ports/renesas-ra/mpbthciport.c b/ports/renesas-ra/mpbthciport.c
index 2e9f6d9166..3fc7e8411f 100644
--- a/ports/renesas-ra/mpbthciport.c
+++ b/ports/renesas-ra/mpbthciport.c
@@ -42,10 +42,10 @@
uint8_t mp_bluetooth_hci_cmd_buf[4 + 256];
-STATIC mp_sched_node_t mp_bluetooth_hci_sched_node;
-STATIC soft_timer_entry_t mp_bluetooth_hci_soft_timer;
+static mp_sched_node_t mp_bluetooth_hci_sched_node;
+static soft_timer_entry_t mp_bluetooth_hci_soft_timer;
-STATIC void mp_bluetooth_hci_soft_timer_callback(soft_timer_entry_t *self) {
+static void mp_bluetooth_hci_soft_timer_callback(soft_timer_entry_t *self) {
mp_bluetooth_hci_poll_now();
}
@@ -58,7 +58,7 @@ void mp_bluetooth_hci_init(void) {
);
}
-STATIC void mp_bluetooth_hci_start_polling(void) {
+static void mp_bluetooth_hci_start_polling(void) {
mp_bluetooth_hci_poll_now();
}
@@ -67,7 +67,7 @@ void mp_bluetooth_hci_poll_in_ms(uint32_t ms) {
}
// For synchronous mode, we run all BLE stack code inside a scheduled task.
-STATIC void run_events_scheduled_task(mp_sched_node_t *node) {
+static void run_events_scheduled_task(mp_sched_node_t *node) {
// This will process all buffered HCI UART data, and run any callouts or events.
mp_bluetooth_hci_poll();
}
diff --git a/ports/renesas-ra/mphalport.c b/ports/renesas-ra/mphalport.c
index 8a8bfd8dc7..7a5bcba2c9 100644
--- a/ports/renesas-ra/mphalport.c
+++ b/ports/renesas-ra/mphalport.c
@@ -47,7 +47,7 @@ void flash_cache_commit(void);
#define MICROPY_HW_STDIN_BUFFER_LEN 512
#endif
-STATIC uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
+static uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
ringbuf_t stdin_ringbuf = { stdin_ringbuf_array, sizeof(stdin_ringbuf_array) };
#endif
diff --git a/ports/renesas-ra/mpthreadport.c b/ports/renesas-ra/mpthreadport.c
index a7d85cfe32..621b4311bf 100644
--- a/ports/renesas-ra/mpthreadport.c
+++ b/ports/renesas-ra/mpthreadport.c
@@ -34,7 +34,7 @@
#if MICROPY_PY_THREAD
// the mutex controls access to the linked list
-STATIC mp_thread_mutex_t thread_mutex;
+static mp_thread_mutex_t thread_mutex;
void mp_thread_init(void) {
mp_thread_mutex_init(&thread_mutex);
diff --git a/ports/renesas-ra/pybthread.c b/ports/renesas-ra/pybthread.c
index 603bc2e4ec..cf3f4bc2e5 100644
--- a/ports/renesas-ra/pybthread.c
+++ b/ports/renesas-ra/pybthread.c
@@ -88,7 +88,7 @@ void pyb_thread_deinit() {
enable_irq(irq_state);
}
-STATIC void pyb_thread_terminate(void) {
+static void pyb_thread_terminate(void) {
uint32_t irq_state = disable_irq();
pyb_thread_t *thread = pyb_thread_cur;
// take current thread off the run list
diff --git a/ports/renesas-ra/ra_it.c b/ports/renesas-ra/ra_it.c
index de5a4e8daa..71a5a66967 100644
--- a/ports/renesas-ra/ra_it.c
+++ b/ports/renesas-ra/ra_it.c
@@ -50,7 +50,7 @@ extern void __fatal_error(const char *);
// More information about decoding the fault registers can be found here:
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/Cihdjcfc.html
-STATIC char *fmt_hex(uint32_t val, char *buf) {
+static char *fmt_hex(uint32_t val, char *buf) {
const char *hexDig = "0123456789abcdef";
buf[0] = hexDig[(val >> 28) & 0x0f];
@@ -66,7 +66,7 @@ STATIC char *fmt_hex(uint32_t val, char *buf) {
return buf;
}
-STATIC void print_reg(const char *label, uint32_t val) {
+static void print_reg(const char *label, uint32_t val) {
char hexStr[9];
mp_hal_stdout_tx_str(label);
@@ -74,7 +74,7 @@ STATIC void print_reg(const char *label, uint32_t val) {
mp_hal_stdout_tx_str("\r\n");
}
-STATIC void print_hex_hex(const char *label, uint32_t val1, uint32_t val2) {
+static void print_hex_hex(const char *label, uint32_t val1, uint32_t val2) {
char hex_str[9];
mp_hal_stdout_tx_str(label);
mp_hal_stdout_tx_str(fmt_hex(val1, hex_str));
diff --git a/ports/renesas-ra/storage.c b/ports/renesas-ra/storage.c
index 18dff97800..12416e4dc7 100644
--- a/ports/renesas-ra/storage.c
+++ b/ports/renesas-ra/storage.c
@@ -249,7 +249,7 @@ const pyb_flash_obj_t pyb_flash_obj = {
0, // actual size handled in ioctl, MP_BLOCKDEV_IOCTL_BLOCK_COUNT case
};
-STATIC void pyb_flash_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_flash_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self == &pyb_flash_obj) {
mp_printf(print, "Flash()");
@@ -258,7 +258,7 @@ STATIC void pyb_flash_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
}
}
-STATIC mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Parse arguments
enum { ARG_start, ARG_len };
static const mp_arg_t allowed_args[] = {
@@ -297,7 +297,7 @@ STATIC mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t pyb_flash_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_flash_readblocks(size_t n_args, const mp_obj_t *args) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t block_num = mp_obj_get_int(args[1]);
mp_buffer_info_t bufinfo;
@@ -318,9 +318,9 @@ STATIC mp_obj_t pyb_flash_readblocks(size_t n_args, const mp_obj_t *args) {
#endif
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_readblocks_obj, 3, 4, pyb_flash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_readblocks_obj, 3, 4, pyb_flash_readblocks);
-STATIC mp_obj_t pyb_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t block_num = mp_obj_get_int(args[1]);
mp_buffer_info_t bufinfo;
@@ -341,9 +341,9 @@ STATIC mp_obj_t pyb_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
#endif
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_writeblocks_obj, 3, 4, pyb_flash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_writeblocks_obj, 3, 4, pyb_flash_writeblocks);
-STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t pyb_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
switch (cmd) {
@@ -390,15 +390,15 @@ STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_ioctl_obj, pyb_flash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_ioctl_obj, pyb_flash_ioctl);
-STATIC const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&pyb_flash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&pyb_flash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&pyb_flash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_flash_type,
diff --git a/ports/renesas-ra/timer.c b/ports/renesas-ra/timer.c
index 1b32bc1eee..d264ab0612 100644
--- a/ports/renesas-ra/timer.c
+++ b/ports/renesas-ra/timer.c
@@ -37,7 +37,7 @@
#define TIMER_SIZE 2
void timer_irq_handler(void *param);
-STATIC mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args);
+static mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args);
#if defined(TIMER_CHANNEL)
typedef struct _pyb_timer_channel_obj_t {
@@ -59,10 +59,10 @@ typedef struct _pyb_timer_obj_t {
} pyb_timer_obj_t;
#define PYB_TIMER_OBJ_ALL_NUM MP_ARRAY_SIZE(MP_STATE_PORT(pyb_timer_obj_all))
-STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in);
-STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback);
+static mp_obj_t pyb_timer_deinit(mp_obj_t self_in);
+static mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback);
#if defined(TIMER_CHANNEL)
-STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback);
+static mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback);
#endif
static const int ra_agt_timer_ch[TIMER_SIZE] = {1, 2};
@@ -86,7 +86,7 @@ void timer_deinit(void) {
* Timer Class
*/
-STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "Timer(%u)", self->tim_id);
}
@@ -106,7 +106,7 @@ STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
/// - `callback` - as per Timer.callback()
//////
/// You must either specify freq.
-STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// enum { ARG_freq, ARG_prescaler, ARG_period, ARG_tick_hz, ARG_mode, ARG_div, ARG_callback, ARG_deadtime };
enum { ARG_freq, ARG_callback };
static const mp_arg_t allowed_args[] = {
@@ -145,7 +145,7 @@ STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, size_t n_args, cons
/// Construct a new timer object of the given id. If additional
/// arguments are given, then the timer is initialised by `init(...)`.
/// `id` can be 1 to 14, excluding 3.
-STATIC mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -174,10 +174,10 @@ STATIC mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(tim);
}
-STATIC mp_obj_t pyb_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_timer_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
/// \method deinit()
/// Deinitialises the timer.
@@ -185,7 +185,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
/// Disables the callback (and the associated irq).
/// Disables any channel callbacks (and the associated irq).
/// Stops the timer, and disables the timer peripheral.
-STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
// Disable the base interrupt
@@ -207,7 +207,7 @@ STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
ra_agt_timer_deinit(self->tim_id - 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
#if defined(TIMER_CHANNEL)
/// \method channel(channel, mode, ...)
@@ -221,7 +221,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
/// input capture. All channels share the same underlying timer, which means
/// that they share the same timer clock.
///
-STATIC mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_callback, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
{ MP_QSTR_compare, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -294,14 +294,14 @@ STATIC mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_ma
// ToDo
return MP_OBJ_FROM_PTR(chan);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_obj, 2, pyb_timer_channel);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_obj, 2, pyb_timer_channel);
#endif
#if TIMER_COUNTER
// Not implemented
/// \method counter([value])
/// Get or set the timer counter.
-STATIC mp_obj_t pyb_timer_counter(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_counter(size_t n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -312,12 +312,12 @@ STATIC mp_obj_t pyb_timer_counter(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_counter_obj, 1, 2, pyb_timer_counter);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_counter_obj, 1, 2, pyb_timer_counter);
#endif
/// \method freq([value])
/// Get or set the frequency for the timer (changes prescaler and period if set).
-STATIC mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
int ch = self->tim_id - 1;
if (n_args == 1) {
@@ -349,13 +349,13 @@ STATIC mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_freq_obj, 1, 2, pyb_timer_freq);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_freq_obj, 1, 2, pyb_timer_freq);
#if TIMER_PERIOD
// Not implemented
/// \method period([value])
/// Get or set the period of the timer.
-STATIC mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -367,14 +367,14 @@ STATIC mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_period_obj, 1, 2, pyb_timer_period);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_period_obj, 1, 2, pyb_timer_period);
#endif
/// \method callback(fun)
/// Set the function to be called when the timer triggers.
/// `fun` is passed 1 argument, the timer object.
/// If `fun` is `None` then the callback will be disabled.
-STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
+static mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (callback == mp_const_none) {
// stop interrupt (but not timer)
@@ -393,9 +393,9 @@ STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_callback_obj, pyb_timer_callback);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_callback_obj, pyb_timer_callback);
-STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_timer_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_timer_deinit_obj) },
@@ -408,7 +408,7 @@ STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
#endif
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&pyb_timer_callback_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_type,
@@ -430,7 +430,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
/// Timer channels are used to generate/capture a signal using a timer.
///
/// TimerChannel objects are created using the Timer.channel() method.
-STATIC void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_channel_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "TimerChannel(timer=%u, channel=%u",
@@ -455,7 +455,7 @@ STATIC void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, m
///
/// In edge aligned mode, a pulse_width of `period + 1` corresponds to a duty cycle of 100%
/// In center aligned mode, a pulse width of `period` corresponds to a duty cycle of 100%
-STATIC mp_obj_t pyb_timer_channel_capture_compare(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_channel_capture_compare(size_t n_args, const mp_obj_t *args) {
pyb_timer_channel_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -466,13 +466,13 @@ STATIC mp_obj_t pyb_timer_channel_capture_compare(size_t n_args, const mp_obj_t
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_capture_compare_obj, 1, 2, pyb_timer_channel_capture_compare);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_capture_compare_obj, 1, 2, pyb_timer_channel_capture_compare);
/// \method callback(fun)
/// Set the function to be called when the timer channel triggers.
/// `fun` is passed 1 argument, the timer object.
/// If `fun` is `None` then the callback will be disabled.
-STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback) {
+static mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback) {
pyb_timer_channel_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (callback == mp_const_none) {
// stop interrupt (but not timer)
@@ -493,17 +493,17 @@ STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback)
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_channel_callback_obj, pyb_timer_channel_callback);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_channel_callback_obj, pyb_timer_channel_callback);
-STATIC const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&pyb_timer_channel_callback_obj) },
{ MP_ROM_QSTR(MP_QSTR_capture), MP_ROM_PTR(&pyb_timer_channel_capture_compare_obj) },
{ MP_ROM_QSTR(MP_QSTR_compare), MP_ROM_PTR(&pyb_timer_channel_capture_compare_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_channel_type,
MP_QSTR_TimerChannel,
MP_TYPE_FLAG_NONE,
@@ -512,7 +512,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif
-STATIC void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_obj_t callback) {
+static void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_obj_t callback) {
// execute callback if it's set
if (callback != mp_const_none) {
diff --git a/ports/renesas-ra/uart.c b/ports/renesas-ra/uart.c
index 47c793e7d3..30707552b3 100644
--- a/ports/renesas-ra/uart.c
+++ b/ports/renesas-ra/uart.c
@@ -506,7 +506,7 @@ void uart_tx_strn(machine_uart_obj_t *uart_obj, const char *str, uint len) {
uart_tx_data(uart_obj, str, len, &errcode);
}
-STATIC mp_uint_t uart_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t uart_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
uart_irq_config(self, false);
self->mp_irq_trigger = new_trigger;
@@ -514,7 +514,7 @@ STATIC mp_uint_t uart_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
return 0;
}
-STATIC mp_uint_t uart_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t uart_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (info_type == MP_IRQ_INFO_FLAGS) {
return self->mp_irq_flags;
diff --git a/ports/renesas-ra/usrsw.c b/ports/renesas-ra/usrsw.c
index edbe519683..746c7714a6 100644
--- a/ports/renesas-ra/usrsw.c
+++ b/ports/renesas-ra/usrsw.c
@@ -69,7 +69,7 @@ typedef struct _pyb_switch_obj_t {
mp_obj_base_t base;
} pyb_switch_obj_t;
-STATIC const pyb_switch_obj_t pyb_switch_obj = {{&pyb_switch_type}};
+static const pyb_switch_obj_t pyb_switch_obj = {{&pyb_switch_type}};
void pyb_switch_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_print_str(print, "Switch()");
@@ -77,7 +77,7 @@ void pyb_switch_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
/// \classmethod \constructor()
/// Create and return a switch object.
-STATIC mp_obj_t pyb_switch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_switch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -101,15 +101,15 @@ mp_obj_t pyb_switch_value(mp_obj_t self_in) {
(void)self_in;
return mp_obj_new_bool(switch_get());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_switch_value_obj, pyb_switch_value);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_switch_value_obj, pyb_switch_value);
-STATIC mp_obj_t switch_callback(mp_obj_t line) {
+static mp_obj_t switch_callback(mp_obj_t line) {
if (MP_STATE_PORT(pyb_switch_callback) != mp_const_none) {
mp_call_function_0(MP_STATE_PORT(pyb_switch_callback));
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(switch_callback_obj, switch_callback);
+static MP_DEFINE_CONST_FUN_OBJ_1(switch_callback_obj, switch_callback);
/// \method callback(fun)
/// Register the given function to be called when the switch is pressed down.
@@ -126,14 +126,14 @@ mp_obj_t pyb_switch_callback(mp_obj_t self_in, mp_obj_t callback) {
true);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_switch_callback_obj, pyb_switch_callback);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_switch_callback_obj, pyb_switch_callback);
-STATIC const mp_rom_map_elem_t pyb_switch_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_switch_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pyb_switch_value_obj) },
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&pyb_switch_callback_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_switch_locals_dict, pyb_switch_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_switch_locals_dict, pyb_switch_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_switch_type,
diff --git a/ports/rp2/machine_adc.c b/ports/rp2/machine_adc.c
index 3a7a71a741..e5a428563d 100644
--- a/ports/rp2/machine_adc.c
+++ b/ports/rp2/machine_adc.c
@@ -35,7 +35,7 @@
#define ADC_CHANNEL_FROM_GPIO(gpio) ((gpio) - 26)
#define ADC_CHANNEL_TEMPSENSOR (4)
-STATIC uint16_t adc_config_and_read_u16(uint32_t channel) {
+static uint16_t adc_config_and_read_u16(uint32_t channel) {
adc_select_input(channel);
uint32_t raw = adc_read();
const uint32_t bits = 12;
@@ -57,13 +57,13 @@ typedef struct _machine_adc_obj_t {
#endif
} machine_adc_obj_t;
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<ADC channel=%u>", self->channel);
}
// ADC(id)
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Check number of arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -132,7 +132,7 @@ STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args
}
// read_u16()
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
#if MICROPY_HW_ADC_EXT_COUNT
if (self->is_ext) {
return machine_pin_ext_read_u16(self->channel);
diff --git a/ports/rp2/machine_i2c.c b/ports/rp2/machine_i2c.c
index 9bea4be2ca..28032e8085 100644
--- a/ports/rp2/machine_i2c.c
+++ b/ports/rp2/machine_i2c.c
@@ -83,12 +83,12 @@ typedef struct _machine_i2c_obj_t {
uint32_t timeout;
} machine_i2c_obj_t;
-STATIC machine_i2c_obj_t machine_i2c_obj[] = {
+static machine_i2c_obj_t machine_i2c_obj[] = {
{{&machine_i2c_type}, i2c0, 0, MICROPY_HW_I2C0_SCL, MICROPY_HW_I2C0_SDA, 0},
{{&machine_i2c_type}, i2c1, 1, MICROPY_HW_I2C1_SCL, MICROPY_HW_I2C1_SDA, 0},
};
-STATIC void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "I2C(%u, freq=%u, scl=%u, sda=%u, timeout=%u)",
self->i2c_id, self->freq, self->scl, self->sda, self->timeout);
@@ -148,7 +148,7 @@ mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return MP_OBJ_FROM_PTR(self);
}
-STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
+static int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
machine_i2c_obj_t *self = (machine_i2c_obj_t *)self_in;
int ret;
bool nostop = !(flags & MP_MACHINE_I2C_FLAG_STOP);
@@ -189,7 +189,7 @@ STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, si
}
}
-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,
};
diff --git a/ports/rp2/machine_i2s.c b/ports/rp2/machine_i2s.c
index ae8026a4af..47eb5350a6 100644
--- a/ports/rp2/machine_i2s.c
+++ b/ports/rp2/machine_i2s.c
@@ -97,14 +97,14 @@ typedef struct _machine_i2s_obj_t {
// The frame map is used with the readinto() method to transform the audio sample data coming
// from DMA memory (32-bit stereo) to the format specified
// in the I2S constructor. e.g. 16-bit mono
-STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
+static const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
{-1, -1, 0, 1, -1, -1, -1, -1 }, // Mono, 16-bits
{ 0, 1, 2, 3, -1, -1, -1, -1 }, // Mono, 32-bits
{-1, -1, 0, 1, -1, -1, 2, 3 }, // Stereo, 16-bits
{ 0, 1, 2, 3, 4, 5, 6, 7 }, // Stereo, 32-bits
};
-STATIC const PIO pio_instances[NUM_PIOS] = {pio0, pio1};
+static const PIO pio_instances[NUM_PIOS] = {pio0, pio1};
// PIO program for 16-bit write
// set(x, 14) .side(0b01)
@@ -117,8 +117,8 @@ STATIC const PIO pio_instances[NUM_PIOS] = {pio0, pio1};
// out(pins, 1) .side(0b10)
// jmp(x_dec, "right_channel") .side(0b11)
// out(pins, 1) .side(0b00)
-STATIC const uint16_t pio_instructions_write_16[] = {59438, 24577, 2113, 28673, 63534, 28673, 6213, 24577};
-STATIC const pio_program_t pio_write_16 = {
+static const uint16_t pio_instructions_write_16[] = {59438, 24577, 2113, 28673, 63534, 28673, 6213, 24577};
+static const pio_program_t pio_write_16 = {
pio_instructions_write_16,
sizeof(pio_instructions_write_16) / sizeof(uint16_t),
-1
@@ -135,8 +135,8 @@ STATIC const pio_program_t pio_write_16 = {
// out(pins, 1) .side(0b10)
// jmp(x_dec, "right_channel") .side(0b11)
// out(pins, 1) .side(0b00)
-STATIC const uint16_t pio_instructions_write_32[] = {59454, 24577, 2113, 28673, 63550, 28673, 6213, 24577};
-STATIC const pio_program_t pio_write_32 = {
+static const uint16_t pio_instructions_write_32[] = {59454, 24577, 2113, 28673, 63550, 28673, 6213, 24577};
+static const pio_program_t pio_write_32 = {
pio_instructions_write_32,
sizeof(pio_instructions_write_32) / sizeof(uint16_t),
-1
@@ -153,17 +153,17 @@ STATIC const pio_program_t pio_write_32 = {
// in_(pins, 1) .side(0b11)
// jmp(x_dec, "right_channel") .side(0b10)
// in_(pins, 1) .side(0b01)
-STATIC const uint16_t pio_instructions_read_32[] = {57406, 18433, 65, 22529, 61502, 22529, 4165, 18433};
-STATIC const pio_program_t pio_read_32 = {
+static const uint16_t pio_instructions_read_32[] = {57406, 18433, 65, 22529, 61502, 22529, 4165, 18433};
+static const pio_program_t pio_read_32 = {
pio_instructions_read_32,
sizeof(pio_instructions_read_32) / sizeof(uint16_t),
-1
};
-STATIC uint8_t dma_get_bits(i2s_mode_t mode, int8_t bits);
-STATIC void dma_irq0_handler(void);
-STATIC void dma_irq1_handler(void);
-STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
+static uint8_t dma_get_bits(i2s_mode_t mode, int8_t bits);
+static void dma_irq0_handler(void);
+static void dma_irq1_handler(void);
+static mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
void machine_i2s_init0(void) {
for (uint8_t i = 0; i < MAX_I2S_RP2; i++) {
@@ -171,7 +171,7 @@ void machine_i2s_init0(void) {
}
}
-STATIC int8_t get_frame_mapping_index(int8_t bits, format_t format) {
+static int8_t get_frame_mapping_index(int8_t bits, format_t format) {
if (format == MONO) {
if (bits == 16) {
return 0;
@@ -188,7 +188,7 @@ STATIC int8_t get_frame_mapping_index(int8_t bits, format_t format) {
}
// function is used in IRQ context
-STATIC void empty_dma(machine_i2s_obj_t *self, uint8_t *dma_buffer_p) {
+static void empty_dma(machine_i2s_obj_t *self, uint8_t *dma_buffer_p) {
// when space exists, copy samples into ring buffer
if (ringbuf_available_space(&self->ring_buffer) >= SIZEOF_HALF_DMA_BUFFER_IN_BYTES) {
for (uint32_t i = 0; i < SIZEOF_HALF_DMA_BUFFER_IN_BYTES; i++) {
@@ -198,7 +198,7 @@ STATIC void empty_dma(machine_i2s_obj_t *self, uint8_t *dma_buffer_p) {
}
// function is used in IRQ context
-STATIC void feed_dma(machine_i2s_obj_t *self, uint8_t *dma_buffer_p) {
+static void feed_dma(machine_i2s_obj_t *self, uint8_t *dma_buffer_p) {
// when data exists, copy samples from ring buffer
if (ringbuf_available_data(&self->ring_buffer) >= SIZEOF_HALF_DMA_BUFFER_IN_BYTES) {
@@ -230,7 +230,7 @@ STATIC void feed_dma(machine_i2s_obj_t *self, uint8_t *dma_buffer_p) {
}
}
-STATIC void irq_configure(machine_i2s_obj_t *self) {
+static void irq_configure(machine_i2s_obj_t *self) {
if (self->i2s_id == 0) {
irq_add_shared_handler(DMA_IRQ_0, dma_irq0_handler, PICO_SHARED_IRQ_HANDLER_DEFAULT_ORDER_PRIORITY);
irq_set_enabled(DMA_IRQ_0, true);
@@ -240,7 +240,7 @@ STATIC void irq_configure(machine_i2s_obj_t *self) {
}
}
-STATIC void irq_deinit(machine_i2s_obj_t *self) {
+static void irq_deinit(machine_i2s_obj_t *self) {
if (self->i2s_id == 0) {
irq_remove_handler(DMA_IRQ_0, dma_irq0_handler);
} else {
@@ -248,7 +248,7 @@ STATIC void irq_deinit(machine_i2s_obj_t *self) {
}
}
-STATIC void pio_configure(machine_i2s_obj_t *self) {
+static void pio_configure(machine_i2s_obj_t *self) {
if (self->mode == TX) {
if (self->bits == 16) {
self->pio_program = &pio_write_16;
@@ -322,7 +322,7 @@ STATIC void pio_configure(machine_i2s_obj_t *self) {
pio_sm_set_config(self->pio, self->sm, &config);
}
-STATIC void pio_deinit(machine_i2s_obj_t *self) {
+static void pio_deinit(machine_i2s_obj_t *self) {
if (self->pio) {
pio_sm_set_enabled(self->pio, self->sm, false);
pio_sm_unclaim(self->pio, self->sm);
@@ -330,14 +330,14 @@ STATIC void pio_deinit(machine_i2s_obj_t *self) {
}
}
-STATIC void gpio_init_i2s(PIO pio, uint8_t sm, mp_hal_pin_obj_t pin_num, uint8_t pin_val, gpio_dir_t pin_dir) {
+static void gpio_init_i2s(PIO pio, uint8_t sm, mp_hal_pin_obj_t pin_num, uint8_t pin_val, gpio_dir_t pin_dir) {
uint32_t pinmask = 1 << pin_num;
pio_sm_set_pins_with_mask(pio, sm, pin_val << pin_num, pinmask);
pio_sm_set_pindirs_with_mask(pio, sm, pin_dir << pin_num, pinmask);
pio_gpio_init(pio, pin_num);
}
-STATIC void gpio_configure(machine_i2s_obj_t *self) {
+static void gpio_configure(machine_i2s_obj_t *self) {
gpio_init_i2s(self->pio, self->sm, self->sck, 0, GP_OUTPUT);
gpio_init_i2s(self->pio, self->sm, self->ws, 0, GP_OUTPUT);
if (self->mode == TX) {
@@ -347,7 +347,7 @@ STATIC void gpio_configure(machine_i2s_obj_t *self) {
}
}
-STATIC uint8_t dma_get_bits(i2s_mode_t mode, int8_t bits) {
+static uint8_t dma_get_bits(i2s_mode_t mode, int8_t bits) {
if (mode == TX) {
return bits;
} else { // RX
@@ -357,7 +357,7 @@ STATIC uint8_t dma_get_bits(i2s_mode_t mode, int8_t bits) {
}
// determine which DMA channel is associated to this IRQ
-STATIC uint dma_map_irq_to_channel(uint irq_index) {
+static uint dma_map_irq_to_channel(uint irq_index) {
for (uint ch = 0; ch < NUM_DMA_CHANNELS; ch++) {
if ((dma_irqn_get_channel_status(irq_index, ch))) {
return ch;
@@ -368,7 +368,7 @@ STATIC uint dma_map_irq_to_channel(uint irq_index) {
}
// note: first DMA channel is mapped to the top half of buffer, second is mapped to the bottom half
-STATIC uint8_t *dma_get_buffer(machine_i2s_obj_t *i2s_obj, uint channel) {
+static uint8_t *dma_get_buffer(machine_i2s_obj_t *i2s_obj, uint channel) {
for (uint8_t ch = 0; ch < I2S_NUM_DMA_CHANNELS; ch++) {
if (i2s_obj->dma_channel[ch] == channel) {
return i2s_obj->dma_buffer + (SIZEOF_HALF_DMA_BUFFER_IN_BYTES * ch);
@@ -378,7 +378,7 @@ STATIC uint8_t *dma_get_buffer(machine_i2s_obj_t *i2s_obj, uint channel) {
return NULL;
}
-STATIC void dma_configure(machine_i2s_obj_t *self) {
+static void dma_configure(machine_i2s_obj_t *self) {
uint8_t num_free_dma_channels = 0;
for (uint8_t ch = 0; ch < NUM_DMA_CHANNELS; ch++) {
if (!dma_channel_is_claimed(ch)) {
@@ -433,7 +433,7 @@ STATIC void dma_configure(machine_i2s_obj_t *self) {
}
}
-STATIC void dma_deinit(machine_i2s_obj_t *self) {
+static void dma_deinit(machine_i2s_obj_t *self) {
for (uint8_t ch = 0; ch < I2S_NUM_DMA_CHANNELS; ch++) {
int channel = self->dma_channel[ch];
@@ -448,7 +448,7 @@ STATIC void dma_deinit(machine_i2s_obj_t *self) {
}
}
-STATIC void dma_irq_handler(uint8_t irq_index) {
+static void dma_irq_handler(uint8_t irq_index) {
int dma_channel = dma_map_irq_to_channel(irq_index);
if (dma_channel == -1) {
// This should never happen
@@ -488,15 +488,15 @@ STATIC void dma_irq_handler(uint8_t irq_index) {
}
}
-STATIC void dma_irq0_handler(void) {
+static void dma_irq0_handler(void) {
dma_irq_handler(0);
}
-STATIC void dma_irq1_handler(void) {
+static void dma_irq1_handler(void) {
dma_irq_handler(1);
}
-STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
+static void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
// are Pins valid?
mp_hal_pin_obj_t sck = args[ARG_sck].u_obj == MP_OBJ_NULL ? -1 : mp_hal_get_pin_obj(args[ARG_sck].u_obj);
mp_hal_pin_obj_t ws = args[ARG_ws].u_obj == MP_OBJ_NULL ? -1 : mp_hal_get_pin_obj(args[ARG_ws].u_obj);
@@ -563,7 +563,7 @@ STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *ar
dma_channel_start(self->dma_channel[0]);
}
-STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
+static machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
if (i2s_id >= MAX_I2S_RP2) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid id"));
}
@@ -581,7 +581,7 @@ STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
return self;
}
-STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
// use self->pio as in indication that I2S object has already been de-initialized
if (self->pio != NULL) {
pio_deinit(self);
@@ -592,7 +592,7 @@ STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
}
}
-STATIC void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
(void)self;
}
diff --git a/ports/rp2/machine_pin.c b/ports/rp2/machine_pin.c
index b277a939e5..de21778569 100644
--- a/ports/rp2/machine_pin.c
+++ b/ports/rp2/machine_pin.c
@@ -85,21 +85,21 @@ typedef struct _machine_pin_irq_obj_t {
uint32_t trigger;
} machine_pin_irq_obj_t;
-STATIC const mp_irq_methods_t machine_pin_irq_methods;
+static const mp_irq_methods_t machine_pin_irq_methods;
extern const machine_pin_obj_t machine_pin_obj_table[NUM_BANK0_GPIOS];
// Mask with "1" indicating that the corresponding pin is in simulated open-drain mode.
uint32_t machine_pin_open_drain_mask;
#if MICROPY_HW_PIN_EXT_COUNT
-STATIC inline bool is_ext_pin(__unused const machine_pin_obj_t *self) {
+static inline bool is_ext_pin(__unused const machine_pin_obj_t *self) {
return self->is_ext;
}
#else
#define is_ext_pin(x) false
#endif
-STATIC void gpio_irq(void) {
+static void gpio_irq(void) {
for (int i = 0; i < 4; ++i) {
uint32_t intr = iobank0_hw->intr[i];
if (intr) {
@@ -196,7 +196,7 @@ const machine_pin_obj_t *machine_pin_find(mp_obj_t pin) {
mp_raise_ValueError("invalid pin");
}
-STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pin_obj_t *self = self_in;
uint funcsel = GPIO_GET_FUNCSEL(self->id);
qstr mode_qst;
@@ -252,7 +252,7 @@ static const mp_arg_t allowed_args[] = {
{MP_QSTR_alt, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = GPIO_FUNC_SIO}},
};
-STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
@@ -329,7 +329,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
}
// fast method for getting/setting pin value
-STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
machine_pin_obj_t *self = self_in;
if (n_args == 0) {
@@ -359,19 +359,19 @@ STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, c
}
// pin.init(mode, pull)
-STATIC mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_init_obj, 1, machine_pin_obj_init);
// pin.value([value])
-STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
return machine_pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
// pin.low()
-STATIC mp_obj_t machine_pin_low(mp_obj_t self_in) {
+static mp_obj_t machine_pin_low(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (is_ext_pin(self)) {
#if MICROPY_HW_PIN_EXT_COUNT
@@ -384,10 +384,10 @@ STATIC mp_obj_t machine_pin_low(mp_obj_t self_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_low_obj, machine_pin_low);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_low_obj, machine_pin_low);
// pin.high()
-STATIC mp_obj_t machine_pin_high(mp_obj_t self_in) {
+static mp_obj_t machine_pin_high(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (is_ext_pin(self)) {
#if MICROPY_HW_PIN_EXT_COUNT
@@ -401,10 +401,10 @@ STATIC mp_obj_t machine_pin_high(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_high_obj, machine_pin_high);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_high_obj, machine_pin_high);
// pin.toggle()
-STATIC mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
+static mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (is_ext_pin(self)) {
#if MICROPY_HW_PIN_EXT_COUNT
@@ -421,9 +421,9 @@ STATIC mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_toggle_obj, machine_pin_toggle);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_toggle_obj, machine_pin_toggle);
-STATIC machine_pin_irq_obj_t *machine_pin_get_irq(mp_hal_pin_obj_t pin) {
+static machine_pin_irq_obj_t *machine_pin_get_irq(mp_hal_pin_obj_t pin) {
// Get the IRQ object.
machine_pin_irq_obj_t *irq = MP_STATE_PORT(machine_pin_irq_obj[pin]);
@@ -459,7 +459,7 @@ void mp_hal_pin_interrupt(mp_hal_pin_obj_t pin, mp_obj_t handler, mp_uint_t trig
}
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING, hard=False)
-STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -485,9 +485,9 @@ STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
}
return MP_OBJ_FROM_PTR(irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
-STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&machine_pin_value_obj) },
@@ -523,9 +523,9 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ALT_GPCK), MP_ROM_INT(GPIO_FUNC_GPCK) },
{ MP_ROM_QSTR(MP_QSTR_ALT_USB), MP_ROM_INT(GPIO_FUNC_USB) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
-STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_pin_obj_t *self = self_in;
@@ -553,7 +553,7 @@ STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, i
return -1;
}
-STATIC const mp_pin_p_t pin_pin_p = {
+static const mp_pin_p_t pin_pin_p = {
.ioctl = pin_ioctl,
};
@@ -568,7 +568,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &machine_pin_locals_dict
);
-STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
machine_pin_irq_obj_t *irq = MP_STATE_PORT(machine_pin_irq_obj[self->id]);
gpio_set_irq_enabled(self->id, GPIO_IRQ_ALL, false);
@@ -578,7 +578,7 @@ STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger
return 0;
}
-STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
machine_pin_irq_obj_t *irq = MP_STATE_PORT(machine_pin_irq_obj[self->id]);
if (info_type == MP_IRQ_INFO_FLAGS) {
@@ -589,7 +589,7 @@ STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
return 0;
}
-STATIC const mp_irq_methods_t machine_pin_irq_methods = {
+static const mp_irq_methods_t machine_pin_irq_methods = {
.trigger = machine_pin_irq_trigger,
.info = machine_pin_irq_info,
};
diff --git a/ports/rp2/machine_pwm.c b/ports/rp2/machine_pwm.c
index 0248b3142a..4c0bc2c103 100644
--- a/ports/rp2/machine_pwm.c
+++ b/ports/rp2/machine_pwm.c
@@ -50,7 +50,7 @@ enum {
DUTY_NS
};
-STATIC machine_pwm_obj_t machine_pwm_obj[] = {
+static machine_pwm_obj_t machine_pwm_obj[] = {
{{&machine_pwm_type}, 0, PWM_CHAN_A, 0, DUTY_NOT_SET, 0 },
{{&machine_pwm_type}, 0, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
{{&machine_pwm_type}, 1, PWM_CHAN_A, 0, DUTY_NOT_SET, 0 },
@@ -69,14 +69,14 @@ STATIC machine_pwm_obj_t machine_pwm_obj[] = {
{{&machine_pwm_type}, 7, PWM_CHAN_B, 0, DUTY_NOT_SET, 0 },
};
-STATIC bool defer_start;
-STATIC bool slice_freq_set[8];
+static bool defer_start;
+static bool slice_freq_set[8];
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq);
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16);
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns);
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq);
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16);
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns);
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<PWM slice=%u channel=%u invert=%u>",
self->slice, self->channel, self->invert);
@@ -94,7 +94,7 @@ void machine_pwm_start(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq, ARG_duty_u16, ARG_duty_ns, ARG_invert };
static const mp_arg_t allowed_args[] = {
@@ -128,7 +128,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
}
// PWM(pin [, args])
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Check number of arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -161,7 +161,7 @@ void machine_pwm_deinit_all(void) {
}
}
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
pwm_set_enabled(self->slice, false);
}
@@ -188,7 +188,7 @@ uint32_t get_slice_hz_ceil(uint32_t div16) {
return get_slice_hz(div16 - 1, div16);
}
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
if (slice_freq_set[self->slice] == true) {
uint32_t div16 = pwm_hw->slice[self->slice].div;
uint32_t top = pwm_hw->slice[self->slice].top;
@@ -199,7 +199,7 @@ STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
// Set the frequency, making "top" as large as possible for maximum resolution.
// Maximum "top" is set at 65534 to be able to achieve 100% duty with 65535.
#define TOP_MAX 65534
@@ -248,7 +248,7 @@ STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
}
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
if (self->duty_type != DUTY_NOT_SET && slice_freq_set[self->slice] == true) {
uint32_t top = pwm_hw->slice[self->slice].top;
uint32_t cc = pwm_hw->slice[self->slice].cc;
@@ -262,7 +262,7 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
uint32_t top = pwm_hw->slice[self->slice].top;
// Limit duty_u16 to 65535
@@ -277,7 +277,7 @@ STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u
machine_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
if (self->duty_type != DUTY_NOT_SET && slice_freq_set[self->slice] == true) {
uint32_t slice_hz = get_slice_hz_round(pwm_hw->slice[self->slice].div);
uint32_t cc = pwm_hw->slice[self->slice].cc;
@@ -288,7 +288,7 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
uint32_t slice_hz = get_slice_hz_round(pwm_hw->slice[self->slice].div);
uint32_t cc = ((uint64_t)duty_ns * slice_hz + 500000000ULL) / 1000000000ULL;
uint32_t top = pwm_hw->slice[self->slice].top;
diff --git a/ports/rp2/machine_rtc.c b/ports/rp2/machine_rtc.c
index eb2e1615b4..ce224be711 100644
--- a/ports/rp2/machine_rtc.c
+++ b/ports/rp2/machine_rtc.c
@@ -45,9 +45,9 @@ typedef struct _machine_rtc_obj_t {
} machine_rtc_obj_t;
// singleton RTC object
-STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
+static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
-STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
bool r = rtc_running();
@@ -64,7 +64,7 @@ STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, s
return (mp_obj_t)&machine_rtc_obj;
}
-STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
if (n_args == 1) {
bool ret;
datetime_t t;
@@ -110,12 +110,12 @@ STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
-STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
diff --git a/ports/rp2/machine_spi.c b/ports/rp2/machine_spi.c
index a4f4243b7a..abf0a70bd0 100644
--- a/ports/rp2/machine_spi.c
+++ b/ports/rp2/machine_spi.c
@@ -103,7 +103,7 @@ typedef struct _machine_spi_obj_t {
uint32_t baudrate;
} machine_spi_obj_t;
-STATIC machine_spi_obj_t machine_spi_obj[] = {
+static machine_spi_obj_t machine_spi_obj[] = {
{
{&machine_spi_type}, spi0, 0,
DEFAULT_SPI_POLARITY, DEFAULT_SPI_PHASE, DEFAULT_SPI_BITS, DEFAULT_SPI_FIRSTBIT,
@@ -118,7 +118,7 @@ STATIC machine_spi_obj_t machine_spi_obj[] = {
},
};
-STATIC void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "SPI(%u, baudrate=%u, polarity=%u, phase=%u, bits=%u, sck=%u, mosi=%u, miso=%u)",
self->spi_id, self->baudrate, self->polarity, self->phase, self->bits,
@@ -197,7 +197,7 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return MP_OBJ_FROM_PTR(self);
}
-STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
@@ -242,7 +242,7 @@ STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj
}
}
-STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
machine_spi_obj_t *self = (machine_spi_obj_t *)self_in;
// Use DMA for large transfers if channels are available
const size_t dma_min_size_threshold = 32;
@@ -304,7 +304,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8
// Buffer protocol implementation for SPI.
// The buffer represents the SPI data FIFO.
-STATIC mp_int_t machine_spi_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+static mp_int_t machine_spi_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
machine_spi_obj_t *self = MP_OBJ_TO_PTR(o_in);
bufinfo->len = 4;
@@ -314,7 +314,7 @@ STATIC mp_int_t machine_spi_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo,
return 0;
}
-STATIC const mp_machine_spi_p_t machine_spi_p = {
+static const mp_machine_spi_p_t machine_spi_p = {
.init = machine_spi_init,
.transfer = machine_spi_transfer,
};
diff --git a/ports/rp2/machine_timer.c b/ports/rp2/machine_timer.c
index f154507141..6f8b04f10e 100644
--- a/ports/rp2/machine_timer.c
+++ b/ports/rp2/machine_timer.c
@@ -44,7 +44,7 @@ typedef struct _machine_timer_obj_t {
const mp_obj_type_t machine_timer_type;
-STATIC int64_t alarm_callback(alarm_id_t id, void *user_data) {
+static int64_t alarm_callback(alarm_id_t id, void *user_data) {
machine_timer_obj_t *self = user_data;
mp_sched_schedule(self->callback, MP_OBJ_FROM_PTR(self));
if (self->mode == TIMER_MODE_ONE_SHOT) {
@@ -54,7 +54,7 @@ STATIC int64_t alarm_callback(alarm_id_t id, void *user_data) {
}
}
-STATIC void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
qstr mode = self->mode == TIMER_MODE_ONE_SHOT ? MP_QSTR_ONE_SHOT : MP_QSTR_PERIODIC;
mp_printf(print, "Timer(mode=%q, tick_hz=1000000, period=", mode);
@@ -65,7 +65,7 @@ STATIC void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
}
}
-STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_callback, ARG_period, ARG_tick_hz, ARG_freq, };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = TIMER_MODE_PERIODIC} },
@@ -104,7 +104,7 @@ STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_ar
return mp_const_none;
}
-STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
machine_timer_obj_t *self = mp_obj_malloc_with_finaliser(machine_timer_obj_t, &machine_timer_type);
self->pool = alarm_pool_get_default();
self->alarm_id = ALARM_ID_INVALID;
@@ -130,7 +130,7 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
machine_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (self->alarm_id != ALARM_ID_INVALID) {
alarm_pool_cancel_alarm(self->pool, self->alarm_id);
@@ -138,9 +138,9 @@ STATIC mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t
}
return machine_timer_init_helper(self, n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
-STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
machine_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->alarm_id != ALARM_ID_INVALID) {
alarm_pool_cancel_alarm(self->pool, self->alarm_id);
@@ -148,9 +148,9 @@ STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
-STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&machine_timer_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_timer_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_timer_deinit_obj) },
@@ -158,7 +158,7 @@ STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(TIMER_MODE_ONE_SHOT) },
{ MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(TIMER_MODE_PERIODIC) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_timer_type,
diff --git a/ports/rp2/machine_uart.c b/ports/rp2/machine_uart.c
index 72e68a6fb6..ccbf8f781a 100644
--- a/ports/rp2/machine_uart.c
+++ b/ports/rp2/machine_uart.c
@@ -81,10 +81,10 @@
#define UART_HWCONTROL_CTS (1)
#define UART_HWCONTROL_RTS (2)
-STATIC mutex_t write_mutex_0;
-STATIC mutex_t write_mutex_1;
-STATIC mutex_t read_mutex_0;
-STATIC mutex_t read_mutex_1;
+static mutex_t write_mutex_0;
+static mutex_t write_mutex_1;
+static mutex_t read_mutex_0;
+static mutex_t read_mutex_1;
auto_init_mutex(write_mutex_0);
auto_init_mutex(write_mutex_1);
@@ -113,7 +113,7 @@ typedef struct _machine_uart_obj_t {
mutex_t *write_mutex;
} machine_uart_obj_t;
-STATIC machine_uart_obj_t machine_uart_obj[] = {
+static machine_uart_obj_t machine_uart_obj[] = {
{{&machine_uart_type}, uart0, 0, 0, DEFAULT_UART_BITS, UART_PARITY_NONE, DEFAULT_UART_STOP,
MICROPY_HW_UART0_TX, MICROPY_HW_UART0_RX, MICROPY_HW_UART0_CTS, MICROPY_HW_UART0_RTS,
0, 0, 0, 0, {NULL, 1, 0, 0}, &read_mutex_0, {NULL, 1, 0, 0}, &write_mutex_0},
@@ -122,8 +122,8 @@ STATIC machine_uart_obj_t machine_uart_obj[] = {
0, 0, 0, 0, {NULL, 1, 0, 0}, &read_mutex_1, {NULL, 1, 0, 0}, &write_mutex_1},
};
-STATIC const char *_parity_name[] = {"None", "0", "1"};
-STATIC const char *_invert_name[] = {"None", "INV_TX", "INV_RX", "INV_TX|INV_RX"};
+static const char *_parity_name[] = {"None", "0", "1"};
+static const char *_invert_name[] = {"None", "INV_TX", "INV_RX", "INV_TX|INV_RX"};
/******************************************************************************/
// IRQ and buffer handling
@@ -145,7 +145,7 @@ static inline void read_mutex_unlock(machine_uart_obj_t *u) {
}
// take all bytes from the fifo and store them in the buffer
-STATIC void uart_drain_rx_fifo(machine_uart_obj_t *self) {
+static void uart_drain_rx_fifo(machine_uart_obj_t *self) {
if (read_mutex_try_lock(self)) {
while (uart_is_readable(self->uart) && ringbuf_free(&self->read_buffer) > 0) {
// Get a byte from uart and put into the buffer. Every entry from
@@ -176,7 +176,7 @@ STATIC void uart_drain_rx_fifo(machine_uart_obj_t *self) {
// take bytes from the buffer and put them into the UART FIFO
// Re-entrancy: quit if an instance already running
-STATIC void uart_fill_tx_fifo(machine_uart_obj_t *self) {
+static void uart_fill_tx_fifo(machine_uart_obj_t *self) {
if (write_mutex_try_lock(self)) {
while (uart_is_writable(self->uart) && ringbuf_avail(&self->write_buffer) > 0) {
// get a byte from the buffer and put it into the uart
@@ -186,7 +186,7 @@ STATIC void uart_fill_tx_fifo(machine_uart_obj_t *self) {
}
}
-STATIC inline void uart_service_interrupt(machine_uart_obj_t *self) {
+static inline void uart_service_interrupt(machine_uart_obj_t *self) {
if (uart_get_hw(self->uart)->mis & (UART_UARTMIS_RXMIS_BITS | UART_UARTMIS_RTMIS_BITS)) { // rx interrupt?
// clear all interrupt bits but tx
uart_get_hw(self->uart)->icr = UART_UARTICR_BITS & (~UART_UARTICR_TXIC_BITS);
@@ -199,11 +199,11 @@ STATIC inline void uart_service_interrupt(machine_uart_obj_t *self) {
}
}
-STATIC void uart0_irq_handler(void) {
+static void uart0_irq_handler(void) {
uart_service_interrupt(&machine_uart_obj[0]);
}
-STATIC void uart1_irq_handler(void) {
+static void uart1_irq_handler(void) {
uart_service_interrupt(&machine_uart_obj[1]);
}
@@ -216,7 +216,7 @@ STATIC void uart1_irq_handler(void) {
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_INT(UART_HWCONTROL_CTS) }, \
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_INT(UART_HWCONTROL_RTS) }, \
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%u, tx=%d, rx=%d, "
"txbuf=%d, rxbuf=%d, timeout=%u, timeout_char=%u, invert=%s)",
@@ -225,7 +225,7 @@ STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_
self->timeout, self->timeout_char, _invert_name[self->invert]);
}
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_cts, ARG_rts,
ARG_timeout, ARG_timeout_char, ARG_invert, ARG_flow, ARG_txbuf, ARG_rxbuf};
static const mp_arg_t allowed_args[] = {
@@ -411,7 +411,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
}
}
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// Get UART bus.
@@ -431,7 +431,7 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
uart_deinit(self->uart);
if (self->uart_id == 0) {
irq_set_enabled(UART0_IRQ, false);
@@ -443,24 +443,24 @@ STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
MP_STATE_PORT(rp2_uart_tx_buffer[self->uart_id]) = NULL;
}
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
// get all bytes from the fifo first
uart_drain_rx_fifo(self);
return ringbuf_avail(&self->read_buffer);
}
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
return ringbuf_avail(&self->write_buffer) == 0
&& (uart_get_hw(self->uart)->fr & UART_UARTFR_TXFE_BITS);
}
-STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
+static void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
uart_set_break(self->uart, true);
mp_hal_delay_us(13000000 / self->baudrate + 1);
uart_set_break(self->uart, false);
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t start = mp_hal_ticks_ms();
mp_uint_t timeout = self->timeout;
@@ -492,7 +492,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
return size;
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t start = mp_hal_ticks_ms();
mp_uint_t timeout = self->timeout;
@@ -534,7 +534,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
return size;
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = self_in;
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
diff --git a/ports/rp2/machine_wdt.c b/ports/rp2/machine_wdt.c
index 58c372176c..9cc955810c 100644
--- a/ports/rp2/machine_wdt.c
+++ b/ports/rp2/machine_wdt.c
@@ -36,9 +36,9 @@ typedef struct _machine_wdt_obj_t {
mp_obj_base_t base;
} machine_wdt_obj_t;
-STATIC const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
+static const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
// Verify the WDT id.
if (id != 0) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("WDT(%d) doesn't exist"), id);
@@ -54,7 +54,7 @@ STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t
return (machine_wdt_obj_t *)&machine_wdt;
}
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
(void)self;
watchdog_update();
}
diff --git a/ports/rp2/modmachine.c b/ports/rp2/modmachine.c
index 70b22dac01..6189e7dc53 100644
--- a/ports/rp2/modmachine.c
+++ b/ports/rp2/modmachine.c
@@ -55,20 +55,20 @@
{ MP_ROM_QSTR(MP_QSTR_PWRON_RESET), MP_ROM_INT(RP2_RESET_PWRON) }, \
{ MP_ROM_QSTR(MP_QSTR_WDT_RESET), MP_ROM_INT(RP2_RESET_WDT) }, \
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
pico_unique_board_id_t id;
pico_get_unique_board_id(&id);
return mp_obj_new_bytes(id.id, sizeof(id.id));
}
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
watchdog_reboot(0, SRAM_END, 0);
for (;;) {
__wfi();
}
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
int reset_cause;
if (watchdog_caused_reboot()) {
reset_cause = RP2_RESET_WDT;
@@ -86,11 +86,11 @@ NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
}
}
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_get_cpu_freq());
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
mp_int_t freq = mp_obj_get_int(args[0]);
if (!set_sys_clock_khz(freq / 1000, false)) {
mp_raise_ValueError(MP_ERROR_TEXT("cannot change frequency"));
@@ -101,11 +101,11 @@ STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
#endif
}
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
__wfe();
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
mp_int_t delay_ms = 0;
bool use_timer_alarm = false;
@@ -189,7 +189,7 @@ STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
restore_interrupts(my_interrupts);
}
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
mp_machine_lightsleep(n_args, args);
mp_machine_reset();
}
diff --git a/ports/rp2/modos.c b/ports/rp2/modos.c
index 77f980a731..0008854a16 100644
--- a/ports/rp2/modos.c
+++ b/ports/rp2/modos.c
@@ -28,7 +28,7 @@
uint8_t rosc_random_u8(size_t cycles);
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -37,4 +37,4 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
diff --git a/ports/rp2/modrp2.c b/ports/rp2/modrp2.c
index bd00eaf40c..c90b6d5840 100644
--- a/ports/rp2/modrp2.c
+++ b/ports/rp2/modrp2.c
@@ -44,7 +44,7 @@ MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_network_country_obj);
// Improved version of
// https://github.com/raspberrypi/pico-examples/blob/master/picoboard/button/button.c
-STATIC bool __no_inline_not_in_flash_func(bootsel_button)(void) {
+static bool __no_inline_not_in_flash_func(bootsel_button)(void) {
const uint CS_PIN_INDEX = 1;
// Disable interrupts and the other core since they might be
@@ -77,13 +77,13 @@ STATIC bool __no_inline_not_in_flash_func(bootsel_button)(void) {
return button_state;
}
-STATIC mp_obj_t rp2_bootsel_button(void) {
+static mp_obj_t rp2_bootsel_button(void) {
return MP_OBJ_NEW_SMALL_INT(bootsel_button());
}
MP_DEFINE_CONST_FUN_OBJ_0(rp2_bootsel_button_obj, rp2_bootsel_button);
-STATIC const mp_rom_map_elem_t rp2_module_globals_table[] = {
+static const mp_rom_map_elem_t rp2_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_rp2) },
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&rp2_flash_type) },
{ MP_ROM_QSTR(MP_QSTR_PIO), MP_ROM_PTR(&rp2_pio_type) },
@@ -96,7 +96,7 @@ STATIC const mp_rom_map_elem_t rp2_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_country), MP_ROM_PTR(&mod_network_country_obj) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(rp2_module_globals, rp2_module_globals_table);
+static MP_DEFINE_CONST_DICT(rp2_module_globals, rp2_module_globals_table);
const mp_obj_module_t mp_module_rp2 = {
.base = { &mp_type_module },
diff --git a/ports/rp2/modtime.c b/ports/rp2/modtime.c
index b4120be7c3..21e5cb459b 100644
--- a/ports/rp2/modtime.c
+++ b/ports/rp2/modtime.c
@@ -29,7 +29,7 @@
#include "hardware/rtc.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
datetime_t t;
rtc_get_datetime(&t);
mp_obj_t tuple[8] = {
@@ -46,7 +46,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Return the number of seconds since the Epoch.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
datetime_t t;
rtc_get_datetime(&t);
return mp_obj_new_int_from_ull(timeutils_seconds_since_epoch(t.year, t.month, t.day, t.hour, t.min, t.sec));
diff --git a/ports/rp2/mpbthciport.c b/ports/rp2/mpbthciport.c
index 1aacbe881f..0112304620 100644
--- a/ports/rp2/mpbthciport.c
+++ b/ports/rp2/mpbthciport.c
@@ -65,7 +65,7 @@ void mp_bluetooth_hci_poll_in_ms(uint32_t ms) {
// For synchronous mode, we run all BLE stack code inside a scheduled task.
// This task is scheduled periodically via a timer, or immediately after UART RX IRQ.
-STATIC void run_events_scheduled_task(mp_sched_node_t *node) {
+static void run_events_scheduled_task(mp_sched_node_t *node) {
(void)node;
// This will process all buffered HCI UART data, and run any callouts or events.
mp_bluetooth_hci_poll();
@@ -81,7 +81,7 @@ void mp_bluetooth_hci_poll_now(void) {
mp_obj_t mp_bthci_uart;
-STATIC void mp_bluetooth_hci_start_polling(void) {
+static void mp_bluetooth_hci_start_polling(void) {
mp_bluetooth_hci_poll_now();
}
diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c
index c5ae221e98..1641eadb7b 100644
--- a/ports/rp2/mphalport.c
+++ b/ports/rp2/mphalport.c
@@ -44,7 +44,7 @@
// This needs to be added to the result of time_us_64() to get the number of
// microseconds since the Epoch.
-STATIC uint64_t time_us_64_offset_from_epoch;
+static uint64_t time_us_64_offset_from_epoch;
static alarm_id_t soft_timer_alarm_id = 0;
@@ -54,7 +54,7 @@ static alarm_id_t soft_timer_alarm_id = 0;
#define MICROPY_HW_STDIN_BUFFER_LEN 512
#endif
-STATIC uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
+static uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
ringbuf_t stdin_ringbuf = { stdin_ringbuf_array, sizeof(stdin_ringbuf_array) };
#endif
diff --git a/ports/rp2/mpthreadport.c b/ports/rp2/mpthreadport.c
index 977df80449..8d8f13a089 100644
--- a/ports/rp2/mpthreadport.c
+++ b/ports/rp2/mpthreadport.c
@@ -39,14 +39,14 @@ extern uint8_t __StackTop, __StackBottom;
void *core_state[2];
// This will be non-NULL while Python code is executing.
-STATIC void *(*core1_entry)(void *) = NULL;
+static void *(*core1_entry)(void *) = NULL;
-STATIC void *core1_arg = NULL;
-STATIC uint32_t *core1_stack = NULL;
-STATIC size_t core1_stack_num_words = 0;
+static void *core1_arg = NULL;
+static uint32_t *core1_stack = NULL;
+static size_t core1_stack_num_words = 0;
// Thread mutex.
-STATIC mutex_t atomic_mutex;
+static mutex_t atomic_mutex;
uint32_t mp_thread_begin_atomic_section(void) {
if (core1_entry) {
@@ -102,7 +102,7 @@ void mp_thread_gc_others(void) {
}
}
-STATIC void core1_entry_wrapper(void) {
+static void core1_entry_wrapper(void) {
// Allow MICROPY_BEGIN_ATOMIC_SECTION to be invoked from core0.
multicore_lockout_victim_init();
diff --git a/ports/rp2/rp2_dma.c b/ports/rp2/rp2_dma.c
index 27624ea8bf..3afcf8b5d6 100644
--- a/ports/rp2/rp2_dma.c
+++ b/ports/rp2/rp2_dma.c
@@ -56,7 +56,7 @@ typedef struct _rp2_dma_ctrl_field_t {
uint8_t read_only : 1;
} rp2_dma_ctrl_field_t;
-STATIC rp2_dma_ctrl_field_t rp2_dma_ctrl_fields_table[] = {
+static rp2_dma_ctrl_field_t rp2_dma_ctrl_fields_table[] = {
{ MP_QSTR_enable, 0, 1, 0 },
{ MP_QSTR_high_pri, 1, 1, 0 },
{ MP_QSTR_size, 2, 2, 0 },
@@ -76,14 +76,14 @@ STATIC rp2_dma_ctrl_field_t rp2_dma_ctrl_fields_table[] = {
{ MP_QSTR_ahb_err, 31, 1, 1 },
};
-STATIC const uint32_t rp2_dma_ctrl_field_count = MP_ARRAY_SIZE(rp2_dma_ctrl_fields_table);
+static const uint32_t rp2_dma_ctrl_field_count = MP_ARRAY_SIZE(rp2_dma_ctrl_fields_table);
#define REG_TYPE_COUNT 0 // Accept just integers
#define REG_TYPE_CONF 1 // Accept integers or ctrl values
#define REG_TYPE_ADDR_READ 2 // Accept integers, buffers or objects that can be read from
#define REG_TYPE_ADDR_WRITE 3 // Accept integers, buffers or objects that can be written to
-STATIC uint32_t rp2_dma_register_value_from_obj(mp_obj_t o, int reg_type) {
+static uint32_t rp2_dma_register_value_from_obj(mp_obj_t o, int reg_type) {
if (reg_type == REG_TYPE_ADDR_READ || reg_type == REG_TYPE_ADDR_WRITE) {
mp_buffer_info_t buf_info;
mp_uint_t flags = (reg_type == REG_TYPE_ADDR_READ) ? MP_BUFFER_READ : MP_BUFFER_WRITE;
@@ -95,7 +95,7 @@ STATIC uint32_t rp2_dma_register_value_from_obj(mp_obj_t o, int reg_type) {
return mp_obj_get_int_truncated(o);
}
-STATIC void rp2_dma_irq_handler(void) {
+static void rp2_dma_irq_handler(void) {
// Main IRQ handler
uint32_t irq_bits = dma_hw->ints0;
@@ -113,7 +113,7 @@ STATIC void rp2_dma_irq_handler(void) {
}
}
-STATIC mp_uint_t rp2_dma_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t rp2_dma_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(self_in);
irq_set_enabled(DMA_IRQ_0, false);
self->irq_flag = 0;
@@ -122,7 +122,7 @@ STATIC mp_uint_t rp2_dma_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
return 0;
}
-STATIC mp_uint_t rp2_dma_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t rp2_dma_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (info_type == MP_IRQ_INFO_FLAGS) {
return self->irq_flag;
@@ -132,12 +132,12 @@ STATIC mp_uint_t rp2_dma_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
return 0;
}
-STATIC const mp_irq_methods_t rp2_dma_irq_methods = {
+static const mp_irq_methods_t rp2_dma_irq_methods = {
.trigger = rp2_dma_irq_trigger,
.info = rp2_dma_irq_info,
};
-STATIC mp_obj_t rp2_dma_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t rp2_dma_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
int dma_channel = dma_claim_unused_channel(false);
@@ -152,13 +152,13 @@ STATIC mp_obj_t rp2_dma_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(self);
}
-STATIC void rp2_dma_error_if_closed(rp2_dma_obj_t *self) {
+static void rp2_dma_error_if_closed(rp2_dma_obj_t *self) {
if (self->channel == CHANNEL_CLOSED) {
mp_raise_ValueError(MP_ERROR_TEXT("channel closed"));
}
}
-STATIC void rp2_dma_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
+static void rp2_dma_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (dest[0] == MP_OBJ_NULL) {
@@ -215,13 +215,13 @@ STATIC void rp2_dma_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
}
}
-STATIC void rp2_dma_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void rp2_dma_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "DMA(%u)", self->channel);
}
// DMA.config(*, read, write, count, ctrl, trigger)
-STATIC mp_obj_t rp2_dma_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t rp2_dma_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(*pos_args);
rp2_dma_error_if_closed(self);
@@ -277,10 +277,10 @@ STATIC mp_obj_t rp2_dma_config(size_t n_args, const mp_obj_t *pos_args, mp_map_t
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(rp2_dma_config_obj, 1, rp2_dma_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(rp2_dma_config_obj, 1, rp2_dma_config);
// DMA.active([value])
-STATIC mp_obj_t rp2_dma_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rp2_dma_active(size_t n_args, const mp_obj_t *args) {
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(args[0]);
rp2_dma_error_if_closed(self);
@@ -295,13 +295,13 @@ STATIC mp_obj_t rp2_dma_active(size_t n_args, const mp_obj_t *args) {
uint32_t busy = dma_channel_is_busy(self->channel);
return mp_obj_new_bool((mp_int_t)busy);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_dma_active_obj, 1, 2, rp2_dma_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_dma_active_obj, 1, 2, rp2_dma_active);
// Default is quiet, unpaced, read and write incrementing, word transfers, enabled
#define DEFAULT_DMA_CONFIG (1 << 21) | (0x3f << 15) | (1 << 5) | (1 << 4) | (2 << 2) | (1 << 0)
// DMA.pack_ctrl(...)
-STATIC mp_obj_t rp2_dma_pack_ctrl(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t rp2_dma_pack_ctrl(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// Pack keyword settings into a control register value, using either the default for this
// DMA channel or the provided defaults
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
@@ -346,10 +346,10 @@ STATIC mp_obj_t rp2_dma_pack_ctrl(size_t n_pos_args, const mp_obj_t *pos_args, m
return mp_obj_new_int_from_uint(value);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(rp2_dma_pack_ctrl_obj, 1, rp2_dma_pack_ctrl);
+static MP_DEFINE_CONST_FUN_OBJ_KW(rp2_dma_pack_ctrl_obj, 1, rp2_dma_pack_ctrl);
// DMA.unpack_ctrl(value)
-STATIC mp_obj_t rp2_dma_unpack_ctrl(mp_obj_t value_obj) {
+static mp_obj_t rp2_dma_unpack_ctrl(mp_obj_t value_obj) {
// Return a dict representing the unpacked fields of a control register value
mp_obj_t result_dict[rp2_dma_ctrl_field_count * 2];
@@ -364,10 +364,10 @@ STATIC mp_obj_t rp2_dma_unpack_ctrl(mp_obj_t value_obj) {
return mp_obj_dict_make_new(&mp_type_dict, 0, rp2_dma_ctrl_field_count, result_dict);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(rp2_dma_unpack_ctrl_fun_obj, rp2_dma_unpack_ctrl);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(rp2_dma_unpack_ctrl_obj, MP_ROM_PTR(&rp2_dma_unpack_ctrl_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_1(rp2_dma_unpack_ctrl_fun_obj, rp2_dma_unpack_ctrl);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(rp2_dma_unpack_ctrl_obj, MP_ROM_PTR(&rp2_dma_unpack_ctrl_fun_obj));
-STATIC mp_obj_t rp2_dma_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t rp2_dma_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = mp_const_none} },
@@ -409,10 +409,10 @@ STATIC mp_obj_t rp2_dma_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
return MP_OBJ_FROM_PTR(irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(rp2_dma_irq_obj, 1, rp2_dma_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(rp2_dma_irq_obj, 1, rp2_dma_irq);
// DMA.close()
-STATIC mp_obj_t rp2_dma_close(mp_obj_t self_in) {
+static mp_obj_t rp2_dma_close(mp_obj_t self_in) {
rp2_dma_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t channel = self->channel;
@@ -431,9 +431,9 @@ STATIC mp_obj_t rp2_dma_close(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(rp2_dma_close_obj, rp2_dma_close);
+static MP_DEFINE_CONST_FUN_OBJ_1(rp2_dma_close_obj, rp2_dma_close);
-STATIC const mp_rom_map_elem_t rp2_dma_locals_dict_table[] = {
+static const mp_rom_map_elem_t rp2_dma_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&rp2_dma_config_obj) },
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&rp2_dma_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&rp2_dma_irq_obj) },
@@ -442,7 +442,7 @@ STATIC const mp_rom_map_elem_t rp2_dma_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_pack_ctrl), MP_ROM_PTR(&rp2_dma_pack_ctrl_obj) },
{ MP_ROM_QSTR(MP_QSTR_unpack_ctrl), MP_ROM_PTR(&rp2_dma_unpack_ctrl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(rp2_dma_locals_dict, rp2_dma_locals_dict_table);
+static MP_DEFINE_CONST_DICT(rp2_dma_locals_dict, rp2_dma_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
rp2_dma_type,
diff --git a/ports/rp2/rp2_flash.c b/ports/rp2/rp2_flash.c
index 35c5164169..c1acb54e75 100644
--- a/ports/rp2/rp2_flash.c
+++ b/ports/rp2/rp2_flash.c
@@ -53,7 +53,7 @@ typedef struct _rp2_flash_obj_t {
uint32_t flash_size;
} rp2_flash_obj_t;
-STATIC rp2_flash_obj_t rp2_flash_obj = {
+static rp2_flash_obj_t rp2_flash_obj = {
.base = { &rp2_flash_type },
.flash_base = MICROPY_HW_FLASH_STORAGE_BASE,
.flash_size = MICROPY_HW_FLASH_STORAGE_BYTES,
@@ -86,7 +86,7 @@ static void end_critical_flash_section(uint32_t state) {
}
}
-STATIC mp_obj_t rp2_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t rp2_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Parse arguments
enum { ARG_start, ARG_len };
static const mp_arg_t allowed_args[] = {
@@ -128,7 +128,7 @@ STATIC mp_obj_t rp2_flash_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t rp2_flash_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rp2_flash_readblocks(size_t n_args, const mp_obj_t *args) {
rp2_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = mp_obj_get_int(args[1]) * BLOCK_SIZE_BYTES;
mp_buffer_info_t bufinfo;
@@ -143,9 +143,9 @@ STATIC mp_obj_t rp2_flash_readblocks(size_t n_args, const mp_obj_t *args) {
mp_event_handle_nowait();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_flash_readblocks_obj, 3, 4, rp2_flash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_flash_readblocks_obj, 3, 4, rp2_flash_readblocks);
-STATIC mp_obj_t rp2_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rp2_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
rp2_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = mp_obj_get_int(args[1]) * BLOCK_SIZE_BYTES;
mp_buffer_info_t bufinfo;
@@ -166,9 +166,9 @@ STATIC mp_obj_t rp2_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
// TODO check return value
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_flash_writeblocks_obj, 3, 4, rp2_flash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_flash_writeblocks_obj, 3, 4, rp2_flash_writeblocks);
-STATIC mp_obj_t rp2_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t rp2_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
rp2_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
switch (cmd) {
@@ -194,14 +194,14 @@ STATIC mp_obj_t rp2_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(rp2_flash_ioctl_obj, rp2_flash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(rp2_flash_ioctl_obj, rp2_flash_ioctl);
-STATIC const mp_rom_map_elem_t rp2_flash_locals_dict_table[] = {
+static const mp_rom_map_elem_t rp2_flash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&rp2_flash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&rp2_flash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&rp2_flash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(rp2_flash_locals_dict, rp2_flash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(rp2_flash_locals_dict, rp2_flash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
rp2_flash_type,
diff --git a/ports/rp2/rp2_pio.c b/ports/rp2/rp2_pio.c
index 42e61684b3..b882bbbc50 100644
--- a/ports/rp2/rp2_pio.c
+++ b/ports/rp2/rp2_pio.c
@@ -65,17 +65,17 @@ typedef struct _rp2_state_machine_irq_obj_t {
uint8_t trigger;
} rp2_state_machine_irq_obj_t;
-STATIC const rp2_state_machine_obj_t rp2_state_machine_obj[8];
-STATIC uint8_t rp2_state_machine_initial_pc[8];
+static const rp2_state_machine_obj_t rp2_state_machine_obj[8];
+static uint8_t rp2_state_machine_initial_pc[8];
// These masks keep track of PIO instruction memory used by this module.
-STATIC uint32_t rp2_pio_instruction_memory_usage_mask[2];
+static uint32_t rp2_pio_instruction_memory_usage_mask[2];
-STATIC const rp2_state_machine_obj_t *rp2_state_machine_get_object(mp_int_t sm_id);
-STATIC void rp2_state_machine_reset_all(void);
-STATIC mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static const rp2_state_machine_obj_t *rp2_state_machine_get_object(mp_int_t sm_id);
+static void rp2_state_machine_reset_all(void);
+static mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
-STATIC void pio_irq0(PIO pio) {
+static void pio_irq0(PIO pio) {
uint32_t ints = pio->ints0;
// Acknowledge SM0-3 IRQs if they are enabled on this IRQ0.
@@ -98,16 +98,16 @@ STATIC void pio_irq0(PIO pio) {
}
}
-STATIC void pio0_irq0(void) {
+static void pio0_irq0(void) {
pio_irq0(pio0);
}
-STATIC void pio1_irq0(void) {
+static void pio1_irq0(void) {
pio_irq0(pio1);
}
// Calls pio_add_program() and keeps track of used instruction memory.
-STATIC uint rp2_pio_add_managed_program(PIO pio, struct pio_program *pio_program) {
+static uint rp2_pio_add_managed_program(PIO pio, struct pio_program *pio_program) {
uint offset = pio_add_program(pio, pio_program);
uint32_t mask = ((1 << pio_program->length) - 1) << offset;
rp2_pio_instruction_memory_usage_mask[pio_get_index(pio)] |= mask;
@@ -115,7 +115,7 @@ STATIC uint rp2_pio_add_managed_program(PIO pio, struct pio_program *pio_program
}
// Calls pio_remove_program() and keeps track of used instruction memory.
-STATIC void rp2_pio_remove_managed_program(PIO pio, struct pio_program *pio_program, uint offset) {
+static void rp2_pio_remove_managed_program(PIO pio, struct pio_program *pio_program, uint offset) {
pio_remove_program(pio, pio_program, offset);
uint32_t mask = ((1 << pio_program->length) - 1) << offset;
rp2_pio_instruction_memory_usage_mask[pio_get_index(pio)] &= ~mask;
@@ -123,7 +123,7 @@ STATIC void rp2_pio_remove_managed_program(PIO pio, struct pio_program *pio_prog
// Calls pio_remove_program() for all programs registered with rp2_pio_add_managed_program(),
// that weren't already removed via rp2_pio_remove_managed_program().
-STATIC void rp2_pio_remove_all_managed_programs(PIO pio) {
+static void rp2_pio_remove_all_managed_programs(PIO pio) {
uint32_t mask = rp2_pio_instruction_memory_usage_mask[pio_get_index(pio)];
for (size_t i = 0; i < 32; ++i) {
if (mask & (1 << i)) {
@@ -188,13 +188,13 @@ typedef struct _asm_pio_config_t {
uint32_t pinvals;
} asm_pio_config_t;
-STATIC void asm_pio_override_shiftctrl(mp_obj_t arg, uint32_t bits, uint32_t lsb, pio_sm_config *config) {
+static void asm_pio_override_shiftctrl(mp_obj_t arg, uint32_t bits, uint32_t lsb, pio_sm_config *config) {
if (arg != mp_const_none) {
config->shiftctrl = (config->shiftctrl & ~bits) | (mp_obj_get_int(arg) << lsb);
}
}
-STATIC void asm_pio_get_pins(const char *type, mp_obj_t prog_pins, mp_obj_t arg_base, asm_pio_config_t *config) {
+static void asm_pio_get_pins(const char *type, mp_obj_t prog_pins, mp_obj_t arg_base, asm_pio_config_t *config) {
if (prog_pins != mp_const_none) {
// The PIO program specified pins for initialisation on out/set/sideset.
if (mp_obj_is_integer(prog_pins)) {
@@ -223,7 +223,7 @@ STATIC void asm_pio_get_pins(const char *type, mp_obj_t prog_pins, mp_obj_t arg_
}
}
-STATIC void asm_pio_init_gpio(PIO pio, uint32_t sm, asm_pio_config_t *config) {
+static void asm_pio_init_gpio(PIO pio, uint32_t sm, asm_pio_config_t *config) {
uint32_t pinmask = ((1 << config->count) - 1) << config->base;
pio_sm_set_pins_with_mask(pio, sm, config->pinvals << config->base, pinmask);
pio_sm_set_pindirs_with_mask(pio, sm, config->pindirs << config->base, pinmask);
@@ -235,20 +235,20 @@ STATIC void asm_pio_init_gpio(PIO pio, uint32_t sm, asm_pio_config_t *config) {
/******************************************************************************/
// PIO object
-STATIC const mp_irq_methods_t rp2_pio_irq_methods;
+static const mp_irq_methods_t rp2_pio_irq_methods;
-STATIC rp2_pio_obj_t rp2_pio_obj[] = {
+static rp2_pio_obj_t rp2_pio_obj[] = {
{ { &rp2_pio_type }, pio0, PIO0_IRQ_0 },
{ { &rp2_pio_type }, pio1, PIO1_IRQ_0 },
};
-STATIC void rp2_pio_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void rp2_pio_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
rp2_pio_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "PIO(%u)", self->pio == pio0 ? 0 : 1);
}
// constructor(id)
-STATIC mp_obj_t rp2_pio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t rp2_pio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// Get the PIO object.
@@ -263,7 +263,7 @@ STATIC mp_obj_t rp2_pio_make_new(const mp_obj_type_t *type, size_t n_args, size_
}
// PIO.add_program(prog)
-STATIC mp_obj_t rp2_pio_add_program(mp_obj_t self_in, mp_obj_t prog_in) {
+static mp_obj_t rp2_pio_add_program(mp_obj_t self_in, mp_obj_t prog_in) {
rp2_pio_obj_t *self = MP_OBJ_TO_PTR(self_in);
// Get the program data.
@@ -284,10 +284,10 @@ STATIC mp_obj_t rp2_pio_add_program(mp_obj_t self_in, mp_obj_t prog_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(rp2_pio_add_program_obj, rp2_pio_add_program);
+static MP_DEFINE_CONST_FUN_OBJ_2(rp2_pio_add_program_obj, rp2_pio_add_program);
// PIO.remove_program([prog])
-STATIC mp_obj_t rp2_pio_remove_program(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rp2_pio_remove_program(size_t n_args, const mp_obj_t *args) {
rp2_pio_obj_t *self = MP_OBJ_TO_PTR(args[0]);
// Default to remove all programs.
@@ -315,10 +315,10 @@ STATIC mp_obj_t rp2_pio_remove_program(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_pio_remove_program_obj, 1, 2, rp2_pio_remove_program);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_pio_remove_program_obj, 1, 2, rp2_pio_remove_program);
// PIO.state_machine(id, prog, freq=-1, *, set=None)
-STATIC mp_obj_t rp2_pio_state_machine(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t rp2_pio_state_machine(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
rp2_pio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
// Get and verify the state machine id.
@@ -340,7 +340,7 @@ STATIC mp_obj_t rp2_pio_state_machine(size_t n_args, const mp_obj_t *pos_args, m
MP_DEFINE_CONST_FUN_OBJ_KW(rp2_pio_state_machine_obj, 2, rp2_pio_state_machine);
// PIO.irq(handler=None, trigger=IRQ_SM0|IRQ_SM1|IRQ_SM2|IRQ_SM3, hard=False)
-STATIC mp_obj_t rp2_pio_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t rp2_pio_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -388,9 +388,9 @@ STATIC mp_obj_t rp2_pio_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
return MP_OBJ_FROM_PTR(irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(rp2_pio_irq_obj, 1, rp2_pio_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(rp2_pio_irq_obj, 1, rp2_pio_irq);
-STATIC const mp_rom_map_elem_t rp2_pio_locals_dict_table[] = {
+static const mp_rom_map_elem_t rp2_pio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_add_program), MP_ROM_PTR(&rp2_pio_add_program_obj) },
{ MP_ROM_QSTR(MP_QSTR_remove_program), MP_ROM_PTR(&rp2_pio_remove_program_obj) },
{ MP_ROM_QSTR(MP_QSTR_state_machine), MP_ROM_PTR(&rp2_pio_state_machine_obj) },
@@ -413,7 +413,7 @@ STATIC const mp_rom_map_elem_t rp2_pio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_SM2), MP_ROM_INT(0x400) },
{ MP_ROM_QSTR(MP_QSTR_IRQ_SM3), MP_ROM_INT(0x800) },
};
-STATIC MP_DEFINE_CONST_DICT(rp2_pio_locals_dict, rp2_pio_locals_dict_table);
+static MP_DEFINE_CONST_DICT(rp2_pio_locals_dict, rp2_pio_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
rp2_pio_type,
@@ -424,7 +424,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &rp2_pio_locals_dict
);
-STATIC mp_uint_t rp2_pio_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t rp2_pio_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
rp2_pio_obj_t *self = MP_OBJ_TO_PTR(self_in);
rp2_pio_irq_obj_t *irq = MP_STATE_PORT(rp2_pio_irq_obj[PIO_NUM(self->pio)]);
irq_set_enabled(self->irq, false);
@@ -434,7 +434,7 @@ STATIC mp_uint_t rp2_pio_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
return 0;
}
-STATIC mp_uint_t rp2_pio_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t rp2_pio_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
rp2_pio_obj_t *self = MP_OBJ_TO_PTR(self_in);
rp2_pio_irq_obj_t *irq = MP_STATE_PORT(rp2_pio_irq_obj[PIO_NUM(self->pio)]);
if (info_type == MP_IRQ_INFO_FLAGS) {
@@ -445,7 +445,7 @@ STATIC mp_uint_t rp2_pio_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
return 0;
}
-STATIC const mp_irq_methods_t rp2_pio_irq_methods = {
+static const mp_irq_methods_t rp2_pio_irq_methods = {
.trigger = rp2_pio_irq_trigger,
.info = rp2_pio_irq_info,
};
@@ -454,11 +454,11 @@ STATIC const mp_irq_methods_t rp2_pio_irq_methods = {
// StateMachine object
// This mask keeps track of state machines claimed by this module.
-STATIC uint32_t rp2_state_machine_claimed_mask;
+static uint32_t rp2_state_machine_claimed_mask;
-STATIC const mp_irq_methods_t rp2_state_machine_irq_methods;
+static const mp_irq_methods_t rp2_state_machine_irq_methods;
-STATIC const rp2_state_machine_obj_t rp2_state_machine_obj[] = {
+static const rp2_state_machine_obj_t rp2_state_machine_obj[] = {
{ { &rp2_state_machine_type }, pio0, PIO0_IRQ_0, 0, 0 },
{ { &rp2_state_machine_type }, pio0, PIO0_IRQ_0, 1, 1 },
{ { &rp2_state_machine_type }, pio0, PIO0_IRQ_0, 2, 2 },
@@ -469,7 +469,7 @@ STATIC const rp2_state_machine_obj_t rp2_state_machine_obj[] = {
{ { &rp2_state_machine_type }, pio1, PIO1_IRQ_0, 3, 7 },
};
-STATIC const rp2_state_machine_obj_t *rp2_state_machine_get_object(mp_int_t sm_id) {
+static const rp2_state_machine_obj_t *rp2_state_machine_get_object(mp_int_t sm_id) {
if (!(0 <= sm_id && sm_id < MP_ARRAY_SIZE(rp2_state_machine_obj))) {
mp_raise_ValueError("invalid StateMachine");
}
@@ -487,7 +487,7 @@ STATIC const rp2_state_machine_obj_t *rp2_state_machine_get_object(mp_int_t sm_i
return sm_obj;
}
-STATIC void rp2_state_machine_reset_all(void) {
+static void rp2_state_machine_reset_all(void) {
for (size_t i = 0; i < MP_ARRAY_SIZE(rp2_state_machine_obj); ++i) {
if (rp2_state_machine_claimed_mask & (1 << i)) {
const rp2_state_machine_obj_t *sm_obj = &rp2_state_machine_obj[i];
@@ -498,7 +498,7 @@ STATIC void rp2_state_machine_reset_all(void) {
rp2_state_machine_claimed_mask = 0;
}
-STATIC void rp2_state_machine_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void rp2_state_machine_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "StateMachine(%u)", self->id);
}
@@ -508,7 +508,7 @@ STATIC void rp2_state_machine_print(const mp_print_t *print, mp_obj_t self_in, m
// sideset_base=None, in_shiftdir=None, out_shiftdir=None,
// push_thresh=None, pull_thresh=None,
// )
-STATIC mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {
ARG_prog, ARG_freq,
ARG_in_base, ARG_out_base, ARG_set_base, ARG_jmp_pin, ARG_sideset_base,
@@ -639,7 +639,7 @@ STATIC mp_obj_t rp2_state_machine_init_helper(const rp2_state_machine_obj_t *sel
}
// StateMachine(id, ...)
-STATIC mp_obj_t rp2_state_machine_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t rp2_state_machine_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// Get the StateMachine object.
@@ -657,32 +657,32 @@ STATIC mp_obj_t rp2_state_machine_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t rp2_state_machine_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t rp2_state_machine_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return rp2_state_machine_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(rp2_state_machine_init_obj, 1, rp2_state_machine_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(rp2_state_machine_init_obj, 1, rp2_state_machine_init);
// StateMachine.active([value])
-STATIC mp_obj_t rp2_state_machine_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rp2_state_machine_active(size_t n_args, const mp_obj_t *args) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args > 1) {
pio_sm_set_enabled(self->pio, self->sm, mp_obj_is_true(args[1]));
}
return mp_obj_new_bool((self->pio->ctrl >> self->sm) & 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_state_machine_active_obj, 1, 2, rp2_state_machine_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_state_machine_active_obj, 1, 2, rp2_state_machine_active);
// StateMachine.restart()
-STATIC mp_obj_t rp2_state_machine_restart(mp_obj_t self_in) {
+static mp_obj_t rp2_state_machine_restart(mp_obj_t self_in) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(self_in);
pio_sm_restart(self->pio, self->sm);
pio_sm_exec(self->pio, self->sm, pio_encode_jmp(rp2_state_machine_initial_pc[self->id]));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(rp2_state_machine_restart_obj, rp2_state_machine_restart);
+static MP_DEFINE_CONST_FUN_OBJ_1(rp2_state_machine_restart_obj, rp2_state_machine_restart);
// StateMachine.exec(instr)
-STATIC mp_obj_t rp2_state_machine_exec(mp_obj_t self_in, mp_obj_t instr_in) {
+static mp_obj_t rp2_state_machine_exec(mp_obj_t self_in, mp_obj_t instr_in) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t encoded = 0;
if (!mp_obj_get_int_maybe(instr_in, &encoded)) {
@@ -700,10 +700,10 @@ STATIC mp_obj_t rp2_state_machine_exec(mp_obj_t self_in, mp_obj_t instr_in) {
pio_sm_exec(self->pio, self->sm, encoded);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(rp2_state_machine_exec_obj, rp2_state_machine_exec);
+static MP_DEFINE_CONST_FUN_OBJ_2(rp2_state_machine_exec_obj, rp2_state_machine_exec);
// StateMachine.get(buf=None, shift=0)
-STATIC mp_obj_t rp2_state_machine_get(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rp2_state_machine_get(size_t n_args, const mp_obj_t *args) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_buffer_info_t bufinfo;
bufinfo.buf = NULL;
@@ -752,10 +752,10 @@ STATIC mp_obj_t rp2_state_machine_get(size_t n_args, const mp_obj_t *args) {
}
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_state_machine_get_obj, 1, 3, rp2_state_machine_get);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_state_machine_get_obj, 1, 3, rp2_state_machine_get);
// StateMachine.put(value, shift=0)
-STATIC mp_obj_t rp2_state_machine_put(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rp2_state_machine_put(size_t n_args, const mp_obj_t *args) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t shift = 0;
if (n_args > 2) {
@@ -793,26 +793,26 @@ STATIC mp_obj_t rp2_state_machine_put(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_state_machine_put_obj, 2, 3, rp2_state_machine_put);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rp2_state_machine_put_obj, 2, 3, rp2_state_machine_put);
// StateMachine.rx_fifo()
-STATIC mp_obj_t rp2_state_machine_rx_fifo(mp_obj_t self_in) {
+static mp_obj_t rp2_state_machine_rx_fifo(mp_obj_t self_in) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(pio_sm_get_rx_fifo_level(self->pio, self->sm));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(rp2_state_machine_rx_fifo_obj, rp2_state_machine_rx_fifo);
+static MP_DEFINE_CONST_FUN_OBJ_1(rp2_state_machine_rx_fifo_obj, rp2_state_machine_rx_fifo);
// StateMachine.tx_fifo()
-STATIC mp_obj_t rp2_state_machine_tx_fifo(mp_obj_t self_in) {
+static mp_obj_t rp2_state_machine_tx_fifo(mp_obj_t self_in) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(pio_sm_get_tx_fifo_level(self->pio, self->sm));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(rp2_state_machine_tx_fifo_obj, rp2_state_machine_tx_fifo);
+static MP_DEFINE_CONST_FUN_OBJ_1(rp2_state_machine_tx_fifo_obj, rp2_state_machine_tx_fifo);
// Buffer protocol implementation for StateMachine.
// The buffer represents one of the FIFO ports of the state machine. Note that a different
// pointer is returned depending on if this is for reading or writing.
-STATIC mp_int_t rp2_state_machine_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+static mp_int_t rp2_state_machine_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(o_in);
bufinfo->len = 4;
@@ -827,7 +827,7 @@ STATIC mp_int_t rp2_state_machine_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bu
}
// StateMachine.irq(handler=None, trigger=0|1, hard=False)
-STATIC mp_obj_t rp2_state_machine_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t rp2_state_machine_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -880,9 +880,9 @@ STATIC mp_obj_t rp2_state_machine_irq(size_t n_args, const mp_obj_t *pos_args, m
return MP_OBJ_FROM_PTR(irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(rp2_state_machine_irq_obj, 1, rp2_state_machine_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(rp2_state_machine_irq_obj, 1, rp2_state_machine_irq);
-STATIC const mp_rom_map_elem_t rp2_state_machine_locals_dict_table[] = {
+static const mp_rom_map_elem_t rp2_state_machine_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&rp2_state_machine_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&rp2_state_machine_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_restart), MP_ROM_PTR(&rp2_state_machine_restart_obj) },
@@ -893,7 +893,7 @@ STATIC const mp_rom_map_elem_t rp2_state_machine_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_tx_fifo), MP_ROM_PTR(&rp2_state_machine_tx_fifo_obj) },
{ MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&rp2_state_machine_irq_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(rp2_state_machine_locals_dict, rp2_state_machine_locals_dict_table);
+static MP_DEFINE_CONST_DICT(rp2_state_machine_locals_dict, rp2_state_machine_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
rp2_state_machine_type,
@@ -905,7 +905,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &rp2_state_machine_locals_dict
);
-STATIC mp_uint_t rp2_state_machine_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t rp2_state_machine_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(self_in);
rp2_state_machine_irq_obj_t *irq = MP_STATE_PORT(rp2_state_machine_irq_obj[PIO_NUM(self->pio)]);
irq_set_enabled(self->irq, false);
@@ -915,7 +915,7 @@ STATIC mp_uint_t rp2_state_machine_irq_trigger(mp_obj_t self_in, mp_uint_t new_t
return 0;
}
-STATIC mp_uint_t rp2_state_machine_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t rp2_state_machine_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
rp2_state_machine_obj_t *self = MP_OBJ_TO_PTR(self_in);
rp2_state_machine_irq_obj_t *irq = MP_STATE_PORT(rp2_state_machine_irq_obj[PIO_NUM(self->pio)]);
if (info_type == MP_IRQ_INFO_FLAGS) {
@@ -926,7 +926,7 @@ STATIC mp_uint_t rp2_state_machine_irq_info(mp_obj_t self_in, mp_uint_t info_typ
return 0;
}
-STATIC const mp_irq_methods_t rp2_state_machine_irq_methods = {
+static const mp_irq_methods_t rp2_state_machine_irq_methods = {
.trigger = rp2_state_machine_irq_trigger,
.info = rp2_state_machine_irq_info,
};
diff --git a/ports/samd/machine_adc.c b/ports/samd/machine_adc.c
index 2e4d4ed842..665af6f6f2 100644
--- a/ports/samd/machine_adc.c
+++ b/ports/samd/machine_adc.c
@@ -85,7 +85,7 @@ static uint8_t resolution[] = {
extern mp_int_t log2i(mp_int_t num);
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -94,7 +94,7 @@ STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_p
self->adc_config.channel, self->bits, 1 << self->avg, self->vref);
}
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_id, ARG_bits, ARG_average, ARG_vref };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_OBJ },
@@ -138,7 +138,7 @@ STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args
}
// read_u16()
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
Adc *adc = adc_bases[self->adc_config.device];
// Set the reference voltage. Default: external AREFA.
adc->REFCTRL.reg = adc_vref_table[self->vref];
@@ -156,7 +156,7 @@ STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
}
// deinit() : release the ADC channel
-STATIC void mp_machine_adc_deinit(machine_adc_obj_t *self) {
+static void mp_machine_adc_deinit(machine_adc_obj_t *self) {
busy_flags &= ~((1 << (self->adc_config.device * 16 + self->adc_config.channel)));
}
diff --git a/ports/samd/machine_dac.c b/ports/samd/machine_dac.c
index 5c9d77624d..c611f95e65 100644
--- a/ports/samd/machine_dac.c
+++ b/ports/samd/machine_dac.c
@@ -44,7 +44,7 @@ typedef struct _dac_obj_t {
uint8_t vref;
} dac_obj_t;
-STATIC dac_obj_t dac_obj[] = {
+static dac_obj_t dac_obj[] = {
#if defined(MCU_SAMD21)
{{&machine_dac_type}, 0, PIN_PA02},
#elif defined(MCU_SAMD51)
@@ -76,7 +76,7 @@ static bool dac_init = false;
#endif
-STATIC mp_obj_t dac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
+static mp_obj_t dac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
const mp_obj_t *all_args) {
enum { ARG_id, ARG_vref };
@@ -150,12 +150,12 @@ STATIC mp_obj_t dac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
return MP_OBJ_FROM_PTR(self);
}
-STATIC void dac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void dac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
dac_obj_t *self = self_in;
mp_printf(print, "DAC(%u, Pin=%q, vref=%d)", self->id, pin_find_by_id(self->gpio_id)->name, self->vref);
}
-STATIC mp_obj_t dac_write(mp_obj_t self_in, mp_obj_t value_in) {
+static mp_obj_t dac_write(mp_obj_t self_in, mp_obj_t value_in) {
Dac *dac = dac_bases[0]; // Just one DAC
int value = mp_obj_get_int(value_in);
if (value < 0 || value > MAX_DAC_VALUE) {
@@ -172,11 +172,11 @@ STATIC mp_obj_t dac_write(mp_obj_t self_in, mp_obj_t value_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(dac_write_obj, dac_write);
-STATIC const mp_rom_map_elem_t dac_locals_dict_table[] = {
+static const mp_rom_map_elem_t dac_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&dac_write_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(dac_locals_dict, dac_locals_dict_table);
+static MP_DEFINE_CONST_DICT(dac_locals_dict, dac_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_dac_type,
diff --git a/ports/samd/machine_i2c.c b/ports/samd/machine_i2c.c
index ea5178dc06..a7b728ddaf 100644
--- a/ports/samd/machine_i2c.c
+++ b/ports/samd/machine_i2c.c
@@ -70,7 +70,7 @@ typedef struct _machine_i2c_obj_t {
uint8_t *buf;
} machine_i2c_obj_t;
-STATIC void i2c_send_command(Sercom *i2c, uint8_t command) {
+static void i2c_send_command(Sercom *i2c, uint8_t command) {
i2c->I2CM.CTRLB.bit.CMD = command;
while (i2c->I2CM.SYNCBUSY.bit.SYSOP) {
}
@@ -117,7 +117,7 @@ void common_i2c_irq_handler(int i2c_id) {
}
}
-STATIC void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "I2C(%u, freq=%u, scl=%u, sda=%u)",
self->id, self->freq, self->scl, self->sda);
@@ -212,7 +212,7 @@ mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return MP_OBJ_FROM_PTR(self);
}
-STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
+static int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
machine_i2c_obj_t *self = (machine_i2c_obj_t *)self_in;
Sercom *i2c = self->instance;
@@ -260,7 +260,7 @@ STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, si
return len;
}
-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,
};
diff --git a/ports/samd/machine_pin.c b/ports/samd/machine_pin.c
index 30b254722b..4dfbd69dcd 100644
--- a/ports/samd/machine_pin.c
+++ b/ports/samd/machine_pin.c
@@ -69,7 +69,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &machine_pin_board_pins_locals_dict
);
-STATIC const mp_irq_methods_t machine_pin_irq_methods;
+static const mp_irq_methods_t machine_pin_irq_methods;
bool EIC_occured;
@@ -78,7 +78,7 @@ uint32_t machine_pin_open_drain_mask[4];
// Open drain behaviour is simulated.
#define GPIO_IS_OPEN_DRAIN(id) (machine_pin_open_drain_mask[id / 32] & (1 << (id % 32)))
-STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pin_obj_t *self = self_in;
char *mode_str;
char *pull_str[] = {"PULL_OFF", "PULL_UP", "PULL_DOWN"};
@@ -94,14 +94,14 @@ STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
pull_str[mp_hal_get_pull_mode(self->pin_id)]);
}
-STATIC void pin_validate_drive(bool strength) {
+static void pin_validate_drive(bool strength) {
if (strength != GPIO_STRENGTH_2MA && strength != GPIO_STRENGTH_8MA) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid argument(s) value"));
}
}
// Pin.init(mode, pull=None, *, value=None, drive=0). No 'alt' yet.
-STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_pull, ARG_value, ARG_drive, ARG_alt };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE}},
@@ -193,7 +193,7 @@ mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp
}
// Pin.init(mode, pull)
-STATIC mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_init_obj, 1, machine_pin_obj_init);
@@ -202,18 +202,18 @@ MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_init_obj, 1, machine_pin_obj_init);
mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
return machine_pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
// Pin.disable(pin)
-STATIC mp_obj_t machine_pin_disable(mp_obj_t self_in) {
+static mp_obj_t machine_pin_disable(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
gpio_set_pin_direction(self->pin_id, GPIO_DIRECTION_OFF); // Disables the pin (low power state)
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_disable_obj, machine_pin_disable);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_disable_obj, machine_pin_disable);
// Pin.low() Totem-pole (push-pull)
-STATIC mp_obj_t machine_pin_low(mp_obj_t self_in) {
+static mp_obj_t machine_pin_low(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (GPIO_IS_OPEN_DRAIN(self->pin_id)) {
mp_hal_pin_od_low(self->pin_id);
@@ -225,7 +225,7 @@ STATIC mp_obj_t machine_pin_low(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_low_obj, machine_pin_low);
// Pin.high() Totem-pole (push-pull)
-STATIC mp_obj_t machine_pin_high(mp_obj_t self_in) {
+static mp_obj_t machine_pin_high(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (GPIO_IS_OPEN_DRAIN(self->pin_id)) {
mp_hal_pin_od_high(self->pin_id);
@@ -237,7 +237,7 @@ STATIC mp_obj_t machine_pin_high(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_high_obj, machine_pin_high);
// Pin.toggle(). Only TOGGLE pins set as OUTPUT.
-STATIC mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
+static mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
// Determine DIRECTION of PIN.
@@ -259,7 +259,7 @@ STATIC mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_toggle_obj, machine_pin_toggle);
// Pin.drive(). Normal (0) is 2mA, High (1) allows 8mA.
-STATIC mp_obj_t machine_pin_drive(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pin_drive(size_t n_args, const mp_obj_t *args) {
machine_pin_obj_t *self = args[0]; // Pin
if (n_args == 1) {
return mp_const_none;
@@ -274,10 +274,10 @@ STATIC mp_obj_t machine_pin_drive(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_drive_obj, 1, 2, machine_pin_drive);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_drive_obj, 1, 2, machine_pin_drive);
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING, hard=False)
-STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -375,7 +375,7 @@ STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
}
return MP_OBJ_FROM_PTR(irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
void pin_irq_deinit_all(void) {
@@ -412,7 +412,7 @@ void EIC_Handler() {
}
}
-STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&machine_pin_value_obj) },
@@ -441,9 +441,9 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_IRQ_EDGE_RISE) },
{ MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_IRQ_EDGE_FALL) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
-STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_pin_obj_t *self = self_in;
@@ -459,7 +459,7 @@ STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, i
return -1;
}
-STATIC const mp_pin_p_t pin_pin_p = {
+static const mp_pin_p_t pin_pin_p = {
.ioctl = pin_ioctl,
};
@@ -484,7 +484,7 @@ static uint8_t find_eic_id(int pin) {
return 0xff;
}
-STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t eic_id = find_eic_id(self->pin_id);
if (eic_id != 0xff) {
@@ -497,7 +497,7 @@ STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger
return 0;
}
-STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t eic_id = find_eic_id(self->pin_id);
if (eic_id != 0xff) {
@@ -511,7 +511,7 @@ STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
return 0;
}
-STATIC const mp_irq_methods_t machine_pin_irq_methods = {
+static const mp_irq_methods_t machine_pin_irq_methods = {
.trigger = machine_pin_irq_trigger,
.info = machine_pin_irq_info,
};
diff --git a/ports/samd/machine_pwm.c b/ports/samd/machine_pwm.c
index 6fc8145372..b2a383c21c 100644
--- a/ports/samd/machine_pwm.c
+++ b/ports/samd/machine_pwm.c
@@ -105,21 +105,21 @@ static uint8_t device_status[TCC_INST_NUM];
static uint8_t output_active[TCC_INST_NUM];
const uint16_t prescaler_table[] = {1, 2, 4, 8, 16, 64, 256, 1024};
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq);
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16);
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns);
-STATIC void mp_machine_pwm_start(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_stop(machine_pwm_obj_t *self);
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq);
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16);
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns);
+static void mp_machine_pwm_start(machine_pwm_obj_t *self);
+static void mp_machine_pwm_stop(machine_pwm_obj_t *self);
-STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "PWM(%q, device=%u, channel=%u, output=%u)",
pin_find_by_id(self->pin_id)->name, self->device, self->channel, self->output);
}
// called by the constructor and init()
-STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
+static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq, ARG_duty_u16, ARG_duty_ns, ARG_invert, ARG_device };
static const mp_arg_t allowed_args[] = {
@@ -225,7 +225,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
}
// PWM(pin)
-STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// Check number of arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -245,7 +245,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_pwm_stop(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_stop(machine_pwm_obj_t *self) {
Tcc *tcc = tcc_instance[self->device];
tcc->CTRLA.bit.ENABLE = 0;
while (tcc->SYNCBUSY.reg & TCC_SYNCBUSY_ENABLE) {
@@ -271,7 +271,7 @@ void pwm_deinit_all(void) {
// switch off that device.
// This stops all channels, but keeps the configuration
// Calling pwm.freq(n), pwm.duty_x() or pwm.init() will start it again.
-STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
mp_hal_clr_pin_mux(self->pin_id); // Switch the output off
output_active[self->device] &= ~(1 << self->output); // clear output flasg
// Stop the device, if no output is active.
@@ -280,7 +280,7 @@ STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
}
}
-STATIC void wait_for_register_update(Tcc *tcc) {
+static void wait_for_register_update(Tcc *tcc) {
// Wait for a period's end (may be long) to have the change settled
// Each loop cycle takes at least 1 ms, giving an implicit timeout.
for (int i = 0; i < PWM_UPDATE_TIMEOUT; i++) {
@@ -293,7 +293,7 @@ STATIC void wait_for_register_update(Tcc *tcc) {
tcc->INTFLAG.reg = TCC_INTFLAG_OVF;
}
-STATIC void mp_machine_pwm_start(machine_pwm_obj_t *self) {
+static void mp_machine_pwm_start(machine_pwm_obj_t *self) {
// Start the PWM. The period counter is 24 bit or 16 bit with a pre-scaling
// of up to 1024, allowing a range from 24 MHz down to 1 Hz.
static const uint32_t max_period[5] = {1 << 24, 1 << 24, 1 << 16, 1 << 16, 1 << 16};
@@ -357,16 +357,16 @@ STATIC void mp_machine_pwm_start(machine_pwm_obj_t *self) {
tcc->CTRLBCLR.reg = TCC_CTRLBCLR_LUPD;
}
-STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
return MP_OBJ_NEW_SMALL_INT(self->freq);
}
-STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
+static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
self->freq = freq;
mp_machine_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
if (duty_type_flags[self->device] & (1 << self->channel)) {
return MP_OBJ_NEW_SMALL_INT(get_duty_value(self->device, self->channel));
} else {
@@ -374,13 +374,13 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
+static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) {
put_duty_value(self->device, self->channel, duty_u16);
duty_type_flags[self->device] |= 1 << self->channel;
mp_machine_pwm_start(self);
}
-STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
+static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
if (!(duty_type_flags[self->device] & (1 << self->channel))) {
return MP_OBJ_NEW_SMALL_INT(get_duty_value(self->device, self->channel));
} else {
@@ -388,7 +388,7 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) {
}
}
-STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
+static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) {
put_duty_value(self->device, self->channel, duty_ns);
duty_type_flags[self->device] &= ~(1 << self->channel);
mp_machine_pwm_start(self);
diff --git a/ports/samd/machine_rtc.c b/ports/samd/machine_rtc.c
index 1f0c9f4dca..a906f9176f 100644
--- a/ports/samd/machine_rtc.c
+++ b/ports/samd/machine_rtc.c
@@ -37,7 +37,7 @@ typedef struct _machine_rtc_obj_t {
} machine_rtc_obj_t;
// Singleton RTC object.
-STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
+static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
// Start the RTC Timer.
void machine_rtc_start(bool force) {
@@ -85,7 +85,7 @@ void rtc_gettime(timeutils_struct_time_t *tm) {
tm->tm_sec = RTC->MODE2.CLOCK.bit.SECOND;
}
-STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// Check arguments.
mp_arg_check_num(n_args, n_kw, 0, 0, false);
// RTC was already started at boot time. So nothing to do here.
@@ -93,7 +93,7 @@ STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, s
return (mp_obj_t)&machine_rtc_obj;
}
-STATIC mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args) {
// Rtc *rtc = RTC;
if (n_args == 1) {
// Get date and time.
@@ -137,21 +137,21 @@ STATIC mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args)
}
}
-STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
return machine_rtc_datetime_helper(n_args, args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
-STATIC mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) {
+static mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) {
mp_obj_t args[2] = {self_in, date};
machine_rtc_datetime_helper(2, args);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init);
// calibration(cal)
// When the argument is a number in the range [-16 to 15], set the calibration value.
-STATIC mp_obj_t machine_rtc_calibration(mp_obj_t self_in, mp_obj_t cal_in) {
+static mp_obj_t machine_rtc_calibration(mp_obj_t self_in, mp_obj_t cal_in) {
int8_t cal = 0;
// Make it negative for a "natural" behavior:
// value > 0: faster, value < 0: slower
@@ -159,14 +159,14 @@ STATIC mp_obj_t machine_rtc_calibration(mp_obj_t self_in, mp_obj_t cal_in) {
RTC->MODE2.FREQCORR.reg = (uint8_t)cal;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_calibration_obj, machine_rtc_calibration);
+static MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_calibration_obj, machine_rtc_calibration);
-STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_rtc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) },
{ MP_ROM_QSTR(MP_QSTR_calibration), MP_ROM_PTR(&machine_rtc_calibration_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
machine_rtc_type,
diff --git a/ports/samd/machine_spi.c b/ports/samd/machine_spi.c
index 3d5729c1f4..9c31cc2778 100644
--- a/ports/samd/machine_spi.c
+++ b/ports/samd/machine_spi.c
@@ -80,13 +80,13 @@ void common_spi_irq_handler(int spi_id) {
}
}
-STATIC void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "SPI(%u, baudrate=%u, firstbit=%u, polarity=%u, phase=%u, bits=8)",
self->id, self->baudrate, self->firstbit, self->polarity, self->phase);
}
-STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_firstbit,
ARG_sck, ARG_mosi, ARG_miso};
static const mp_arg_t allowed_args[] = {
@@ -231,7 +231,7 @@ STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj
}
}
-STATIC mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// Get SPI bus.
@@ -260,7 +260,7 @@ STATIC mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, s
return self;
}
-STATIC void machine_sercom_deinit(mp_obj_base_t *self_in) {
+static void machine_sercom_deinit(mp_obj_base_t *self_in) {
machine_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
Sercom *spi = sercom_instance[self->id];
// Disable interrupts (if any)
@@ -270,7 +270,7 @@ STATIC void machine_sercom_deinit(mp_obj_base_t *self_in) {
MP_STATE_PORT(sercom_table[self->id]) = NULL;
}
-STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
machine_spi_obj_t *self = (machine_spi_obj_t *)self_in;
Sercom *spi = sercom_instance[self->id];
@@ -316,7 +316,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8
}
-STATIC const mp_machine_spi_p_t machine_spi_p = {
+static const mp_machine_spi_p_t machine_spi_p = {
.init = machine_spi_init,
.deinit = machine_sercom_deinit,
.transfer = machine_spi_transfer,
diff --git a/ports/samd/machine_uart.c b/ports/samd/machine_uart.c
index de6c92c5f5..b560e0e8e6 100644
--- a/ports/samd/machine_uart.c
+++ b/ports/samd/machine_uart.c
@@ -69,12 +69,12 @@ typedef struct _machine_uart_obj_t {
#endif
} machine_uart_obj_t;
-STATIC const char *_parity_name[] = {"None", "", "0", "1"}; // Is defined as 0, 2, 3
+static const char *_parity_name[] = {"None", "", "0", "1"}; // Is defined as 0, 2, 3
// Irq handler
// take all bytes from the fifo and store them in the buffer
-STATIC void uart_drain_rx_fifo(machine_uart_obj_t *self, Sercom *uart) {
+static void uart_drain_rx_fifo(machine_uart_obj_t *self, Sercom *uart) {
while (uart->USART.INTFLAG.bit.RXC != 0) {
if (ringbuf_free(&self->read_buffer) > 0) {
// get a byte from uart and put into the buffer
@@ -114,7 +114,7 @@ void common_uart_irq_handler(int uart_id) {
}
// Configure the Sercom device
-STATIC void machine_sercom_configure(machine_uart_obj_t *self) {
+static void machine_sercom_configure(machine_uart_obj_t *self) {
Sercom *uart = sercom_instance[self->id];
// Reset (clear) the peripheral registers.
@@ -192,7 +192,7 @@ void machine_uart_set_baudrate(mp_obj_t self_in, uint32_t baudrate) {
machine_sercom_configure(self);
}
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=%s, stop=%u, "
"timeout=%u, timeout_char=%u, rxbuf=%d"
@@ -215,7 +215,7 @@ STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_
);
}
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx,
ARG_timeout, ARG_timeout_char, ARG_rxbuf, ARG_txbuf, ARG_rts, ARG_cts };
static const mp_arg_t allowed_args[] = {
@@ -363,7 +363,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
}
}
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// Get UART bus.
@@ -396,7 +396,7 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
// Check if it is the active object.
if (MP_STATE_PORT(sercom_table)[self->id] == self) {
Sercom *uart = sercom_instance[self->id];
@@ -409,11 +409,11 @@ STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
}
}
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
return ringbuf_avail(&self->read_buffer);
}
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
Sercom *uart = sercom_instance[self->id];
return uart->USART.INTFLAG.bit.DRE
@@ -423,7 +423,7 @@ STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
&& uart->USART.INTFLAG.bit.TXC;
}
-STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
+static void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
uint32_t break_time_us = 13 * 1000000 / self->baudrate;
// Wait for the tx buffer to drain.
@@ -445,7 +445,7 @@ STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
mp_hal_set_pin_mux(self->tx, self->tx_pad_config.alt_fct);
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
Sercom *uart = sercom_instance[self->id];
uint64_t t = mp_hal_ticks_ms_64() + self->timeout;
@@ -475,7 +475,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
return size;
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
size_t i = 0;
const uint8_t *src = buf_in;
@@ -514,7 +514,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
return size;
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = self_in;
mp_uint_t ret;
Sercom *uart = sercom_instance[self->id];
diff --git a/ports/samd/machine_wdt.c b/ports/samd/machine_wdt.c
index d6fadfd123..301abbe90c 100644
--- a/ports/samd/machine_wdt.c
+++ b/ports/samd/machine_wdt.c
@@ -45,9 +45,9 @@ mp_int_t log2i(mp_int_t num) {
return res;
}
-STATIC const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
+static const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
-STATIC void set_timeout(uint32_t timeout) {
+static void set_timeout(uint32_t timeout) {
// Set new timeout. Have to disable WDT first.
// Confine to the valid range
@@ -76,7 +76,7 @@ STATIC void set_timeout(uint32_t timeout) {
#endif
}
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
#if defined(MCU_SAMD51)
// Verify the WDT id. SAMD51 only, saving a few bytes for SAMD21
if (id != 0) {
@@ -105,12 +105,12 @@ STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t
return (machine_wdt_obj_t *)&machine_wdt;
}
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
(void)self;
WDT->CLEAR.reg = 0xa5;
}
-STATIC void mp_machine_wdt_timeout_ms_set(machine_wdt_obj_t *self, mp_int_t timeout_ms) {
+static void mp_machine_wdt_timeout_ms_set(machine_wdt_obj_t *self, mp_int_t timeout_ms) {
(void)self;
set_timeout(timeout_ms);
}
diff --git a/ports/samd/modmachine.c b/ports/samd/modmachine.c
index c39aec95ea..65dbf8a7f5 100644
--- a/ports/samd/modmachine.c
+++ b/ports/samd/modmachine.c
@@ -65,7 +65,7 @@
extern bool EIC_occured;
extern uint32_t _dbl_tap_addr;
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
*DBL_TAP_ADDR = DBL_TAP_MAGIC_RESET;
#ifdef DBL_TAP_ADDR_ALT
*DBL_TAP_ADDR_ALT = DBL_TAP_MAGIC_RESET;
@@ -81,28 +81,28 @@ NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
NVIC_SystemReset();
}
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
return MP_OBJ_NEW_SMALL_INT(get_cpu_freq());
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
uint32_t freq = mp_obj_get_int(args[0]);
if (freq >= 1000000 && freq <= MAX_CPU_FREQ) {
set_cpu_freq(freq);
}
}
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
samd_unique_id_t id;
samd_get_unique_id(&id);
return mp_obj_new_bytes((byte *)&id.bytes, sizeof(id.bytes));
}
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
MICROPY_EVENT_POLL_HOOK;
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
#if defined(MCU_SAMD21)
return PM->RCAUSE.reg;
#elif defined(MCU_SAMD51)
@@ -112,7 +112,7 @@ STATIC mp_int_t mp_machine_reset_cause(void) {
#endif
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
int32_t duration = -1;
uint32_t freq = get_cpu_freq();
if (n_args > 0) {
@@ -164,7 +164,7 @@ STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
set_cpu_freq(freq);
}
-NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
mp_machine_lightsleep(n_args, args);
mp_machine_reset();
}
diff --git a/ports/samd/modos.c b/ports/samd/modos.c
index 16b9eb0841..64d40a46cc 100644
--- a/ports/samd/modos.c
+++ b/ports/samd/modos.c
@@ -40,7 +40,7 @@
#if defined(MCU_SAMD51)
static bool initialized = false;
-STATIC void trng_start(void) {
+static void trng_start(void) {
if (!initialized) {
MCLK->APBCMASK.bit.TRNG_ = 1;
REG_TRNG_CTRLA = TRNG_CTRLA_ENABLE;
@@ -73,7 +73,7 @@ uint32_t trng_random_u32(int delay) {
#endif
#if MICROPY_PY_OS_URANDOM
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -89,7 +89,7 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
#endif // MICROPY_PY_OS_URANDOM
diff --git a/ports/samd/modsamd.c b/ports/samd/modsamd.c
index 307de62af5..2afe1d1222 100644
--- a/ports/samd/modsamd.c
+++ b/ports/samd/modsamd.c
@@ -45,7 +45,7 @@ extern const mp_obj_type_t samd_spiflash_type;
#define SPIFLASH_TYPE samd_spiflash_type
#endif
-STATIC mp_obj_t samd_pininfo(mp_obj_t pin_obj) {
+static mp_obj_t samd_pininfo(mp_obj_t pin_obj) {
const machine_pin_obj_t *pin_af = pin_find(pin_obj);
#if defined(MCU_SAMD21)
mp_obj_t tuple[7] = {
@@ -74,14 +74,14 @@ STATIC mp_obj_t samd_pininfo(mp_obj_t pin_obj) {
#endif
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(samd_pininfo_obj, samd_pininfo);
+static MP_DEFINE_CONST_FUN_OBJ_1(samd_pininfo_obj, samd_pininfo);
-STATIC const mp_rom_map_elem_t samd_module_globals_table[] = {
+static const mp_rom_map_elem_t samd_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_samd) },
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&SPIFLASH_TYPE) },
{ MP_ROM_QSTR(MP_QSTR_pininfo), MP_ROM_PTR(&samd_pininfo_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(samd_module_globals, samd_module_globals_table);
+static MP_DEFINE_CONST_DICT(samd_module_globals, samd_module_globals_table);
const mp_obj_module_t mp_module_samd = {
.base = { &mp_type_module },
diff --git a/ports/samd/modtime.c b/ports/samd/modtime.c
index aa5bd33609..83072dd16f 100644
--- a/ports/samd/modtime.c
+++ b/ports/samd/modtime.c
@@ -29,7 +29,7 @@
#include "modmachine.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
timeutils_struct_time_t tm;
rtc_gettime(&tm);
tm.tm_wday = timeutils_calc_weekday(tm.tm_year, tm.tm_mon, tm.tm_mday);
@@ -48,7 +48,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Returns the number of seconds, as an integer, since the Epoch.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
timeutils_struct_time_t tm;
rtc_gettime(&tm);
return mp_obj_new_int_from_uint(timeutils_mktime(
diff --git a/ports/samd/mphalport.c b/ports/samd/mphalport.c
index de1650c991..3fc6875908 100644
--- a/ports/samd/mphalport.c
+++ b/ports/samd/mphalport.c
@@ -40,7 +40,7 @@
extern volatile uint32_t ticks_us64_upper;
-STATIC uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
+static uint8_t stdin_ringbuf_array[MICROPY_HW_STDIN_BUFFER_LEN];
ringbuf_t stdin_ringbuf = { stdin_ringbuf_array, sizeof(stdin_ringbuf_array), 0, 0 };
// Explicitly run the USB stack in case the scheduler is locked (eg we are in an
diff --git a/ports/samd/pin_af.c b/ports/samd/pin_af.c
index a73c6591dd..5d05b6d18d 100644
--- a/ports/samd/pin_af.c
+++ b/ports/samd/pin_af.c
@@ -53,7 +53,7 @@ const machine_pin_obj_t *pin_find_by_id(int pin_id) {
mp_raise_ValueError(MP_ERROR_TEXT("not a Pin"));
}
-STATIC const machine_pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name) {
+static const machine_pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name) {
mp_map_elem_t *named_elem = mp_map_lookup((mp_map_t *)&named_pins->map, name, MP_MAP_LOOKUP);
if (named_elem != NULL) {
return named_elem->value;
diff --git a/ports/samd/samd_flash.c b/ports/samd/samd_flash.c
index b00b4af603..ef0de7b6fb 100644
--- a/ports/samd/samd_flash.c
+++ b/ports/samd/samd_flash.c
@@ -45,7 +45,7 @@
#endif
static struct flash_descriptor flash_desc;
-STATIC mp_int_t BLOCK_SIZE = VFS_BLOCK_SIZE_BYTES; // Board specific: mpconfigboard.h
+static mp_int_t BLOCK_SIZE = VFS_BLOCK_SIZE_BYTES; // Board specific: mpconfigboard.h
extern const mp_obj_type_t samd_flash_type;
typedef struct _samd_flash_obj_t {
@@ -57,7 +57,7 @@ typedef struct _samd_flash_obj_t {
extern uint8_t _oflash_fs, _sflash_fs;
// Build a Flash storage at top.
-STATIC samd_flash_obj_t samd_flash_obj = {
+static samd_flash_obj_t samd_flash_obj = {
.base = { &samd_flash_type },
.flash_base = (uint32_t)&_oflash_fs, // Get from MCU-Specific loader script.
.flash_size = (uint32_t)&_sflash_fs, // Get from MCU-Specific loader script.
@@ -65,7 +65,7 @@ STATIC samd_flash_obj_t samd_flash_obj = {
// Flash init (from cctpy)
// Method is needed for when MP starts up in _boot.py
-STATIC void samd_flash_init(void) {
+static void samd_flash_init(void) {
#ifdef SAMD51
hri_mclk_set_AHBMASK_NVMCTRL_bit(MCLK);
#endif
@@ -76,7 +76,7 @@ STATIC void samd_flash_init(void) {
flash_init(&flash_desc, NVMCTRL);
}
-STATIC mp_obj_t samd_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t samd_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// No args required. bdev=Flash(). Start Addr & Size defined in samd_flash_obj.
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -87,7 +87,7 @@ STATIC mp_obj_t samd_flash_make_new(const mp_obj_type_t *type, size_t n_args, si
}
// Function for ioctl.
-STATIC mp_obj_t eraseblock(uint32_t sector_in) {
+static mp_obj_t eraseblock(uint32_t sector_in) {
// Destination address aligned with page start to be erased.
uint32_t DEST_ADDR = sector_in; // Number of pages to be erased.
mp_int_t PAGE_SIZE = flash_get_page_size(&flash_desc); // adf4 API call
@@ -97,12 +97,12 @@ STATIC mp_obj_t eraseblock(uint32_t sector_in) {
return mp_const_none;
}
-STATIC mp_obj_t samd_flash_version(void) {
+static mp_obj_t samd_flash_version(void) {
return MP_OBJ_NEW_SMALL_INT(flash_get_version());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(samd_flash_version_obj, samd_flash_version);
+static MP_DEFINE_CONST_FUN_OBJ_0(samd_flash_version_obj, samd_flash_version);
-STATIC mp_obj_t samd_flash_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t samd_flash_readblocks(size_t n_args, const mp_obj_t *args) {
uint32_t offset = (mp_obj_get_int(args[1]) * BLOCK_SIZE) + samd_flash_obj.flash_base;
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_WRITE);
@@ -115,9 +115,9 @@ STATIC mp_obj_t samd_flash_readblocks(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_flash_readblocks_obj, 3, 4, samd_flash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_flash_readblocks_obj, 3, 4, samd_flash_readblocks);
-STATIC mp_obj_t samd_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t samd_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
uint32_t offset = (mp_obj_get_int(args[1]) * BLOCK_SIZE) + samd_flash_obj.flash_base;
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ);
@@ -132,9 +132,9 @@ STATIC mp_obj_t samd_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
// TODO check return value
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_flash_writeblocks_obj, 3, 4, samd_flash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_flash_writeblocks_obj, 3, 4, samd_flash_writeblocks);
-STATIC mp_obj_t samd_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t samd_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
samd_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
@@ -159,15 +159,15 @@ STATIC mp_obj_t samd_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(samd_flash_ioctl_obj, samd_flash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(samd_flash_ioctl_obj, samd_flash_ioctl);
-STATIC const mp_rom_map_elem_t samd_flash_locals_dict_table[] = {
+static const mp_rom_map_elem_t samd_flash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_flash_version), MP_ROM_PTR(&samd_flash_version_obj) },
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&samd_flash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&samd_flash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&samd_flash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(samd_flash_locals_dict, samd_flash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(samd_flash_locals_dict, samd_flash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
samd_flash_type,
diff --git a/ports/samd/samd_qspiflash.c b/ports/samd/samd_qspiflash.c
index 054bfd231e..60aa434dcf 100644
--- a/ports/samd/samd_qspiflash.c
+++ b/ports/samd/samd_qspiflash.c
@@ -257,7 +257,7 @@ int get_sfdp_table(uint8_t *table, int maxlen) {
return len;
}
-STATIC mp_obj_t samd_qspiflash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t samd_qspiflash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
// The QSPI is a singleton
@@ -374,7 +374,7 @@ STATIC mp_obj_t samd_qspiflash_make_new(const mp_obj_type_t *type, size_t n_args
return self;
}
-STATIC mp_obj_t samd_qspiflash_read(samd_qspiflash_obj_t *self, uint32_t addr, uint8_t *dest, uint32_t len) {
+static mp_obj_t samd_qspiflash_read(samd_qspiflash_obj_t *self, uint32_t addr, uint8_t *dest, uint32_t len) {
if (len > 0) {
wait_for_flash_ready();
// Command 0x6B 1 line address, 4 line Data
@@ -385,7 +385,7 @@ STATIC mp_obj_t samd_qspiflash_read(samd_qspiflash_obj_t *self, uint32_t addr, u
return mp_const_none;
}
-STATIC mp_obj_t samd_qspiflash_write(samd_qspiflash_obj_t *self, uint32_t addr, uint8_t *src, uint32_t len) {
+static mp_obj_t samd_qspiflash_write(samd_qspiflash_obj_t *self, uint32_t addr, uint8_t *src, uint32_t len) {
uint32_t length = len;
uint32_t pos = 0;
uint8_t *buf = src;
@@ -405,7 +405,7 @@ STATIC mp_obj_t samd_qspiflash_write(samd_qspiflash_obj_t *self, uint32_t addr,
return mp_const_none;
}
-STATIC mp_obj_t samd_qspiflash_erase(uint32_t addr) {
+static mp_obj_t samd_qspiflash_erase(uint32_t addr) {
wait_for_flash_ready();
write_enable();
erase_command(QSPI_CMD_ERASE_SECTOR, addr);
@@ -413,7 +413,7 @@ STATIC mp_obj_t samd_qspiflash_erase(uint32_t addr) {
return mp_const_none;
}
-STATIC mp_obj_t samd_qspiflash_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t samd_qspiflash_readblocks(size_t n_args, const mp_obj_t *args) {
samd_qspiflash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = (mp_obj_get_int(args[1]) * self->sectorsize);
mp_buffer_info_t bufinfo;
@@ -427,9 +427,9 @@ STATIC mp_obj_t samd_qspiflash_readblocks(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_qspiflash_readblocks_obj, 3, 4, samd_qspiflash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_qspiflash_readblocks_obj, 3, 4, samd_qspiflash_readblocks);
-STATIC mp_obj_t samd_qspiflash_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t samd_qspiflash_writeblocks(size_t n_args, const mp_obj_t *args) {
samd_qspiflash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = (mp_obj_get_int(args[1]) * self->sectorsize);
mp_buffer_info_t bufinfo;
@@ -445,9 +445,9 @@ STATIC mp_obj_t samd_qspiflash_writeblocks(size_t n_args, const mp_obj_t *args)
// TODO check return value
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_qspiflash_writeblocks_obj, 3, 4, samd_qspiflash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(samd_qspiflash_writeblocks_obj, 3, 4, samd_qspiflash_writeblocks);
-STATIC mp_obj_t samd_qspiflash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t samd_qspiflash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
samd_qspiflash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
@@ -471,14 +471,14 @@ STATIC mp_obj_t samd_qspiflash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(samd_qspiflash_ioctl_obj, samd_qspiflash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(samd_qspiflash_ioctl_obj, samd_qspiflash_ioctl);
-STATIC const mp_rom_map_elem_t samd_qspiflash_locals_dict_table[] = {
+static const mp_rom_map_elem_t samd_qspiflash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&samd_qspiflash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&samd_qspiflash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&samd_qspiflash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(samd_qspiflash_locals_dict, samd_qspiflash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(samd_qspiflash_locals_dict, samd_qspiflash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
samd_qspiflash_type,
diff --git a/ports/samd/samd_spiflash.c b/ports/samd/samd_spiflash.c
index f17d3c45ca..1313a6fd9d 100644
--- a/ports/samd/samd_spiflash.c
+++ b/ports/samd/samd_spiflash.c
@@ -128,7 +128,7 @@ static void get_sfdp(spiflash_obj_t *self, uint32_t addr, uint8_t *buffer, int s
mp_hal_pin_write(self->cs, 1);
}
-STATIC mp_obj_t spiflash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t spiflash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
// Set up the object
@@ -179,7 +179,7 @@ STATIC mp_obj_t spiflash_make_new(const mp_obj_type_t *type, size_t n_args, size
return self;
}
-STATIC mp_obj_t spiflash_read(spiflash_obj_t *self, uint32_t addr, uint8_t *dest, uint32_t len) {
+static mp_obj_t spiflash_read(spiflash_obj_t *self, uint32_t addr, uint8_t *dest, uint32_t len) {
if (len > 0) {
write_addr(self, self->commands[_READ_INDEX], addr);
spi_transfer(self->spi, len, dest, dest);
@@ -189,7 +189,7 @@ STATIC mp_obj_t spiflash_read(spiflash_obj_t *self, uint32_t addr, uint8_t *dest
return mp_const_none;
}
-STATIC mp_obj_t spiflash_write(spiflash_obj_t *self, uint32_t addr, uint8_t *src, uint32_t len) {
+static mp_obj_t spiflash_write(spiflash_obj_t *self, uint32_t addr, uint8_t *src, uint32_t len) {
uint32_t length = len;
uint32_t pos = 0;
uint8_t *buf = src;
@@ -211,7 +211,7 @@ STATIC mp_obj_t spiflash_write(spiflash_obj_t *self, uint32_t addr, uint8_t *src
return mp_const_none;
}
-STATIC mp_obj_t spiflash_erase(spiflash_obj_t *self, uint32_t addr) {
+static mp_obj_t spiflash_erase(spiflash_obj_t *self, uint32_t addr) {
write_enable(self);
write_addr(self, self->commands[_SECTOR_ERASE_INDEX], addr);
mp_hal_pin_write(self->cs, 1);
@@ -220,7 +220,7 @@ STATIC mp_obj_t spiflash_erase(spiflash_obj_t *self, uint32_t addr) {
return mp_const_none;
}
-STATIC mp_obj_t spiflash_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t spiflash_readblocks(size_t n_args, const mp_obj_t *args) {
spiflash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = (mp_obj_get_int(args[1]) * self->sectorsize);
mp_buffer_info_t bufinfo;
@@ -234,9 +234,9 @@ STATIC mp_obj_t spiflash_readblocks(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(spiflash_readblocks_obj, 3, 4, spiflash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(spiflash_readblocks_obj, 3, 4, spiflash_readblocks);
-STATIC mp_obj_t spiflash_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t spiflash_writeblocks(size_t n_args, const mp_obj_t *args) {
spiflash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t offset = (mp_obj_get_int(args[1]) * self->sectorsize);
mp_buffer_info_t bufinfo;
@@ -252,9 +252,9 @@ STATIC mp_obj_t spiflash_writeblocks(size_t n_args, const mp_obj_t *args) {
// TODO check return value
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(spiflash_writeblocks_obj, 3, 4, spiflash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(spiflash_writeblocks_obj, 3, 4, spiflash_writeblocks);
-STATIC mp_obj_t spiflash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t spiflash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
spiflash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
@@ -278,14 +278,14 @@ STATIC mp_obj_t spiflash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_i
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(spiflash_ioctl_obj, spiflash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(spiflash_ioctl_obj, spiflash_ioctl);
-STATIC const mp_rom_map_elem_t spiflash_locals_dict_table[] = {
+static const mp_rom_map_elem_t spiflash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&spiflash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&spiflash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&spiflash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(spiflash_locals_dict, spiflash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(spiflash_locals_dict, spiflash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
samd_spiflash_type,
diff --git a/ports/stm32/accel.c b/ports/stm32/accel.c
index 19e16831ea..9f1d4ee9a0 100644
--- a/ports/stm32/accel.c
+++ b/ports/stm32/accel.c
@@ -89,7 +89,7 @@ void accel_init(void) {
#endif
}
-STATIC void accel_start(void) {
+static void accel_start(void) {
// start the I2C bus in master mode
i2c_init(I2C1, MICROPY_HW_I2C1_SCL, MICROPY_HW_I2C1_SDA, 400000, I2C_TIMEOUT_MS);
@@ -153,7 +153,7 @@ typedef struct _pyb_accel_obj_t {
int16_t buf[NUM_AXIS * FILT_DEPTH];
} pyb_accel_obj_t;
-STATIC pyb_accel_obj_t pyb_accel_obj;
+static pyb_accel_obj_t pyb_accel_obj;
/// \classmethod \constructor()
/// Create and return an accelerometer object.
@@ -166,7 +166,7 @@ STATIC pyb_accel_obj_t pyb_accel_obj;
/// accel = pyb.Accel()
/// pyb.delay(20)
/// print(accel.x())
-STATIC mp_obj_t pyb_accel_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_accel_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -177,7 +177,7 @@ STATIC mp_obj_t pyb_accel_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(&pyb_accel_obj);
}
-STATIC mp_obj_t read_axis(int axis) {
+static mp_obj_t read_axis(int axis) {
uint8_t data[1] = { axis };
i2c_writeto(I2C1, ACCEL_ADDR, data, 1, false);
i2c_readfrom(I2C1, ACCEL_ADDR, data, 1, true);
@@ -186,28 +186,28 @@ STATIC mp_obj_t read_axis(int axis) {
/// \method x()
/// Get the x-axis value.
-STATIC mp_obj_t pyb_accel_x(mp_obj_t self_in) {
+static mp_obj_t pyb_accel_x(mp_obj_t self_in) {
return read_axis(ACCEL_REG_X);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_x_obj, pyb_accel_x);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_x_obj, pyb_accel_x);
/// \method y()
/// Get the y-axis value.
-STATIC mp_obj_t pyb_accel_y(mp_obj_t self_in) {
+static mp_obj_t pyb_accel_y(mp_obj_t self_in) {
return read_axis(ACCEL_REG_Y);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_y_obj, pyb_accel_y);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_y_obj, pyb_accel_y);
/// \method z()
/// Get the z-axis value.
-STATIC mp_obj_t pyb_accel_z(mp_obj_t self_in) {
+static mp_obj_t pyb_accel_z(mp_obj_t self_in) {
return read_axis(ACCEL_REG_Z);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_z_obj, pyb_accel_z);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_z_obj, pyb_accel_z);
/// \method tilt()
/// Get the tilt register.
-STATIC mp_obj_t pyb_accel_tilt(mp_obj_t self_in) {
+static mp_obj_t pyb_accel_tilt(mp_obj_t self_in) {
#if MICROPY_HW_HAS_MMA7660
uint8_t data[1] = { ACCEL_REG_TILT };
i2c_writeto(I2C1, ACCEL_ADDR, data, 1, false);
@@ -218,11 +218,11 @@ STATIC mp_obj_t pyb_accel_tilt(mp_obj_t self_in) {
return 0;
#endif
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_tilt_obj, pyb_accel_tilt);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_tilt_obj, pyb_accel_tilt);
/// \method filtered_xyz()
/// Get a 3-tuple of filtered x, y and z values.
-STATIC mp_obj_t pyb_accel_filtered_xyz(mp_obj_t self_in) {
+static mp_obj_t pyb_accel_filtered_xyz(mp_obj_t self_in) {
pyb_accel_obj_t *self = MP_OBJ_TO_PTR(self_in);
memmove(self->buf, self->buf + NUM_AXIS, NUM_AXIS * (FILT_DEPTH - 1) * sizeof(int16_t));
@@ -251,9 +251,9 @@ STATIC mp_obj_t pyb_accel_filtered_xyz(mp_obj_t self_in) {
return mp_obj_new_tuple(3, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_filtered_xyz_obj, pyb_accel_filtered_xyz);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_accel_filtered_xyz_obj, pyb_accel_filtered_xyz);
-STATIC mp_obj_t pyb_accel_read(mp_obj_t self_in, mp_obj_t reg) {
+static mp_obj_t pyb_accel_read(mp_obj_t self_in, mp_obj_t reg) {
uint8_t data[1] = { mp_obj_get_int(reg) };
i2c_writeto(I2C1, ACCEL_ADDR, data, 1, false);
i2c_readfrom(I2C1, ACCEL_ADDR, data, 1, true);
@@ -261,14 +261,14 @@ STATIC mp_obj_t pyb_accel_read(mp_obj_t self_in, mp_obj_t reg) {
}
MP_DEFINE_CONST_FUN_OBJ_2(pyb_accel_read_obj, pyb_accel_read);
-STATIC mp_obj_t pyb_accel_write(mp_obj_t self_in, mp_obj_t reg, mp_obj_t val) {
+static mp_obj_t pyb_accel_write(mp_obj_t self_in, mp_obj_t reg, mp_obj_t val) {
uint8_t data[2] = { mp_obj_get_int(reg), mp_obj_get_int(val) };
i2c_writeto(I2C1, ACCEL_ADDR, data, 2, true);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_3(pyb_accel_write_obj, pyb_accel_write);
-STATIC const mp_rom_map_elem_t pyb_accel_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_accel_locals_dict_table[] = {
// TODO add init, deinit, and perhaps reset methods
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&pyb_accel_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&pyb_accel_y_obj) },
@@ -279,7 +279,7 @@ STATIC const mp_rom_map_elem_t pyb_accel_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&pyb_accel_write_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_accel_locals_dict, pyb_accel_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_accel_locals_dict, pyb_accel_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_accel_type,
diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c
index ddb8a35703..3549fc29a9 100644
--- a/ports/stm32/adc.c
+++ b/ports/stm32/adc.c
@@ -245,7 +245,7 @@ static inline uint32_t adc_get_internal_channel(uint32_t channel) {
return channel;
}
-STATIC bool is_adcx_channel(int channel) {
+static bool is_adcx_channel(int channel) {
#if defined(STM32F411xE)
// The HAL has an incorrect IS_ADC_CHANNEL macro for the F411 so we check for temp
return IS_ADC_CHANNEL(channel) || channel == ADC_CHANNEL_TEMPSENSOR;
@@ -272,7 +272,7 @@ STATIC bool is_adcx_channel(int channel) {
#endif
}
-STATIC void adc_wait_for_eoc_or_timeout(ADC_HandleTypeDef *adcHandle, int32_t timeout) {
+static void adc_wait_for_eoc_or_timeout(ADC_HandleTypeDef *adcHandle, int32_t timeout) {
uint32_t tickstart = HAL_GetTick();
#if defined(STM32F4) || defined(STM32F7) || defined(STM32L1)
while ((adcHandle->Instance->SR & ADC_FLAG_EOC) != ADC_FLAG_EOC) {
@@ -287,7 +287,7 @@ STATIC void adc_wait_for_eoc_or_timeout(ADC_HandleTypeDef *adcHandle, int32_t ti
}
}
-STATIC void adcx_clock_enable(ADC_HandleTypeDef *adch) {
+static void adcx_clock_enable(ADC_HandleTypeDef *adch) {
#if defined(STM32F0) || defined(STM32F4) || defined(STM32F7) || defined(STM32L1)
ADCx_CLK_ENABLE();
#elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ)
@@ -316,7 +316,7 @@ STATIC void adcx_clock_enable(ADC_HandleTypeDef *adch) {
#endif
}
-STATIC void adcx_init_periph(ADC_HandleTypeDef *adch, uint32_t resolution) {
+static void adcx_init_periph(ADC_HandleTypeDef *adch, uint32_t resolution) {
adcx_clock_enable(adch);
adch->Init.Resolution = resolution;
@@ -384,7 +384,7 @@ STATIC void adcx_init_periph(ADC_HandleTypeDef *adch, uint32_t resolution) {
#endif
}
-STATIC void adc_init_single(pyb_obj_adc_t *adc_obj, ADC_TypeDef *adc) {
+static void adc_init_single(pyb_obj_adc_t *adc_obj, ADC_TypeDef *adc) {
adc_obj->handle.Instance = adc;
adcx_init_periph(&adc_obj->handle, ADC_RESOLUTION_12B);
@@ -397,7 +397,7 @@ STATIC void adc_init_single(pyb_obj_adc_t *adc_obj, ADC_TypeDef *adc) {
#endif
}
-STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) {
+static void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) {
ADC_ChannelConfTypeDef sConfig;
#if defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB)
@@ -462,7 +462,7 @@ STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel)
HAL_ADC_ConfigChannel(adc_handle, &sConfig);
}
-STATIC uint32_t adc_read_channel(ADC_HandleTypeDef *adcHandle) {
+static uint32_t adc_read_channel(ADC_HandleTypeDef *adcHandle) {
uint32_t value;
#if defined(STM32G4)
// For STM32G4 there is errata 2.7.7, "Wrong ADC result if conversion done late after
@@ -479,7 +479,7 @@ STATIC uint32_t adc_read_channel(ADC_HandleTypeDef *adcHandle) {
return value;
}
-STATIC uint32_t adc_config_and_read_channel(ADC_HandleTypeDef *adcHandle, uint32_t channel) {
+static uint32_t adc_config_and_read_channel(ADC_HandleTypeDef *adcHandle, uint32_t channel) {
adc_config_channel(adcHandle, channel);
uint32_t raw_value = adc_read_channel(adcHandle);
@@ -498,7 +498,7 @@ STATIC uint32_t adc_config_and_read_channel(ADC_HandleTypeDef *adcHandle, uint32
/******************************************************************************/
/* MicroPython bindings : adc object (single channel) */
-STATIC void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_obj_adc_t *self = MP_OBJ_TO_PTR(self_in);
#if defined STM32H5
unsigned adc_id = 1;
@@ -516,7 +516,7 @@ STATIC void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
/// \classmethod \constructor(pin)
/// Create an ADC object associated with the given pin.
/// This allows you to then read analog values on that pin.
-STATIC mp_obj_t adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check number of arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -587,11 +587,11 @@ STATIC mp_obj_t adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
/// \method read()
/// Read the value on the analog pin and return it. The returned value
/// will be between 0 and 4095.
-STATIC mp_obj_t adc_read(mp_obj_t self_in) {
+static mp_obj_t adc_read(mp_obj_t self_in) {
pyb_obj_adc_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(adc_config_and_read_channel(&self->handle, self->channel));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_read_obj, adc_read);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_read_obj, adc_read);
/// \method read_timed(buf, timer)
///
@@ -627,7 +627,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_read_obj, adc_read);
/// print(val) # print the value out
///
/// This function does not allocate any memory.
-STATIC mp_obj_t adc_read_timed(mp_obj_t self_in, mp_obj_t buf_in, mp_obj_t freq_in) {
+static mp_obj_t adc_read_timed(mp_obj_t self_in, mp_obj_t buf_in, mp_obj_t freq_in) {
pyb_obj_adc_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t bufinfo;
@@ -699,7 +699,7 @@ STATIC mp_obj_t adc_read_timed(mp_obj_t self_in, mp_obj_t buf_in, mp_obj_t freq_
return mp_obj_new_int(bufinfo.len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(adc_read_timed_obj, adc_read_timed);
+static MP_DEFINE_CONST_FUN_OBJ_3(adc_read_timed_obj, adc_read_timed);
// read_timed_multi((adcx, adcy, ...), (bufx, bufy, ...), timer)
//
@@ -709,7 +709,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(adc_read_timed_obj, adc_read_timed);
// the sample resolution will be reduced to 8 bits.
//
// This function should not allocate any heap memory.
-STATIC mp_obj_t adc_read_timed_multi(mp_obj_t adc_array_in, mp_obj_t buf_array_in, mp_obj_t tim_in) {
+static mp_obj_t adc_read_timed_multi(mp_obj_t adc_array_in, mp_obj_t buf_array_in, mp_obj_t tim_in) {
size_t nadcs, nbufs;
mp_obj_t *adc_array, *buf_array;
mp_obj_get_array(adc_array_in, &nadcs, &adc_array);
@@ -802,16 +802,16 @@ STATIC mp_obj_t adc_read_timed_multi(mp_obj_t adc_array_in, mp_obj_t buf_array_i
return mp_obj_new_bool(success);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(adc_read_timed_multi_fun_obj, adc_read_timed_multi);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(adc_read_timed_multi_obj, MP_ROM_PTR(&adc_read_timed_multi_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_3(adc_read_timed_multi_fun_obj, adc_read_timed_multi);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(adc_read_timed_multi_obj, MP_ROM_PTR(&adc_read_timed_multi_fun_obj));
-STATIC const mp_rom_map_elem_t adc_locals_dict_table[] = {
+static const mp_rom_map_elem_t adc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&adc_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_read_timed), MP_ROM_PTR(&adc_read_timed_obj) },
{ MP_ROM_QSTR(MP_QSTR_read_timed_multi), MP_ROM_PTR(&adc_read_timed_multi_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_type,
@@ -897,7 +897,7 @@ int adc_get_resolution(ADC_HandleTypeDef *adcHandle) {
return 12;
}
-STATIC uint32_t adc_config_and_read_ref(ADC_HandleTypeDef *adcHandle, uint32_t channel) {
+static uint32_t adc_config_and_read_ref(ADC_HandleTypeDef *adcHandle, uint32_t channel) {
uint32_t raw_value = adc_config_and_read_channel(adcHandle, channel);
// Scale raw reading to the number of bits used by the calibration constants
return raw_value << (ADC_CAL_BITS - adc_get_resolution(adcHandle));
@@ -919,7 +919,7 @@ int adc_read_core_temp(ADC_HandleTypeDef *adcHandle) {
#if MICROPY_PY_BUILTINS_FLOAT
// correction factor for reference value
-STATIC volatile float adc_refcor = 1.0f;
+static volatile float adc_refcor = 1.0f;
float adc_read_core_temp_float(ADC_HandleTypeDef *adcHandle) {
#if defined(STM32G4) || defined(STM32L1) || defined(STM32L4)
@@ -974,7 +974,7 @@ float adc_read_core_vref(ADC_HandleTypeDef *adcHandle) {
/******************************************************************************/
/* MicroPython bindings : adc_all object */
-STATIC mp_obj_t adc_all_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t adc_all_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check number of arguments
mp_arg_check_num(n_args, n_kw, 1, 2, false);
@@ -990,7 +990,7 @@ STATIC mp_obj_t adc_all_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t adc_all_read_channel(mp_obj_t self_in, mp_obj_t channel) {
+static mp_obj_t adc_all_read_channel(mp_obj_t self_in, mp_obj_t channel) {
pyb_adc_all_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint32_t chan = adc_get_internal_channel(mp_obj_get_int(channel));
if (!is_adcx_channel(chan)) {
@@ -999,9 +999,9 @@ STATIC mp_obj_t adc_all_read_channel(mp_obj_t self_in, mp_obj_t channel) {
uint32_t data = adc_config_and_read_channel(&self->handle, chan);
return mp_obj_new_int(data);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(adc_all_read_channel_obj, adc_all_read_channel);
+static MP_DEFINE_CONST_FUN_OBJ_2(adc_all_read_channel_obj, adc_all_read_channel);
-STATIC mp_obj_t adc_all_read_core_temp(mp_obj_t self_in) {
+static mp_obj_t adc_all_read_core_temp(mp_obj_t self_in) {
pyb_adc_all_obj_t *self = MP_OBJ_TO_PTR(self_in);
#if MICROPY_PY_BUILTINS_FLOAT
float data = adc_read_core_temp_float(&self->handle);
@@ -1011,32 +1011,32 @@ STATIC mp_obj_t adc_all_read_core_temp(mp_obj_t self_in) {
return mp_obj_new_int(data);
#endif
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_core_temp_obj, adc_all_read_core_temp);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_core_temp_obj, adc_all_read_core_temp);
#if MICROPY_PY_BUILTINS_FLOAT
-STATIC mp_obj_t adc_all_read_core_vbat(mp_obj_t self_in) {
+static mp_obj_t adc_all_read_core_vbat(mp_obj_t self_in) {
pyb_adc_all_obj_t *self = MP_OBJ_TO_PTR(self_in);
float data = adc_read_core_vbat(&self->handle);
return mp_obj_new_float(data);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_core_vbat_obj, adc_all_read_core_vbat);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_core_vbat_obj, adc_all_read_core_vbat);
-STATIC mp_obj_t adc_all_read_core_vref(mp_obj_t self_in) {
+static mp_obj_t adc_all_read_core_vref(mp_obj_t self_in) {
pyb_adc_all_obj_t *self = MP_OBJ_TO_PTR(self_in);
float data = adc_read_core_vref(&self->handle);
return mp_obj_new_float(data);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_core_vref_obj, adc_all_read_core_vref);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_core_vref_obj, adc_all_read_core_vref);
-STATIC mp_obj_t adc_all_read_vref(mp_obj_t self_in) {
+static mp_obj_t adc_all_read_vref(mp_obj_t self_in) {
pyb_adc_all_obj_t *self = MP_OBJ_TO_PTR(self_in);
adc_read_core_vref(&self->handle);
return mp_obj_new_float(ADC_SCALE_V * adc_refcor);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_vref_obj, adc_all_read_vref);
+static MP_DEFINE_CONST_FUN_OBJ_1(adc_all_read_vref_obj, adc_all_read_vref);
#endif
-STATIC const mp_rom_map_elem_t adc_all_locals_dict_table[] = {
+static const mp_rom_map_elem_t adc_all_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read_channel), MP_ROM_PTR(&adc_all_read_channel_obj) },
{ MP_ROM_QSTR(MP_QSTR_read_core_temp), MP_ROM_PTR(&adc_all_read_core_temp_obj) },
#if MICROPY_PY_BUILTINS_FLOAT
@@ -1046,7 +1046,7 @@ STATIC const mp_rom_map_elem_t adc_all_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(adc_all_locals_dict, adc_all_locals_dict_table);
+static MP_DEFINE_CONST_DICT(adc_all_locals_dict, adc_all_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_adc_all_type,
diff --git a/ports/stm32/boardctrl.c b/ports/stm32/boardctrl.c
index 85a42a240f..8f0d066f37 100644
--- a/ports/stm32/boardctrl.c
+++ b/ports/stm32/boardctrl.c
@@ -55,7 +55,7 @@ NORETURN void boardctrl_fatal_error(const char *msg) {
}
}
-STATIC void flash_error(int n) {
+static void flash_error(int n) {
for (int i = 0; i < n; i++) {
led_state(PYB_LED_RED, 1);
led_state(PYB_LED_GREEN, 0);
@@ -88,7 +88,7 @@ void boardctrl_maybe_enter_mboot(size_t n_args, const void *args_in) {
#endif
#if !MICROPY_HW_USES_BOOTLOADER
-STATIC uint update_reset_mode(uint reset_mode) {
+static uint update_reset_mode(uint reset_mode) {
// Note: Must use HAL_Delay here as MicroPython is not yet initialised
// and mp_hal_delay_ms will attempt to invoke the scheduler.
diff --git a/ports/stm32/boards/ADAFRUIT_F405_EXPRESS/bdev.c b/ports/stm32/boards/ADAFRUIT_F405_EXPRESS/bdev.c
index 402d5b83a9..3a6336bc2c 100644
--- a/ports/stm32/boards/ADAFRUIT_F405_EXPRESS/bdev.c
+++ b/ports/stm32/boards/ADAFRUIT_F405_EXPRESS/bdev.c
@@ -4,7 +4,7 @@
#if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
-STATIC const spi_proto_cfg_t spi_bus = {
+static const spi_proto_cfg_t spi_bus = {
.spi = &spi_obj[0], // SPI1
.baudrate = 25000000,
.polarity = 0,
@@ -13,7 +13,7 @@ STATIC const spi_proto_cfg_t spi_bus = {
.firstbit = SPI_FIRSTBIT_MSB,
};
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
diff --git a/ports/stm32/boards/ARDUINO_GIGA/bdev.c b/ports/stm32/boards/ARDUINO_GIGA/bdev.c
index caadc2b649..fea6241686 100644
--- a/ports/stm32/boards/ARDUINO_GIGA/bdev.c
+++ b/ports/stm32/boards/ARDUINO_GIGA/bdev.c
@@ -29,7 +29,7 @@
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
// Shared cache for first and second SPI block devices
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
#endif
// First external SPI flash uses hardware QSPI interface
diff --git a/ports/stm32/boards/ARDUINO_NICLA_VISION/bdev.c b/ports/stm32/boards/ARDUINO_NICLA_VISION/bdev.c
index caadc2b649..fea6241686 100644
--- a/ports/stm32/boards/ARDUINO_NICLA_VISION/bdev.c
+++ b/ports/stm32/boards/ARDUINO_NICLA_VISION/bdev.c
@@ -29,7 +29,7 @@
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
// Shared cache for first and second SPI block devices
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
#endif
// First external SPI flash uses hardware QSPI interface
diff --git a/ports/stm32/boards/ARDUINO_PORTENTA_H7/bdev.c b/ports/stm32/boards/ARDUINO_PORTENTA_H7/bdev.c
index bba81990cf..1e92486368 100644
--- a/ports/stm32/boards/ARDUINO_PORTENTA_H7/bdev.c
+++ b/ports/stm32/boards/ARDUINO_PORTENTA_H7/bdev.c
@@ -29,7 +29,7 @@
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
// Shared cache for first and second SPI block devices
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
#endif
// First external SPI flash uses hardware QSPI interface
diff --git a/ports/stm32/boards/LEGO_HUB_NO6/bdev.c b/ports/stm32/boards/LEGO_HUB_NO6/bdev.c
index c90614a028..0c9b6e4797 100644
--- a/ports/stm32/boards/LEGO_HUB_NO6/bdev.c
+++ b/ports/stm32/boards/LEGO_HUB_NO6/bdev.c
@@ -32,7 +32,7 @@
// Mboot doesn't support hardware SPI, so use software SPI instead.
-STATIC const mp_soft_spi_obj_t soft_spi_bus = {
+static const mp_soft_spi_obj_t soft_spi_bus = {
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
.polarity = 0,
.phase = 0,
@@ -52,7 +52,7 @@ mp_spiflash_t board_mboot_spiflash;
#else
-STATIC const spi_proto_cfg_t spi_bus = {
+static const spi_proto_cfg_t spi_bus = {
.spi = &spi_obj[1], // SPI2 hardware peripheral
.baudrate = 25000000,
.polarity = 0,
@@ -61,7 +61,7 @@ STATIC const spi_proto_cfg_t spi_bus = {
.firstbit = SPI_FIRSTBIT_MSB,
};
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
diff --git a/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c b/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c
index 6ec20935f0..b47c1aafc2 100644
--- a/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c
+++ b/ports/stm32/boards/LEGO_HUB_NO6/cc2564.c
@@ -44,7 +44,7 @@
#define CC2564_TIMER_BT_SLOWCLOCK_TIM_CH 4
#endif
-STATIC void cc2564_wait_cts_low(mp_hal_pin_obj_t cts, uint32_t timeout_ms) {
+static void cc2564_wait_cts_low(mp_hal_pin_obj_t cts, uint32_t timeout_ms) {
for (int i = 0; i < timeout_ms; ++i) {
if (mp_hal_pin_read(cts) == 0) {
break;
diff --git a/ports/stm32/boards/MIKROE_QUAIL/bdev.c b/ports/stm32/boards/MIKROE_QUAIL/bdev.c
index 7095817e49..913b308339 100644
--- a/ports/stm32/boards/MIKROE_QUAIL/bdev.c
+++ b/ports/stm32/boards/MIKROE_QUAIL/bdev.c
@@ -4,7 +4,7 @@
#if !MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
-STATIC const spi_proto_cfg_t spi_bus = {
+static const spi_proto_cfg_t spi_bus = {
.spi = &spi_obj[2], // SPI3 hardware peripheral
.baudrate = 25000000,
.polarity = 0,
@@ -13,7 +13,7 @@ STATIC const spi_proto_cfg_t spi_bus = {
.firstbit = SPI_FIRSTBIT_MSB,
};
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
diff --git a/ports/stm32/boards/PYBD_SF2/bdev.c b/ports/stm32/boards/PYBD_SF2/bdev.c
index fba0b8f227..2c9dd5b0d4 100644
--- a/ports/stm32/boards/PYBD_SF2/bdev.c
+++ b/ports/stm32/boards/PYBD_SF2/bdev.c
@@ -29,12 +29,12 @@
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
// Shared cache for first and second SPI block devices
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
#endif
// First external SPI flash uses software QSPI interface
-STATIC const mp_soft_qspi_obj_t soft_qspi_bus = {
+static const mp_soft_qspi_obj_t soft_qspi_bus = {
.cs = MICROPY_HW_SPIFLASH_CS,
.clk = MICROPY_HW_SPIFLASH_SCK,
.io0 = MICROPY_HW_SPIFLASH_IO0,
diff --git a/ports/stm32/boards/SPARKFUN_MICROMOD_STM32/bdev.c b/ports/stm32/boards/SPARKFUN_MICROMOD_STM32/bdev.c
index dd62a0eb17..0e23a9df6a 100644
--- a/ports/stm32/boards/SPARKFUN_MICROMOD_STM32/bdev.c
+++ b/ports/stm32/boards/SPARKFUN_MICROMOD_STM32/bdev.c
@@ -4,7 +4,7 @@
// External SPI flash uses standard SPI interface
-STATIC const mp_soft_spi_obj_t soft_spi_bus = {
+static const mp_soft_spi_obj_t soft_spi_bus = {
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
.polarity = 0,
.phase = 0,
@@ -13,7 +13,7 @@ STATIC const mp_soft_spi_obj_t soft_spi_bus = {
.miso = MICROPY_HW_SPIFLASH_MISO,
};
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
diff --git a/ports/stm32/boards/STM32F769DISC/board_init.c b/ports/stm32/boards/STM32F769DISC/board_init.c
index e89d187fec..578dc9adb6 100644
--- a/ports/stm32/boards/STM32F769DISC/board_init.c
+++ b/ports/stm32/boards/STM32F769DISC/board_init.c
@@ -4,7 +4,7 @@
// This configuration is needed for mboot to be able to write to the external QSPI flash
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
#endif
const mp_spiflash_config_t spiflash_config = {
diff --git a/ports/stm32/boards/STM32L476DISC/bdev.c b/ports/stm32/boards/STM32L476DISC/bdev.c
index c76eb6e2c9..b5628c4fba 100644
--- a/ports/stm32/boards/STM32L476DISC/bdev.c
+++ b/ports/stm32/boards/STM32L476DISC/bdev.c
@@ -2,7 +2,7 @@
// External SPI flash uses standard SPI interface
-STATIC const mp_soft_spi_obj_t soft_spi_bus = {
+static const mp_soft_spi_obj_t soft_spi_bus = {
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
.polarity = 0,
.phase = 0,
@@ -11,7 +11,7 @@ STATIC const mp_soft_spi_obj_t soft_spi_bus = {
.miso = MICROPY_HW_SPIFLASH_MISO,
};
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
diff --git a/ports/stm32/boards/VCC_GND_F407VE/bdev.c b/ports/stm32/boards/VCC_GND_F407VE/bdev.c
index dd62a0eb17..0e23a9df6a 100644
--- a/ports/stm32/boards/VCC_GND_F407VE/bdev.c
+++ b/ports/stm32/boards/VCC_GND_F407VE/bdev.c
@@ -4,7 +4,7 @@
// External SPI flash uses standard SPI interface
-STATIC const mp_soft_spi_obj_t soft_spi_bus = {
+static const mp_soft_spi_obj_t soft_spi_bus = {
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
.polarity = 0,
.phase = 0,
@@ -13,7 +13,7 @@ STATIC const mp_soft_spi_obj_t soft_spi_bus = {
.miso = MICROPY_HW_SPIFLASH_MISO,
};
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
diff --git a/ports/stm32/boards/VCC_GND_F407ZG/bdev.c b/ports/stm32/boards/VCC_GND_F407ZG/bdev.c
index dd62a0eb17..0e23a9df6a 100644
--- a/ports/stm32/boards/VCC_GND_F407ZG/bdev.c
+++ b/ports/stm32/boards/VCC_GND_F407ZG/bdev.c
@@ -4,7 +4,7 @@
// External SPI flash uses standard SPI interface
-STATIC const mp_soft_spi_obj_t soft_spi_bus = {
+static const mp_soft_spi_obj_t soft_spi_bus = {
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
.polarity = 0,
.phase = 0,
@@ -13,7 +13,7 @@ STATIC const mp_soft_spi_obj_t soft_spi_bus = {
.miso = MICROPY_HW_SPIFLASH_MISO,
};
-STATIC mp_spiflash_cache_t spi_bdev_cache;
+static mp_spiflash_cache_t spi_bdev_cache;
const mp_spiflash_config_t spiflash_config = {
.bus_kind = MP_SPIFLASH_BUS_SPI,
diff --git a/ports/stm32/can.c b/ports/stm32/can.c
index 9248e216c9..27d2920722 100644
--- a/ports/stm32/can.c
+++ b/ports/stm32/can.c
@@ -312,7 +312,7 @@ HAL_StatusTypeDef CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout) {
}
}
-STATIC void can_rx_irq_handler(uint can_id, uint fifo_id) {
+static void can_rx_irq_handler(uint can_id, uint fifo_id) {
mp_obj_t callback;
pyb_can_obj_t *self;
mp_obj_t irq_reason = MP_OBJ_NEW_SMALL_INT(0);
@@ -354,7 +354,7 @@ STATIC void can_rx_irq_handler(uint can_id, uint fifo_id) {
pyb_can_handle_callback(self, fifo_id, callback, irq_reason);
}
-STATIC void can_sce_irq_handler(uint can_id) {
+static void can_sce_irq_handler(uint can_id) {
pyb_can_obj_t *self = MP_STATE_PORT(pyb_can_obj_all)[can_id - 1];
if (self) {
self->can.Instance->MSR = CAN_MSR_ERRI;
diff --git a/ports/stm32/dac.c b/ports/stm32/dac.c
index 252af369c0..54d5acc6ce 100644
--- a/ports/stm32/dac.c
+++ b/ports/stm32/dac.c
@@ -71,7 +71,7 @@
#endif
#if defined(TIM6)
-STATIC void TIM6_Config(uint freq) {
+static void TIM6_Config(uint freq) {
// Init TIM6 at the required frequency (in Hz)
TIM_HandleTypeDef *tim = timer_tim6_init(freq);
@@ -86,7 +86,7 @@ STATIC void TIM6_Config(uint freq) {
}
#endif
-STATIC uint32_t TIMx_Config(mp_obj_t timer) {
+static uint32_t TIMx_Config(mp_obj_t timer) {
// TRGO selection to trigger DAC
TIM_HandleTypeDef *tim = pyb_timer_get_handle(timer);
TIM_MasterConfigTypeDef config;
@@ -122,7 +122,7 @@ STATIC uint32_t TIMx_Config(mp_obj_t timer) {
}
}
-STATIC void dac_deinit(uint32_t dac_channel) {
+static void dac_deinit(uint32_t dac_channel) {
DAC->CR &= ~(DAC_CR_EN1 << dac_channel);
#if defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32H7) || defined(STM32L4)
DAC->MCR = (DAC->MCR & ~(DAC_MCR_MODE1_Msk << dac_channel)) | (DAC_OUTPUTBUFFER_DISABLE << dac_channel);
@@ -138,7 +138,7 @@ void dac_deinit_all(void) {
#endif
}
-STATIC void dac_config_channel(uint32_t dac_channel, uint32_t trig, uint32_t outbuf) {
+static void dac_config_channel(uint32_t dac_channel, uint32_t trig, uint32_t outbuf) {
DAC->CR &= ~(DAC_CR_EN1 << dac_channel);
uint32_t cr_off = DAC_CR_DMAEN1 | DAC_CR_MAMP1 | DAC_CR_WAVE1 | DAC_CR_TSEL1 | DAC_CR_TEN1;
uint32_t cr_on = trig;
@@ -151,7 +151,7 @@ STATIC void dac_config_channel(uint32_t dac_channel, uint32_t trig, uint32_t out
DAC->CR = (DAC->CR & ~(cr_off << dac_channel)) | (cr_on << dac_channel);
}
-STATIC void dac_set_value(uint32_t dac_channel, uint32_t align, uint32_t value) {
+static void dac_set_value(uint32_t dac_channel, uint32_t align, uint32_t value) {
uint32_t base;
if (dac_channel == DAC_CHANNEL_1) {
base = (uint32_t)&DAC->DHR12R1;
@@ -163,11 +163,11 @@ STATIC void dac_set_value(uint32_t dac_channel, uint32_t align, uint32_t value)
*(volatile uint32_t *)(base + align) = value;
}
-STATIC void dac_start(uint32_t dac_channel) {
+static void dac_start(uint32_t dac_channel) {
DAC->CR |= DAC_CR_EN1 << dac_channel;
}
-STATIC void dac_start_dma(uint32_t dac_channel, const dma_descr_t *dma_descr, uint32_t dma_mode, uint32_t bit_size, uint32_t dac_align, size_t len, void *buf) {
+static void dac_start_dma(uint32_t dac_channel, const dma_descr_t *dma_descr, uint32_t dma_mode, uint32_t bit_size, uint32_t dac_align, size_t len, void *buf) {
uint32_t dma_align;
if (bit_size == 8) {
#if defined(STM32G4)
@@ -216,9 +216,9 @@ typedef struct _pyb_dac_obj_t {
uint8_t outbuf_waveform;
} pyb_dac_obj_t;
-STATIC pyb_dac_obj_t pyb_dac_obj[2];
+static pyb_dac_obj_t pyb_dac_obj[2];
-STATIC void pyb_dac_reconfigure(pyb_dac_obj_t *self, uint32_t cr, uint32_t outbuf, uint32_t value) {
+static void pyb_dac_reconfigure(pyb_dac_obj_t *self, uint32_t cr, uint32_t outbuf, uint32_t value) {
bool restart = false;
const uint32_t cr_mask = DAC_CR_DMAEN1 | DAC_CR_MAMP1 | DAC_CR_WAVE1 | DAC_CR_TSEL1 | DAC_CR_TEN1 | DAC_CR_EN1;
if (((DAC->CR >> self->dac_channel) & cr_mask) != (cr | DAC_CR_EN1)) {
@@ -240,14 +240,14 @@ STATIC void pyb_dac_reconfigure(pyb_dac_obj_t *self, uint32_t cr, uint32_t outbu
}
}
-STATIC void pyb_dac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_dac_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "DAC(%u, bits=%u)",
self->dac_channel == DAC_CHANNEL_1 ? 1 : 2,
self->bits);
}
-STATIC mp_obj_t pyb_dac_init_helper(pyb_dac_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_dac_init_helper(pyb_dac_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_bits, MP_ARG_INT, {.u_int = 8} },
{ MP_QSTR_buffering, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -315,7 +315,7 @@ STATIC mp_obj_t pyb_dac_init_helper(pyb_dac_obj_t *self, size_t n_args, const mp
///
/// `port` can be a pin object, or an integer (1 or 2).
/// DAC(1) is on pin X5 and DAC(2) is on pin X6.
-STATIC mp_obj_t pyb_dac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_dac_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -360,25 +360,25 @@ STATIC mp_obj_t pyb_dac_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(dac);
}
-STATIC mp_obj_t pyb_dac_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_dac_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_dac_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_dac_init_obj, 1, pyb_dac_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_dac_init_obj, 1, pyb_dac_init);
/// \method deinit()
/// Turn off the DAC, enable other use of pin.
-STATIC mp_obj_t pyb_dac_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_dac_deinit(mp_obj_t self_in) {
pyb_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
dac_deinit(self->dac_channel);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_dac_deinit_obj, pyb_dac_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_dac_deinit_obj, pyb_dac_deinit);
#if defined(TIM6)
/// \method noise(freq)
/// Generate a pseudo-random noise signal. A new random sample is written
/// to the DAC output at the given frequency.
-STATIC mp_obj_t pyb_dac_noise(mp_obj_t self_in, mp_obj_t freq) {
+static mp_obj_t pyb_dac_noise(mp_obj_t self_in, mp_obj_t freq) {
pyb_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
// set TIM6 to trigger the DAC at the given frequency
@@ -390,7 +390,7 @@ STATIC mp_obj_t pyb_dac_noise(mp_obj_t self_in, mp_obj_t freq) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_noise_obj, pyb_dac_noise);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_noise_obj, pyb_dac_noise);
#endif
#if defined(TIM6)
@@ -398,7 +398,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_noise_obj, pyb_dac_noise);
/// Generate a triangle wave. The value on the DAC output changes at
/// the given frequency, and the frequency of the repeating triangle wave
/// itself is 8192 times smaller.
-STATIC mp_obj_t pyb_dac_triangle(mp_obj_t self_in, mp_obj_t freq) {
+static mp_obj_t pyb_dac_triangle(mp_obj_t self_in, mp_obj_t freq) {
pyb_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
// set TIM6 to trigger the DAC at the given frequency
@@ -410,12 +410,12 @@ STATIC mp_obj_t pyb_dac_triangle(mp_obj_t self_in, mp_obj_t freq) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_triangle_obj, pyb_dac_triangle);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_triangle_obj, pyb_dac_triangle);
#endif
/// \method write(value)
/// Direct access to the DAC output (8 bit only at the moment).
-STATIC mp_obj_t pyb_dac_write(mp_obj_t self_in, mp_obj_t val) {
+static mp_obj_t pyb_dac_write(mp_obj_t self_in, mp_obj_t val) {
pyb_dac_obj_t *self = MP_OBJ_TO_PTR(self_in);
// DAC output is always 12-bit at the hardware level, and we provide support
@@ -426,7 +426,7 @@ STATIC mp_obj_t pyb_dac_write(mp_obj_t self_in, mp_obj_t val) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_write_obj, pyb_dac_write);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_write_obj, pyb_dac_write);
#if defined(TIM6)
/// \method write_timed(data, freq, *, mode=DAC.NORMAL)
@@ -497,10 +497,10 @@ mp_obj_t pyb_dac_write_timed(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_dac_write_timed_obj, 1, pyb_dac_write_timed);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_dac_write_timed_obj, 1, pyb_dac_write_timed);
#endif
-STATIC const mp_rom_map_elem_t pyb_dac_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_dac_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_dac_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_dac_deinit_obj) },
@@ -516,7 +516,7 @@ STATIC const mp_rom_map_elem_t pyb_dac_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_CIRCULAR), MP_ROM_INT(DMA_CIRCULAR) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_dac_locals_dict, pyb_dac_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_dac_locals_dict, pyb_dac_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_dac_type,
diff --git a/ports/stm32/eth.c b/ports/stm32/eth.c
index 363357dac9..12c29f0716 100644
--- a/ports/stm32/eth.c
+++ b/ports/stm32/eth.c
@@ -143,10 +143,10 @@ static eth_dma_t eth_dma __attribute__((aligned(16384)));
eth_t eth_instance;
-STATIC void eth_mac_deinit(eth_t *self);
-STATIC void eth_process_frame(eth_t *self, size_t len, const uint8_t *buf);
+static void eth_mac_deinit(eth_t *self);
+static void eth_process_frame(eth_t *self, size_t len, const uint8_t *buf);
-STATIC void eth_phy_write(uint32_t reg, uint32_t val) {
+static void eth_phy_write(uint32_t reg, uint32_t val) {
#if defined(STM32H5) || defined(STM32H7)
while (ETH->MACMDIOAR & ETH_MACMDIOAR_MB) {
}
@@ -172,7 +172,7 @@ STATIC void eth_phy_write(uint32_t reg, uint32_t val) {
#endif
}
-STATIC uint32_t eth_phy_read(uint32_t reg) {
+static uint32_t eth_phy_read(uint32_t reg) {
#if defined(STM32H5) || defined(STM32H7)
while (ETH->MACMDIOAR & ETH_MACMDIOAR_MB) {
}
@@ -231,7 +231,7 @@ void eth_set_trace(eth_t *self, uint32_t value) {
self->trace_flags = value;
}
-STATIC int eth_mac_init(eth_t *self) {
+static int eth_mac_init(eth_t *self) {
// Configure MPU
uint32_t irq_state = mpu_config_start();
#if defined(STM32H5)
@@ -540,7 +540,7 @@ STATIC int eth_mac_init(eth_t *self) {
return 0;
}
-STATIC void eth_mac_deinit(eth_t *self) {
+static void eth_mac_deinit(eth_t *self) {
(void)self;
HAL_NVIC_DisableIRQ(ETH_IRQn);
#if defined(STM32H5)
@@ -558,7 +558,7 @@ STATIC void eth_mac_deinit(eth_t *self) {
#endif
}
-STATIC int eth_tx_buf_get(size_t len, uint8_t **buf) {
+static int eth_tx_buf_get(size_t len, uint8_t **buf) {
if (len > TX_BUF_SIZE) {
return -MP_EINVAL;
}
@@ -597,7 +597,7 @@ STATIC int eth_tx_buf_get(size_t len, uint8_t **buf) {
return 0;
}
-STATIC int eth_tx_buf_send(void) {
+static int eth_tx_buf_send(void) {
// Get TX descriptor and move to next one
eth_dma_tx_descr_t *tx_descr = &eth_dma.tx_descr[eth_dma.tx_descr_idx];
eth_dma.tx_descr_idx = (eth_dma.tx_descr_idx + 1) % TX_BUF_NUM;
@@ -637,7 +637,7 @@ STATIC int eth_tx_buf_send(void) {
return 0;
}
-STATIC void eth_dma_rx_free(void) {
+static void eth_dma_rx_free(void) {
// Get RX descriptor, RX buffer and move to next one
eth_dma_rx_descr_t *rx_descr = &eth_dma.rx_descr[eth_dma.rx_descr_idx];
uint8_t *buf = &eth_dma.rx_buf[eth_dma.rx_descr_idx * RX_BUF_SIZE];
@@ -727,7 +727,7 @@ void ETH_IRQHandler(void) {
#define TRACE_ETH_RX (0x0004)
#define TRACE_ETH_FULL (0x0008)
-STATIC void eth_trace(eth_t *self, size_t len, const void *data, unsigned int flags) {
+static void eth_trace(eth_t *self, size_t len, const void *data, unsigned int flags) {
if (((flags & NETUTILS_TRACE_IS_TX) && (self->trace_flags & TRACE_ETH_TX))
|| (!(flags & NETUTILS_TRACE_IS_TX) && (self->trace_flags & TRACE_ETH_RX))) {
const uint8_t *buf;
@@ -747,7 +747,7 @@ STATIC void eth_trace(eth_t *self, size_t len, const void *data, unsigned int fl
}
}
-STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) {
+static err_t eth_netif_output(struct netif *netif, struct pbuf *p) {
// This function should always be called from a context where PendSV-level IRQs are disabled
LINK_STATS_INC(link.xmit);
@@ -763,7 +763,7 @@ STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) {
return ret ? ERR_BUF : ERR_OK;
}
-STATIC err_t eth_netif_init(struct netif *netif) {
+static err_t eth_netif_init(struct netif *netif) {
netif->linkoutput = eth_netif_output;
netif->output = etharp_output;
netif->mtu = 1500;
@@ -778,7 +778,7 @@ STATIC err_t eth_netif_init(struct netif *netif) {
return ERR_OK;
}
-STATIC void eth_lwip_init(eth_t *self) {
+static void eth_lwip_init(eth_t *self) {
ip_addr_t ipconfig[4];
IP4_ADDR(&ipconfig[0], 0, 0, 0, 0);
IP4_ADDR(&ipconfig[2], 192, 168, 0, 1);
@@ -804,7 +804,7 @@ STATIC void eth_lwip_init(eth_t *self) {
MICROPY_PY_LWIP_EXIT
}
-STATIC void eth_lwip_deinit(eth_t *self) {
+static void eth_lwip_deinit(eth_t *self) {
MICROPY_PY_LWIP_ENTER
for (struct netif *netif = netif_list; netif != NULL; netif = netif->next) {
if (netif == &self->netif) {
@@ -816,7 +816,7 @@ STATIC void eth_lwip_deinit(eth_t *self) {
MICROPY_PY_LWIP_EXIT
}
-STATIC void eth_process_frame(eth_t *self, size_t len, const uint8_t *buf) {
+static void eth_process_frame(eth_t *self, size_t len, const uint8_t *buf) {
eth_trace(self, len, buf, NETUTILS_TRACE_NEWLINE);
struct netif *netif = &self->netif;
diff --git a/ports/stm32/extint.c b/ports/stm32/extint.c
index f6db1e6328..2a08810125 100644
--- a/ports/stm32/extint.c
+++ b/ports/stm32/extint.c
@@ -123,11 +123,11 @@ typedef struct {
mp_int_t line;
} extint_obj_t;
-STATIC uint8_t pyb_extint_mode[EXTI_NUM_VECTORS];
-STATIC bool pyb_extint_hard_irq[EXTI_NUM_VECTORS];
+static uint8_t pyb_extint_mode[EXTI_NUM_VECTORS];
+static bool pyb_extint_hard_irq[EXTI_NUM_VECTORS];
// The callback arg is a small-int or a ROM Pin object, so no need to scan by GC
-STATIC mp_obj_t pyb_extint_callback_arg[EXTI_NUM_VECTORS];
+static mp_obj_t pyb_extint_callback_arg[EXTI_NUM_VECTORS];
#if !defined(ETH)
#define ETH_WKUP_IRQn 62 // Some MCUs don't have ETH, but we want a value to put in our table
@@ -143,7 +143,7 @@ STATIC mp_obj_t pyb_extint_callback_arg[EXTI_NUM_VECTORS];
#define TAMP_STAMP_IRQn RTC_TAMP_LSECSS_IRQn
#endif
-STATIC const uint8_t nvic_irq_channel[EXTI_NUM_VECTORS] = {
+static const uint8_t nvic_irq_channel[EXTI_NUM_VECTORS] = {
#if defined(STM32F0) || defined(STM32L0) || defined(STM32G0)
EXTI0_1_IRQn, EXTI0_1_IRQn, EXTI2_3_IRQn, EXTI2_3_IRQn,
@@ -531,44 +531,44 @@ void extint_trigger_mode(uint line, uint32_t mode) {
/// \method line()
/// Return the line number that the pin is mapped to.
-STATIC mp_obj_t extint_obj_line(mp_obj_t self_in) {
+static mp_obj_t extint_obj_line(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(self->line);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_line_obj, extint_obj_line);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_line_obj, extint_obj_line);
/// \method enable()
/// Enable a disabled interrupt.
-STATIC mp_obj_t extint_obj_enable(mp_obj_t self_in) {
+static mp_obj_t extint_obj_enable(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
extint_enable(self->line);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_enable_obj, extint_obj_enable);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_enable_obj, extint_obj_enable);
/// \method disable()
/// Disable the interrupt associated with the ExtInt object.
/// This could be useful for debouncing.
-STATIC mp_obj_t extint_obj_disable(mp_obj_t self_in) {
+static mp_obj_t extint_obj_disable(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
extint_disable(self->line);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_disable_obj, extint_obj_disable);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_disable_obj, extint_obj_disable);
/// \method swint()
/// Trigger the callback from software.
-STATIC mp_obj_t extint_obj_swint(mp_obj_t self_in) {
+static mp_obj_t extint_obj_swint(mp_obj_t self_in) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
extint_swint(self->line);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_swint_obj, extint_obj_swint);
+static MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_swint_obj, extint_obj_swint);
// TODO document as a staticmethod
/// \classmethod regs()
/// Dump the values of the EXTI registers.
-STATIC mp_obj_t extint_regs(void) {
+static mp_obj_t extint_regs(void) {
const mp_print_t *print = &mp_plat_print;
#if defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL)
@@ -621,8 +621,8 @@ STATIC mp_obj_t extint_regs(void) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(extint_regs_fun_obj, extint_regs);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(extint_regs_obj, MP_ROM_PTR(&extint_regs_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_0(extint_regs_fun_obj, extint_regs);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(extint_regs_obj, MP_ROM_PTR(&extint_regs_fun_obj));
/// \classmethod \constructor(pin, mode, pull, callback)
/// Create an ExtInt object:
@@ -639,7 +639,7 @@ STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(extint_regs_obj, MP_ROM_PTR(&extint_regs
/// - `callback` is the function to call when the interrupt triggers. The
/// callback function must accept exactly 1 argument, which is the line that
/// triggered the interrupt.
-STATIC const mp_arg_t pyb_extint_make_new_args[] = {
+static const mp_arg_t pyb_extint_make_new_args[] = {
{ MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_pull, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
@@ -647,7 +647,7 @@ STATIC const mp_arg_t pyb_extint_make_new_args[] = {
};
#define PYB_EXTINT_MAKE_NEW_NUM_ARGS MP_ARRAY_SIZE(pyb_extint_make_new_args)
-STATIC mp_obj_t extint_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t extint_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// type_in == extint_obj_type
// parse args
@@ -660,12 +660,12 @@ STATIC mp_obj_t extint_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(self);
}
-STATIC void extint_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void extint_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
extint_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<ExtInt line=%u>", self->line);
}
-STATIC const mp_rom_map_elem_t extint_locals_dict_table[] = {
+static const mp_rom_map_elem_t extint_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_line), MP_ROM_PTR(&extint_obj_line_obj) },
{ MP_ROM_QSTR(MP_QSTR_enable), MP_ROM_PTR(&extint_obj_enable_obj) },
{ MP_ROM_QSTR(MP_QSTR_disable), MP_ROM_PTR(&extint_obj_disable_obj) },
@@ -684,7 +684,7 @@ STATIC const mp_rom_map_elem_t extint_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_EVT_RISING_FALLING), MP_ROM_INT(GPIO_MODE_EVT_RISING_FALLING) },
};
-STATIC MP_DEFINE_CONST_DICT(extint_locals_dict, extint_locals_dict_table);
+static MP_DEFINE_CONST_DICT(extint_locals_dict, extint_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
extint_type,
diff --git a/ports/stm32/fdcan.c b/ports/stm32/fdcan.c
index 640244a3b9..26a8860988 100644
--- a/ports/stm32/fdcan.c
+++ b/ports/stm32/fdcan.c
@@ -340,7 +340,7 @@ int can_receive(FDCAN_HandleTypeDef *can, int fifo, FDCAN_RxHeaderTypeDef *hdr,
return 0; // success
}
-STATIC void can_rx_irq_handler(uint can_id, uint fifo_id) {
+static void can_rx_irq_handler(uint can_id, uint fifo_id) {
mp_obj_t callback;
pyb_can_obj_t *self;
mp_obj_t irq_reason = MP_OBJ_NEW_SMALL_INT(0);
diff --git a/ports/stm32/i2c.c b/ports/stm32/i2c.c
index 52f227a950..9d128acc3c 100644
--- a/ports/stm32/i2c.c
+++ b/ports/stm32/i2c.c
@@ -34,7 +34,7 @@
#if defined(STM32F4) || defined(STM32L1)
-STATIC uint16_t i2c_timeout_ms[MICROPY_HW_MAX_I2C];
+static uint16_t i2c_timeout_ms[MICROPY_HW_MAX_I2C];
int i2c_init(i2c_t *i2c, mp_hal_pin_obj_t scl, mp_hal_pin_obj_t sda, uint32_t freq, uint16_t timeout_ms) {
uint32_t i2c_id = ((uint32_t)i2c - I2C1_BASE) / (I2C2_BASE - I2C1_BASE);
@@ -93,7 +93,7 @@ int i2c_init(i2c_t *i2c, mp_hal_pin_obj_t scl, mp_hal_pin_obj_t sda, uint32_t fr
return 0;
}
-STATIC int i2c_wait_sr1_set(i2c_t *i2c, uint32_t mask) {
+static int i2c_wait_sr1_set(i2c_t *i2c, uint32_t mask) {
uint32_t i2c_id = ((uint32_t)i2c - I2C1_BASE) / (I2C2_BASE - I2C1_BASE);
uint32_t t0 = HAL_GetTick();
while (!(i2c->SR1 & mask)) {
@@ -105,7 +105,7 @@ STATIC int i2c_wait_sr1_set(i2c_t *i2c, uint32_t mask) {
return 0;
}
-STATIC int i2c_wait_stop(i2c_t *i2c) {
+static int i2c_wait_stop(i2c_t *i2c) {
uint32_t i2c_id = ((uint32_t)i2c - I2C1_BASE) / (I2C2_BASE - I2C1_BASE);
uint32_t t0 = HAL_GetTick();
while (i2c->CR1 & I2C_CR1_STOP) {
@@ -284,7 +284,7 @@ int i2c_write(i2c_t *i2c, const uint8_t *src, size_t len, size_t next_len) {
#endif
#endif
-STATIC uint16_t i2c_timeout_ms[MICROPY_HW_MAX_I2C];
+static uint16_t i2c_timeout_ms[MICROPY_HW_MAX_I2C];
static uint32_t i2c_get_id(i2c_t *i2c) {
#if defined(STM32H7)
@@ -362,7 +362,7 @@ int i2c_init(i2c_t *i2c, mp_hal_pin_obj_t scl, mp_hal_pin_obj_t sda, uint32_t fr
return 0;
}
-STATIC int i2c_wait_cr2_clear(i2c_t *i2c, uint32_t mask) {
+static int i2c_wait_cr2_clear(i2c_t *i2c, uint32_t mask) {
uint32_t i2c_id = i2c_get_id(i2c);
uint32_t t0 = HAL_GetTick();
@@ -375,7 +375,7 @@ STATIC int i2c_wait_cr2_clear(i2c_t *i2c, uint32_t mask) {
return 0;
}
-STATIC int i2c_wait_isr_set(i2c_t *i2c, uint32_t mask) {
+static int i2c_wait_isr_set(i2c_t *i2c, uint32_t mask) {
uint32_t i2c_id = i2c_get_id(i2c);
uint32_t t0 = HAL_GetTick();
@@ -423,7 +423,7 @@ int i2c_start_addr(i2c_t *i2c, int rd_wrn, uint16_t addr, size_t len, bool stop)
return 0;
}
-STATIC int i2c_check_stop(i2c_t *i2c) {
+static int i2c_check_stop(i2c_t *i2c) {
if (i2c->CR2 & I2C_CR2_AUTOEND) {
// Wait for the STOP condition and then disable the peripheral
int ret;
@@ -539,7 +539,7 @@ int i2c_writeto(i2c_t *i2c, uint16_t addr, const uint8_t *src, size_t len, bool
#endif
-STATIC const uint8_t i2c_available =
+static const uint8_t i2c_available =
0
#if defined(MICROPY_HW_I2C1_SCL)
| 1 << 1
diff --git a/ports/stm32/irq.c b/ports/stm32/irq.c
index fdaf2385cc..3bef1712fc 100644
--- a/ports/stm32/irq.c
+++ b/ports/stm32/irq.c
@@ -36,7 +36,7 @@ uint32_t irq_stats[IRQ_STATS_MAX] = {0};
// disable_irq()
// Disable interrupt requests.
// Returns the previous IRQ state which can be passed to enable_irq.
-STATIC mp_obj_t machine_disable_irq(void) {
+static mp_obj_t machine_disable_irq(void) {
return mp_obj_new_bool(disable_irq() == IRQ_STATE_ENABLED);
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
@@ -44,7 +44,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq);
// enable_irq(state=True)
// Enable interrupt requests, based on the argument, which is usually the
// value returned by a previous call to disable_irq.
-STATIC mp_obj_t machine_enable_irq(uint n_args, const mp_obj_t *arg) {
+static mp_obj_t machine_enable_irq(uint n_args, const mp_obj_t *arg) {
enable_irq((n_args == 0 || mp_obj_is_true(arg[0])) ? IRQ_STATE_ENABLED : IRQ_STATE_DISABLED);
return mp_const_none;
}
@@ -52,7 +52,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_enable_irq_obj, 0, 1, machine_enable
#if IRQ_ENABLE_STATS
// return a memoryview of the irq statistics array
-STATIC mp_obj_t pyb_irq_stats(void) {
+static mp_obj_t pyb_irq_stats(void) {
return mp_obj_new_memoryview(0x80 | 'I', MP_ARRAY_SIZE(irq_stats), &irq_stats[0]);
}
MP_DEFINE_CONST_FUN_OBJ_0(pyb_irq_stats_obj, pyb_irq_stats);
diff --git a/ports/stm32/lcd.c b/ports/stm32/lcd.c
index a78718872b..ec53b1c46b 100644
--- a/ports/stm32/lcd.c
+++ b/ports/stm32/lcd.c
@@ -105,11 +105,11 @@ typedef struct _pyb_lcd_obj_t {
byte pix_buf2[LCD_PIX_BUF_BYTE_SIZE];
} pyb_lcd_obj_t;
-STATIC void lcd_delay(void) {
+static void lcd_delay(void) {
__asm volatile ("nop\nnop");
}
-STATIC void lcd_out(pyb_lcd_obj_t *lcd, int instr_data, uint8_t i) {
+static void lcd_out(pyb_lcd_obj_t *lcd, int instr_data, uint8_t i) {
lcd_delay();
mp_hal_pin_low(lcd->pin_cs1); // CS=0; enable
if (instr_data == LCD_INSTR) {
@@ -125,7 +125,7 @@ STATIC void lcd_out(pyb_lcd_obj_t *lcd, int instr_data, uint8_t i) {
// write a string to the LCD at the current cursor location
// output it straight away (doesn't use the pixel buffer)
-STATIC void lcd_write_strn(pyb_lcd_obj_t *lcd, const char *str, unsigned int len) {
+static void lcd_write_strn(pyb_lcd_obj_t *lcd, const char *str, unsigned int len) {
int redraw_min = lcd->line * LCD_CHAR_BUF_W + lcd->column;
int redraw_max = redraw_min;
for (; len > 0; len--, str++) {
@@ -192,7 +192,7 @@ STATIC void lcd_write_strn(pyb_lcd_obj_t *lcd, const char *str, unsigned int len
///
/// Construct an LCD object in the given skin position. `skin_position` can be 'X' or 'Y', and
/// should match the position where the LCD pyskin is plugged in.
-STATIC mp_obj_t pyb_lcd_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_lcd_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -323,7 +323,7 @@ STATIC mp_obj_t pyb_lcd_make_new(const mp_obj_type_t *type, size_t n_args, size_
/// Send an arbitrary command to the LCD. Pass 0 for `instr_data` to send an
/// instruction, otherwise pass 1 to send data. `buf` is a buffer with the
/// instructions/data to send.
-STATIC mp_obj_t pyb_lcd_command(mp_obj_t self_in, mp_obj_t instr_data_in, mp_obj_t val) {
+static mp_obj_t pyb_lcd_command(mp_obj_t self_in, mp_obj_t instr_data_in, mp_obj_t val) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
// get whether instr or data
@@ -341,12 +341,12 @@ STATIC mp_obj_t pyb_lcd_command(mp_obj_t self_in, mp_obj_t instr_data_in, mp_obj
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_lcd_command_obj, pyb_lcd_command);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_lcd_command_obj, pyb_lcd_command);
/// \method contrast(value)
///
/// Set the contrast of the LCD. Valid values are between 0 and 47.
-STATIC mp_obj_t pyb_lcd_contrast(mp_obj_t self_in, mp_obj_t contrast_in) {
+static mp_obj_t pyb_lcd_contrast(mp_obj_t self_in, mp_obj_t contrast_in) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
int contrast = mp_obj_get_int(contrast_in);
if (contrast < 0) {
@@ -358,12 +358,12 @@ STATIC mp_obj_t pyb_lcd_contrast(mp_obj_t self_in, mp_obj_t contrast_in) {
lcd_out(self, LCD_INSTR, contrast); // electronic volume register set
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_contrast_obj, pyb_lcd_contrast);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_contrast_obj, pyb_lcd_contrast);
/// \method light(value)
///
/// Turn the backlight on/off. True or 1 turns it on, False or 0 turns it off.
-STATIC mp_obj_t pyb_lcd_light(mp_obj_t self_in, mp_obj_t value) {
+static mp_obj_t pyb_lcd_light(mp_obj_t self_in, mp_obj_t value) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (mp_obj_is_true(value)) {
mp_hal_pin_high(self->pin_bl); // set pin high to turn backlight on
@@ -372,26 +372,26 @@ STATIC mp_obj_t pyb_lcd_light(mp_obj_t self_in, mp_obj_t value) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_light_obj, pyb_lcd_light);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_light_obj, pyb_lcd_light);
/// \method write(str)
///
/// Write the string `str` to the screen. It will appear immediately.
-STATIC mp_obj_t pyb_lcd_write(mp_obj_t self_in, mp_obj_t str) {
+static mp_obj_t pyb_lcd_write(mp_obj_t self_in, mp_obj_t str) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
size_t len;
const char *data = mp_obj_str_get_data(str, &len);
lcd_write_strn(self, data, len);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_write_obj, pyb_lcd_write);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_write_obj, pyb_lcd_write);
/// \method fill(colour)
///
/// Fill the screen with the given colour (0 or 1 for white or black).
///
/// This method writes to the hidden buffer. Use `show()` to show the buffer.
-STATIC mp_obj_t pyb_lcd_fill(mp_obj_t self_in, mp_obj_t col_in) {
+static mp_obj_t pyb_lcd_fill(mp_obj_t self_in, mp_obj_t col_in) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
int col = mp_obj_get_int(col_in);
if (col) {
@@ -401,14 +401,14 @@ STATIC mp_obj_t pyb_lcd_fill(mp_obj_t self_in, mp_obj_t col_in) {
memset(self->pix_buf2, col, LCD_PIX_BUF_BYTE_SIZE);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_fill_obj, pyb_lcd_fill);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_lcd_fill_obj, pyb_lcd_fill);
/// \method get(x, y)
///
/// Get the pixel at the position `(x, y)`. Returns 0 or 1.
///
/// This method reads from the visible buffer.
-STATIC mp_obj_t pyb_lcd_get(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
+static mp_obj_t pyb_lcd_get(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
int x = mp_obj_get_int(x_in);
int y = mp_obj_get_int(y_in);
@@ -420,14 +420,14 @@ STATIC mp_obj_t pyb_lcd_get(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) {
}
return mp_obj_new_int(0);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_lcd_get_obj, pyb_lcd_get);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_lcd_get_obj, pyb_lcd_get);
/// \method pixel(x, y, colour)
///
/// Set the pixel at `(x, y)` to the given colour (0 or 1).
///
/// This method writes to the hidden buffer. Use `show()` to show the buffer.
-STATIC mp_obj_t pyb_lcd_pixel(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_lcd_pixel(size_t n_args, const mp_obj_t *args) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(args[0]);
int x = mp_obj_get_int(args[1]);
int y = mp_obj_get_int(args[2]);
@@ -441,14 +441,14 @@ STATIC mp_obj_t pyb_lcd_pixel(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_lcd_pixel_obj, 4, 4, pyb_lcd_pixel);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_lcd_pixel_obj, 4, 4, pyb_lcd_pixel);
/// \method text(str, x, y, colour)
///
/// Draw the given text to the position `(x, y)` using the given colour (0 or 1).
///
/// This method writes to the hidden buffer. Use `show()` to show the buffer.
-STATIC mp_obj_t pyb_lcd_text(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_lcd_text(size_t n_args, const mp_obj_t *args) {
// extract arguments
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(args[0]);
size_t len;
@@ -490,12 +490,12 @@ STATIC mp_obj_t pyb_lcd_text(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_lcd_text_obj, 5, 5, pyb_lcd_text);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_lcd_text_obj, 5, 5, pyb_lcd_text);
/// \method show()
///
/// Show the hidden buffer on the screen.
-STATIC mp_obj_t pyb_lcd_show(mp_obj_t self_in) {
+static mp_obj_t pyb_lcd_show(mp_obj_t self_in) {
pyb_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
memcpy(self->pix_buf, self->pix_buf2, LCD_PIX_BUF_BYTE_SIZE);
for (uint page = 0; page < 4; page++) {
@@ -508,9 +508,9 @@ STATIC mp_obj_t pyb_lcd_show(mp_obj_t self_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_lcd_show_obj, pyb_lcd_show);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_lcd_show_obj, pyb_lcd_show);
-STATIC const mp_rom_map_elem_t pyb_lcd_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_lcd_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_command), MP_ROM_PTR(&pyb_lcd_command_obj) },
{ MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&pyb_lcd_contrast_obj) },
@@ -523,7 +523,7 @@ STATIC const mp_rom_map_elem_t pyb_lcd_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&pyb_lcd_show_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_lcd_locals_dict, pyb_lcd_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_lcd_locals_dict, pyb_lcd_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_lcd_type,
diff --git a/ports/stm32/led.c b/ports/stm32/led.c
index 39b1f7e388..795d8c1109 100644
--- a/ports/stm32/led.c
+++ b/ports/stm32/led.c
@@ -50,7 +50,7 @@ typedef struct _pyb_led_obj_t {
const machine_pin_obj_t *led_pin;
} pyb_led_obj_t;
-STATIC const pyb_led_obj_t pyb_led_obj[] = {
+static const pyb_led_obj_t pyb_led_obj[] = {
{{&pyb_led_type}, 1, MICROPY_HW_LED1},
#if defined(MICROPY_HW_LED2)
{{&pyb_led_type}, 2, MICROPY_HW_LED2},
@@ -125,7 +125,7 @@ typedef struct _led_pwm_config_t {
uint8_t alt_func;
} led_pwm_config_t;
-STATIC const led_pwm_config_t led_pwm_config[] = {
+static const led_pwm_config_t led_pwm_config[] = {
MICROPY_HW_LED1_PWM,
MICROPY_HW_LED2_PWM,
MICROPY_HW_LED3_PWM,
@@ -134,15 +134,15 @@ STATIC const led_pwm_config_t led_pwm_config[] = {
MICROPY_HW_LED6_PWM,
};
-STATIC uint8_t led_pwm_state = 0;
+static uint8_t led_pwm_state = 0;
static inline bool led_pwm_is_enabled(int led) {
return (led_pwm_state & (1 << led)) != 0;
}
// this function has a large stack so it should not be inlined
-STATIC void led_pwm_init(int led) __attribute__((noinline));
-STATIC void led_pwm_init(int led) {
+static void led_pwm_init(int led) __attribute__((noinline));
+static void led_pwm_init(int led) {
const machine_pin_obj_t *led_pin = pyb_led_obj[led - 1].led_pin;
const led_pwm_config_t *pwm_cfg = &led_pwm_config[led - 1];
@@ -190,7 +190,7 @@ STATIC void led_pwm_init(int led) {
led_pwm_state |= 1 << led;
}
-STATIC void led_pwm_deinit(int led) {
+static void led_pwm_deinit(int led) {
// make the LED's pin a standard GPIO output pin
const machine_pin_obj_t *led_pin = pyb_led_obj[led - 1].led_pin;
GPIO_TypeDef *g = led_pin->gpio;
@@ -312,7 +312,7 @@ void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t ki
/// Create an LED object associated with the given LED:
///
/// - `id` is the LED number, 1-4.
-STATIC mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t led_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -366,19 +366,19 @@ mp_obj_t led_obj_intensity(size_t n_args, const mp_obj_t *args) {
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(led_obj_intensity_obj, 1, 2, led_obj_intensity);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_on_obj, led_obj_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_off_obj, led_obj_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(led_obj_toggle_obj, led_obj_toggle);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(led_obj_intensity_obj, 1, 2, led_obj_intensity);
-STATIC const mp_rom_map_elem_t led_locals_dict_table[] = {
+static const mp_rom_map_elem_t led_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&led_obj_on_obj) },
{ MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&led_obj_off_obj) },
{ MP_ROM_QSTR(MP_QSTR_toggle), MP_ROM_PTR(&led_obj_toggle_obj) },
{ MP_ROM_QSTR(MP_QSTR_intensity), MP_ROM_PTR(&led_obj_intensity_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
+static MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_led_type,
diff --git a/ports/stm32/machine_adc.c b/ports/stm32/machine_adc.c
index 91094427b8..8f07075914 100644
--- a/ports/stm32/machine_adc.c
+++ b/ports/stm32/machine_adc.c
@@ -112,7 +112,7 @@ typedef enum _machine_adc_internal_ch_t {
// Convert machine_adc_internal_ch_t value to STM32 library ADC channel literal.
// This function is required as literals are uint32_t types that don't map with MP_ROM_INT (31 bit signed).
-STATIC uint32_t adc_ll_channel(uint32_t channel_id) {
+static uint32_t adc_ll_channel(uint32_t channel_id) {
uint32_t adc_ll_ch;
switch (channel_id) {
// external channels map 1:1
@@ -154,7 +154,7 @@ static inline void adc_stabilisation_delay_us(uint32_t us) {
mp_hal_delay_us(us + 1);
}
-STATIC void adc_wait_eoc(ADC_TypeDef *adc, int32_t timeout_ms) {
+static void adc_wait_eoc(ADC_TypeDef *adc, int32_t timeout_ms) {
uint32_t t0 = mp_hal_ticks_ms();
#if ADC_V2
while (!(adc->ISR & ADC_ISR_EOC))
@@ -169,9 +169,9 @@ STATIC void adc_wait_eoc(ADC_TypeDef *adc, int32_t timeout_ms) {
}
#if defined(STM32H7)
-STATIC const uint8_t adc_cr_to_bits_table[] = {16, 14, 12, 10, 8, 8, 8, 8};
+static const uint8_t adc_cr_to_bits_table[] = {16, 14, 12, 10, 8, 8, 8, 8};
#else
-STATIC const uint8_t adc_cr_to_bits_table[] = {12, 10, 8, 6};
+static const uint8_t adc_cr_to_bits_table[] = {12, 10, 8, 6};
#endif
void adc_config(ADC_TypeDef *adc, uint32_t bits) {
@@ -313,7 +313,7 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) {
#endif
}
-STATIC int adc_get_bits(ADC_TypeDef *adc) {
+static int adc_get_bits(ADC_TypeDef *adc) {
#if defined(STM32F0) || defined(STM32G0) || defined(STM32L0) || defined(STM32WL)
uint32_t res = (adc->CFGR1 & ADC_CFGR1_RES) >> ADC_CFGR1_RES_Pos;
#elif defined(STM32F4) || defined(STM32F7) || defined(STM32L1)
@@ -324,7 +324,7 @@ STATIC int adc_get_bits(ADC_TypeDef *adc) {
return adc_cr_to_bits_table[res];
}
-STATIC void adc_config_channel(ADC_TypeDef *adc, uint32_t channel, uint32_t sample_time) {
+static void adc_config_channel(ADC_TypeDef *adc, uint32_t channel, uint32_t sample_time) {
#if ADC_V2
if (!(adc->CR & ADC_CR_ADEN)) {
if (adc->CR & 0x3f) {
@@ -443,7 +443,7 @@ STATIC void adc_config_channel(ADC_TypeDef *adc, uint32_t channel, uint32_t samp
#endif
}
-STATIC uint32_t adc_read_channel(ADC_TypeDef *adc) {
+static uint32_t adc_read_channel(ADC_TypeDef *adc) {
uint32_t value;
#if defined(STM32G4)
// For STM32G4 there is errata 2.7.7, "Wrong ADC result if conversion done late after
@@ -520,7 +520,7 @@ typedef struct _machine_adc_obj_t {
uint32_t sample_time;
} machine_adc_obj_t;
-STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in);
unsigned adc_id = 1;
#if defined(ADC2)
@@ -537,7 +537,7 @@ STATIC void mp_machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_p
}
// ADC(id)
-STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Check number of arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -607,7 +607,7 @@ STATIC mp_obj_t mp_machine_adc_make_new(const mp_obj_type_t *type, size_t n_args
}
// read_u16()
-STATIC mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
+static mp_int_t mp_machine_adc_read_u16(machine_adc_obj_t *self) {
return adc_config_and_read_u16(self->adc, self->channel, self->sample_time);
}
diff --git a/ports/stm32/machine_i2c.c b/ports/stm32/machine_i2c.c
index 8beefcad6d..ca2170e32d 100644
--- a/ports/stm32/machine_i2c.c
+++ b/ports/stm32/machine_i2c.c
@@ -43,7 +43,7 @@ typedef struct _machine_hard_i2c_obj_t {
mp_hal_pin_obj_t sda;
} machine_hard_i2c_obj_t;
-STATIC const machine_hard_i2c_obj_t machine_hard_i2c_obj[MICROPY_HW_MAX_I2C] = {
+static const machine_hard_i2c_obj_t machine_hard_i2c_obj[MICROPY_HW_MAX_I2C] = {
#if defined(MICROPY_HW_I2C1_SCL)
[0] = {{&machine_i2c_type}, I2C1, MICROPY_HW_I2C1_SCL, MICROPY_HW_I2C1_SDA},
#endif
@@ -58,7 +58,7 @@ STATIC const machine_hard_i2c_obj_t machine_hard_i2c_obj[MICROPY_HW_MAX_I2C] = {
#endif
};
-STATIC void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
#if defined(STM32F4) || defined(STM32L1)
@@ -134,7 +134,7 @@ int machine_hard_i2c_transfer(mp_obj_base_t *self_in, uint16_t addr, size_t n, m
typedef mp_machine_soft_i2c_obj_t machine_hard_i2c_obj_t;
-STATIC machine_hard_i2c_obj_t machine_hard_i2c_obj[MICROPY_HW_MAX_I2C] = {
+static machine_hard_i2c_obj_t machine_hard_i2c_obj[MICROPY_HW_MAX_I2C] = {
#if defined(MICROPY_HW_I2C1_SCL)
[0] = {{&machine_i2c_type}, 1, I2C_POLL_DEFAULT_TIMEOUT_US, MICROPY_HW_I2C1_SCL, MICROPY_HW_I2C1_SDA},
#endif
@@ -149,14 +149,14 @@ STATIC machine_hard_i2c_obj_t machine_hard_i2c_obj[MICROPY_HW_MAX_I2C] = {
#endif
};
-STATIC void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "I2C(%u, scl=%q, sda=%q, freq=%u, timeout=%u)",
self - &machine_hard_i2c_obj[0] + 1,
self->scl->name, self->sda->name, 500000 / self->us_delay, self->us_timeout);
}
-STATIC void machine_hard_i2c_init(machine_hard_i2c_obj_t *self, uint32_t freq, uint32_t timeout) {
+static void machine_hard_i2c_init(machine_hard_i2c_obj_t *self, uint32_t freq, uint32_t timeout) {
// set parameters
if (freq >= 1000000) {
// allow fastest possible bit-bang rate
@@ -228,7 +228,7 @@ mp_obj_t machine_hard_i2c_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC const mp_machine_i2c_p_t machine_hard_i2c_p = {
+static const mp_machine_i2c_p_t machine_hard_i2c_p = {
.transfer = machine_hard_i2c_transfer,
};
diff --git a/ports/stm32/machine_i2s.c b/ports/stm32/machine_i2s.c
index dbee81bb39..a2a0a82910 100644
--- a/ports/stm32/machine_i2s.c
+++ b/ports/stm32/machine_i2s.c
@@ -94,19 +94,19 @@ typedef struct _machine_i2s_obj_t {
const dma_descr_t *dma_descr_rx;
} machine_i2s_obj_t;
-STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
+static mp_obj_t machine_i2s_deinit(mp_obj_t self_in);
// The frame map is used with the readinto() method to transform the audio sample data coming
// from DMA memory (32-bit stereo) to the format specified
// in the I2S constructor. e.g. 16-bit mono
-STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
+static const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = {
{ 0, 1, -1, -1, -1, -1, -1, -1 }, // Mono, 16-bits
{ 2, 3, 0, 1, -1, -1, -1, -1 }, // Mono, 32-bits
{ 0, 1, -1, -1, 2, 3, -1, -1 }, // Stereo, 16-bits
{ 2, 3, 0, 1, 6, 7, 4, 5 }, // Stereo, 32-bits
};
-STATIC const plli2s_config_t plli2s_config[] = PLLI2S_TABLE;
+static const plli2s_config_t plli2s_config[] = PLLI2S_TABLE;
void machine_i2s_init0() {
for (uint8_t i = 0; i < MICROPY_HW_MAX_I2S; i++) {
@@ -114,7 +114,7 @@ void machine_i2s_init0() {
}
}
-STATIC bool lookup_plli2s_config(int8_t bits, int32_t rate, uint16_t *plli2sn, uint16_t *plli2sr) {
+static bool lookup_plli2s_config(int8_t bits, int32_t rate, uint16_t *plli2sn, uint16_t *plli2sr) {
for (uint16_t i = 0; i < MP_ARRAY_SIZE(plli2s_config); i++) {
if ((plli2s_config[i].bits == bits) && (plli2s_config[i].rate == rate)) {
*plli2sn = plli2s_config[i].plli2sn;
@@ -148,7 +148,7 @@ STATIC bool lookup_plli2s_config(int8_t bits, int32_t rate, uint16_t *plli2sn, u
// where:
// LEFT Channel = 0x99, 0xBB, 0x11, 0x22
// RIGHT Channel = 0x44, 0x55, 0xAB, 0x77
-STATIC void reformat_32_bit_samples(int32_t *sample, uint32_t num_samples) {
+static void reformat_32_bit_samples(int32_t *sample, uint32_t num_samples) {
int16_t sample_ms;
int16_t sample_ls;
for (uint32_t i = 0; i < num_samples; i++) {
@@ -158,7 +158,7 @@ STATIC void reformat_32_bit_samples(int32_t *sample, uint32_t num_samples) {
}
}
-STATIC int8_t get_frame_mapping_index(int8_t bits, format_t format) {
+static int8_t get_frame_mapping_index(int8_t bits, format_t format) {
if (format == MONO) {
if (bits == 16) {
return 0;
@@ -174,7 +174,7 @@ STATIC int8_t get_frame_mapping_index(int8_t bits, format_t format) {
}
}
-STATIC int8_t get_dma_bits(uint16_t mode, int8_t bits) {
+static int8_t get_dma_bits(uint16_t mode, int8_t bits) {
if (mode == I2S_MODE_MASTER_TX) {
if (bits == 16) {
return I2S_DATAFORMAT_16B;
@@ -189,7 +189,7 @@ STATIC int8_t get_dma_bits(uint16_t mode, int8_t bits) {
}
// function is used in IRQ context
-STATIC void empty_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
+static void empty_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
uint16_t dma_buffer_offset = 0;
if (dma_ping_pong == TOP_HALF) {
@@ -212,7 +212,7 @@ STATIC void empty_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
}
// function is used in IRQ context
-STATIC void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
+static void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
uint16_t dma_buffer_offset = 0;
if (dma_ping_pong == TOP_HALF) {
@@ -262,7 +262,7 @@ STATIC void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) {
MP_HAL_CLEAN_DCACHE(dma_buffer_p, SIZEOF_HALF_DMA_BUFFER_IN_BYTES);
}
-STATIC bool i2s_init(machine_i2s_obj_t *self) {
+static bool i2s_init(machine_i2s_obj_t *self) {
// init the GPIO lines
GPIO_InitTypeDef GPIO_InitStructure;
@@ -439,7 +439,7 @@ void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s) {
feed_dma(self, TOP_HALF);
}
-STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
+static void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *args) {
memset(&self->hi2s, 0, sizeof(self->hi2s));
// are I2S pin assignments valid?
@@ -558,7 +558,7 @@ STATIC void mp_machine_i2s_init_helper(machine_i2s_obj_t *self, mp_arg_val_t *ar
}
}
-STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
+static machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
uint8_t i2s_id_zero_base = 0;
if (0) {
@@ -590,7 +590,7 @@ STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) {
return self;
}
-STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
if (self->ring_buffer_storage != NULL) {
dma_deinit(self->dma_descr_tx);
dma_deinit(self->dma_descr_rx);
@@ -611,7 +611,7 @@ STATIC void mp_machine_i2s_deinit(machine_i2s_obj_t *self) {
}
}
-STATIC void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
+static void mp_machine_i2s_irq_update(machine_i2s_obj_t *self) {
(void)self;
}
diff --git a/ports/stm32/machine_spi.c b/ports/stm32/machine_spi.c
index 0a5a67ef2e..a2e3e35954 100644
--- a/ports/stm32/machine_spi.c
+++ b/ports/stm32/machine_spi.c
@@ -33,7 +33,7 @@
/******************************************************************************/
// Implementation of hard SPI for machine module
-STATIC const machine_hard_spi_obj_t machine_hard_spi_obj[] = {
+static const machine_hard_spi_obj_t machine_hard_spi_obj[] = {
{{&machine_spi_type}, &spi_obj[0]},
{{&machine_spi_type}, &spi_obj[1]},
{{&machine_spi_type}, &spi_obj[2]},
@@ -42,7 +42,7 @@ STATIC const machine_hard_spi_obj_t machine_hard_spi_obj[] = {
{{&machine_spi_type}, &spi_obj[5]},
};
-STATIC void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
spi_print(print, self->spi, false);
}
@@ -101,7 +101,7 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t *)self_in;
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit };
@@ -127,17 +127,17 @@ STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const m
}
}
-STATIC void machine_hard_spi_deinit(mp_obj_base_t *self_in) {
+static void machine_hard_spi_deinit(mp_obj_base_t *self_in) {
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t *)self_in;
spi_deinit(self->spi);
}
-STATIC void machine_hard_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_hard_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t *)self_in;
spi_transfer(self->spi, len, src, dest, SPI_TRANSFER_TIMEOUT(len));
}
-STATIC const mp_machine_spi_p_t machine_hard_spi_p = {
+static const mp_machine_spi_p_t machine_hard_spi_p = {
.init = machine_hard_spi_init,
.deinit = machine_hard_spi_deinit,
.transfer = machine_hard_spi_transfer,
diff --git a/ports/stm32/machine_uart.c b/ports/stm32/machine_uart.c
index 6f1a7f9a2d..0f139ae832 100644
--- a/ports/stm32/machine_uart.c
+++ b/ports/stm32/machine_uart.c
@@ -42,7 +42,7 @@
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_INT(UART_HWCONTROL_CTS) }, \
{ MP_ROM_QSTR(MP_QSTR_IRQ_RXIDLE), MP_ROM_INT(UART_FLAG_IDLE) }, \
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (!self->is_enabled) {
#if defined(LPUART1)
@@ -140,7 +140,7 @@ STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_
/// - `timeout_char` is the timeout in milliseconds to wait between characters.
/// - `flow` is RTS | CTS where RTS == 256, CTS == 512
/// - `read_buf_len` is the character length of the read buffer (0 to disable).
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 9600} },
{ MP_QSTR_bits, MP_ARG_INT, {.u_int = 8} },
@@ -278,7 +278,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
/// - `UART(6)` is on `YA`: `(TX, RX) = (Y1, Y2) = (PC6, PC7)`
/// - `UART(3)` is on `YB`: `(TX, RX) = (Y9, Y10) = (PB10, PB11)`
/// - `UART(2)` is on: `(TX, RX) = (X3, X4) = (PA2, PA3)`
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -381,23 +381,23 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
}
// Turn off the UART bus.
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
uart_deinit(self);
}
// Return number of characters waiting.
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
return uart_rx_any(self);
}
// Since uart.write() waits up to the last byte, uart.txdone() always returns True.
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
(void)self;
return true;
}
// Send a break condition.
-STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
+static void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
#if defined(STM32F0) || defined(STM32F7) || defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL)
self->uartx->RQR = USART_RQR_SBKRQ; // write-only register
#else
@@ -407,7 +407,7 @@ STATIC void mp_machine_uart_sendbreak(machine_uart_obj_t *self) {
// Write a single character on the bus. `data` is an integer to write.
// The `data` can be up to 9 bits.
-STATIC void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
+static void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
// write the character
int errcode;
if (uart_tx_wait(self, self->timeout)) {
@@ -423,7 +423,7 @@ STATIC void mp_machine_uart_writechar(machine_uart_obj_t *self, uint16_t data) {
// Receive a single character on the bus.
// Return value: The character read, as an integer. Returns -1 on timeout.
-STATIC mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
if (uart_rx_wait(self, self->timeout)) {
return uart_rx_char(self);
} else {
@@ -432,7 +432,7 @@ STATIC mp_int_t mp_machine_uart_readchar(machine_uart_obj_t *self) {
}
}
-STATIC mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args, mp_arg_val_t *args) {
+static mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args, mp_arg_val_t *args) {
if (self->mp_irq_obj == NULL) {
self->mp_irq_trigger = 0;
self->mp_irq_obj = mp_irq_new(&uart_irq_methods, MP_OBJ_FROM_PTR(self));
@@ -463,7 +463,7 @@ STATIC mp_irq_obj_t *mp_machine_uart_irq(machine_uart_obj_t *self, bool any_args
return self->mp_irq_obj;
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
byte *buf = buf_in;
@@ -505,7 +505,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
}
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
const byte *buf = buf_in;
@@ -532,7 +532,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
}
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
diff --git a/ports/stm32/machine_wdt.c b/ports/stm32/machine_wdt.c
index e0605751d1..4789b85a60 100644
--- a/ports/stm32/machine_wdt.c
+++ b/ports/stm32/machine_wdt.c
@@ -37,9 +37,9 @@ typedef struct _machine_wdt_obj_t {
mp_obj_base_t base;
} machine_wdt_obj_t;
-STATIC const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
+static const machine_wdt_obj_t machine_wdt = {{&machine_wdt_type}};
-STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
+static machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t timeout_ms) {
if (id != 0) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("WDT(%d) doesn't exist"), id);
}
@@ -77,7 +77,7 @@ STATIC machine_wdt_obj_t *mp_machine_wdt_make_new_instance(mp_int_t id, mp_int_t
return (machine_wdt_obj_t *)&machine_wdt;
}
-STATIC void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
+static void mp_machine_wdt_feed(machine_wdt_obj_t *self) {
(void)self;
IWDG->KR = 0xaaaa;
}
diff --git a/ports/stm32/main.c b/ports/stm32/main.c
index 3279770ea0..802a884d87 100644
--- a/ports/stm32/main.c
+++ b/ports/stm32/main.c
@@ -90,15 +90,15 @@
#include "subghz.h"
#if MICROPY_PY_THREAD
-STATIC pyb_thread_t pyb_thread_main;
+static pyb_thread_t pyb_thread_main;
#endif
#if defined(MICROPY_HW_UART_REPL)
#ifndef MICROPY_HW_UART_REPL_RXBUF
#define MICROPY_HW_UART_REPL_RXBUF (260)
#endif
-STATIC machine_uart_obj_t pyb_uart_repl_obj;
-STATIC uint8_t pyb_uart_repl_rxbuf[MICROPY_HW_UART_REPL_RXBUF];
+static machine_uart_obj_t pyb_uart_repl_obj;
+static uint8_t pyb_uart_repl_rxbuf[MICROPY_HW_UART_REPL_RXBUF];
#endif
void nlr_jump_fail(void *val) {
@@ -119,7 +119,7 @@ void MP_WEAK __assert_func(const char *file, int line, const char *func, const c
}
#endif
-STATIC mp_obj_t pyb_main(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_main(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_opt, MP_ARG_INT, {.u_int = 0} }
};
@@ -140,7 +140,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(pyb_main_obj, 1, pyb_main);
#if MICROPY_HW_FLASH_MOUNT_AT_BOOT
// avoid inlining to avoid stack usage within main()
-MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
+MP_NOINLINE static bool init_flash_fs(uint reset_mode) {
if (reset_mode == BOARDCTRL_RESET_MODE_FACTORY_FILESYSTEM) {
// Asked by user to reset filesystem
factory_reset_create_filesystem();
@@ -215,7 +215,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
#endif
#if MICROPY_HW_SDCARD_MOUNT_AT_BOOT
-STATIC bool init_sdcard_fs(void) {
+static bool init_sdcard_fs(void) {
bool first_part = true;
for (int part_num = 1; part_num <= 5; ++part_num) {
// create vfs object
diff --git a/ports/stm32/make-stmconst.py b/ports/stm32/make-stmconst.py
index 6d64fe3cfa..4ef6143bda 100644
--- a/ports/stm32/make-stmconst.py
+++ b/ports/stm32/make-stmconst.py
@@ -213,7 +213,7 @@ def print_regs_as_submodules(reg_name, reg_defs, modules):
print(
"""
-STATIC const mp_rom_map_elem_t stm_%s_globals_table[] = {
+static const mp_rom_map_elem_t stm_%s_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_%s) },
"""
% (mod_name_lower, mod_name_upper)
@@ -228,7 +228,7 @@ STATIC const mp_rom_map_elem_t stm_%s_globals_table[] = {
print(
"""};
-STATIC MP_DEFINE_CONST_DICT(stm_%s_globals, stm_%s_globals_table);
+static MP_DEFINE_CONST_DICT(stm_%s_globals, stm_%s_globals_table);
const mp_obj_module_t stm_%s_obj = {
.base = { &mp_type_module },
@@ -310,7 +310,7 @@ def main():
for mpz in sorted(needed_mpzs):
assert 0 <= mpz <= 0xFFFFFFFF
print(
- "STATIC const mp_obj_int_t mpz_%08x = {{&mp_type_int}, "
+ "static const mp_obj_int_t mpz_%08x = {{&mp_type_int}, "
"{.neg=0, .fixed_dig=1, .alloc=2, .len=2, "
".dig=(uint16_t*)(const uint16_t[]){%#x, %#x}}};"
% (mpz, mpz & 0xFFFF, (mpz >> 16) & 0xFFFF),
diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c
index 39492b4e54..9bb2dcfcaf 100644
--- a/ports/stm32/mboot/main.c
+++ b/ports/stm32/mboot/main.c
@@ -1051,7 +1051,7 @@ typedef struct _pyb_usbdd_obj_t {
#define MSFT100_VENDOR_CODE (0x42)
#if !MICROPY_HW_USB_IS_MULTI_OTG
-STATIC const uint8_t usbd_fifo_size[USBD_PMA_NUM_FIFO] = {
+static const uint8_t usbd_fifo_size[USBD_PMA_NUM_FIFO] = {
32, 32, // EP0(out), EP0(in)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 14x unused
};
diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c
index 206d28a89e..7c1c4da60b 100644
--- a/ports/stm32/modmachine.c
+++ b/ports/stm32/modmachine.c
@@ -114,7 +114,7 @@
{ MP_ROM_QSTR(MP_QSTR_DEEPSLEEP_RESET), MP_ROM_INT(PYB_RESET_DEEPSLEEP) }, \
{ MP_ROM_QSTR(MP_QSTR_SOFT_RESET), MP_ROM_INT(PYB_RESET_SOFT) }, \
-STATIC uint32_t reset_cause;
+static uint32_t reset_cause;
void machine_init(void) {
#if defined(STM32F4)
@@ -186,7 +186,7 @@ void machine_deinit(void) {
// machine.info([dump_alloc_table])
// Print out lots of information about the board.
-STATIC mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) {
const mp_print_t *print = &mp_plat_print;
// get and print unique id; 96 bits
@@ -277,13 +277,13 @@ STATIC mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info);
// Returns a string of 12 bytes (96 bits), which is the unique ID for the MCU.
-STATIC mp_obj_t mp_machine_unique_id(void) {
+static mp_obj_t mp_machine_unique_id(void) {
byte *id = (byte *)MP_HAL_UNIQUE_ID_ADDRESS;
return mp_obj_new_bytes(id, 12);
}
// Resets the pyboard in a manner similar to pushing the external RESET button.
-NORETURN STATIC void mp_machine_reset(void) {
+NORETURN static void mp_machine_reset(void) {
powerctrl_mcu_reset();
}
@@ -314,7 +314,7 @@ NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {
}
// get or set the MCU frequencies
-STATIC mp_obj_t mp_machine_get_freq(void) {
+static mp_obj_t mp_machine_get_freq(void) {
mp_obj_t tuple[] = {
mp_obj_new_int(HAL_RCC_GetSysClockFreq()),
mp_obj_new_int(HAL_RCC_GetHCLKFreq()),
@@ -326,7 +326,7 @@ STATIC mp_obj_t mp_machine_get_freq(void) {
return mp_obj_new_tuple(MP_ARRAY_SIZE(tuple), tuple);
}
-STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
#if defined(STM32F0) || defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32G0)
mp_raise_NotImplementedError(MP_ERROR_TEXT("machine.freq set not supported yet"));
#else
@@ -365,11 +365,11 @@ STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) {
// idle()
// This executies a wfi machine instruction which reduces power consumption
// of the MCU until an interrupt occurs, at which point execution continues.
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
__WFI();
}
-STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
if (n_args != 0) {
mp_obj_t args2[2] = {MP_OBJ_NULL, args[0]};
pyb_rtc_wakeup(2, args2);
@@ -377,7 +377,7 @@ STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
powerctrl_enter_stop_mode();
}
-STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
+static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
if (n_args != 0) {
mp_obj_t args2[2] = {MP_OBJ_NULL, args[0]};
pyb_rtc_wakeup(2, args2);
@@ -385,6 +385,6 @@ STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) {
powerctrl_enter_standby_mode();
}
-STATIC mp_int_t mp_machine_reset_cause(void) {
+static mp_int_t mp_machine_reset_cause(void) {
return reset_cause;
}
diff --git a/ports/stm32/modos.c b/ports/stm32/modos.c
index 6f3577f44a..7949cf87cd 100644
--- a/ports/stm32/modos.c
+++ b/ports/stm32/modos.c
@@ -34,7 +34,7 @@
// urandom(n)
// Return a bytes object with n random bytes, generated by the hardware
// random number generator.
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
@@ -43,7 +43,7 @@ STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
}
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
#endif
bool mp_os_dupterm_is_builtin_stream(mp_const_obj_t stream) {
diff --git a/ports/stm32/modpyb.c b/ports/stm32/modpyb.c
index 165c982f5d..176010a7e5 100644
--- a/ports/stm32/modpyb.c
+++ b/ports/stm32/modpyb.c
@@ -59,37 +59,37 @@
#if MICROPY_PY_PYB
-STATIC mp_obj_t pyb_fault_debug(mp_obj_t value) {
+static mp_obj_t pyb_fault_debug(mp_obj_t value) {
pyb_hard_fault_debug = mp_obj_is_true(value);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_fault_debug_obj, pyb_fault_debug);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_fault_debug_obj, pyb_fault_debug);
-STATIC mp_obj_t pyb_idle(void) {
+static mp_obj_t pyb_idle(void) {
__WFI();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_idle_obj, pyb_idle);
+static MP_DEFINE_CONST_FUN_OBJ_0(pyb_idle_obj, pyb_idle);
#if MICROPY_PY_PYB_LEGACY
// Returns the number of milliseconds which have elapsed since `start`.
// This function takes care of counter wrap and always returns a positive number.
-STATIC mp_obj_t pyb_elapsed_millis(mp_obj_t start) {
+static mp_obj_t pyb_elapsed_millis(mp_obj_t start) {
uint32_t startMillis = mp_obj_get_int(start);
uint32_t currMillis = mp_hal_ticks_ms();
return MP_OBJ_NEW_SMALL_INT((currMillis - startMillis) & 0x3fffffff);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);
// Returns the number of microseconds which have elapsed since `start`.
// This function takes care of counter wrap and always returns a positive number.
-STATIC mp_obj_t pyb_elapsed_micros(mp_obj_t start) {
+static mp_obj_t pyb_elapsed_micros(mp_obj_t start) {
uint32_t startMicros = mp_obj_get_int(start);
uint32_t currMicros = mp_hal_ticks_us();
return MP_OBJ_NEW_SMALL_INT((currMicros - startMicros) & 0x3fffffff);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);
#endif
@@ -97,7 +97,7 @@ MP_DECLARE_CONST_FUN_OBJ_KW(pyb_main_obj); // defined in main.c
// Get or set the UART object that the REPL is repeated on.
// This is a legacy function, use of os.dupterm is preferred.
-STATIC mp_obj_t pyb_repl_uart(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_repl_uart(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
if (MP_STATE_PORT(pyb_stdio_uart) == NULL) {
return mp_const_none;
@@ -119,22 +119,22 @@ STATIC mp_obj_t pyb_repl_uart(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_repl_uart_obj, 0, 1, pyb_repl_uart);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_repl_uart_obj, 0, 1, pyb_repl_uart);
#if MICROPY_PY_NETWORK
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_network_country_obj);
#else
// Provide a no-op version of pyb.country for backwards compatibility on
// boards that don't support networking.
-STATIC mp_obj_t pyb_country(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_country(size_t n_args, const mp_obj_t *args) {
(void)n_args;
(void)args;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_network_country_obj, 0, 1, pyb_country);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_network_country_obj, 0, 1, pyb_country);
#endif
-STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
+static const mp_rom_map_elem_t pyb_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pyb) },
{ MP_ROM_QSTR(MP_QSTR_fault_debug), MP_ROM_PTR(&pyb_fault_debug_obj) },
@@ -262,7 +262,7 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(pyb_module_globals, pyb_module_globals_table);
+static MP_DEFINE_CONST_DICT(pyb_module_globals, pyb_module_globals_table);
const mp_obj_module_t pyb_module = {
.base = { &mp_type_module },
diff --git a/ports/stm32/modstm.c b/ports/stm32/modstm.c
index 896465d0cc..4f26dce790 100644
--- a/ports/stm32/modstm.c
+++ b/ports/stm32/modstm.c
@@ -38,7 +38,7 @@
#include "genhdr/modstm_mpz.h"
-STATIC const mp_rom_map_elem_t stm_module_globals_table[] = {
+static const mp_rom_map_elem_t stm_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_stm) },
{ MP_ROM_QSTR(MP_QSTR_mem8), MP_ROM_PTR(&machine_mem8_obj) },
@@ -62,7 +62,7 @@ STATIC const mp_rom_map_elem_t stm_module_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(stm_module_globals, stm_module_globals_table);
+static MP_DEFINE_CONST_DICT(stm_module_globals, stm_module_globals_table);
const mp_obj_module_t stm_module = {
.base = { &mp_type_module },
diff --git a/ports/stm32/modtime.c b/ports/stm32/modtime.c
index e7160cd5b2..ff1495a5d9 100644
--- a/ports/stm32/modtime.c
+++ b/ports/stm32/modtime.c
@@ -29,7 +29,7 @@
#include "rtc.h"
// Return the localtime as an 8-tuple.
-STATIC mp_obj_t mp_time_localtime_get(void) {
+static mp_obj_t mp_time_localtime_get(void) {
// get current date and time
// note: need to call get time then get date to correctly access the registers
rtc_init_finalise();
@@ -51,7 +51,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) {
}
// Returns the number of seconds, as an integer, since 1/1/2000.
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
// get date and time
// note: need to call get time then get date to correctly access the registers
rtc_init_finalise();
diff --git a/ports/stm32/mpbthciport.c b/ports/stm32/mpbthciport.c
index 06ff8a7faa..3f71146834 100644
--- a/ports/stm32/mpbthciport.c
+++ b/ports/stm32/mpbthciport.c
@@ -41,10 +41,10 @@
uint8_t mp_bluetooth_hci_cmd_buf[4 + 256];
// Soft timer for scheduling a HCI poll.
-STATIC soft_timer_entry_t mp_bluetooth_hci_soft_timer;
+static soft_timer_entry_t mp_bluetooth_hci_soft_timer;
// This is called by soft_timer and executes at IRQ_PRI_PENDSV.
-STATIC void mp_bluetooth_hci_soft_timer_callback(soft_timer_entry_t *self) {
+static void mp_bluetooth_hci_soft_timer_callback(soft_timer_entry_t *self) {
mp_bluetooth_hci_poll_now();
}
@@ -57,7 +57,7 @@ void mp_bluetooth_hci_init(void) {
);
}
-STATIC void mp_bluetooth_hci_start_polling(void) {
+static void mp_bluetooth_hci_start_polling(void) {
mp_bluetooth_hci_poll_now();
}
@@ -67,12 +67,12 @@ void mp_bluetooth_hci_poll_in_ms_default(uint32_t ms) {
#if MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
-STATIC mp_sched_node_t mp_bluetooth_hci_sched_node;
+static mp_sched_node_t mp_bluetooth_hci_sched_node;
// For synchronous mode, we run all BLE stack code inside a scheduled task.
// This task is scheduled periodically via a soft timer, or
// immediately on HCI UART RXIDLE.
-STATIC void run_events_scheduled_task(mp_sched_node_t *node) {
+static void run_events_scheduled_task(mp_sched_node_t *node) {
// This will process all buffered HCI UART data, and run any callouts or events.
(void)node;
mp_bluetooth_hci_poll();
@@ -133,7 +133,7 @@ int mp_bluetooth_hci_uart_write(const uint8_t *buf, size_t len) {
}
// Callback to forward data from rfcore to the bluetooth hci handler.
-STATIC void mp_bluetooth_hci_uart_msg_cb(void *env, const uint8_t *buf, size_t len) {
+static void mp_bluetooth_hci_uart_msg_cb(void *env, const uint8_t *buf, size_t len) {
mp_bluetooth_hci_uart_readchar_t handler = (mp_bluetooth_hci_uart_readchar_t)env;
for (size_t i = 0; i < len; ++i) {
handler(buf[i]);
diff --git a/ports/stm32/mpbtstackport.c b/ports/stm32/mpbtstackport.c
index 728594d19c..bbc1280b86 100644
--- a/ports/stm32/mpbtstackport.c
+++ b/ports/stm32/mpbtstackport.c
@@ -106,7 +106,7 @@ static const btstack_run_loop_t mp_btstack_runloop_stm32 = {
&mp_btstack_runloop_get_time_ms,
};
-STATIC const hci_transport_config_uart_t hci_transport_config_uart = {
+static const hci_transport_config_uart_t hci_transport_config_uart = {
HCI_TRANSPORT_CONFIG_UART,
MICROPY_HW_BLE_UART_BAUDRATE,
MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY,
diff --git a/ports/stm32/mpnetworkport.c b/ports/stm32/mpnetworkport.c
index 3b9591213a..6db3e91ba9 100644
--- a/ports/stm32/mpnetworkport.c
+++ b/ports/stm32/mpnetworkport.c
@@ -64,7 +64,7 @@ u32_t sys_now(void) {
return mp_hal_ticks_ms();
}
-STATIC void pyb_lwip_poll(void) {
+static void pyb_lwip_poll(void) {
#if MICROPY_PY_NETWORK_WIZNET5K
// Poll the NIC for incoming data
wiznet5k_poll();
diff --git a/ports/stm32/mpthreadport.c b/ports/stm32/mpthreadport.c
index a7d85cfe32..621b4311bf 100644
--- a/ports/stm32/mpthreadport.c
+++ b/ports/stm32/mpthreadport.c
@@ -34,7 +34,7 @@
#if MICROPY_PY_THREAD
// the mutex controls access to the linked list
-STATIC mp_thread_mutex_t thread_mutex;
+static mp_thread_mutex_t thread_mutex;
void mp_thread_init(void) {
mp_thread_mutex_init(&thread_mutex);
diff --git a/ports/stm32/network_lan.c b/ports/stm32/network_lan.c
index 556adebd8f..2f70caf012 100644
--- a/ports/stm32/network_lan.c
+++ b/ports/stm32/network_lan.c
@@ -38,9 +38,9 @@ typedef struct _network_lan_obj_t {
eth_t *eth;
} network_lan_obj_t;
-STATIC const network_lan_obj_t network_lan_eth0 = { { &network_lan_type }, &eth_instance };
+static const network_lan_obj_t network_lan_eth0 = { { &network_lan_type }, &eth_instance };
-STATIC void network_lan_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void network_lan_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(self_in);
struct netif *netif = eth_netif(self->eth);
int status = eth_link_status(self->eth);
@@ -53,14 +53,14 @@ STATIC void network_lan_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
);
}
-STATIC mp_obj_t network_lan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t network_lan_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
const network_lan_obj_t *self = &network_lan_eth0;
eth_init(self->eth, MP_HAL_MAC_ETH0);
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t network_lan_active(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_lan_active(size_t n_args, const mp_obj_t *args) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
return mp_obj_new_bool(eth_link_status(self->eth));
@@ -77,21 +77,21 @@ STATIC mp_obj_t network_lan_active(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_active_obj, 1, 2, network_lan_active);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_active_obj, 1, 2, network_lan_active);
-STATIC mp_obj_t network_lan_isconnected(mp_obj_t self_in) {
+static mp_obj_t network_lan_isconnected(mp_obj_t self_in) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(eth_link_status(self->eth) == 3);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_lan_isconnected_obj, network_lan_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(network_lan_isconnected_obj, network_lan_isconnected);
-STATIC mp_obj_t network_lan_ifconfig(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_lan_ifconfig(size_t n_args, const mp_obj_t *args) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
return mod_network_nic_ifconfig(eth_netif(self->eth), n_args - 1, args + 1);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_ifconfig_obj, 1, 2, network_lan_ifconfig);
-STATIC mp_obj_t network_lan_status(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t network_lan_status(size_t n_args, const mp_obj_t *args) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
(void)self;
@@ -102,9 +102,9 @@ STATIC mp_obj_t network_lan_status(size_t n_args, const mp_obj_t *args) {
mp_raise_ValueError(MP_ERROR_TEXT("unknown status param"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_status_obj, 1, 2, network_lan_status);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_lan_status_obj, 1, 2, network_lan_status);
-STATIC mp_obj_t network_lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t network_lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
network_lan_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (kwargs->used == 0) {
@@ -147,16 +147,16 @@ STATIC mp_obj_t network_lan_config(size_t n_args, const mp_obj_t *args, mp_map_t
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_lan_config_obj, 1, network_lan_config);
+static MP_DEFINE_CONST_FUN_OBJ_KW(network_lan_config_obj, 1, network_lan_config);
-STATIC const mp_rom_map_elem_t network_lan_locals_dict_table[] = {
+static const mp_rom_map_elem_t network_lan_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&network_lan_active_obj) },
{ MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&network_lan_isconnected_obj) },
{ MP_ROM_QSTR(MP_QSTR_ifconfig), MP_ROM_PTR(&network_lan_ifconfig_obj) },
{ MP_ROM_QSTR(MP_QSTR_status), MP_ROM_PTR(&network_lan_status_obj) },
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&network_lan_config_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(network_lan_locals_dict, network_lan_locals_dict_table);
+static MP_DEFINE_CONST_DICT(network_lan_locals_dict, network_lan_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
network_lan_type,
diff --git a/ports/stm32/octospi.c b/ports/stm32/octospi.c
index f2854f3796..1d59e2b560 100644
--- a/ports/stm32/octospi.c
+++ b/ports/stm32/octospi.c
@@ -92,7 +92,7 @@ void octospi_init(void) {
OCTOSPI1->CR |= OCTOSPI_CR_EN;
}
-STATIC int octospi_ioctl(void *self_in, uint32_t cmd) {
+static int octospi_ioctl(void *self_in, uint32_t cmd) {
(void)self_in;
switch (cmd) {
case MP_QSPI_IOCTL_INIT:
@@ -112,7 +112,7 @@ STATIC int octospi_ioctl(void *self_in, uint32_t cmd) {
return 0; // success
}
-STATIC int octospi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t data) {
+static int octospi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t data) {
(void)self_in;
OCTOSPI1->FCR = OCTOSPI_FCR_CTCF; // clear TC flag
@@ -166,7 +166,7 @@ STATIC int octospi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32
return 0;
}
-STATIC int octospi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src) {
+static int octospi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src) {
(void)self_in;
uint8_t adsize = MICROPY_HW_SPI_ADDR_IS_32BIT(addr) ? 3 : 2;
@@ -231,7 +231,7 @@ STATIC int octospi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr
return 0;
}
-STATIC int octospi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *dest) {
+static int octospi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *dest) {
(void)self_in;
OCTOSPI1->FCR = OCTOSPI_FCR_CTCF; // clear TC flag
@@ -269,7 +269,7 @@ STATIC int octospi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *de
return 0;
}
-STATIC int octospi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr, size_t len, uint8_t *dest) {
+static int octospi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr, size_t len, uint8_t *dest) {
(void)self_in;
#if defined(MICROPY_HW_OSPIFLASH_IO1) && !defined(MICROPY_HW_OSPIFLASH_IO2) && !defined(MICROPY_HW_OSPIFLASH_IO4)
diff --git a/ports/stm32/pin.c b/ports/stm32/pin.c
index 599d61de41..0b939334a2 100644
--- a/ports/stm32/pin.c
+++ b/ports/stm32/pin.c
@@ -88,7 +88,7 @@
/// how a particular object gets mapped to a pin.
// Pin class variables
-STATIC bool pin_class_debug;
+static bool pin_class_debug;
void pin_init0(void) {
MP_STATE_PORT(pin_class_mapper) = mp_const_none;
@@ -179,7 +179,7 @@ const machine_pin_obj_t *pin_find(mp_obj_t user_obj) {
/// \method __str__()
/// Return a string describing the pin object.
-STATIC void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
// pin name
@@ -238,7 +238,7 @@ STATIC void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
}
}
-STATIC mp_obj_t pin_obj_init_helper(const machine_pin_obj_t *pin, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args);
+static mp_obj_t pin_obj_init_helper(const machine_pin_obj_t *pin, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args);
/// \classmethod \constructor(id, ...)
/// Create a new Pin object associated with the id. If additional arguments are given,
@@ -263,7 +263,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
}
// fast method for getting/setting pin value
-STATIC mp_obj_t pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (n_args == 0) {
@@ -278,31 +278,31 @@ STATIC mp_obj_t pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_
/// \classmethod mapper([fun])
/// Get or set the pin mapper function.
-STATIC mp_obj_t pin_mapper(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_mapper(size_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
MP_STATE_PORT(pin_class_mapper) = args[1];
return mp_const_none;
}
return MP_STATE_PORT(pin_class_mapper);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_mapper_fun_obj, 1, 2, pin_mapper);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_mapper_obj, MP_ROM_PTR(&pin_mapper_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_mapper_fun_obj, 1, 2, pin_mapper);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_mapper_obj, MP_ROM_PTR(&pin_mapper_fun_obj));
/// \classmethod dict([dict])
/// Get or set the pin mapper dictionary.
-STATIC mp_obj_t pin_map_dict(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_map_dict(size_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
MP_STATE_PORT(pin_class_map_dict) = args[1];
return mp_const_none;
}
return MP_STATE_PORT(pin_class_map_dict);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_map_dict_fun_obj, 1, 2, pin_map_dict);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_map_dict_obj, MP_ROM_PTR(&pin_map_dict_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_map_dict_fun_obj, 1, 2, pin_map_dict);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_map_dict_obj, MP_ROM_PTR(&pin_map_dict_fun_obj));
/// \classmethod af_list()
/// Returns an array of alternate functions available for this pin.
-STATIC mp_obj_t pin_af_list(mp_obj_t self_in) {
+static mp_obj_t pin_af_list(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t result = mp_obj_new_list(0, NULL);
@@ -312,22 +312,22 @@ STATIC mp_obj_t pin_af_list(mp_obj_t self_in) {
}
return result;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_list_obj, pin_af_list);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_list_obj, pin_af_list);
/// \classmethod debug([state])
/// Get or set the debugging state (`True` or `False` for on or off).
-STATIC mp_obj_t pin_debug(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_debug(size_t n_args, const mp_obj_t *args) {
if (n_args > 1) {
pin_class_debug = mp_obj_is_true(args[1]);
return mp_const_none;
}
return mp_obj_new_bool(pin_class_debug);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_debug_fun_obj, 1, 2, pin_debug);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_debug_obj, MP_ROM_PTR(&pin_debug_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_debug_fun_obj, 1, 2, pin_debug);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_debug_obj, MP_ROM_PTR(&pin_debug_fun_obj));
// init(mode, pull=None, alt=-1, *, value, alt)
-STATIC mp_obj_t pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_pull, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE}},
@@ -384,7 +384,7 @@ STATIC mp_obj_t pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args
return mp_const_none;
}
-STATIC mp_obj_t pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pin_obj_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(pin_init_obj, 1, pin_obj_init);
@@ -396,27 +396,27 @@ MP_DEFINE_CONST_FUN_OBJ_KW(pin_init_obj, 1, pin_obj_init);
/// - With `value` given, set the logic level of the pin. `value` can be
/// anything that converts to a boolean. If it converts to `True`, the pin
/// is set high, otherwise it is set low.
-STATIC mp_obj_t pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pin_value(size_t n_args, const mp_obj_t *args) {
return pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_value_obj, 1, 2, pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_value_obj, 1, 2, pin_value);
-STATIC mp_obj_t pin_off(mp_obj_t self_in) {
+static mp_obj_t pin_off(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_hal_pin_low(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_off_obj, pin_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_off_obj, pin_off);
-STATIC mp_obj_t pin_on(mp_obj_t self_in) {
+static mp_obj_t pin_on(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_hal_pin_high(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_on_obj, pin_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_on_obj, pin_on);
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING, hard=False)
-STATIC mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -436,19 +436,19 @@ STATIC mp_obj_t pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
// TODO should return an IRQ object
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pin_irq_obj, 1, pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pin_irq_obj, 1, pin_irq);
/// \method name()
/// Get the pin name.
-STATIC mp_obj_t pin_name(mp_obj_t self_in) {
+static mp_obj_t pin_name(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_QSTR(self->name);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_name_obj, pin_name);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_name_obj, pin_name);
/// \method names()
/// Returns the cpu and board names for this pin.
-STATIC mp_obj_t pin_names(mp_obj_t self_in) {
+static mp_obj_t pin_names(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t result = mp_obj_new_list(0, NULL);
mp_obj_list_append(result, MP_OBJ_NEW_QSTR(self->name));
@@ -463,60 +463,60 @@ STATIC mp_obj_t pin_names(mp_obj_t self_in) {
}
return result;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_names_obj, pin_names);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_names_obj, pin_names);
/// \method port()
/// Get the pin port.
-STATIC mp_obj_t pin_port(mp_obj_t self_in) {
+static mp_obj_t pin_port(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(self->port);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_port_obj, pin_port);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_port_obj, pin_port);
/// \method pin()
/// Get the pin number.
-STATIC mp_obj_t pin_pin(mp_obj_t self_in) {
+static mp_obj_t pin_pin(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(self->pin);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_pin_obj, pin_pin);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_pin_obj, pin_pin);
/// \method gpio()
/// Returns the base address of the GPIO block associated with this pin.
-STATIC mp_obj_t pin_gpio(mp_obj_t self_in) {
+static mp_obj_t pin_gpio(mp_obj_t self_in) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT((intptr_t)self->gpio);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_gpio_obj, pin_gpio);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_gpio_obj, pin_gpio);
/// \method mode()
/// Returns the currently configured mode of the pin. The integer returned
/// will match one of the allowed constants for the mode argument to the init
/// function.
-STATIC mp_obj_t pin_mode(mp_obj_t self_in) {
+static mp_obj_t pin_mode(mp_obj_t self_in) {
return MP_OBJ_NEW_SMALL_INT(pin_get_mode(MP_OBJ_TO_PTR(self_in)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_mode_obj, pin_mode);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_mode_obj, pin_mode);
/// \method pull()
/// Returns the currently configured pull of the pin. The integer returned
/// will match one of the allowed constants for the pull argument to the init
/// function.
-STATIC mp_obj_t pin_pull(mp_obj_t self_in) {
+static mp_obj_t pin_pull(mp_obj_t self_in) {
return MP_OBJ_NEW_SMALL_INT(pin_get_pull(MP_OBJ_TO_PTR(self_in)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_pull_obj, pin_pull);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_pull_obj, pin_pull);
/// \method af()
/// Returns the currently configured alternate-function of the pin. The
/// integer returned will match one of the allowed constants for the af
/// argument to the init function.
-STATIC mp_obj_t pin_af(mp_obj_t self_in) {
+static mp_obj_t pin_af(mp_obj_t self_in) {
return MP_OBJ_NEW_SMALL_INT(pin_get_af(MP_OBJ_TO_PTR(self_in)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_obj, pin_af);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_obj, pin_af);
-STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pin_value_obj) },
@@ -568,9 +568,9 @@ STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
#include "genhdr/pins_af_const.h"
};
-STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
-STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -586,7 +586,7 @@ STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, i
return -1;
}
-STATIC const mp_pin_p_t pin_pin_p = {
+static const mp_pin_p_t pin_pin_p = {
.ioctl = pin_ioctl,
};
@@ -630,43 +630,43 @@ MP_DEFINE_CONST_OBJ_TYPE(
/// \method __str__()
/// Return a string describing the alternate function.
-STATIC void pin_af_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pin_af_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pin_af_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "Pin.%q", self->name);
}
/// \method index()
/// Return the alternate function index.
-STATIC mp_obj_t pin_af_index(mp_obj_t self_in) {
+static mp_obj_t pin_af_index(mp_obj_t self_in) {
pin_af_obj_t *af = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(af->idx);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_index_obj, pin_af_index);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_index_obj, pin_af_index);
/// \method name()
/// Return the name of the alternate function.
-STATIC mp_obj_t pin_af_name(mp_obj_t self_in) {
+static mp_obj_t pin_af_name(mp_obj_t self_in) {
pin_af_obj_t *af = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_QSTR(af->name);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_name_obj, pin_af_name);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_name_obj, pin_af_name);
/// \method reg()
/// Return the base register associated with the peripheral assigned to this
/// alternate function. For example, if the alternate function were TIM2_CH3
/// this would return stm.TIM2
-STATIC mp_obj_t pin_af_reg(mp_obj_t self_in) {
+static mp_obj_t pin_af_reg(mp_obj_t self_in) {
pin_af_obj_t *af = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT((uintptr_t)af->reg);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_af_reg_obj, pin_af_reg);
+static MP_DEFINE_CONST_FUN_OBJ_1(pin_af_reg_obj, pin_af_reg);
-STATIC const mp_rom_map_elem_t pin_af_locals_dict_table[] = {
+static const mp_rom_map_elem_t pin_af_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&pin_af_index_obj) },
{ MP_ROM_QSTR(MP_QSTR_name), MP_ROM_PTR(&pin_af_name_obj) },
{ MP_ROM_QSTR(MP_QSTR_reg), MP_ROM_PTR(&pin_af_reg_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pin_af_locals_dict, pin_af_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pin_af_locals_dict, pin_af_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pin_af_type,
diff --git a/ports/stm32/powerctrl.c b/ports/stm32/powerctrl.c
index 712021edb6..7755149227 100644
--- a/ports/stm32/powerctrl.c
+++ b/ports/stm32/powerctrl.c
@@ -162,14 +162,14 @@ typedef struct _sysclk_scaling_table_entry_t {
} sysclk_scaling_table_entry_t;
#if defined(STM32F7)
-STATIC const sysclk_scaling_table_entry_t volt_scale_table[] = {
+static const sysclk_scaling_table_entry_t volt_scale_table[] = {
{ 151, PWR_REGULATOR_VOLTAGE_SCALE3 },
{ 180, PWR_REGULATOR_VOLTAGE_SCALE2 },
// Above 180MHz uses default PWR_REGULATOR_VOLTAGE_SCALE1
};
#elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || \
defined(STM32H7B3xx) || defined(STM32H7B3xxQ)
-STATIC const sysclk_scaling_table_entry_t volt_scale_table[] = {
+static const sysclk_scaling_table_entry_t volt_scale_table[] = {
// See table 15 "FLASH recommended number of wait states and programming delay" of RM0455.
{88, PWR_REGULATOR_VOLTAGE_SCALE3},
{160, PWR_REGULATOR_VOLTAGE_SCALE2},
@@ -177,7 +177,7 @@ STATIC const sysclk_scaling_table_entry_t volt_scale_table[] = {
{280, PWR_REGULATOR_VOLTAGE_SCALE0},
};
#elif defined(STM32H7)
-STATIC const sysclk_scaling_table_entry_t volt_scale_table[] = {
+static const sysclk_scaling_table_entry_t volt_scale_table[] = {
// See table 55 "Kernel clock distribution overview" of RM0433.
{200, PWR_REGULATOR_VOLTAGE_SCALE3},
{300, PWR_REGULATOR_VOLTAGE_SCALE2},
@@ -186,7 +186,7 @@ STATIC const sysclk_scaling_table_entry_t volt_scale_table[] = {
};
#endif
-STATIC int powerctrl_config_vos(uint32_t sysclk_mhz) {
+static int powerctrl_config_vos(uint32_t sysclk_mhz) {
#if defined(STM32F7) || defined(STM32H7)
uint32_t volt_scale = PWR_REGULATOR_VOLTAGE_SCALE1;
for (int i = 0; i < MP_ARRAY_SIZE(volt_scale_table); ++i) {
@@ -291,7 +291,7 @@ int powerctrl_rcc_clock_config_pll(RCC_ClkInitTypeDef *rcc_init, uint32_t sysclk
#if !defined(STM32F0) && !defined(STM32G0) && !defined(STM32L0) && !defined(STM32L1) && !defined(STM32L4)
-STATIC uint32_t calc_ahb_div(uint32_t wanted_div) {
+static uint32_t calc_ahb_div(uint32_t wanted_div) {
#if defined(STM32H7)
if (wanted_div <= 1) {
return RCC_HCLK_DIV1;
@@ -335,7 +335,7 @@ STATIC uint32_t calc_ahb_div(uint32_t wanted_div) {
#endif
}
-STATIC uint32_t calc_apb1_div(uint32_t wanted_div) {
+static uint32_t calc_apb1_div(uint32_t wanted_div) {
#if defined(STM32H7)
if (wanted_div <= 1) {
return RCC_APB1_DIV1;
@@ -363,7 +363,7 @@ STATIC uint32_t calc_apb1_div(uint32_t wanted_div) {
#endif
}
-STATIC uint32_t calc_apb2_div(uint32_t wanted_div) {
+static uint32_t calc_apb2_div(uint32_t wanted_div) {
#if defined(STM32H7)
if (wanted_div <= 1) {
return RCC_APB2_DIV1;
diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c
index 3c61405e7c..71c7177824 100644
--- a/ports/stm32/pyb_can.c
+++ b/ports/stm32/pyb_can.c
@@ -123,11 +123,11 @@ extern const uint8_t DLCtoBytes[16];
#define CAN_FLAG_FIFO0_OVRF CAN_FLAG_FOV0
#define CAN_FLAG_FIFO1_OVRF CAN_FLAG_FOV1
-STATIC uint8_t can2_start_bank = 14;
+static uint8_t can2_start_bank = 14;
#endif
-STATIC void pyb_can_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_can_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (!self->is_enabled) {
mp_printf(print, "CAN(%u)", self->can_id);
@@ -160,7 +160,7 @@ STATIC void pyb_can_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
}
}
-STATIC uint32_t pyb_can_get_source_freq() {
+static uint32_t pyb_can_get_source_freq() {
uint32_t can_kern_clk = 0;
// Find CAN kernel clock
@@ -192,7 +192,7 @@ STATIC uint32_t pyb_can_get_source_freq() {
return can_kern_clk;
}
-STATIC void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point,
+static void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point,
uint32_t max_brp, uint32_t max_bs1, uint32_t max_bs2, uint32_t min_tseg,
mp_int_t *bs1_out, mp_int_t *bs2_out, mp_int_t *prescaler_out) {
uint32_t can_kern_clk = pyb_can_get_source_freq();
@@ -215,7 +215,7 @@ STATIC void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point,
}
// init(mode, prescaler=100, *, sjw=1, bs1=6, bs2=8)
-STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_prescaler, ARG_sjw, ARG_bs1, ARG_bs2, ARG_auto_restart, ARG_baudrate, ARG_sample_point,
ARG_num_filter_banks, ARG_brs_prescaler, ARG_brs_sjw, ARG_brs_bs1, ARG_brs_bs2, ARG_brs_baudrate, ARG_brs_sample_point };
static const mp_arg_t allowed_args[] = {
@@ -285,7 +285,7 @@ STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp
}
// CAN(bus, ...)
-STATIC mp_obj_t pyb_can_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_can_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -354,21 +354,21 @@ STATIC mp_obj_t pyb_can_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t pyb_can_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_can_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_can_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_init_obj, 1, pyb_can_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_init_obj, 1, pyb_can_init);
// deinit()
-STATIC mp_obj_t pyb_can_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_can_deinit(mp_obj_t self_in) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
can_deinit(self);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_can_deinit_obj, pyb_can_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_can_deinit_obj, pyb_can_deinit);
// Force a software restart of the controller, to allow transmission after a bus error
-STATIC mp_obj_t pyb_can_restart(mp_obj_t self_in) {
+static mp_obj_t pyb_can_restart(mp_obj_t self_in) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (!self->is_enabled) {
mp_raise_ValueError(NULL);
@@ -394,10 +394,10 @@ STATIC mp_obj_t pyb_can_restart(mp_obj_t self_in) {
#endif
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_can_restart_obj, pyb_can_restart);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_can_restart_obj, pyb_can_restart);
// Get the state of the controller
-STATIC mp_obj_t pyb_can_state(mp_obj_t self_in) {
+static mp_obj_t pyb_can_state(mp_obj_t self_in) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t state = CAN_STATE_STOPPED;
if (self->is_enabled) {
@@ -427,10 +427,10 @@ STATIC mp_obj_t pyb_can_state(mp_obj_t self_in) {
}
return MP_OBJ_NEW_SMALL_INT(state);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_can_state_obj, pyb_can_state);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_can_state_obj, pyb_can_state);
// Get info about error states and TX/RX buffers
-STATIC mp_obj_t pyb_can_info(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_can_info(size_t n_args, const mp_obj_t *args) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_list_t *list;
if (n_args == 1) {
@@ -473,10 +473,10 @@ STATIC mp_obj_t pyb_can_info(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(list);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_can_info_obj, 1, 2, pyb_can_info);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_can_info_obj, 1, 2, pyb_can_info);
// any(fifo) - return `True` if any message waiting on the FIFO, else `False`
-STATIC mp_obj_t pyb_can_any(mp_obj_t self_in, mp_obj_t fifo_in) {
+static mp_obj_t pyb_can_any(mp_obj_t self_in, mp_obj_t fifo_in) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t fifo = mp_obj_get_int(fifo_in);
if (fifo == 0) {
@@ -490,10 +490,10 @@ STATIC mp_obj_t pyb_can_any(mp_obj_t self_in, mp_obj_t fifo_in) {
}
return mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_any_obj, pyb_can_any);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_any_obj, pyb_can_any);
// send(send, addr, *, timeout=5000)
-STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_data, ARG_id, ARG_timeout, ARG_rtr, ARG_extframe, ARG_fdf, ARG_brs };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -611,10 +611,10 @@ STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_send_obj, 1, pyb_can_send);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_send_obj, 1, pyb_can_send);
// recv(fifo, list=None, *, timeout=5000)
-STATIC mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_fifo, ARG_list, ARG_timeout };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_fifo, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
@@ -730,9 +730,9 @@ STATIC mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
// Return the result
return ret_obj;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_recv_obj, 1, pyb_can_recv);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_recv_obj, 1, pyb_can_recv);
-STATIC mp_obj_t pyb_can_clearfilter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_can_clearfilter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_extframe };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_extframe, MP_ARG_BOOL, {.u_bool = false} },
@@ -754,11 +754,11 @@ STATIC mp_obj_t pyb_can_clearfilter(size_t n_args, const mp_obj_t *pos_args, mp_
#endif
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_clearfilter_obj, 2, pyb_can_clearfilter);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_clearfilter_obj, 2, pyb_can_clearfilter);
// setfilter(bank, mode, fifo, params, *, rtr)
#define EXTENDED_ID_TO_16BIT_FILTER(id) (((id & 0xC00000) >> 13) | ((id & 0x38000) >> 15)) | 8
-STATIC mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_bank, ARG_mode, ARG_fifo, ARG_params, ARG_rtr, ARG_extframe };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_bank, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
@@ -930,9 +930,9 @@ STATIC mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_ma
error:
mp_raise_ValueError(MP_ERROR_TEXT("CAN filter parameter error"));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_setfilter_obj, 1, pyb_can_setfilter);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_setfilter_obj, 1, pyb_can_setfilter);
-STATIC mp_obj_t pyb_can_rxcallback(mp_obj_t self_in, mp_obj_t fifo_in, mp_obj_t callback_in) {
+static mp_obj_t pyb_can_rxcallback(mp_obj_t self_in, mp_obj_t fifo_in, mp_obj_t callback_in) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t fifo = mp_obj_get_int(fifo_in);
mp_obj_t *callback;
@@ -971,9 +971,9 @@ STATIC mp_obj_t pyb_can_rxcallback(mp_obj_t self_in, mp_obj_t fifo_in, mp_obj_t
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_can_rxcallback_obj, pyb_can_rxcallback);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_can_rxcallback_obj, pyb_can_rxcallback);
-STATIC const mp_rom_map_elem_t pyb_can_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_can_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_can_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_can_deinit_obj) },
@@ -1018,9 +1018,9 @@ STATIC const mp_rom_map_elem_t pyb_can_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ERROR_PASSIVE), MP_ROM_INT(CAN_STATE_ERROR_PASSIVE) },
{ MP_ROM_QSTR(MP_QSTR_BUS_OFF), MP_ROM_INT(CAN_STATE_BUS_OFF) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_can_locals_dict, pyb_can_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_can_locals_dict, pyb_can_locals_dict_table);
-STATIC mp_uint_t can_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t can_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
@@ -1065,7 +1065,7 @@ void pyb_can_handle_callback(pyb_can_obj_t *self, uint fifo_id, mp_obj_t callbac
}
}
-STATIC const mp_stream_p_t can_stream_p = {
+static const mp_stream_p_t can_stream_p = {
// .read = can_read, // is read sensible for CAN?
// .write = can_write, // is write sensible for CAN?
.ioctl = can_ioctl,
diff --git a/ports/stm32/pyb_i2c.c b/ports/stm32/pyb_i2c.c
index fa38ef372d..0529d3bd56 100644
--- a/ports/stm32/pyb_i2c.c
+++ b/ports/stm32/pyb_i2c.c
@@ -103,7 +103,7 @@ I2C_HandleTypeDef I2CHandle3 = {.Instance = NULL};
I2C_HandleTypeDef I2CHandle4 = {.Instance = NULL};
#endif
-STATIC bool pyb_i2c_use_dma[4];
+static bool pyb_i2c_use_dma[4];
const pyb_i2c_obj_t pyb_i2c_obj[] = {
#if defined(MICROPY_HW_I2C1_SCL)
@@ -219,14 +219,14 @@ const pyb_i2c_obj_t pyb_i2c_obj[] = {
#error "no I2C timings for this MCU"
#endif
-STATIC const struct {
+static const struct {
uint32_t baudrate;
uint32_t timing;
} pyb_i2c_baudrate_timing[] = MICROPY_HW_I2C_BAUDRATE_TIMING;
#define NUM_BAUDRATE_TIMINGS MP_ARRAY_SIZE(pyb_i2c_baudrate_timing)
-STATIC void i2c_set_baudrate(I2C_InitTypeDef *init, uint32_t baudrate) {
+static void i2c_set_baudrate(I2C_InitTypeDef *init, uint32_t baudrate) {
for (int i = 0; i < NUM_BAUDRATE_TIMINGS; i++) {
if (pyb_i2c_baudrate_timing[i].baudrate == baudrate) {
init->Timing = pyb_i2c_baudrate_timing[i].timing;
@@ -252,7 +252,7 @@ uint32_t pyb_i2c_get_baudrate(I2C_HandleTypeDef *i2c) {
#define MICROPY_HW_I2C_BAUDRATE_DEFAULT (PYB_I2C_SPEED_FULL)
#define MICROPY_HW_I2C_BAUDRATE_MAX (PYB_I2C_SPEED_FULL)
-STATIC void i2c_set_baudrate(I2C_InitTypeDef *init, uint32_t baudrate) {
+static void i2c_set_baudrate(I2C_InitTypeDef *init, uint32_t baudrate) {
init->ClockSpeed = baudrate;
init->DutyCycle = I2C_DUTYCYCLE_16_9;
}
@@ -428,7 +428,7 @@ int pyb_i2c_init_freq(const pyb_i2c_obj_t *self, mp_int_t freq) {
return pyb_i2c_init(self->i2c);
}
-STATIC void i2c_reset_after_error(I2C_HandleTypeDef *i2c) {
+static void i2c_reset_after_error(I2C_HandleTypeDef *i2c) {
// wait for bus-busy flag to be cleared, with a timeout
for (int timeout = 50; timeout > 0; --timeout) {
if (!__HAL_I2C_GET_FLAG(i2c, I2C_FLAG_BUSY)) {
@@ -581,7 +581,7 @@ void i2c_er_irq_handler(mp_uint_t i2c_id) {
#endif
}
-STATIC HAL_StatusTypeDef i2c_wait_dma_finished(I2C_HandleTypeDef *i2c, uint32_t timeout) {
+static HAL_StatusTypeDef i2c_wait_dma_finished(I2C_HandleTypeDef *i2c, uint32_t timeout) {
// Note: we can't use WFI to idle in this loop because the DMA completion
// interrupt may occur before the WFI. Hence we miss it and have to wait
// until the next sys-tick (up to 1ms).
@@ -601,7 +601,7 @@ static inline bool in_master_mode(pyb_i2c_obj_t *self) {
return self->i2c->Init.OwnAddress1 == PYB_I2C_MASTER_ADDRESS;
}
-STATIC void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint i2c_num = 0;
@@ -655,7 +655,7 @@ STATIC void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
/// - `addr` is the 7-bit address (only sensible for a peripheral)
/// - `baudrate` is the SCL clock rate (only sensible for a controller)
/// - `gencall` is whether to support general call mode
-STATIC mp_obj_t pyb_i2c_init_helper(const pyb_i2c_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_init_helper(const pyb_i2c_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_INT, {.u_int = PYB_I2C_MASTER} },
{ MP_QSTR_addr, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0x12} },
@@ -721,7 +721,7 @@ STATIC mp_obj_t pyb_i2c_init_helper(const pyb_i2c_obj_t *self, size_t n_args, co
///
/// - `I2C(1)` is on the X position: `(SCL, SDA) = (X9, X10) = (PB6, PB7)`
/// - `I2C(2)` is on the Y position: `(SCL, SDA) = (Y9, Y10) = (PB10, PB11)`
-STATIC mp_obj_t pyb_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -739,23 +739,23 @@ STATIC mp_obj_t pyb_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(i2c_obj);
}
-STATIC mp_obj_t pyb_i2c_init_(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_init_(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_i2c_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_init_obj, 1, pyb_i2c_init_);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_init_obj, 1, pyb_i2c_init_);
/// \method deinit()
/// Turn off the I2C bus.
-STATIC mp_obj_t pyb_i2c_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_i2c_deinit(mp_obj_t self_in) {
pyb_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
i2c_deinit(self->i2c);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_deinit_obj, pyb_i2c_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_deinit_obj, pyb_i2c_deinit);
/// \method is_ready(addr)
/// Check if an I2C device responds to the given address. Only valid when in controller mode.
-STATIC mp_obj_t pyb_i2c_is_ready(mp_obj_t self_in, mp_obj_t i2c_addr_o) {
+static mp_obj_t pyb_i2c_is_ready(mp_obj_t self_in, mp_obj_t i2c_addr_o) {
pyb_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (!in_master_mode(self)) {
@@ -773,12 +773,12 @@ STATIC mp_obj_t pyb_i2c_is_ready(mp_obj_t self_in, mp_obj_t i2c_addr_o) {
return mp_const_false;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_i2c_is_ready_obj, pyb_i2c_is_ready);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_i2c_is_ready_obj, pyb_i2c_is_ready);
/// \method scan()
/// Scan all I2C addresses from 0x08 to 0x77 and return a list of those that respond.
/// Only valid when in controller mode.
-STATIC mp_obj_t pyb_i2c_scan(mp_obj_t self_in) {
+static mp_obj_t pyb_i2c_scan(mp_obj_t self_in) {
pyb_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (!in_master_mode(self)) {
@@ -796,7 +796,7 @@ STATIC mp_obj_t pyb_i2c_scan(mp_obj_t self_in) {
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_scan_obj, pyb_i2c_scan);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_scan_obj, pyb_i2c_scan);
/// \method send(send, addr=0x00, timeout=5000)
/// Send data on the bus:
@@ -806,7 +806,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_i2c_scan_obj, pyb_i2c_scan);
/// - `timeout` is the timeout in milliseconds to wait for the send
///
/// Return value: `None`.
-STATIC mp_obj_t pyb_i2c_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_send, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_addr, MP_ARG_INT, {.u_int = PYB_I2C_MASTER_ADDRESS} },
@@ -873,7 +873,7 @@ STATIC mp_obj_t pyb_i2c_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_send_obj, 1, pyb_i2c_send);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_send_obj, 1, pyb_i2c_send);
/// \method recv(recv, addr=0x00, timeout=5000)
///
@@ -886,7 +886,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_send_obj, 1, pyb_i2c_send);
///
/// Return value: if `recv` is an integer then a new buffer of the bytes received,
/// otherwise the same buffer that was passed in to `recv`.
-STATIC mp_obj_t pyb_i2c_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_recv, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_addr, MP_ARG_INT, {.u_int = PYB_I2C_MASTER_ADDRESS} },
@@ -954,7 +954,7 @@ STATIC mp_obj_t pyb_i2c_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
return mp_obj_new_bytes_from_vstr(&vstr);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_recv_obj, 1, pyb_i2c_recv);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_recv_obj, 1, pyb_i2c_recv);
/// \method mem_read(data, addr, memaddr, timeout=5000, addr_size=8)
///
@@ -968,7 +968,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_recv_obj, 1, pyb_i2c_recv);
///
/// Returns the read data.
/// This is only valid in controller mode.
-STATIC const mp_arg_t pyb_i2c_mem_read_allowed_args[] = {
+static const mp_arg_t pyb_i2c_mem_read_allowed_args[] = {
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_addr, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_memaddr, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
@@ -976,7 +976,7 @@ STATIC const mp_arg_t pyb_i2c_mem_read_allowed_args[] = {
{ MP_QSTR_addr_size, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 8} },
};
-STATIC mp_obj_t pyb_i2c_mem_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_mem_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args
pyb_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_i2c_mem_read_allowed_args)];
@@ -1030,7 +1030,7 @@ STATIC mp_obj_t pyb_i2c_mem_read(size_t n_args, const mp_obj_t *pos_args, mp_map
return mp_obj_new_bytes_from_vstr(&vstr);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_mem_read_obj, 1, pyb_i2c_mem_read);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_mem_read_obj, 1, pyb_i2c_mem_read);
/// \method mem_write(data, addr, memaddr, timeout=5000, addr_size=8)
///
@@ -1044,7 +1044,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_mem_read_obj, 1, pyb_i2c_mem_read);
///
/// Returns `None`.
/// This is only valid in controller mode.
-STATIC mp_obj_t pyb_i2c_mem_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_i2c_mem_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// parse args (same as mem_read)
pyb_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(pyb_i2c_mem_read_allowed_args)];
@@ -1094,9 +1094,9 @@ STATIC mp_obj_t pyb_i2c_mem_write(size_t n_args, const mp_obj_t *pos_args, mp_ma
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_mem_write_obj, 1, pyb_i2c_mem_write);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_mem_write_obj, 1, pyb_i2c_mem_write);
-STATIC const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_i2c_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_i2c_deinit_obj) },
@@ -1117,7 +1117,7 @@ STATIC const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SLAVE), MP_ROM_INT(PYB_I2C_SLAVE) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_i2c_locals_dict, pyb_i2c_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_i2c_locals_dict, pyb_i2c_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_i2c_type,
diff --git a/ports/stm32/pyb_spi.c b/ports/stm32/pyb_spi.c
index f92642dddc..2fcccaf161 100644
--- a/ports/stm32/pyb_spi.c
+++ b/ports/stm32/pyb_spi.c
@@ -57,7 +57,7 @@
// spi.send_recv(b'1234', buf) # send 4 bytes and receive 4 into buf
// spi.send_recv(buf, buf) # send/recv 4 bytes from/to buf
-STATIC const pyb_spi_obj_t pyb_spi_obj[] = {
+static const pyb_spi_obj_t pyb_spi_obj[] = {
{{&pyb_spi_type}, &spi_obj[0]},
{{&pyb_spi_type}, &spi_obj[1]},
{{&pyb_spi_type}, &spi_obj[2]},
@@ -66,7 +66,7 @@ STATIC const pyb_spi_obj_t pyb_spi_obj[] = {
{{&pyb_spi_type}, &spi_obj[5]},
};
-STATIC void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
spi_print(print, self->spi, true);
}
@@ -76,7 +76,7 @@ STATIC void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
// Initialise the SPI bus with the given parameters:
// - `mode` must be either `SPI.CONTROLLER` or `SPI.PERIPHERAL`.
// - `baudrate` is the SCK clock rate (only sensible for a controller).
-STATIC mp_obj_t pyb_spi_init_helper(const pyb_spi_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_init_helper(const pyb_spi_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 328125} },
@@ -136,7 +136,7 @@ STATIC mp_obj_t pyb_spi_init_helper(const pyb_spi_obj_t *self, size_t n_args, co
//
// At the moment, the NSS pin is not used by the SPI driver and is free
// for other use.
-STATIC mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -156,19 +156,19 @@ STATIC mp_obj_t pyb_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_
return MP_OBJ_FROM_PTR(spi_obj);
}
-STATIC mp_obj_t pyb_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_spi_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_init_obj, 1, pyb_spi_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_init_obj, 1, pyb_spi_init);
// deinit()
// Turn off the SPI bus.
-STATIC mp_obj_t pyb_spi_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_spi_deinit(mp_obj_t self_in) {
pyb_spi_obj_t *self = MP_OBJ_TO_PTR(self_in);
spi_deinit(self->spi);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_spi_deinit_obj, pyb_spi_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_spi_deinit_obj, pyb_spi_deinit);
// send(send, *, timeout=5000)
// Send data on the bus:
@@ -176,7 +176,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_spi_deinit_obj, pyb_spi_deinit);
// - `timeout` is the timeout in milliseconds to wait for the send.
//
// Return value: `None`.
-STATIC mp_obj_t pyb_spi_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// TODO assumes transmission size is 8-bits wide
static const mp_arg_t allowed_args[] = {
@@ -199,7 +199,7 @@ STATIC mp_obj_t pyb_spi_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_send_obj, 1, pyb_spi_send);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_send_obj, 1, pyb_spi_send);
// recv(recv, *, timeout=5000)
//
@@ -210,7 +210,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_send_obj, 1, pyb_spi_send);
//
// Return value: if `recv` is an integer then a new buffer of the bytes received,
// otherwise the same buffer that was passed in to `recv`.
-STATIC mp_obj_t pyb_spi_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// TODO assumes transmission size is 8-bits wide
static const mp_arg_t allowed_args[] = {
@@ -237,7 +237,7 @@ STATIC mp_obj_t pyb_spi_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
return mp_obj_new_bytes_from_vstr(&vstr);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_recv_obj, 1, pyb_spi_recv);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_recv_obj, 1, pyb_spi_recv);
// send_recv(send, recv=None, *, timeout=5000)
//
@@ -249,7 +249,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_recv_obj, 1, pyb_spi_recv);
// - `timeout` is the timeout in milliseconds to wait for the receive.
//
// Return value: the buffer with the received bytes.
-STATIC mp_obj_t pyb_spi_send_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_spi_send_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// TODO assumes transmission size is 8-bits wide
static const mp_arg_t allowed_args[] = {
@@ -306,9 +306,9 @@ STATIC mp_obj_t pyb_spi_send_recv(size_t n_args, const mp_obj_t *pos_args, mp_ma
return mp_obj_new_bytes_from_vstr(&vstr_recv);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_send_recv_obj, 1, pyb_spi_send_recv);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_spi_send_recv_obj, 1, pyb_spi_send_recv);
-STATIC const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_spi_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_spi_deinit_obj) },
@@ -344,14 +344,14 @@ STATIC const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_NSS_HARD_OUTPUT ((uint32_t)0x00040000)
*/
};
-STATIC MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table);
-STATIC void spi_transfer_machine(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void spi_transfer_machine(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
pyb_spi_obj_t *self = (pyb_spi_obj_t *)self_in;
spi_transfer(self->spi, len, src, dest, SPI_TRANSFER_TIMEOUT(len));
}
-STATIC const mp_machine_spi_p_t pyb_spi_p = {
+static const mp_machine_spi_p_t pyb_spi_p = {
.transfer = spi_transfer_machine,
};
diff --git a/ports/stm32/pybthread.c b/ports/stm32/pybthread.c
index 57c8d1fdde..e2f2de7ff0 100644
--- a/ports/stm32/pybthread.c
+++ b/ports/stm32/pybthread.c
@@ -84,7 +84,7 @@ void pyb_thread_deinit() {
enable_irq(irq_state);
}
-STATIC void pyb_thread_terminate(void) {
+static void pyb_thread_terminate(void) {
uint32_t irq_state = disable_irq();
pyb_thread_t *thread = pyb_thread_cur;
// take current thread off the run list
diff --git a/ports/stm32/qspi.c b/ports/stm32/qspi.c
index c10bec2365..a560f8fb62 100644
--- a/ports/stm32/qspi.c
+++ b/ports/stm32/qspi.c
@@ -172,7 +172,7 @@ void qspi_memory_map(void) {
qspi_mpu_enable_mapped();
}
-STATIC int qspi_ioctl(void *self_in, uint32_t cmd) {
+static int qspi_ioctl(void *self_in, uint32_t cmd) {
(void)self_in;
switch (cmd) {
case MP_QSPI_IOCTL_INIT:
@@ -196,7 +196,7 @@ STATIC int qspi_ioctl(void *self_in, uint32_t cmd) {
return 0; // success
}
-STATIC int qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t data) {
+static int qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t data) {
(void)self_in;
QUADSPI->FCR = QUADSPI_FCR_CTCF; // clear TC flag
@@ -252,7 +252,7 @@ STATIC int qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t
return 0;
}
-STATIC int qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src) {
+static int qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, size_t len, const uint8_t *src) {
(void)self_in;
uint8_t adsize = MICROPY_HW_SPI_ADDR_IS_32BIT(addr) ? 3 : 2;
@@ -316,7 +316,7 @@ STATIC int qspi_write_cmd_addr_data(void *self_in, uint8_t cmd, uint32_t addr, s
return 0;
}
-STATIC int qspi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *dest) {
+static int qspi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *dest) {
(void)self_in;
QUADSPI->FCR = QUADSPI_FCR_CTCF; // clear TC flag
@@ -350,7 +350,7 @@ STATIC int qspi_read_cmd(void *self_in, uint8_t cmd, size_t len, uint32_t *dest)
return 0;
}
-STATIC int qspi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr, size_t len, uint8_t *dest) {
+static int qspi_read_cmd_qaddr_qdata(void *self_in, uint8_t cmd, uint32_t addr, size_t len, uint8_t *dest) {
(void)self_in;
uint8_t adsize = MICROPY_HW_SPI_ADDR_IS_32BIT(addr) ? 3 : 2;
diff --git a/ports/stm32/rfcore.c b/ports/stm32/rfcore.c
index 2e660d6d9e..05582e887e 100644
--- a/ports/stm32/rfcore.c
+++ b/ports/stm32/rfcore.c
@@ -195,33 +195,33 @@ typedef struct __attribute__((packed)) _ipcc_ref_table_t {
// The stm32wb55xg.ld script puts .bss.ipcc_mem_* into SRAM2A and .bss_ipcc_membuf_* into SRAM2B.
// It also leaves 64 bytes at the start of SRAM2A for the ref table.
-STATIC ipcc_device_info_table_t ipcc_mem_dev_info_tab; // mem1
-STATIC ipcc_ble_table_t ipcc_mem_ble_tab; // mem1
-STATIC ipcc_sys_table_t ipcc_mem_sys_tab; // mem1
-STATIC ipcc_mem_manager_table_t ipcc_mem_memmgr_tab; // mem1
+static ipcc_device_info_table_t ipcc_mem_dev_info_tab; // mem1
+static ipcc_ble_table_t ipcc_mem_ble_tab; // mem1
+static ipcc_sys_table_t ipcc_mem_sys_tab; // mem1
+static ipcc_mem_manager_table_t ipcc_mem_memmgr_tab; // mem1
-STATIC uint8_t ipcc_membuf_sys_cmd_buf[272]; // mem2
-STATIC tl_list_node_t ipcc_mem_sys_queue; // mem1
+static uint8_t ipcc_membuf_sys_cmd_buf[272]; // mem2
+static tl_list_node_t ipcc_mem_sys_queue; // mem1
-STATIC tl_list_node_t ipcc_mem_memmgr_free_buf_queue; // mem1
-STATIC uint8_t ipcc_membuf_memmgr_ble_spare_evt_buf[272]; // mem2
-STATIC uint8_t ipcc_membuf_memmgr_sys_spare_evt_buf[272]; // mem2
-STATIC uint8_t ipcc_membuf_memmgr_evt_pool[6 * 272]; // mem2
+static tl_list_node_t ipcc_mem_memmgr_free_buf_queue; // mem1
+static uint8_t ipcc_membuf_memmgr_ble_spare_evt_buf[272]; // mem2
+static uint8_t ipcc_membuf_memmgr_sys_spare_evt_buf[272]; // mem2
+static uint8_t ipcc_membuf_memmgr_evt_pool[6 * 272]; // mem2
-STATIC uint8_t ipcc_membuf_ble_cmd_buf[272]; // mem2
-STATIC uint8_t ipcc_membuf_ble_cs_buf[272]; // mem2
-STATIC tl_list_node_t ipcc_mem_ble_evt_queue; // mem1
-STATIC uint8_t ipcc_membuf_ble_hci_acl_data_buf[272]; // mem2
+static uint8_t ipcc_membuf_ble_cmd_buf[272]; // mem2
+static uint8_t ipcc_membuf_ble_cs_buf[272]; // mem2
+static tl_list_node_t ipcc_mem_ble_evt_queue; // mem1
+static uint8_t ipcc_membuf_ble_hci_acl_data_buf[272]; // mem2
/******************************************************************************/
// Transport layer linked list
-STATIC void tl_list_init(volatile tl_list_node_t *n) {
+static void tl_list_init(volatile tl_list_node_t *n) {
n->next = n;
n->prev = n;
}
-STATIC volatile tl_list_node_t *tl_list_unlink(volatile tl_list_node_t *n) {
+static volatile tl_list_node_t *tl_list_unlink(volatile tl_list_node_t *n) {
volatile tl_list_node_t *next = n->next;
volatile tl_list_node_t *prev = n->prev;
prev->next = next;
@@ -229,7 +229,7 @@ STATIC volatile tl_list_node_t *tl_list_unlink(volatile tl_list_node_t *n) {
return next;
}
-STATIC void tl_list_append(volatile tl_list_node_t *head, volatile tl_list_node_t *n) {
+static void tl_list_append(volatile tl_list_node_t *head, volatile tl_list_node_t *n) {
n->next = head;
n->prev = head->prev;
head->prev->next = n;
@@ -239,7 +239,7 @@ STATIC void tl_list_append(volatile tl_list_node_t *head, volatile tl_list_node_
/******************************************************************************/
// IPCC interface
-STATIC volatile ipcc_ref_table_t *get_buffer_table(void) {
+static volatile ipcc_ref_table_t *get_buffer_table(void) {
// The IPCCDBA option bytes must not be changed without
// making a corresponding change to the linker script.
return (volatile ipcc_ref_table_t *)(SRAM2A_BASE + LL_FLASH_GetIPCCBufferAddr() * 4);
@@ -299,9 +299,9 @@ void ipcc_init(uint32_t irq_pri) {
// In either case we detect the failure response and inject this response
// instead (which is HCI_EVENT_COMMAND_COMPLETE for OCF_CB_SET_EVENT_MASK2
// with status=0).
-STATIC const uint8_t set_event_event_mask2_fix_payload[] = { 0x04, 0x0e, 0x04, 0x01, 0x63, 0x0c, 0x00 };
+static const uint8_t set_event_event_mask2_fix_payload[] = { 0x04, 0x0e, 0x04, 0x01, 0x63, 0x0c, 0x00 };
-STATIC size_t tl_parse_hci_msg(const uint8_t *buf, parse_hci_info_t *parse) {
+static size_t tl_parse_hci_msg(const uint8_t *buf, parse_hci_info_t *parse) {
const char *info;
#if HCI_TRACE
int applied_set_event_event_mask2_fix = 0;
@@ -408,7 +408,7 @@ STATIC size_t tl_parse_hci_msg(const uint8_t *buf, parse_hci_info_t *parse) {
return len;
}
-STATIC size_t tl_process_msg(volatile tl_list_node_t *head, unsigned int ch, parse_hci_info_t *parse) {
+static size_t tl_process_msg(volatile tl_list_node_t *head, unsigned int ch, parse_hci_info_t *parse) {
volatile tl_list_node_t *cur = head->next;
bool added_to_free_queue = false;
size_t len = 0;
@@ -441,7 +441,7 @@ STATIC size_t tl_process_msg(volatile tl_list_node_t *head, unsigned int ch, par
}
// Only call this when IRQs are disabled on this channel.
-STATIC size_t tl_check_msg(volatile tl_list_node_t *head, unsigned int ch, parse_hci_info_t *parse) {
+static size_t tl_check_msg(volatile tl_list_node_t *head, unsigned int ch, parse_hci_info_t *parse) {
size_t len = 0;
if (LL_C2_IPCC_IsActiveFlag_CHx(IPCC, ch)) {
// Process new data.
@@ -458,7 +458,7 @@ STATIC size_t tl_check_msg(volatile tl_list_node_t *head, unsigned int ch, parse
return len;
}
-STATIC void tl_hci_cmd(uint8_t *cmd, unsigned int ch, uint8_t hdr, uint16_t opcode, const uint8_t *buf, size_t len) {
+static void tl_hci_cmd(uint8_t *cmd, unsigned int ch, uint8_t hdr, uint16_t opcode, const uint8_t *buf, size_t len) {
tl_list_node_t *n = (tl_list_node_t *)cmd;
n->next = NULL;
n->prev = NULL;
@@ -480,7 +480,7 @@ STATIC void tl_hci_cmd(uint8_t *cmd, unsigned int ch, uint8_t hdr, uint16_t opco
LL_C1_IPCC_SetFlag_CHx(IPCC, ch);
}
-STATIC ssize_t tl_sys_wait_ack(const uint8_t *buf, mp_int_t timeout_ms) {
+static ssize_t tl_sys_wait_ack(const uint8_t *buf, mp_int_t timeout_ms) {
uint32_t t0 = mp_hal_ticks_ms();
timeout_ms = MAX(SYS_ACK_TIMEOUT_MS, timeout_ms);
@@ -498,12 +498,12 @@ STATIC ssize_t tl_sys_wait_ack(const uint8_t *buf, mp_int_t timeout_ms) {
return (ssize_t)tl_parse_hci_msg(buf, NULL);
}
-STATIC ssize_t tl_sys_hci_cmd_resp(uint16_t opcode, const uint8_t *buf, size_t len, mp_int_t timeout_ms) {
+static ssize_t tl_sys_hci_cmd_resp(uint16_t opcode, const uint8_t *buf, size_t len, mp_int_t timeout_ms) {
tl_hci_cmd(ipcc_membuf_sys_cmd_buf, IPCC_CH_SYS, 0x10, opcode, buf, len);
return tl_sys_wait_ack(ipcc_membuf_sys_cmd_buf, timeout_ms);
}
-STATIC int tl_ble_wait_resp(void) {
+static int tl_ble_wait_resp(void) {
uint32_t t0 = mp_hal_ticks_ms();
while (!LL_C2_IPCC_IsActiveFlag_CHx(IPCC, IPCC_CH_BLE)) {
if (mp_hal_ticks_ms() - t0 > BLE_ACK_TIMEOUT_MS) {
@@ -518,7 +518,7 @@ STATIC int tl_ble_wait_resp(void) {
}
// Synchronously send a BLE command.
-STATIC void tl_ble_hci_cmd_resp(uint16_t opcode, const uint8_t *buf, size_t len) {
+static void tl_ble_hci_cmd_resp(uint16_t opcode, const uint8_t *buf, size_t len) {
// Poll for completion rather than wait for IRQ->scheduler.
LL_C1_IPCC_DisableReceiveChannel(IPCC, IPCC_CH_BLE);
tl_hci_cmd(ipcc_membuf_ble_cmd_buf, IPCC_CH_BLE, HCI_KIND_BT_CMD, opcode, buf, len);
@@ -743,19 +743,19 @@ void IPCC_C1_RX_IRQHandler(void) {
/******************************************************************************/
// MicroPython bindings
-STATIC mp_obj_t rfcore_status(void) {
+static mp_obj_t rfcore_status(void) {
return mp_obj_new_int_from_uint(ipcc_mem_dev_info_tab.fus.table_state);
}
MP_DEFINE_CONST_FUN_OBJ_0(rfcore_status_obj, rfcore_status);
-STATIC mp_obj_t get_version_tuple(uint32_t data) {
+static mp_obj_t get_version_tuple(uint32_t data) {
mp_obj_t items[] = {
MP_OBJ_NEW_SMALL_INT(data >> 24), MP_OBJ_NEW_SMALL_INT(data >> 16 & 0xFF), MP_OBJ_NEW_SMALL_INT(data >> 8 & 0xFF), MP_OBJ_NEW_SMALL_INT(data >> 4 & 0xF), MP_OBJ_NEW_SMALL_INT(data & 0xF)
};
return mp_obj_new_tuple(5, items);
}
-STATIC mp_obj_t rfcore_fw_version(mp_obj_t fw_id_in) {
+static mp_obj_t rfcore_fw_version(mp_obj_t fw_id_in) {
if (ipcc_mem_dev_info_tab.fus.table_state == MAGIC_IPCC_MEM_INCORRECT) {
mp_raise_OSError(MP_EINVAL);
}
@@ -773,7 +773,7 @@ STATIC mp_obj_t rfcore_fw_version(mp_obj_t fw_id_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(rfcore_fw_version_obj, rfcore_fw_version);
-STATIC mp_obj_t rfcore_sys_hci(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t rfcore_sys_hci(size_t n_args, const mp_obj_t *args) {
if (ipcc_mem_dev_info_tab.fus.table_state == MAGIC_IPCC_MEM_INCORRECT) {
mp_raise_OSError(MP_EINVAL);
}
diff --git a/ports/stm32/rng.c b/ports/stm32/rng.c
index 236d79ea87..400e1bd16d 100644
--- a/ports/stm32/rng.c
+++ b/ports/stm32/rng.c
@@ -57,7 +57,7 @@ uint32_t rng_get(void) {
}
// Return a 30-bit hardware generated random number.
-STATIC mp_obj_t pyb_rng_get(void) {
+static mp_obj_t pyb_rng_get(void) {
return mp_obj_new_int(rng_get() >> 2);
}
MP_DEFINE_CONST_FUN_OBJ_0(pyb_rng_get_obj, pyb_rng_get);
@@ -72,7 +72,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(pyb_rng_get_obj, pyb_rng_get);
// Yasmarang random number generator by Ilya Levin
// http://www.literatecode.com/yasmarang
-STATIC uint32_t pyb_rng_yasmarang(void) {
+static uint32_t pyb_rng_yasmarang(void) {
static bool seeded = false;
static uint32_t pad = 0, n = 0, d = 0;
static uint8_t dat = 0;
diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c
index b209ea8354..8dadc4a88d 100644
--- a/ports/stm32/rtc.c
+++ b/ports/stm32/rtc.c
@@ -67,18 +67,18 @@ static mp_uint_t rtc_info;
#define RTC_SYNCH_PREDIV (0x00ff)
#endif
-STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc);
-STATIC void PYB_RTC_MspInit_Kick(RTC_HandleTypeDef *hrtc, bool rtc_use_lse, bool rtc_use_byp);
-STATIC HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc);
-STATIC void RTC_CalendarConfig(void);
+static HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc);
+static void PYB_RTC_MspInit_Kick(RTC_HandleTypeDef *hrtc, bool rtc_use_lse, bool rtc_use_byp);
+static HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc);
+static void RTC_CalendarConfig(void);
#if MICROPY_HW_RTC_USE_LSE || MICROPY_HW_RTC_USE_BYPASS
-STATIC bool rtc_use_lse = true;
+static bool rtc_use_lse = true;
#else
-STATIC bool rtc_use_lse = false;
+static bool rtc_use_lse = false;
#endif
-STATIC uint32_t rtc_startup_tick;
-STATIC bool rtc_need_init_finalise = false;
+static uint32_t rtc_startup_tick;
+static bool rtc_need_init_finalise = false;
#if defined(STM32L0)
#define BDCR CSR
@@ -262,7 +262,7 @@ void rtc_init_finalise() {
rtc_need_init_finalise = false;
}
-STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) {
+static HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct) {
/*------------------------------ LSI Configuration -------------------------*/
if ((RCC_OscInitStruct->OscillatorType & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI) {
// Check the LSI State
@@ -331,7 +331,7 @@ STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct
return HAL_OK;
}
-STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) {
+static HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) {
// Check the RTC peripheral state
if (hrtc == NULL) {
return HAL_ERROR;
@@ -399,7 +399,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) {
}
}
-STATIC void PYB_RTC_MspInit_Kick(RTC_HandleTypeDef *hrtc, bool rtc_use_lse, bool rtc_use_byp) {
+static void PYB_RTC_MspInit_Kick(RTC_HandleTypeDef *hrtc, bool rtc_use_lse, bool rtc_use_byp) {
/* To change the source clock of the RTC feature (LSE, LSI), You have to:
- Enable the power clock using __PWR_CLK_ENABLE()
- Enable write access using HAL_PWR_EnableBkUpAccess() function before to
@@ -443,7 +443,7 @@ STATIC void PYB_RTC_MspInit_Kick(RTC_HandleTypeDef *hrtc, bool rtc_use_lse, bool
#define MICROPY_HW_RTC_BYP_TIMEOUT_MS 150
#endif
-STATIC HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc) {
+static HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc) {
// we already had a kick so now wait for the corresponding ready state...
if (rtc_use_lse) {
// we now have to wait for LSE ready or timeout
@@ -486,7 +486,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc) {
return HAL_OK;
}
-STATIC void RTC_CalendarConfig(void) {
+static void RTC_CalendarConfig(void) {
// set the date to 1st Jan 2015
RTC_DateTypeDef date;
date.Year = 15;
@@ -538,11 +538,11 @@ typedef struct _pyb_rtc_obj_t {
mp_obj_base_t base;
} pyb_rtc_obj_t;
-STATIC const pyb_rtc_obj_t pyb_rtc_obj = {{&pyb_rtc_type}};
+static const pyb_rtc_obj_t pyb_rtc_obj = {{&pyb_rtc_type}};
/// \classmethod \constructor()
/// Create an RTC object.
-STATIC mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -862,14 +862,14 @@ mp_obj_t pyb_rtc_calibration(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_rtc_calibration_obj, 1, 2, pyb_rtc_calibration);
-STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_rtc_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&pyb_rtc_info_obj) },
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&pyb_rtc_datetime_obj) },
{ MP_ROM_QSTR(MP_QSTR_wakeup), MP_ROM_PTR(&pyb_rtc_wakeup_obj) },
{ MP_ROM_QSTR(MP_QSTR_calibration), MP_ROM_PTR(&pyb_rtc_calibration_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_rtc_type,
diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c
index a903f79ed2..a7d0629399 100644
--- a/ports/stm32/sdcard.c
+++ b/ports/stm32/sdcard.c
@@ -208,7 +208,7 @@ void sdcard_select_mmc(void) {
pyb_sdmmc_flags |= PYB_SDMMC_FLAG_MMC;
}
-STATIC void sdmmc_msp_init(void) {
+static void sdmmc_msp_init(void) {
// enable SDIO clock
SDMMC_CLK_ENABLE();
@@ -264,7 +264,7 @@ bool sdcard_is_present(void) {
}
#if MICROPY_HW_ENABLE_SDCARD
-STATIC HAL_StatusTypeDef sdmmc_init_sd(void) {
+static HAL_StatusTypeDef sdmmc_init_sd(void) {
// SD device interface configuration
sdmmc_handle.sd.Instance = SDIO;
sdmmc_handle.sd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
@@ -299,7 +299,7 @@ STATIC HAL_StatusTypeDef sdmmc_init_sd(void) {
#endif
#if MICROPY_HW_ENABLE_MMCARD
-STATIC HAL_StatusTypeDef sdmmc_init_mmc(void) {
+static HAL_StatusTypeDef sdmmc_init_mmc(void) {
// MMC device interface configuration
sdmmc_handle.mmc.Instance = SDIO;
sdmmc_handle.mmc.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
@@ -410,7 +410,7 @@ uint64_t sdcard_get_capacity_in_bytes(void) {
}
}
-STATIC void sdmmc_irq_handler(void) {
+static void sdmmc_irq_handler(void) {
switch (pyb_sdmmc_flags) {
#if MICROPY_HW_ENABLE_SDCARD
case PYB_SDMMC_FLAG_ACTIVE | PYB_SDMMC_FLAG_SD:
@@ -431,7 +431,7 @@ void SDMMC_IRQHandler(void) {
IRQ_EXIT(SDMMC_IRQn);
}
-STATIC void sdcard_reset_periph(void) {
+static void sdcard_reset_periph(void) {
// Fully reset the SDMMC peripheral before calling HAL SD DMA functions.
// (There could be an outstanding DTIMEOUT event from a previous call and the
// HAL function enables IRQs before fully configuring the SDMMC peripheral.)
@@ -441,7 +441,7 @@ STATIC void sdcard_reset_periph(void) {
SDIO->ICR = SDMMC_STATIC_FLAGS;
}
-STATIC HAL_StatusTypeDef sdcard_wait_finished(uint32_t timeout) {
+static HAL_StatusTypeDef sdcard_wait_finished(uint32_t timeout) {
// Wait for HAL driver to be ready (eg for DMA to finish)
uint32_t start = HAL_GetTick();
for (;;) {
@@ -699,7 +699,7 @@ const mp_obj_base_t pyb_mmcard_obj = {&pyb_mmcard_type};
#endif
#if MICROPY_HW_ENABLE_SDCARD
-STATIC mp_obj_t pyb_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -717,7 +717,7 @@ STATIC mp_obj_t pyb_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, si
#endif
#if MICROPY_HW_ENABLE_MMCARD
-STATIC mp_obj_t pyb_mmcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_mmcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -734,12 +734,12 @@ STATIC mp_obj_t pyb_mmcard_make_new(const mp_obj_type_t *type, size_t n_args, si
}
#endif
-STATIC mp_obj_t sd_present(mp_obj_t self) {
+static mp_obj_t sd_present(mp_obj_t self) {
return mp_obj_new_bool(sdcard_is_present());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(sd_present_obj, sd_present);
+static MP_DEFINE_CONST_FUN_OBJ_1(sd_present_obj, sd_present);
-STATIC mp_obj_t sd_power(mp_obj_t self, mp_obj_t state) {
+static mp_obj_t sd_power(mp_obj_t self, mp_obj_t state) {
bool result;
if (mp_obj_is_true(state)) {
result = sdcard_power_on();
@@ -749,9 +749,9 @@ STATIC mp_obj_t sd_power(mp_obj_t self, mp_obj_t state) {
}
return mp_obj_new_bool(result);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(sd_power_obj, sd_power);
+static MP_DEFINE_CONST_FUN_OBJ_2(sd_power_obj, sd_power);
-STATIC mp_obj_t sd_info(mp_obj_t self) {
+static mp_obj_t sd_info(mp_obj_t self) {
if (!(pyb_sdmmc_flags & PYB_SDMMC_FLAG_ACTIVE)) {
return mp_const_none;
}
@@ -778,10 +778,10 @@ STATIC mp_obj_t sd_info(mp_obj_t self) {
};
return mp_obj_new_tuple(3, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(sd_info_obj, sd_info);
+static MP_DEFINE_CONST_FUN_OBJ_1(sd_info_obj, sd_info);
// now obsolete, kept for backwards compatibility
-STATIC mp_obj_t sd_read(mp_obj_t self, mp_obj_t block_num) {
+static mp_obj_t sd_read(mp_obj_t self, mp_obj_t block_num) {
uint8_t *dest = m_new(uint8_t, SDCARD_BLOCK_SIZE);
mp_uint_t ret = sdcard_read_blocks(dest, mp_obj_get_int(block_num), 1);
@@ -792,10 +792,10 @@ STATIC mp_obj_t sd_read(mp_obj_t self, mp_obj_t block_num) {
return mp_obj_new_bytearray_by_ref(SDCARD_BLOCK_SIZE, dest);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(sd_read_obj, sd_read);
+static MP_DEFINE_CONST_FUN_OBJ_2(sd_read_obj, sd_read);
// now obsolete, kept for backwards compatibility
-STATIC mp_obj_t sd_write(mp_obj_t self, mp_obj_t block_num, mp_obj_t data) {
+static mp_obj_t sd_write(mp_obj_t self, mp_obj_t block_num, mp_obj_t data) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
if (bufinfo.len % SDCARD_BLOCK_SIZE != 0) {
@@ -810,25 +810,25 @@ STATIC mp_obj_t sd_write(mp_obj_t self, mp_obj_t block_num, mp_obj_t data) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(sd_write_obj, sd_write);
+static MP_DEFINE_CONST_FUN_OBJ_3(sd_write_obj, sd_write);
-STATIC mp_obj_t pyb_sdcard_readblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t pyb_sdcard_readblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
mp_uint_t ret = sdcard_read_blocks(bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / SDCARD_BLOCK_SIZE);
return mp_obj_new_bool(ret == 0);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_sdcard_readblocks_obj, pyb_sdcard_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_sdcard_readblocks_obj, pyb_sdcard_readblocks);
-STATIC mp_obj_t pyb_sdcard_writeblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t pyb_sdcard_writeblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
mp_uint_t ret = sdcard_write_blocks(bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / SDCARD_BLOCK_SIZE);
return mp_obj_new_bool(ret == 0);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_sdcard_writeblocks_obj, pyb_sdcard_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_sdcard_writeblocks_obj, pyb_sdcard_writeblocks);
-STATIC mp_obj_t pyb_sdcard_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t pyb_sdcard_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
mp_int_t cmd = mp_obj_get_int(cmd_in);
switch (cmd) {
case MP_BLOCKDEV_IOCTL_INIT:
@@ -855,9 +855,9 @@ STATIC mp_obj_t pyb_sdcard_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in
return MP_OBJ_NEW_SMALL_INT(-1); // error
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_sdcard_ioctl_obj, pyb_sdcard_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_sdcard_ioctl_obj, pyb_sdcard_ioctl);
-STATIC const mp_rom_map_elem_t pyb_sdcard_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_present), MP_ROM_PTR(&sd_present_obj) },
{ MP_ROM_QSTR(MP_QSTR_power), MP_ROM_PTR(&sd_power_obj) },
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&sd_info_obj) },
@@ -869,7 +869,7 @@ STATIC const mp_rom_map_elem_t pyb_sdcard_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&pyb_sdcard_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_sdcard_locals_dict, pyb_sdcard_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_sdcard_locals_dict, pyb_sdcard_locals_dict_table);
#if MICROPY_HW_ENABLE_SDCARD
MP_DEFINE_CONST_OBJ_TYPE(
diff --git a/ports/stm32/servo.c b/ports/stm32/servo.c
index 07cc4eab88..ea8205756a 100644
--- a/ports/stm32/servo.c
+++ b/ports/stm32/servo.c
@@ -60,7 +60,7 @@ typedef struct _pyb_servo_obj_t {
uint16_t time_left;
} pyb_servo_obj_t;
-STATIC pyb_servo_obj_t pyb_servo_obj[PYB_SERVO_NUM];
+static pyb_servo_obj_t pyb_servo_obj[PYB_SERVO_NUM];
void servo_init(void) {
// reset servo objects
@@ -123,7 +123,7 @@ void servo_timer_irq_callback(void) {
}
}
-STATIC void servo_init_channel(pyb_servo_obj_t *s) {
+static void servo_init_channel(pyb_servo_obj_t *s) {
static const uint8_t channel_table[4] =
{TIM_CHANNEL_1, TIM_CHANNEL_2, TIM_CHANNEL_3, TIM_CHANNEL_4};
uint32_t channel = channel_table[s->pin->pin];
@@ -150,7 +150,7 @@ STATIC void servo_init_channel(pyb_servo_obj_t *s) {
/******************************************************************************/
// MicroPython bindings
-STATIC mp_obj_t pyb_servo_set(mp_obj_t port, mp_obj_t value) {
+static mp_obj_t pyb_servo_set(mp_obj_t port, mp_obj_t value) {
int p = mp_obj_get_int(port);
int v = mp_obj_get_int(value);
if (v < 50) {
@@ -178,7 +178,7 @@ STATIC mp_obj_t pyb_servo_set(mp_obj_t port, mp_obj_t value) {
MP_DEFINE_CONST_FUN_OBJ_2(pyb_servo_set_obj, pyb_servo_set);
-STATIC mp_obj_t pyb_pwm_set(mp_obj_t period, mp_obj_t pulse) {
+static mp_obj_t pyb_pwm_set(mp_obj_t period, mp_obj_t pulse) {
int pe = mp_obj_get_int(period);
int pu = mp_obj_get_int(pulse);
TIM5->ARR = pe;
@@ -188,14 +188,14 @@ STATIC mp_obj_t pyb_pwm_set(mp_obj_t period, mp_obj_t pulse) {
MP_DEFINE_CONST_FUN_OBJ_2(pyb_pwm_set_obj, pyb_pwm_set);
-STATIC void pyb_servo_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_servo_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_servo_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<Servo %u at %uus>", self - &pyb_servo_obj[0] + 1, 10 * self->pulse_cur);
}
/// \classmethod \constructor(id)
/// Create a servo object. `id` is 1-4.
-STATIC mp_obj_t pyb_servo_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_servo_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -218,7 +218,7 @@ STATIC mp_obj_t pyb_servo_make_new(const mp_obj_type_t *type, size_t n_args, siz
/// \method pulse_width([value])
/// Get or set the pulse width in milliseconds.
-STATIC mp_obj_t pyb_servo_pulse_width(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_servo_pulse_width(size_t n_args, const mp_obj_t *args) {
pyb_servo_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get pulse width, in us
@@ -231,12 +231,12 @@ STATIC mp_obj_t pyb_servo_pulse_width(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_pulse_width_obj, 1, 2, pyb_servo_pulse_width);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_pulse_width_obj, 1, 2, pyb_servo_pulse_width);
/// \method calibration([pulse_min, pulse_max, pulse_centre, [pulse_angle_90, pulse_speed_100]])
/// Get or set the calibration of the servo timing.
// TODO should accept 1 arg, a 5-tuple of values to set
-STATIC mp_obj_t pyb_servo_calibration(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_servo_calibration(size_t n_args, const mp_obj_t *args) {
pyb_servo_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get calibration values
@@ -264,14 +264,14 @@ STATIC mp_obj_t pyb_servo_calibration(size_t n_args, const mp_obj_t *args) {
// bad number of arguments
mp_raise_msg_varg(&mp_type_TypeError, MP_ERROR_TEXT("calibration expecting 1, 4 or 6 arguments, got %d"), n_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_calibration_obj, 1, 6, pyb_servo_calibration);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_calibration_obj, 1, 6, pyb_servo_calibration);
/// \method angle([angle, time=0])
/// Get or set the angle of the servo.
///
/// - `angle` is the angle to move to in degrees.
/// - `time` is the number of milliseconds to take to get to the specified angle.
-STATIC mp_obj_t pyb_servo_angle(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_servo_angle(size_t n_args, const mp_obj_t *args) {
pyb_servo_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get angle
@@ -294,14 +294,14 @@ STATIC mp_obj_t pyb_servo_angle(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_angle_obj, 1, 3, pyb_servo_angle);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_angle_obj, 1, 3, pyb_servo_angle);
/// \method speed([speed, time=0])
/// Get or set the speed of a continuous rotation servo.
///
/// - `speed` is the speed to move to change to, between -100 and 100.
/// - `time` is the number of milliseconds to take to get to the specified speed.
-STATIC mp_obj_t pyb_servo_speed(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_servo_speed(size_t n_args, const mp_obj_t *args) {
pyb_servo_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get speed
@@ -325,16 +325,16 @@ STATIC mp_obj_t pyb_servo_speed(size_t n_args, const mp_obj_t *args) {
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_speed_obj, 1, 3, pyb_servo_speed);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_speed_obj, 1, 3, pyb_servo_speed);
-STATIC const mp_rom_map_elem_t pyb_servo_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_servo_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_pulse_width), MP_ROM_PTR(&pyb_servo_pulse_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_calibration), MP_ROM_PTR(&pyb_servo_calibration_obj) },
{ MP_ROM_QSTR(MP_QSTR_angle), MP_ROM_PTR(&pyb_servo_angle_obj) },
{ MP_ROM_QSTR(MP_QSTR_speed), MP_ROM_PTR(&pyb_servo_speed_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_servo_locals_dict, pyb_servo_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_servo_locals_dict, pyb_servo_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_servo_type,
diff --git a/ports/stm32/spi.c b/ports/stm32/spi.c
index df71efd3fe..5aace8e9a3 100644
--- a/ports/stm32/spi.c
+++ b/ports/stm32/spi.c
@@ -46,22 +46,22 @@
// SPI6_RX: DMA2_Stream6.CHANNEL_1
#if defined(MICROPY_HW_SPI1_SCK)
-STATIC SPI_HandleTypeDef SPIHandle1 = {.Instance = NULL};
+static SPI_HandleTypeDef SPIHandle1 = {.Instance = NULL};
#endif
#if defined(MICROPY_HW_SPI2_SCK)
-STATIC SPI_HandleTypeDef SPIHandle2 = {.Instance = NULL};
+static SPI_HandleTypeDef SPIHandle2 = {.Instance = NULL};
#endif
#if defined(MICROPY_HW_SPI3_SCK)
-STATIC SPI_HandleTypeDef SPIHandle3 = {.Instance = NULL};
+static SPI_HandleTypeDef SPIHandle3 = {.Instance = NULL};
#endif
#if defined(MICROPY_HW_SPI4_SCK)
-STATIC SPI_HandleTypeDef SPIHandle4 = {.Instance = NULL};
+static SPI_HandleTypeDef SPIHandle4 = {.Instance = NULL};
#endif
#if defined(MICROPY_HW_SPI5_SCK)
-STATIC SPI_HandleTypeDef SPIHandle5 = {.Instance = NULL};
+static SPI_HandleTypeDef SPIHandle5 = {.Instance = NULL};
#endif
#if defined(MICROPY_HW_SPI6_SCK)
-STATIC SPI_HandleTypeDef SPIHandle6 = {.Instance = NULL};
+static SPI_HandleTypeDef SPIHandle6 = {.Instance = NULL};
#endif
#if defined(MICROPY_HW_SUBGHZSPI_ID)
static SPI_HandleTypeDef SPIHandleSubGhz = {.Instance = NULL};
@@ -231,7 +231,7 @@ int spi_find_index(mp_obj_t id) {
return spi_id;
}
-STATIC uint32_t spi_get_source_freq(SPI_HandleTypeDef *spi) {
+static uint32_t spi_get_source_freq(SPI_HandleTypeDef *spi) {
#if defined(STM32F0) || defined(STM32G0)
return HAL_RCC_GetPCLK1Freq();
#elif defined(STM32H5)
@@ -545,7 +545,7 @@ void spi_deinit(const spi_t *spi_obj) {
}
}
-STATIC HAL_StatusTypeDef spi_wait_dma_finished(const spi_t *spi, uint32_t t_start, uint32_t timeout) {
+static HAL_StatusTypeDef spi_wait_dma_finished(const spi_t *spi, uint32_t t_start, uint32_t timeout) {
volatile HAL_SPI_StateTypeDef *state = &spi->spi->State;
for (;;) {
// Do an atomic check of the state; WFI will exit even if IRQs are disabled
@@ -768,7 +768,7 @@ mp_obj_base_t *mp_hal_get_spi_obj(mp_obj_t o) {
/******************************************************************************/
// Implementation of low-level SPI C protocol
-STATIC int spi_proto_ioctl(void *self_in, uint32_t cmd) {
+static int spi_proto_ioctl(void *self_in, uint32_t cmd) {
spi_proto_cfg_t *self = (spi_proto_cfg_t *)self_in;
switch (cmd) {
@@ -790,7 +790,7 @@ STATIC int spi_proto_ioctl(void *self_in, uint32_t cmd) {
return 0;
}
-STATIC void spi_proto_transfer(void *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
+static void spi_proto_transfer(void *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
spi_proto_cfg_t *self = (spi_proto_cfg_t *)self_in;
spi_transfer(self->spi, len, src, dest, SPI_TRANSFER_TIMEOUT(len));
}
diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c
index 50fd56ecae..bc1feceb9c 100644
--- a/ports/stm32/stm32_it.c
+++ b/ports/stm32/stm32_it.c
@@ -98,7 +98,7 @@ extern PCD_HandleTypeDef pcd_hs_handle;
// More information about decoding the fault registers can be found here:
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/Cihdjcfc.html
-STATIC char *fmt_hex(uint32_t val, char *buf) {
+static char *fmt_hex(uint32_t val, char *buf) {
const char *hexDig = "0123456789abcdef";
buf[0] = hexDig[(val >> 28) & 0x0f];
@@ -114,7 +114,7 @@ STATIC char *fmt_hex(uint32_t val, char *buf) {
return buf;
}
-STATIC void print_reg(const char *label, uint32_t val) {
+static void print_reg(const char *label, uint32_t val) {
char hexStr[9];
mp_hal_stdout_tx_str(label);
@@ -122,7 +122,7 @@ STATIC void print_reg(const char *label, uint32_t val) {
mp_hal_stdout_tx_str("\r\n");
}
-STATIC void print_hex_hex(const char *label, uint32_t val1, uint32_t val2) {
+static void print_hex_hex(const char *label, uint32_t val1, uint32_t val2) {
char hex_str[9];
mp_hal_stdout_tx_str(label);
mp_hal_stdout_tx_str(fmt_hex(val1, hex_str));
@@ -356,7 +356,7 @@ void OTG_HS_IRQHandler(void) {
* @param *pcd_handle for FS or HS
* @retval None
*/
-STATIC void OTG_CMD_WKUP_Handler(PCD_HandleTypeDef *pcd_handle) {
+static void OTG_CMD_WKUP_Handler(PCD_HandleTypeDef *pcd_handle) {
if (pcd_handle->Init.low_power_enable) {
/* Reset SLEEPDEEP bit of Cortex System Control Register */
diff --git a/ports/stm32/storage.c b/ports/stm32/storage.c
index 4623225804..a6594fd4d9 100644
--- a/ports/stm32/storage.c
+++ b/ports/stm32/storage.c
@@ -273,7 +273,7 @@ const pyb_flash_obj_t pyb_flash_obj = {
0, // actual size handled in ioctl, MP_BLOCKDEV_IOCTL_BLOCK_COUNT case
};
-STATIC void pyb_flash_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_flash_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self == &pyb_flash_obj) {
mp_printf(print, "Flash()");
@@ -282,7 +282,7 @@ STATIC void pyb_flash_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
}
}
-STATIC mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+static mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
// Parse arguments
enum { ARG_start, ARG_len };
static const mp_arg_t allowed_args[] = {
@@ -322,7 +322,7 @@ STATIC mp_obj_t pyb_flash_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t pyb_flash_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_flash_readblocks(size_t n_args, const mp_obj_t *args) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t block_num = mp_obj_get_int(args[1]);
mp_buffer_info_t bufinfo;
@@ -347,9 +347,9 @@ STATIC mp_obj_t pyb_flash_readblocks(size_t n_args, const mp_obj_t *args) {
#endif
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_readblocks_obj, 3, 4, pyb_flash_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_readblocks_obj, 3, 4, pyb_flash_readblocks);
-STATIC mp_obj_t pyb_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t block_num = mp_obj_get_int(args[1]);
mp_buffer_info_t bufinfo;
@@ -374,9 +374,9 @@ STATIC mp_obj_t pyb_flash_writeblocks(size_t n_args, const mp_obj_t *args) {
#endif
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_writeblocks_obj, 3, 4, pyb_flash_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_flash_writeblocks_obj, 3, 4, pyb_flash_writeblocks);
-STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t pyb_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
pyb_flash_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t cmd = mp_obj_get_int(cmd_in);
switch (cmd) {
@@ -438,15 +438,15 @@ STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_ioctl_obj, pyb_flash_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_ioctl_obj, pyb_flash_ioctl);
-STATIC const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&pyb_flash_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&pyb_flash_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&pyb_flash_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_flash_type,
diff --git a/ports/stm32/subghz.c b/ports/stm32/subghz.c
index 1daed59aaf..f131a2f91a 100644
--- a/ports/stm32/subghz.c
+++ b/ports/stm32/subghz.c
@@ -34,7 +34,7 @@
// Interface to the STM32WL series "SUBGHZ Radio" module
-STATIC void handle_radio_irq() {
+static void handle_radio_irq() {
// Level-triggered interrupts means the interrupt has to be cleared before
// this function returns.
//
@@ -90,7 +90,7 @@ void subghz_deinit(void) {
__HAL_RCC_SUBGHZ_RADIO_RELEASE_RESET();
}
-STATIC mp_obj_t subghz_cs(mp_obj_t value) {
+static mp_obj_t subghz_cs(mp_obj_t value) {
// Treat the same as normal SPI - truthy is "unselected",
// falsey is active low "selected",
if (mp_obj_is_true(value)) {
@@ -103,7 +103,7 @@ STATIC mp_obj_t subghz_cs(mp_obj_t value) {
}
MP_DEFINE_CONST_FUN_OBJ_1(subghz_cs_obj, subghz_cs);
-STATIC mp_obj_t subghz_irq(mp_obj_t handler) {
+static mp_obj_t subghz_irq(mp_obj_t handler) {
MP_STATE_PORT(subghz_callback) = handler;
if (mp_obj_is_true(handler)) {
@@ -117,7 +117,7 @@ STATIC mp_obj_t subghz_irq(mp_obj_t handler) {
}
MP_DEFINE_CONST_FUN_OBJ_1(subghz_irq_obj, subghz_irq);
-STATIC mp_obj_t subghz_is_busy(void) {
+static mp_obj_t subghz_is_busy(void) {
// Read the raw unmasked busy signal. This should be checked before driving
// CS low to start a command.
//
diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c
index 41e5c6157d..d999e57462 100644
--- a/ports/stm32/timer.c
+++ b/ports/stm32/timer.c
@@ -93,7 +93,7 @@ typedef enum {
CHANNEL_MODE_ENC_AB,
} pyb_channel_mode;
-STATIC const struct {
+static const struct {
qstr name;
uint32_t oc_mode;
} channel_mode_info[] = {
@@ -147,9 +147,9 @@ TIM_HandleTypeDef TIM6_Handle;
#define PYB_TIMER_OBJ_ALL_NUM MP_ARRAY_SIZE(MP_STATE_PORT(pyb_timer_obj_all))
-STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in);
-STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback);
-STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback);
+static mp_obj_t pyb_timer_deinit(mp_obj_t self_in);
+static mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback);
+static mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback);
void timer_init0(void) {
for (uint i = 0; i < PYB_TIMER_OBJ_ALL_NUM; i++) {
@@ -304,14 +304,14 @@ uint32_t timer_get_source_freq(uint32_t tim_id) {
/******************************************************************************/
/* MicroPython bindings */
-STATIC const mp_obj_type_t pyb_timer_channel_type;
+static const mp_obj_type_t pyb_timer_channel_type;
// This is the largest value that we can multiply by 100 and have the result
// fit in a uint32_t.
#define MAX_PERIOD_DIV_100 42949672
// computes prescaler and period so TIM triggers at freq-Hz
-STATIC uint32_t compute_prescaler_period_from_freq(pyb_timer_obj_t *self, mp_obj_t freq_in, uint32_t *period_out) {
+static uint32_t compute_prescaler_period_from_freq(pyb_timer_obj_t *self, mp_obj_t freq_in, uint32_t *period_out) {
uint32_t source_freq = timer_get_source_freq(self->tim_id);
uint32_t prescaler = 1;
uint32_t period;
@@ -357,7 +357,7 @@ STATIC uint32_t compute_prescaler_period_from_freq(pyb_timer_obj_t *self, mp_obj
}
// computes prescaler and period so TIM triggers with a period of t_num/t_den seconds
-STATIC uint32_t compute_prescaler_period_from_t(pyb_timer_obj_t *self, int32_t t_num, int32_t t_den, uint32_t *period_out) {
+static uint32_t compute_prescaler_period_from_t(pyb_timer_obj_t *self, int32_t t_num, int32_t t_den, uint32_t *period_out) {
uint32_t source_freq = timer_get_source_freq(self->tim_id);
if (t_num <= 0 || t_den <= 0) {
mp_raise_ValueError(MP_ERROR_TEXT("must have positive freq"));
@@ -391,7 +391,7 @@ STATIC uint32_t compute_prescaler_period_from_t(pyb_timer_obj_t *self, int32_t t
}
// Helper function for determining the period used for calculating percent
-STATIC uint32_t compute_period(pyb_timer_obj_t *self) {
+static uint32_t compute_period(pyb_timer_obj_t *self) {
// In center mode, compare == period corresponds to 100%
// In edge mode, compare == (period + 1) corresponds to 100%
uint32_t period = (__HAL_TIM_GET_AUTORELOAD(&self->tim) & TIMER_CNT_MASK(self));
@@ -408,7 +408,7 @@ STATIC uint32_t compute_period(pyb_timer_obj_t *self) {
// Helper function to compute PWM value from timer period and percent value.
// 'percent_in' can be an int or a float between 0 and 100 (out of range
// values are clamped).
-STATIC uint32_t compute_pwm_value_from_percent(uint32_t period, mp_obj_t percent_in) {
+static uint32_t compute_pwm_value_from_percent(uint32_t period, mp_obj_t percent_in) {
uint32_t cmp;
if (0) {
#if MICROPY_PY_BUILTINS_FLOAT
@@ -441,7 +441,7 @@ STATIC uint32_t compute_pwm_value_from_percent(uint32_t period, mp_obj_t percent
}
// Helper function to compute percentage from timer perion and PWM value.
-STATIC mp_obj_t compute_percent_from_pwm_value(uint32_t period, uint32_t cmp) {
+static mp_obj_t compute_percent_from_pwm_value(uint32_t period, uint32_t cmp) {
#if MICROPY_PY_BUILTINS_FLOAT
mp_float_t percent;
if (cmp >= period) {
@@ -472,7 +472,7 @@ STATIC mp_obj_t compute_percent_from_pwm_value(uint32_t period, uint32_t cmp) {
// 128-256 ticks in increments of 2
// 256-512 ticks in increments of 8
// 512-1008 ticks in increments of 16
-STATIC uint32_t compute_dtg_from_ticks(mp_int_t ticks) {
+static uint32_t compute_dtg_from_ticks(mp_int_t ticks) {
if (ticks <= 0) {
return 0;
}
@@ -493,7 +493,7 @@ STATIC uint32_t compute_dtg_from_ticks(mp_int_t ticks) {
// Given the 8-bit value stored in the DTG field of the BDTR register, compute
// the number of ticks.
-STATIC mp_int_t compute_ticks_from_dtg(uint32_t dtg) {
+static mp_int_t compute_ticks_from_dtg(uint32_t dtg) {
if ((dtg & 0x80) == 0) {
return dtg & 0x7F;
}
@@ -506,7 +506,7 @@ STATIC mp_int_t compute_ticks_from_dtg(uint32_t dtg) {
return 512 + ((dtg & 0x1F) * 16);
}
-STATIC void config_deadtime(pyb_timer_obj_t *self, mp_int_t ticks, mp_int_t brk) {
+static void config_deadtime(pyb_timer_obj_t *self, mp_int_t ticks, mp_int_t brk) {
TIM_BreakDeadTimeConfigTypeDef deadTimeConfig = {0};
deadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE;
deadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE;
@@ -534,7 +534,7 @@ TIM_HandleTypeDef *pyb_timer_get_handle(mp_obj_t timer) {
return &self->tim;
}
-STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->tim.State == HAL_TIM_STATE_RESET) {
@@ -628,7 +628,7 @@ STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
///
///
/// You must either specify freq or both of period and prescaler.
-STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq, ARG_prescaler, ARG_period, ARG_tick_hz, ARG_mode, ARG_div, ARG_callback, ARG_deadtime, ARG_brk };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_freq, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -834,7 +834,7 @@ STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, size_t n_args, cons
// This table encodes the timer instance and irq number (for the update irq).
// It assumes that timer instance pointer has the lower 8 bits cleared.
#define TIM_ENTRY(id, irq) [id - 1] = (uint32_t)TIM##id | irq
-STATIC const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = {
+static const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = {
#if defined(TIM1)
#if defined(STM32F0) || defined(STM32G0)
TIM_ENTRY(1, TIM1_BRK_UP_TRG_COM_IRQn),
@@ -977,7 +977,7 @@ STATIC const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = {
/// Construct a new timer object of the given id. If additional
/// arguments are given, then the timer is initialised by `init(...)`.
/// `id` can be 1 to 14, excluding 3.
-STATIC mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -1026,13 +1026,13 @@ STATIC mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(tim);
}
-STATIC mp_obj_t pyb_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return pyb_timer_init_helper(MP_OBJ_TO_PTR(args[0]), n_args - 1, args + 1, kw_args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
// timer.deinit()
-STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
+static mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
// Disable the base interrupt
@@ -1055,7 +1055,7 @@ STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
/// \method channel(channel, mode, ...)
///
@@ -1129,7 +1129,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
/// timer = pyb.Timer(2, freq=1000)
/// ch2 = timer.channel(2, pyb.Timer.PWM, pin=pyb.Pin.board.X2, pulse_width=210000)
/// ch3 = timer.channel(3, pyb.Timer.PWM, pin=pyb.Pin.board.X3, pulse_width=420000)
-STATIC mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_callback, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -1386,11 +1386,11 @@ STATIC mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_ma
return MP_OBJ_FROM_PTR(chan);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_obj, 2, pyb_timer_channel);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_obj, 2, pyb_timer_channel);
/// \method counter([value])
/// Get or set the timer counter.
-STATIC mp_obj_t pyb_timer_counter(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_counter(size_t n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -1401,20 +1401,20 @@ STATIC mp_obj_t pyb_timer_counter(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_counter_obj, 1, 2, pyb_timer_counter);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_counter_obj, 1, 2, pyb_timer_counter);
/// \method source_freq()
/// Get the frequency of the source of the timer.
-STATIC mp_obj_t pyb_timer_source_freq(mp_obj_t self_in) {
+static mp_obj_t pyb_timer_source_freq(mp_obj_t self_in) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint32_t source_freq = timer_get_source_freq(self->tim_id);
return mp_obj_new_int(source_freq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_source_freq_obj, pyb_timer_source_freq);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_source_freq_obj, pyb_timer_source_freq);
/// \method freq([value])
/// Get or set the frequency for the timer (changes prescaler and period if set).
-STATIC mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -1445,11 +1445,11 @@ STATIC mp_obj_t pyb_timer_freq(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_freq_obj, 1, 2, pyb_timer_freq);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_freq_obj, 1, 2, pyb_timer_freq);
/// \method prescaler([value])
/// Get or set the prescaler for the timer.
-STATIC mp_obj_t pyb_timer_prescaler(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_prescaler(size_t n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -1460,11 +1460,11 @@ STATIC mp_obj_t pyb_timer_prescaler(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_prescaler_obj, 1, 2, pyb_timer_prescaler);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_prescaler_obj, 1, 2, pyb_timer_prescaler);
/// \method period([value])
/// Get or set the period of the timer.
-STATIC mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -1475,13 +1475,13 @@ STATIC mp_obj_t pyb_timer_period(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_period_obj, 1, 2, pyb_timer_period);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_period_obj, 1, 2, pyb_timer_period);
/// \method callback(fun)
/// Set the function to be called when the timer triggers.
/// `fun` is passed 1 argument, the timer object.
/// If `fun` is `None` then the callback will be disabled.
-STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
+static mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
pyb_timer_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (callback == mp_const_none) {
// stop interrupt (but not timer)
@@ -1501,9 +1501,9 @@ STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_callback_obj, pyb_timer_callback);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_callback_obj, pyb_timer_callback);
-STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_timer_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_timer_deinit_obj) },
@@ -1538,7 +1538,7 @@ STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_BRK_LOW), MP_ROM_INT(BRK_LOW) },
{ MP_ROM_QSTR(MP_QSTR_BRK_HIGH), MP_ROM_INT(BRK_HIGH) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_type,
@@ -1555,7 +1555,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
/// Timer channels are used to generate/capture a signal using a timer.
///
/// TimerChannel objects are created using the Timer.channel() method.
-STATIC void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_channel_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "TimerChannel(timer=%u, channel=%u, mode=%s)",
@@ -1581,7 +1581,7 @@ STATIC void pyb_timer_channel_print(const mp_print_t *print, mp_obj_t self_in, m
///
/// In edge aligned mode, a pulse_width of `period + 1` corresponds to a duty cycle of 100%
/// In center aligned mode, a pulse width of `period` corresponds to a duty cycle of 100%
-STATIC mp_obj_t pyb_timer_channel_capture_compare(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_channel_capture_compare(size_t n_args, const mp_obj_t *args) {
pyb_timer_channel_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) {
// get
@@ -1592,7 +1592,7 @@ STATIC mp_obj_t pyb_timer_channel_capture_compare(size_t n_args, const mp_obj_t
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_capture_compare_obj, 1, 2, pyb_timer_channel_capture_compare);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_capture_compare_obj, 1, 2, pyb_timer_channel_capture_compare);
/// \method pulse_width_percent([value])
/// Get or set the pulse width percentage associated with a channel. The value
@@ -1600,7 +1600,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_capture_compare_obj
/// for which the pulse is active. The value can be an integer or
/// floating-point number for more accuracy. For example, a value of 25 gives
/// a duty cycle of 25%.
-STATIC mp_obj_t pyb_timer_channel_pulse_width_percent(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t pyb_timer_channel_pulse_width_percent(size_t n_args, const mp_obj_t *args) {
pyb_timer_channel_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t period = compute_period(self->timer);
if (n_args == 1) {
@@ -1614,13 +1614,13 @@ STATIC mp_obj_t pyb_timer_channel_pulse_width_percent(size_t n_args, const mp_ob
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_pulse_width_percent_obj, 1, 2, pyb_timer_channel_pulse_width_percent);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_channel_pulse_width_percent_obj, 1, 2, pyb_timer_channel_pulse_width_percent);
/// \method callback(fun)
/// Set the function to be called when the timer channel triggers.
/// `fun` is passed 1 argument, the timer object.
/// If `fun` is `None` then the callback will be disabled.
-STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback) {
+static mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback) {
pyb_timer_channel_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (callback == mp_const_none) {
// stop interrupt (but not timer)
@@ -1668,9 +1668,9 @@ STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback)
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_channel_callback_obj, pyb_timer_channel_callback);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_timer_channel_callback_obj, pyb_timer_channel_callback);
-STATIC const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&pyb_timer_channel_callback_obj) },
{ MP_ROM_QSTR(MP_QSTR_pulse_width), MP_ROM_PTR(&pyb_timer_channel_capture_compare_obj) },
@@ -1678,9 +1678,9 @@ STATIC const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_capture), MP_ROM_PTR(&pyb_timer_channel_capture_compare_obj) },
{ MP_ROM_QSTR(MP_QSTR_compare), MP_ROM_PTR(&pyb_timer_channel_capture_compare_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
pyb_timer_channel_type,
MP_QSTR_TimerChannel,
MP_TYPE_FLAG_NONE,
@@ -1688,7 +1688,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &pyb_timer_channel_locals_dict
);
-STATIC void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_obj_t callback) {
+static void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_obj_t callback) {
uint32_t irq_mask = TIMER_IRQ_MASK(channel);
if (__HAL_TIM_GET_FLAG(&tim->tim, irq_mask) != RESET) {
diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c
index 83e9e0fdd8..886cf1ab34 100644
--- a/ports/stm32/uart.c
+++ b/ports/stm32/uart.c
@@ -122,7 +122,7 @@ typedef struct _machine_uart_irq_map_t {
uint16_t flag;
} machine_uart_irq_map_t;
-STATIC const machine_uart_irq_map_t mp_uart_irq_map[] = {
+static const machine_uart_irq_map_t mp_uart_irq_map[] = {
{ USART_CR1_IDLEIE, UART_FLAG_IDLE}, // RX idle
{ USART_CR1_PEIE, UART_FLAG_PE}, // parity error
#if defined(STM32G0) || defined(STM32WL)
@@ -1038,7 +1038,7 @@ bool uart_tx_wait(machine_uart_obj_t *self, uint32_t timeout) {
// Waits at most timeout milliseconds for UART flag to be set.
// Returns true if flag is/was set, false on timeout.
-STATIC bool uart_wait_flag_set(machine_uart_obj_t *self, uint32_t flag, uint32_t timeout) {
+static bool uart_wait_flag_set(machine_uart_obj_t *self, uint32_t flag, uint32_t timeout) {
// Note: we don't use WFI to idle in this loop because UART tx doesn't generate
// an interrupt and the flag can be set quickly if the baudrate is large.
uint32_t start = HAL_GetTick();
@@ -1215,7 +1215,7 @@ void uart_irq_handler(mp_uint_t uart_id) {
}
}
-STATIC mp_uint_t uart_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t uart_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
uart_irq_config(self, false);
self->mp_irq_trigger = new_trigger;
@@ -1223,7 +1223,7 @@ STATIC mp_uint_t uart_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
return 0;
}
-STATIC mp_uint_t uart_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t uart_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (info_type == MP_IRQ_INFO_FLAGS) {
return self->mp_irq_flags;
diff --git a/ports/stm32/usb.c b/ports/stm32/usb.c
index df6b2cf62a..af9dd1d70e 100644
--- a/ports/stm32/usb.c
+++ b/ports/stm32/usb.c
@@ -74,7 +74,7 @@
// Constants for USB_VCP.irq trigger.
#define USBD_CDC_IRQ_RX (1)
-STATIC void pyb_usb_vcp_init0(void);
+static void pyb_usb_vcp_init0(void);
// this will be persistent across a soft-reset
mp_uint_t pyb_usb_flags = 0;
@@ -97,14 +97,14 @@ pyb_usb_storage_medium_t pyb_usb_storage_medium = PYB_USB_STORAGE_MEDIUM_NONE;
// Units of FIFO size arrays below are 4x 16-bit words = 8 bytes
// There are 512x 16-bit words it total to use here (when using PCD_SNG_BUF)
-STATIC const uint8_t usbd_fifo_size_cdc1[USBD_PMA_NUM_FIFO] = {
+static const uint8_t usbd_fifo_size_cdc1[USBD_PMA_NUM_FIFO] = {
16, 16, 16, 16, // EP0(out), EP0(in), MSC/HID(out), MSC/HID(in)
0, 16, 16, 16, // unused, CDC_CMD(in), CDC_DATA(out), CDC_DATA(in)
0, 0, 0, 0, 0, 0, 0, 0, // 8x unused
};
#if MICROPY_HW_USB_CDC_NUM >= 2
-STATIC const uint8_t usbd_fifo_size_cdc2[USBD_PMA_NUM_FIFO] = {
+static const uint8_t usbd_fifo_size_cdc2[USBD_PMA_NUM_FIFO] = {
8, 8, 16, 16, // EP0(out), EP0(in), MSC/HID(out), MSC/HID(in)
0, 8, 16, 8, // unused, CDC_CMD(in), CDC_DATA(out), CDC_DATA(in)
0, 8, 16, 8, // unused, CDC2_CMD(in), CDC2_DATA(out), CDC2_DATA(in)
@@ -112,7 +112,7 @@ STATIC const uint8_t usbd_fifo_size_cdc2[USBD_PMA_NUM_FIFO] = {
};
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA, CDC2_CMD/HID, CDC2_DATA, HID
-STATIC const uint8_t usbd_fifo_size_cdc2_msc_hid[USBD_PMA_NUM_FIFO] = {
+static const uint8_t usbd_fifo_size_cdc2_msc_hid[USBD_PMA_NUM_FIFO] = {
8, 8, 16, 16, // EP0(out), EP0(in), MSC/HID(out), MSC/HID(in)
0, 8, 8, 8, // unused, CDC_CMD(in), CDC_DATA(out), CDC_DATA(in)
0, 8, 8, 8, // unused, CDC2_CMD(in), CDC2_DATA(out), CDC2_DATA(in)
@@ -128,7 +128,7 @@ STATIC const uint8_t usbd_fifo_size_cdc2_msc_hid[USBD_PMA_NUM_FIFO] = {
// HS: there are 1024x 32-bit words in total to use here
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA
-STATIC const uint8_t usbd_fifo_size_cdc1[] = {
+static const uint8_t usbd_fifo_size_cdc1[] = {
32, 8, 16, 8, 16, 0, 0, // FS: RX, EP0(in), 5x IN endpoints
#if MICROPY_HW_USB_HS
116, 8, 64, 4, 64, 0, 0, 0, 0, 0, // HS: RX, EP0(in), 8x IN endpoints
@@ -136,7 +136,7 @@ STATIC const uint8_t usbd_fifo_size_cdc1[] = {
};
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA, HID
-STATIC const uint8_t usbd_fifo_size_cdc1_msc_hid[] = {
+static const uint8_t usbd_fifo_size_cdc1_msc_hid[] = {
32, 8, 16, 4, 12, 8, 0,
#if MICROPY_HW_USB_HS
116, 8, 64, 4, 56, 8, 0, 0, 0, 0,
@@ -145,7 +145,7 @@ STATIC const uint8_t usbd_fifo_size_cdc1_msc_hid[] = {
#if MICROPY_HW_USB_CDC_NUM >= 2
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA, CDC2_CMD, CDC2_DATA
-STATIC const uint8_t usbd_fifo_size_cdc2[] = {
+static const uint8_t usbd_fifo_size_cdc2[] = {
32, 8, 16, 4, 8, 4, 8,
#if MICROPY_HW_USB_HS
116, 8, 64, 2, 32, 2, 32, 0, 0, 0,
@@ -153,7 +153,7 @@ STATIC const uint8_t usbd_fifo_size_cdc2[] = {
};
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA, CDC2_CMD/HID, CDC2_DATA, HID
-STATIC const uint8_t usbd_fifo_size_cdc2_msc_hid[] = {
+static const uint8_t usbd_fifo_size_cdc2_msc_hid[] = {
0, 0, 0, 0, 0, 0, 0, // FS: can't support 2xVCP+MSC+HID
#if MICROPY_HW_USB_HS
102, 8, 64, 2, 32, 8, 32, 8, 0, 0,
@@ -163,7 +163,7 @@ STATIC const uint8_t usbd_fifo_size_cdc2_msc_hid[] = {
#if MICROPY_HW_USB_CDC_NUM >= 3
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA, CDC2_CMD, CDC2_DATA, CDC3_CMD, CDC3_DATA
-STATIC const uint8_t usbd_fifo_size_cdc3[] = {
+static const uint8_t usbd_fifo_size_cdc3[] = {
0, 0, 0, 0, 0, 0, 0, // FS: can't support 3x VCP mode
#if MICROPY_HW_USB_HS
82, 8, 64, 2, 32, 2, 32, 2, 32, 0,
@@ -171,7 +171,7 @@ STATIC const uint8_t usbd_fifo_size_cdc3[] = {
};
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA, CDC2_CMD/HID, CDC2_DATA, CDC3_CMD/HID, CDC3_DATA, HID
-STATIC const uint8_t usbd_fifo_size_cdc3_msc_hid[] = {
+static const uint8_t usbd_fifo_size_cdc3_msc_hid[] = {
0, 0, 0, 0, 0, 0, 0, // FS: can't support 3x VCP mode
#if MICROPY_HW_USB_HS
82, 8, 64, 2, 25, 8, 25, 8, 25, 8,
@@ -183,7 +183,7 @@ STATIC const uint8_t usbd_fifo_size_cdc3_msc_hid[] = {
#if MICROPY_HW_USB_HID
// predefined hid mouse data
-STATIC const mp_obj_str_t pyb_usb_hid_mouse_desc_obj = {
+static const mp_obj_str_t pyb_usb_hid_mouse_desc_obj = {
{&mp_type_bytes},
0, // hash not valid
USBD_HID_MOUSE_REPORT_DESC_SIZE,
@@ -202,7 +202,7 @@ const mp_rom_obj_tuple_t pyb_usb_hid_mouse_obj = {
};
// predefined hid keyboard data
-STATIC const mp_obj_str_t pyb_usb_hid_keyboard_desc_obj = {
+static const mp_obj_str_t pyb_usb_hid_keyboard_desc_obj = {
{&mp_type_bytes},
0, // hash not valid
USBD_HID_KEYBOARD_REPORT_DESC_SIZE,
@@ -423,7 +423,7 @@ typedef struct _pyb_usb_mode_table_t {
// These are all the modes supported by USBD_SelectMode.
// Note: there are some names (eg CDC, VCP+VCP) which are supported for backwards compatibility.
-STATIC const pyb_usb_mode_table_t pyb_usb_mode_table[] = {
+static const pyb_usb_mode_table_t pyb_usb_mode_table[] = {
{ USBD_MODE_CDC, MP_QSTR_VCP, "CDC", MICROPY_HW_USB_PID_CDC },
{ USBD_MODE_MSC, MP_QSTR_MSC, NULL, MICROPY_HW_USB_PID_MSC },
{ USBD_MODE_CDC_MSC, MP_QSTR_VCP_plus_MSC, "CDC+MSC", MICROPY_HW_USB_PID_CDC_MSC },
@@ -443,7 +443,7 @@ STATIC const pyb_usb_mode_table_t pyb_usb_mode_table[] = {
#endif
};
-STATIC mp_obj_t pyb_usb_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_usb_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {
ARG_mode, ARG_port, ARG_vid, ARG_pid,
#if MICROPY_HW_USB_MSC
@@ -638,9 +638,9 @@ const pyb_usb_vcp_obj_t pyb_usb_vcp_obj[MICROPY_HW_USB_CDC_NUM] = {
#endif
};
-STATIC bool pyb_usb_vcp_irq_scheduled[MICROPY_HW_USB_CDC_NUM];
+static bool pyb_usb_vcp_irq_scheduled[MICROPY_HW_USB_CDC_NUM];
-STATIC void pyb_usb_vcp_init0(void) {
+static void pyb_usb_vcp_init0(void) {
for (size_t i = 0; i < MICROPY_HW_USB_CDC_NUM; ++i) {
MP_STATE_PORT(pyb_usb_vcp_irq)[i] = mp_const_none;
pyb_usb_vcp_irq_scheduled[i] = false;
@@ -651,7 +651,7 @@ STATIC void pyb_usb_vcp_init0(void) {
usb_vcp_attach_to_repl(&pyb_usb_vcp_obj[0], true);
}
-STATIC mp_obj_t pyb_usb_vcp_irq_run(mp_obj_t self_in) {
+static mp_obj_t pyb_usb_vcp_irq_run(mp_obj_t self_in) {
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t idx = self->cdc_itf->cdc_idx;
mp_obj_t callback = MP_STATE_PORT(pyb_usb_vcp_irq)[idx];
@@ -661,7 +661,7 @@ STATIC mp_obj_t pyb_usb_vcp_irq_run(mp_obj_t self_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_usb_vcp_irq_run_obj, pyb_usb_vcp_irq_run);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_usb_vcp_irq_run_obj, pyb_usb_vcp_irq_run);
void usbd_cdc_rx_event_callback(usbd_cdc_itf_t *cdc) {
uint8_t idx = cdc->cdc_idx;
@@ -672,7 +672,7 @@ void usbd_cdc_rx_event_callback(usbd_cdc_itf_t *cdc) {
}
}
-STATIC void pyb_usb_vcp_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void pyb_usb_vcp_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
int id = ((pyb_usb_vcp_obj_t *)MP_OBJ_TO_PTR(self_in))->cdc_itf->cdc_idx;
mp_printf(print, "USB_VCP(%u)", id);
}
@@ -689,7 +689,7 @@ void usb_vcp_attach_to_repl(const pyb_usb_vcp_obj_t *self, bool attached) {
/// \classmethod \constructor()
/// Create a new USB_VCP object.
-STATIC mp_obj_t pyb_usb_vcp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_usb_vcp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 1, false);
@@ -704,7 +704,7 @@ STATIC mp_obj_t pyb_usb_vcp_make_new(const mp_obj_type_t *type, size_t n_args, s
}
// init(*, flow=-1)
-STATIC mp_obj_t pyb_usb_vcp_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_usb_vcp_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_flow };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_flow, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} },
@@ -722,29 +722,29 @@ STATIC mp_obj_t pyb_usb_vcp_init(size_t n_args, const mp_obj_t *pos_args, mp_map
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_init_obj, 1, pyb_usb_vcp_init);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_init_obj, 1, pyb_usb_vcp_init);
-STATIC mp_obj_t pyb_usb_vcp_setinterrupt(mp_obj_t self_in, mp_obj_t int_chr_in) {
+static mp_obj_t pyb_usb_vcp_setinterrupt(mp_obj_t self_in, mp_obj_t int_chr_in) {
mp_hal_set_interrupt_char(mp_obj_get_int(int_chr_in));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_usb_vcp_setinterrupt_obj, pyb_usb_vcp_setinterrupt);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_usb_vcp_setinterrupt_obj, pyb_usb_vcp_setinterrupt);
-STATIC mp_obj_t pyb_usb_vcp_isconnected(mp_obj_t self_in) {
+static mp_obj_t pyb_usb_vcp_isconnected(mp_obj_t self_in) {
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(usbd_cdc_is_connected(self->cdc_itf));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_usb_vcp_isconnected_obj, pyb_usb_vcp_isconnected);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_usb_vcp_isconnected_obj, pyb_usb_vcp_isconnected);
// deprecated in favour of USB_VCP.isconnected
-STATIC mp_obj_t pyb_have_cdc(void) {
+static mp_obj_t pyb_have_cdc(void) {
return pyb_usb_vcp_isconnected(MP_OBJ_FROM_PTR(&pyb_usb_vcp_obj[0]));
}
MP_DEFINE_CONST_FUN_OBJ_0(pyb_have_cdc_obj, pyb_have_cdc);
/// \method any()
/// Return `True` if any characters waiting, else `False`.
-STATIC mp_obj_t pyb_usb_vcp_any(mp_obj_t self_in) {
+static mp_obj_t pyb_usb_vcp_any(mp_obj_t self_in) {
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (usbd_cdc_rx_num(self->cdc_itf) > 0) {
return mp_const_true;
@@ -752,7 +752,7 @@ STATIC mp_obj_t pyb_usb_vcp_any(mp_obj_t self_in) {
return mp_const_false;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_usb_vcp_any_obj, pyb_usb_vcp_any);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_usb_vcp_any_obj, pyb_usb_vcp_any);
/// \method send(data, *, timeout=5000)
/// Send data over the USB VCP:
@@ -761,13 +761,13 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_usb_vcp_any_obj, pyb_usb_vcp_any);
/// - `timeout` is the timeout in milliseconds to wait for the send.
///
/// Return value: number of bytes sent.
-STATIC const mp_arg_t pyb_usb_vcp_send_args[] = {
+static const mp_arg_t pyb_usb_vcp_send_args[] = {
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 5000} },
};
#define PYB_USB_VCP_SEND_NUM_ARGS MP_ARRAY_SIZE(pyb_usb_vcp_send_args)
-STATIC mp_obj_t pyb_usb_vcp_send(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_usb_vcp_send(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// parse args
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_arg_val_t vals[PYB_USB_VCP_SEND_NUM_ARGS];
@@ -783,7 +783,7 @@ STATIC mp_obj_t pyb_usb_vcp_send(size_t n_args, const mp_obj_t *args, mp_map_t *
return mp_obj_new_int(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_send_obj, 1, pyb_usb_vcp_send);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_send_obj, 1, pyb_usb_vcp_send);
/// \method recv(data, *, timeout=5000)
///
@@ -795,7 +795,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_send_obj, 1, pyb_usb_vcp_send);
///
/// Return value: if `data` is an integer then a new buffer of the bytes received,
/// otherwise the number of bytes read into `data` is returned.
-STATIC mp_obj_t pyb_usb_vcp_recv(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_usb_vcp_recv(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// parse args
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_arg_val_t vals[PYB_USB_VCP_SEND_NUM_ARGS];
@@ -816,10 +816,10 @@ STATIC mp_obj_t pyb_usb_vcp_recv(size_t n_args, const mp_obj_t *args, mp_map_t *
return mp_obj_new_bytes_from_vstr(&vstr); // create a new buffer
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_recv_obj, 1, pyb_usb_vcp_recv);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_recv_obj, 1, pyb_usb_vcp_recv);
// irq(handler=None, trigger=IRQ_RX, hard=False)
-STATIC mp_obj_t pyb_usb_vcp_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t pyb_usb_vcp_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -856,9 +856,9 @@ STATIC mp_obj_t pyb_usb_vcp_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_irq_obj, 1, pyb_usb_vcp_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_vcp_irq_obj, 1, pyb_usb_vcp_irq);
-STATIC const mp_rom_map_elem_t pyb_usb_vcp_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_usb_vcp_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_usb_vcp_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_setinterrupt), MP_ROM_PTR(&pyb_usb_vcp_setinterrupt_obj) },
{ MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&pyb_usb_vcp_isconnected_obj) },
@@ -882,9 +882,9 @@ STATIC const mp_rom_map_elem_t pyb_usb_vcp_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_RX), MP_ROM_INT(USBD_CDC_IRQ_RX) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_usb_vcp_locals_dict, pyb_usb_vcp_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_usb_vcp_locals_dict, pyb_usb_vcp_locals_dict_table);
-STATIC mp_uint_t pyb_usb_vcp_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t pyb_usb_vcp_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(self_in);
int ret = usbd_cdc_rx(self->cdc_itf, (byte *)buf, size, 0);
if (ret == 0) {
@@ -895,7 +895,7 @@ STATIC mp_uint_t pyb_usb_vcp_read(mp_obj_t self_in, void *buf, mp_uint_t size, i
return ret;
}
-STATIC mp_uint_t pyb_usb_vcp_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t pyb_usb_vcp_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(self_in);
int ret = usbd_cdc_tx_flow(self->cdc_itf, (const byte *)buf, size);
if (ret == 0) {
@@ -906,7 +906,7 @@ STATIC mp_uint_t pyb_usb_vcp_write(mp_obj_t self_in, const void *buf, mp_uint_t
return ret;
}
-STATIC mp_uint_t pyb_usb_vcp_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t pyb_usb_vcp_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_uint_t ret;
pyb_usb_vcp_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (request == MP_STREAM_POLL) {
@@ -927,7 +927,7 @@ STATIC mp_uint_t pyb_usb_vcp_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return ret;
}
-STATIC const mp_stream_p_t pyb_usb_vcp_stream_p = {
+static const mp_stream_p_t pyb_usb_vcp_stream_p = {
.read = pyb_usb_vcp_read,
.write = pyb_usb_vcp_write,
.ioctl = pyb_usb_vcp_ioctl,
@@ -953,9 +953,9 @@ typedef struct _pyb_usb_hid_obj_t {
usb_device_t *usb_dev;
} pyb_usb_hid_obj_t;
-STATIC const pyb_usb_hid_obj_t pyb_usb_hid_obj = {{&pyb_usb_hid_type}, &usb_device};
+static const pyb_usb_hid_obj_t pyb_usb_hid_obj = {{&pyb_usb_hid_type}, &usb_device};
-STATIC mp_obj_t pyb_usb_hid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_usb_hid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -975,7 +975,7 @@ STATIC mp_obj_t pyb_usb_hid_make_new(const mp_obj_type_t *type, size_t n_args, s
///
/// Return value: if `data` is an integer then a new buffer of the bytes received,
/// otherwise the number of bytes read into `data` is returned.
-STATIC mp_obj_t pyb_usb_hid_recv(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t pyb_usb_hid_recv(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 5000} },
@@ -1006,9 +1006,9 @@ STATIC mp_obj_t pyb_usb_hid_recv(size_t n_args, const mp_obj_t *args, mp_map_t *
return mp_obj_new_bytes_from_vstr(&vstr); // create a new buffer
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_hid_recv_obj, 1, pyb_usb_hid_recv);
+static MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_hid_recv_obj, 1, pyb_usb_hid_recv);
-STATIC mp_obj_t pyb_usb_hid_send(mp_obj_t self_in, mp_obj_t report_in) {
+static mp_obj_t pyb_usb_hid_send(mp_obj_t self_in, mp_obj_t report_in) {
pyb_usb_hid_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t bufinfo;
byte temp_buf[8];
@@ -1035,22 +1035,22 @@ STATIC mp_obj_t pyb_usb_hid_send(mp_obj_t self_in, mp_obj_t report_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_usb_hid_send_obj, pyb_usb_hid_send);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_usb_hid_send_obj, pyb_usb_hid_send);
// deprecated in favour of USB_HID.send
-STATIC mp_obj_t pyb_hid_send_report(mp_obj_t arg) {
+static mp_obj_t pyb_hid_send_report(mp_obj_t arg) {
return pyb_usb_hid_send(MP_OBJ_FROM_PTR(&pyb_usb_hid_obj), arg);
}
MP_DEFINE_CONST_FUN_OBJ_1(pyb_hid_send_report_obj, pyb_hid_send_report);
-STATIC const mp_rom_map_elem_t pyb_usb_hid_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_usb_hid_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&pyb_usb_hid_send_obj) },
{ MP_ROM_QSTR(MP_QSTR_recv), MP_ROM_PTR(&pyb_usb_hid_recv_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_usb_hid_locals_dict, pyb_usb_hid_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_usb_hid_locals_dict, pyb_usb_hid_locals_dict_table);
-STATIC mp_uint_t pyb_usb_hid_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t pyb_usb_hid_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
pyb_usb_hid_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
@@ -1069,7 +1069,7 @@ STATIC mp_uint_t pyb_usb_hid_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return ret;
}
-STATIC const mp_stream_p_t pyb_usb_hid_stream_p = {
+static const mp_stream_p_t pyb_usb_hid_stream_p = {
.ioctl = pyb_usb_hid_ioctl,
};
diff --git a/ports/stm32/usbd_cdc_interface.c b/ports/stm32/usbd_cdc_interface.c
index 20d8b3036d..88a9cafe0c 100644
--- a/ports/stm32/usbd_cdc_interface.c
+++ b/ports/stm32/usbd_cdc_interface.c
@@ -75,7 +75,7 @@ static uint8_t usbd_cdc_connect_tx_timer;
#if MICROPY_HW_USB_CDC_1200BPS_TOUCH
static mp_sched_node_t mp_bootloader_sched_node;
-STATIC void usbd_cdc_run_bootloader_task(mp_sched_node_t *node) {
+static void usbd_cdc_run_bootloader_task(mp_sched_node_t *node) {
mp_hal_delay_ms(250);
machine_bootloader(0, NULL);
}
diff --git a/ports/stm32/usbd_desc.c b/ports/stm32/usbd_desc.c
index db94fd2be8..340d317c54 100644
--- a/ports/stm32/usbd_desc.c
+++ b/ports/stm32/usbd_desc.c
@@ -86,7 +86,7 @@ void USBD_SetVIDPIDRelease(usbd_cdc_msc_hid_state_t *usbd, uint16_t vid, uint16_
* @param length: Pointer to data length variable
* @retval Pointer to descriptor buffer
*/
-STATIC uint8_t *USBD_DeviceDescriptor(USBD_HandleTypeDef *pdev, uint16_t *length) {
+static uint8_t *USBD_DeviceDescriptor(USBD_HandleTypeDef *pdev, uint16_t *length) {
uint8_t *dev_desc = ((usbd_cdc_msc_hid_state_t *)pdev->pClassData)->usbd_device_desc;
*length = USB_LEN_DEV_DESC;
return dev_desc;
@@ -98,7 +98,7 @@ STATIC uint8_t *USBD_DeviceDescriptor(USBD_HandleTypeDef *pdev, uint16_t *length
* @param length: Pointer to data length variable
* @retval Pointer to descriptor buffer, or NULL if idx is invalid
*/
-STATIC uint8_t *USBD_StrDescriptor(USBD_HandleTypeDef *pdev, uint8_t idx, uint16_t *length) {
+static uint8_t *USBD_StrDescriptor(USBD_HandleTypeDef *pdev, uint8_t idx, uint16_t *length) {
char str_buf[16];
const char *str = NULL;
diff --git a/ports/stm32/usbd_msc_interface.c b/ports/stm32/usbd_msc_interface.c
index a294a295b3..68236e5c51 100644
--- a/ports/stm32/usbd_msc_interface.c
+++ b/ports/stm32/usbd_msc_interface.c
@@ -41,9 +41,9 @@
#define FLAGS_READONLY (0x02)
-STATIC const void *usbd_msc_lu_data[USBD_MSC_MAX_LUN];
-STATIC uint8_t usbd_msc_lu_num;
-STATIC uint16_t usbd_msc_lu_flags;
+static const void *usbd_msc_lu_data[USBD_MSC_MAX_LUN];
+static uint8_t usbd_msc_lu_num;
+static uint16_t usbd_msc_lu_flags;
static inline void lu_flag_set(uint8_t lun, uint8_t flag) {
usbd_msc_lu_flags |= flag << (lun * 2);
@@ -75,7 +75,7 @@ const uint8_t USBD_MSC_Mode_Sense10_Data[8] = {
0x00, 0x00, // block descriptor length
};
-STATIC const uint8_t usbd_msc_vpd00[6] = {
+static const uint8_t usbd_msc_vpd00[6] = {
0x00, // peripheral qualifier; peripheral device type
0x00, // page code
0x00, // reserved
@@ -84,13 +84,13 @@ STATIC const uint8_t usbd_msc_vpd00[6] = {
0x83, // page 0x83 supported
};
-STATIC const uint8_t usbd_msc_vpd83[4] = {
+static const uint8_t usbd_msc_vpd83[4] = {
0x00, // peripheral qualifier; peripheral device type
0x83, // page code
0x00, 0x00, // page length (additional bytes beyond this entry)
};
-STATIC const int8_t usbd_msc_inquiry_data[STANDARD_INQUIRY_DATA_LEN] = \
+static const int8_t usbd_msc_inquiry_data[STANDARD_INQUIRY_DATA_LEN] = \
"\x00" // peripheral qualifier; peripheral device type
"\x80" // 0x00 for a fixed drive, 0x80 for a removable drive
"\x02" // version
@@ -110,7 +110,7 @@ void usbd_msc_init_lu(size_t lu_n, const void *lu_data) {
}
// Helper function to perform an ioctl on a logical unit
-STATIC int lu_ioctl(uint8_t lun, int op, uint32_t *data) {
+static int lu_ioctl(uint8_t lun, int op, uint32_t *data) {
if (lun >= usbd_msc_lu_num) {
return -1;
}
@@ -165,7 +165,7 @@ STATIC int lu_ioctl(uint8_t lun, int op, uint32_t *data) {
}
// Initialise all logical units (it's only ever called once, with lun_in=0)
-STATIC int8_t usbd_msc_Init(uint8_t lun_in) {
+static int8_t usbd_msc_Init(uint8_t lun_in) {
if (lun_in != 0) {
return 0;
}
@@ -185,7 +185,7 @@ STATIC int8_t usbd_msc_Init(uint8_t lun_in) {
}
// Process SCSI INQUIRY command for the logical unit
-STATIC int usbd_msc_Inquiry(uint8_t lun, const uint8_t *params, uint8_t *data_out) {
+static int usbd_msc_Inquiry(uint8_t lun, const uint8_t *params, uint8_t *data_out) {
if (params[1] & 1) {
// EVPD set - return vital product data parameters
uint8_t page_code = params[2];
@@ -234,7 +234,7 @@ STATIC int usbd_msc_Inquiry(uint8_t lun, const uint8_t *params, uint8_t *data_ou
}
// Get storage capacity of a logical unit
-STATIC int8_t usbd_msc_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *block_size) {
+static int8_t usbd_msc_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *block_size) {
uint32_t block_size_u32 = 0;
int res = lu_ioctl(lun, MP_BLOCKDEV_IOCTL_BLOCK_SIZE, &block_size_u32);
if (res != 0) {
@@ -245,7 +245,7 @@ STATIC int8_t usbd_msc_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *b
}
// Check if a logical unit is ready
-STATIC int8_t usbd_msc_IsReady(uint8_t lun) {
+static int8_t usbd_msc_IsReady(uint8_t lun) {
if (lun >= usbd_msc_lu_num) {
return -1;
}
@@ -253,7 +253,7 @@ STATIC int8_t usbd_msc_IsReady(uint8_t lun) {
}
// Check if a logical unit is write protected
-STATIC int8_t usbd_msc_IsWriteProtected(uint8_t lun) {
+static int8_t usbd_msc_IsWriteProtected(uint8_t lun) {
if (lun >= usbd_msc_lu_num) {
return -1;
}
@@ -261,7 +261,7 @@ STATIC int8_t usbd_msc_IsWriteProtected(uint8_t lun) {
}
// Start or stop a logical unit
-STATIC int8_t usbd_msc_StartStopUnit(uint8_t lun, uint8_t started) {
+static int8_t usbd_msc_StartStopUnit(uint8_t lun, uint8_t started) {
if (lun >= usbd_msc_lu_num) {
return -1;
}
@@ -274,14 +274,14 @@ STATIC int8_t usbd_msc_StartStopUnit(uint8_t lun, uint8_t started) {
}
// Prepare a logical unit for possible removal
-STATIC int8_t usbd_msc_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) {
+static int8_t usbd_msc_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) {
uint32_t dummy;
// Sync the logical unit so the device can be unplugged/turned off
return lu_ioctl(lun, MP_BLOCKDEV_IOCTL_SYNC, &dummy);
}
// Read data from a logical unit
-STATIC int8_t usbd_msc_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
+static int8_t usbd_msc_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
if (lun >= usbd_msc_lu_num) {
return -1;
}
@@ -305,7 +305,7 @@ STATIC int8_t usbd_msc_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16
}
// Write data to a logical unit
-STATIC int8_t usbd_msc_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
+static int8_t usbd_msc_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
if (lun >= usbd_msc_lu_num) {
return -1;
}
@@ -329,7 +329,7 @@ STATIC int8_t usbd_msc_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint1
}
// Get the number of attached logical units
-STATIC int8_t usbd_msc_GetMaxLun(void) {
+static int8_t usbd_msc_GetMaxLun(void) {
return usbd_msc_lu_num - 1;
}
diff --git a/ports/stm32/usrsw.c b/ports/stm32/usrsw.c
index 170c01bd6d..cbf4a36fb4 100644
--- a/ports/stm32/usrsw.c
+++ b/ports/stm32/usrsw.c
@@ -68,7 +68,7 @@ typedef struct _pyb_switch_obj_t {
mp_obj_base_t base;
} pyb_switch_obj_t;
-STATIC const pyb_switch_obj_t pyb_switch_obj = {{&pyb_switch_type}};
+static const pyb_switch_obj_t pyb_switch_obj = {{&pyb_switch_type}};
void pyb_switch_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_print_str(print, "Switch()");
@@ -76,7 +76,7 @@ void pyb_switch_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
/// \classmethod \constructor()
/// Create and return a switch object.
-STATIC mp_obj_t pyb_switch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t pyb_switch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -100,15 +100,15 @@ mp_obj_t pyb_switch_value(mp_obj_t self_in) {
(void)self_in;
return mp_obj_new_bool(switch_get());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_switch_value_obj, pyb_switch_value);
+static MP_DEFINE_CONST_FUN_OBJ_1(pyb_switch_value_obj, pyb_switch_value);
-STATIC mp_obj_t switch_callback(mp_obj_t line) {
+static mp_obj_t switch_callback(mp_obj_t line) {
if (MP_STATE_PORT(pyb_switch_callback) != mp_const_none) {
mp_call_function_0(MP_STATE_PORT(pyb_switch_callback));
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(switch_callback_obj, switch_callback);
+static MP_DEFINE_CONST_FUN_OBJ_1(switch_callback_obj, switch_callback);
/// \method callback(fun)
/// Register the given function to be called when the switch is pressed down.
@@ -125,14 +125,14 @@ mp_obj_t pyb_switch_callback(mp_obj_t self_in, mp_obj_t callback) {
true);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_switch_callback_obj, pyb_switch_callback);
+static MP_DEFINE_CONST_FUN_OBJ_2(pyb_switch_callback_obj, pyb_switch_callback);
-STATIC const mp_rom_map_elem_t pyb_switch_locals_dict_table[] = {
+static const mp_rom_map_elem_t pyb_switch_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pyb_switch_value_obj) },
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&pyb_switch_callback_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(pyb_switch_locals_dict, pyb_switch_locals_dict_table);
+static MP_DEFINE_CONST_DICT(pyb_switch_locals_dict, pyb_switch_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
pyb_switch_type,
diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c
index 543af365c2..803f849535 100644
--- a/ports/unix/coverage.c
+++ b/ports/unix/coverage.c
@@ -31,7 +31,7 @@ typedef struct _mp_obj_streamtest_t {
int error_code;
} mp_obj_streamtest_t;
-STATIC mp_obj_t stest_set_buf(mp_obj_t o_in, mp_obj_t buf_in) {
+static mp_obj_t stest_set_buf(mp_obj_t o_in, mp_obj_t buf_in) {
mp_obj_streamtest_t *o = MP_OBJ_TO_PTR(o_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
@@ -41,16 +41,16 @@ STATIC mp_obj_t stest_set_buf(mp_obj_t o_in, mp_obj_t buf_in) {
o->pos = 0;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(stest_set_buf_obj, stest_set_buf);
+static MP_DEFINE_CONST_FUN_OBJ_2(stest_set_buf_obj, stest_set_buf);
-STATIC mp_obj_t stest_set_error(mp_obj_t o_in, mp_obj_t err_in) {
+static mp_obj_t stest_set_error(mp_obj_t o_in, mp_obj_t err_in) {
mp_obj_streamtest_t *o = MP_OBJ_TO_PTR(o_in);
o->error_code = mp_obj_get_int(err_in);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(stest_set_error_obj, stest_set_error);
+static MP_DEFINE_CONST_FUN_OBJ_2(stest_set_error_obj, stest_set_error);
-STATIC mp_uint_t stest_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stest_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_streamtest_t *o = MP_OBJ_TO_PTR(o_in);
if (o->pos < o->len) {
if (size > o->len - o->pos) {
@@ -67,7 +67,7 @@ STATIC mp_uint_t stest_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errco
}
}
-STATIC mp_uint_t stest_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stest_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_streamtest_t *o = MP_OBJ_TO_PTR(o_in);
(void)buf;
(void)size;
@@ -75,7 +75,7 @@ STATIC mp_uint_t stest_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int
return MP_STREAM_ERROR;
}
-STATIC mp_uint_t stest_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t stest_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_streamtest_t *o = MP_OBJ_TO_PTR(o_in);
(void)arg;
(void)request;
@@ -87,7 +87,7 @@ STATIC mp_uint_t stest_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, in
return 0;
}
-STATIC const mp_rom_map_elem_t rawfile_locals_dict_table[] = {
+static const mp_rom_map_elem_t rawfile_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_set_buf), MP_ROM_PTR(&stest_set_buf_obj) },
{ MP_ROM_QSTR(MP_QSTR_set_error), MP_ROM_PTR(&stest_set_error_obj) },
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
@@ -99,15 +99,15 @@ STATIC const mp_rom_map_elem_t rawfile_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&mp_stream_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(rawfile_locals_dict, rawfile_locals_dict_table);
+static MP_DEFINE_CONST_DICT(rawfile_locals_dict, rawfile_locals_dict_table);
-STATIC const mp_stream_p_t fileio_stream_p = {
+static const mp_stream_p_t fileio_stream_p = {
.read = stest_read,
.write = stest_write,
.ioctl = stest_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_stest_fileio,
MP_QSTR_stest_fileio,
MP_TYPE_FLAG_NONE,
@@ -116,7 +116,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
// stream read returns non-blocking error
-STATIC mp_uint_t stest_read2(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stest_read2(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
(void)o_in;
(void)buf;
(void)size;
@@ -124,19 +124,19 @@ STATIC mp_uint_t stest_read2(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
return MP_STREAM_ERROR;
}
-STATIC const mp_rom_map_elem_t rawfile_locals_dict_table2[] = {
+static const mp_rom_map_elem_t rawfile_locals_dict_table2[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(rawfile_locals_dict2, rawfile_locals_dict_table2);
+static MP_DEFINE_CONST_DICT(rawfile_locals_dict2, rawfile_locals_dict_table2);
-STATIC const mp_stream_p_t textio_stream_p2 = {
+static const mp_stream_p_t textio_stream_p2 = {
.read = stest_read2,
.write = NULL,
.is_text = true,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_stest_textio2,
MP_QSTR_stest_textio2,
MP_TYPE_FLAG_NONE,
@@ -145,15 +145,15 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
// str/bytes objects without a valid hash
-STATIC const mp_obj_str_t str_no_hash_obj = {{&mp_type_str}, 0, 10, (const byte *)"0123456789"};
-STATIC const mp_obj_str_t bytes_no_hash_obj = {{&mp_type_bytes}, 0, 10, (const byte *)"0123456789"};
+static const mp_obj_str_t str_no_hash_obj = {{&mp_type_str}, 0, 10, (const byte *)"0123456789"};
+static const mp_obj_str_t bytes_no_hash_obj = {{&mp_type_bytes}, 0, 10, (const byte *)"0123456789"};
-STATIC int pairheap_lt(mp_pairheap_t *a, mp_pairheap_t *b) {
+static int pairheap_lt(mp_pairheap_t *a, mp_pairheap_t *b) {
return (uintptr_t)a < (uintptr_t)b;
}
// ops array contain operations: x>=0 means push(x), x<0 means delete(-x)
-STATIC void pairheap_test(size_t nops, int *ops) {
+static void pairheap_test(size_t nops, int *ops) {
mp_pairheap_t node[8];
for (size_t i = 0; i < MP_ARRAY_SIZE(node); ++i) {
mp_pairheap_init_node(pairheap_lt, &node[i]);
@@ -183,7 +183,7 @@ STATIC void pairheap_test(size_t nops, int *ops) {
}
// function to run extra tests for things that can't be checked by scripts
-STATIC mp_obj_t extra_coverage(void) {
+static mp_obj_t extra_coverage(void) {
// mp_printf (used by ports that don't have a native printf)
{
mp_printf(&mp_plat_print, "# mp_printf\n");
diff --git a/ports/unix/coveragecpp.cpp b/ports/unix/coveragecpp.cpp
index ea7418e1dd..93c1b387fe 100644
--- a/ports/unix/coveragecpp.cpp
+++ b/ports/unix/coveragecpp.cpp
@@ -5,7 +5,7 @@ extern "C" {
#if defined(MICROPY_UNIX_COVERAGE)
// Just to test building of C++ code.
-STATIC mp_obj_t extra_cpp_coverage_impl() {
+static mp_obj_t extra_cpp_coverage_impl() {
return mp_const_none;
}
diff --git a/ports/unix/main.c b/ports/unix/main.c
index 468fc40964..0cf11d37cf 100644
--- a/ports/unix/main.c
+++ b/ports/unix/main.c
@@ -55,8 +55,8 @@
#include "input.h"
// Command line options, with their defaults
-STATIC bool compile_only = false;
-STATIC uint emit_opt = MP_EMIT_OPT_NONE;
+static bool compile_only = false;
+static uint emit_opt = MP_EMIT_OPT_NONE;
#if MICROPY_ENABLE_GC
// Heap size of GC heap (if enabled)
@@ -77,7 +77,7 @@ long heap_size = 1024 * 1024 * (sizeof(mp_uint_t) / 4);
#error "The unix port requires MICROPY_PY_SYS_ARGV=1"
#endif
-STATIC void stderr_print_strn(void *env, const char *str, size_t len) {
+static void stderr_print_strn(void *env, const char *str, size_t len) {
(void)env;
ssize_t ret;
MP_HAL_RETRY_SYSCALL(ret, write(STDERR_FILENO, str, len), {});
@@ -90,7 +90,7 @@ const mp_print_t mp_stderr_print = {NULL, stderr_print_strn};
// If exc is SystemExit, return value where FORCED_EXIT bit set,
// and lower 8 bits are SystemExit value. For all other exceptions,
// return 1.
-STATIC int handle_uncaught_exception(mp_obj_base_t *exc) {
+static int handle_uncaught_exception(mp_obj_base_t *exc) {
// check for SystemExit
if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(exc->type), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) {
// None is an exit value of 0; an int is its value; anything else is 1
@@ -115,7 +115,7 @@ STATIC int handle_uncaught_exception(mp_obj_base_t *exc) {
// Returns standard error codes: 0 for success, 1 for all other errors,
// except if FORCED_EXIT bit is set then script raised SystemExit and the
// value of the exit is in the lower 8 bits of the return value
-STATIC int execute_from_lexer(int source_kind, const void *source, mp_parse_input_kind_t input_kind, bool is_repl) {
+static int execute_from_lexer(int source_kind, const void *source, mp_parse_input_kind_t input_kind, bool is_repl) {
mp_hal_set_interrupt_char(CHAR_CTRL_C);
nlr_buf_t nlr;
@@ -177,7 +177,7 @@ STATIC int execute_from_lexer(int source_kind, const void *source, mp_parse_inpu
#if MICROPY_USE_READLINE == 1
#include "shared/readline/readline.h"
#else
-STATIC char *strjoin(const char *s1, int sep_char, const char *s2) {
+static char *strjoin(const char *s1, int sep_char, const char *s2) {
int l1 = strlen(s1);
int l2 = strlen(s2);
char *s = malloc(l1 + l2 + 2);
@@ -192,7 +192,7 @@ STATIC char *strjoin(const char *s1, int sep_char, const char *s2) {
}
#endif
-STATIC int do_repl(void) {
+static int do_repl(void) {
mp_hal_stdout_tx_str(MICROPY_BANNER_NAME_AND_VERSION);
mp_hal_stdout_tx_str("; " MICROPY_BANNER_MACHINE);
mp_hal_stdout_tx_str("\nUse Ctrl-D to exit, Ctrl-E for paste mode\n");
@@ -306,15 +306,15 @@ STATIC int do_repl(void) {
#endif
}
-STATIC int do_file(const char *file) {
+static int do_file(const char *file) {
return execute_from_lexer(LEX_SRC_FILENAME, file, MP_PARSE_FILE_INPUT, false);
}
-STATIC int do_str(const char *str) {
+static int do_str(const char *str) {
return execute_from_lexer(LEX_SRC_STR, str, MP_PARSE_FILE_INPUT, false);
}
-STATIC void print_help(char **argv) {
+static void print_help(char **argv) {
printf(
"usage: %s [<opts>] [-X <implopt>] [-c <command> | -m <module> | <filename>]\n"
"Options:\n"
@@ -353,13 +353,13 @@ STATIC void print_help(char **argv) {
}
}
-STATIC int invalid_args(void) {
+static int invalid_args(void) {
fprintf(stderr, "Invalid command line arguments. Use -h option for help.\n");
return 1;
}
// Process options which set interpreter init options
-STATIC void pre_process_options(int argc, char **argv) {
+static void pre_process_options(int argc, char **argv) {
for (int a = 1; a < argc; a++) {
if (argv[a][0] == '-') {
if (strcmp(argv[a], "-c") == 0 || strcmp(argv[a], "-m") == 0) {
@@ -439,7 +439,7 @@ STATIC void pre_process_options(int argc, char **argv) {
}
}
-STATIC void set_sys_argv(char *argv[], int argc, int start_arg) {
+static void set_sys_argv(char *argv[], int argc, int start_arg) {
for (int i = start_arg; i < argc; i++) {
mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
}
@@ -447,9 +447,9 @@ STATIC void set_sys_argv(char *argv[], int argc, int start_arg) {
#if MICROPY_PY_SYS_EXECUTABLE
extern mp_obj_str_t mp_sys_executable_obj;
-STATIC char executable_path[MICROPY_ALLOC_PATH_MAX];
+static char executable_path[MICROPY_ALLOC_PATH_MAX];
-STATIC void sys_set_excecutable(char *argv0) {
+static void sys_set_excecutable(char *argv0) {
if (realpath(argv0, executable_path)) {
mp_obj_str_set_data(&mp_sys_executable_obj, (byte *)executable_path, strlen(executable_path));
}
diff --git a/ports/unix/modffi.c b/ports/unix/modffi.c
index 897fa07ace..b7d03e84dd 100644
--- a/ports/unix/modffi.c
+++ b/ports/unix/modffi.c
@@ -107,13 +107,13 @@ typedef struct _mp_obj_fficallback_t {
ffi_type *params[];
} mp_obj_fficallback_t;
-// STATIC const mp_obj_type_t opaque_type;
-STATIC const mp_obj_type_t ffimod_type;
-STATIC const mp_obj_type_t ffifunc_type;
-STATIC const mp_obj_type_t fficallback_type;
-STATIC const mp_obj_type_t ffivar_type;
+// static const mp_obj_type_t opaque_type;
+static const mp_obj_type_t ffimod_type;
+static const mp_obj_type_t ffifunc_type;
+static const mp_obj_type_t fficallback_type;
+static const mp_obj_type_t ffivar_type;
-STATIC ffi_type *char2ffi_type(char c) {
+static ffi_type *char2ffi_type(char c) {
switch (c) {
case 'b':
return &ffi_type_schar;
@@ -154,7 +154,7 @@ STATIC ffi_type *char2ffi_type(char c) {
}
}
-STATIC ffi_type *get_ffi_type(mp_obj_t o_in) {
+static ffi_type *get_ffi_type(mp_obj_t o_in) {
if (mp_obj_is_str(o_in)) {
const char *s = mp_obj_str_get_str(o_in);
ffi_type *t = char2ffi_type(*s);
@@ -167,7 +167,7 @@ STATIC ffi_type *get_ffi_type(mp_obj_t o_in) {
mp_raise_TypeError(MP_ERROR_TEXT("unknown type"));
}
-STATIC mp_obj_t return_ffi_value(ffi_union_t *val, char type) {
+static mp_obj_t return_ffi_value(ffi_union_t *val, char type) {
switch (type) {
case 's': {
const char *s = (const char *)(intptr_t)val->ffi;
@@ -209,20 +209,20 @@ STATIC mp_obj_t return_ffi_value(ffi_union_t *val, char type) {
// FFI module
-STATIC void ffimod_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void ffimod_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_ffimod_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<ffimod %p>", self->handle);
}
-STATIC mp_obj_t ffimod_close(mp_obj_t self_in) {
+static mp_obj_t ffimod_close(mp_obj_t self_in) {
mp_obj_ffimod_t *self = MP_OBJ_TO_PTR(self_in);
dlclose(self->handle);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(ffimod_close_obj, ffimod_close);
+static MP_DEFINE_CONST_FUN_OBJ_1(ffimod_close_obj, ffimod_close);
-STATIC mp_obj_t make_func(mp_obj_t rettype_in, void *func, mp_obj_t argtypes_in) {
+static mp_obj_t make_func(mp_obj_t rettype_in, void *func, mp_obj_t argtypes_in) {
const char *rettype = mp_obj_str_get_str(rettype_in);
const char *argtypes = mp_obj_str_get_str(argtypes_in);
@@ -249,7 +249,7 @@ STATIC mp_obj_t make_func(mp_obj_t rettype_in, void *func, mp_obj_t argtypes_in)
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t ffimod_func(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t ffimod_func(size_t n_args, const mp_obj_t *args) {
(void)n_args; // always 4
mp_obj_ffimod_t *self = MP_OBJ_TO_PTR(args[0]);
const char *symname = mp_obj_str_get_str(args[2]);
@@ -262,13 +262,13 @@ STATIC mp_obj_t ffimod_func(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ffimod_func_obj, 4, 4, ffimod_func);
-STATIC mp_obj_t mod_ffi_func(mp_obj_t rettype, mp_obj_t addr_in, mp_obj_t argtypes) {
+static mp_obj_t mod_ffi_func(mp_obj_t rettype, mp_obj_t addr_in, mp_obj_t argtypes) {
void *addr = (void *)MP_OBJ_TO_PTR(mp_obj_int_get_truncated(addr_in));
return make_func(rettype, addr, argtypes);
}
MP_DEFINE_CONST_FUN_OBJ_3(mod_ffi_func_obj, mod_ffi_func);
-STATIC void call_py_func(ffi_cif *cif, void *ret, void **args, void *user_data) {
+static void call_py_func(ffi_cif *cif, void *ret, void **args, void *user_data) {
mp_obj_t pyargs[cif->nargs];
mp_obj_fficallback_t *o = user_data;
mp_obj_t pyfunc = o->pyfunc;
@@ -283,7 +283,7 @@ STATIC void call_py_func(ffi_cif *cif, void *ret, void **args, void *user_data)
}
}
-STATIC void call_py_func_with_lock(ffi_cif *cif, void *ret, void **args, void *user_data) {
+static void call_py_func_with_lock(ffi_cif *cif, void *ret, void **args, void *user_data) {
mp_obj_t pyargs[cif->nargs];
mp_obj_fficallback_t *o = user_data;
mp_obj_t pyfunc = o->pyfunc;
@@ -316,7 +316,7 @@ STATIC void call_py_func_with_lock(ffi_cif *cif, void *ret, void **args, void *u
#endif
}
-STATIC mp_obj_t mod_ffi_callback(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mod_ffi_callback(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// first 3 args are positional: retttype, func, paramtypes.
mp_obj_t rettype_in = pos_args[0];
mp_obj_t func_in = pos_args[1];
@@ -364,7 +364,7 @@ STATIC mp_obj_t mod_ffi_callback(size_t n_args, const mp_obj_t *pos_args, mp_map
}
MP_DEFINE_CONST_FUN_OBJ_KW(mod_ffi_callback_obj, 3, mod_ffi_callback);
-STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symname_in) {
+static mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symname_in) {
mp_obj_ffimod_t *self = MP_OBJ_TO_PTR(self_in);
const char *rettype = mp_obj_str_get_str(vartype_in);
const char *symname = mp_obj_str_get_str(symname_in);
@@ -381,7 +381,7 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna
}
MP_DEFINE_CONST_FUN_OBJ_3(ffimod_var_obj, ffimod_var);
-STATIC mp_obj_t ffimod_addr(mp_obj_t self_in, mp_obj_t symname_in) {
+static mp_obj_t ffimod_addr(mp_obj_t self_in, mp_obj_t symname_in) {
mp_obj_ffimod_t *self = MP_OBJ_TO_PTR(self_in);
const char *symname = mp_obj_str_get_str(symname_in);
@@ -393,7 +393,7 @@ STATIC mp_obj_t ffimod_addr(mp_obj_t self_in, mp_obj_t symname_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(ffimod_addr_obj, ffimod_addr);
-STATIC mp_obj_t ffimod_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t ffimod_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)n_args;
(void)n_kw;
@@ -411,16 +411,16 @@ STATIC mp_obj_t ffimod_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC const mp_rom_map_elem_t ffimod_locals_dict_table[] = {
+static const mp_rom_map_elem_t ffimod_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_func), MP_ROM_PTR(&ffimod_func_obj) },
{ MP_ROM_QSTR(MP_QSTR_var), MP_ROM_PTR(&ffimod_var_obj) },
{ MP_ROM_QSTR(MP_QSTR_addr), MP_ROM_PTR(&ffimod_addr_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&ffimod_close_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ffimod_locals_dict, ffimod_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ffimod_locals_dict, ffimod_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ffimod_type,
MP_QSTR_ffimod,
MP_TYPE_FLAG_NONE,
@@ -431,13 +431,13 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
// FFI function
-STATIC void ffifunc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void ffifunc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_ffifunc_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<ffifunc %p>", self->func);
}
-STATIC unsigned long long ffi_get_int_value(mp_obj_t o) {
+static unsigned long long ffi_get_int_value(mp_obj_t o) {
if (mp_obj_is_small_int(o)) {
return MP_OBJ_SMALL_INT_VALUE(o);
} else {
@@ -447,7 +447,7 @@ STATIC unsigned long long ffi_get_int_value(mp_obj_t o) {
}
}
-STATIC ffi_union_t ffi_int_obj_to_ffi_union(mp_obj_t o, const char argtype) {
+static ffi_union_t ffi_int_obj_to_ffi_union(mp_obj_t o, const char argtype) {
ffi_union_t ret;
if ((argtype | 0x20) == 'q') {
ret.Q = ffi_get_int_value(o);
@@ -479,7 +479,7 @@ STATIC ffi_union_t ffi_int_obj_to_ffi_union(mp_obj_t o, const char argtype) {
return ret;
}
-STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t ffifunc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)n_kw;
mp_obj_ffifunc_t *self = MP_OBJ_TO_PTR(self_in);
assert(n_kw == 0);
@@ -530,7 +530,7 @@ error:
mp_raise_TypeError(MP_ERROR_TEXT("don't know how to pass object to native function"));
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ffifunc_type,
MP_QSTR_ffifunc,
MP_TYPE_FLAG_NONE,
@@ -540,24 +540,24 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
// FFI callback for Python function
-STATIC void fficallback_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void fficallback_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_fficallback_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<fficallback %p>", self->func);
}
-STATIC mp_obj_t fficallback_cfun(mp_obj_t self_in) {
+static mp_obj_t fficallback_cfun(mp_obj_t self_in) {
mp_obj_fficallback_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int_from_ull((uintptr_t)self->func);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(fficallback_cfun_obj, fficallback_cfun);
+static MP_DEFINE_CONST_FUN_OBJ_1(fficallback_cfun_obj, fficallback_cfun);
-STATIC const mp_rom_map_elem_t fficallback_locals_dict_table[] = {
+static const mp_rom_map_elem_t fficallback_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_cfun), MP_ROM_PTR(&fficallback_cfun_obj) }
};
-STATIC MP_DEFINE_CONST_DICT(fficallback_locals_dict, fficallback_locals_dict_table);
+static MP_DEFINE_CONST_DICT(fficallback_locals_dict, fficallback_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
fficallback_type,
MP_QSTR_fficallback,
MP_TYPE_FLAG_NONE,
@@ -567,34 +567,34 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
// FFI variable
-STATIC void ffivar_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void ffivar_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_ffivar_t *self = MP_OBJ_TO_PTR(self_in);
// Variable value printed as cast to int
mp_printf(print, "<ffivar @%p: 0x%x>", self->var, *(int *)self->var);
}
-STATIC mp_obj_t ffivar_get(mp_obj_t self_in) {
+static mp_obj_t ffivar_get(mp_obj_t self_in) {
mp_obj_ffivar_t *self = MP_OBJ_TO_PTR(self_in);
return mp_binary_get_val_array(self->type, self->var, 0);
}
MP_DEFINE_CONST_FUN_OBJ_1(ffivar_get_obj, ffivar_get);
-STATIC mp_obj_t ffivar_set(mp_obj_t self_in, mp_obj_t val_in) {
+static mp_obj_t ffivar_set(mp_obj_t self_in, mp_obj_t val_in) {
mp_obj_ffivar_t *self = MP_OBJ_TO_PTR(self_in);
mp_binary_set_val_array(self->type, self->var, 0, val_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(ffivar_set_obj, ffivar_set);
-STATIC const mp_rom_map_elem_t ffivar_locals_dict_table[] = {
+static const mp_rom_map_elem_t ffivar_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_get), MP_ROM_PTR(&ffivar_get_obj) },
{ MP_ROM_QSTR(MP_QSTR_set), MP_ROM_PTR(&ffivar_set_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(ffivar_locals_dict, ffivar_locals_dict_table);
+static MP_DEFINE_CONST_DICT(ffivar_locals_dict, ffivar_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
ffivar_type,
MP_QSTR_ffivar,
MP_TYPE_FLAG_NONE,
@@ -605,7 +605,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
// Generic opaque storage object (unused)
/*
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
opaque_type,
MP_QSTR_opaqueval,
MP_TYPE_FLAG_NONE,
@@ -613,17 +613,17 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
*/
-STATIC mp_obj_t mod_ffi_open(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_ffi_open(size_t n_args, const mp_obj_t *args) {
return ffimod_make_new(&ffimod_type, n_args, 0, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_ffi_open_obj, 1, 2, mod_ffi_open);
-STATIC mp_obj_t mod_ffi_as_bytearray(mp_obj_t ptr, mp_obj_t size) {
+static mp_obj_t mod_ffi_as_bytearray(mp_obj_t ptr, mp_obj_t size) {
return mp_obj_new_bytearray_by_ref(mp_obj_int_get_truncated(size), (void *)(uintptr_t)mp_obj_int_get_truncated(ptr));
}
MP_DEFINE_CONST_FUN_OBJ_2(mod_ffi_as_bytearray_obj, mod_ffi_as_bytearray);
-STATIC const mp_rom_map_elem_t mp_module_ffi_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_ffi_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ffi) },
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mod_ffi_open_obj) },
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&mod_ffi_callback_obj) },
@@ -631,7 +631,7 @@ STATIC const mp_rom_map_elem_t mp_module_ffi_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_as_bytearray), MP_ROM_PTR(&mod_ffi_as_bytearray_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_ffi_globals, mp_module_ffi_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_ffi_globals, mp_module_ffi_globals_table);
const mp_obj_module_t mp_module_ffi = {
.base = { &mp_type_module },
diff --git a/ports/unix/modjni.c b/ports/unix/modjni.c
index a1cfca8149..d953e7e015 100644
--- a/ports/unix/modjni.c
+++ b/ports/unix/modjni.c
@@ -59,13 +59,13 @@ static jmethodID List_size_mid;
static jclass IndexException_class;
-STATIC const mp_obj_type_t jobject_type;
-STATIC const mp_obj_type_t jmethod_type;
+static const mp_obj_type_t jobject_type;
+static const mp_obj_type_t jmethod_type;
-STATIC mp_obj_t new_jobject(jobject jo);
-STATIC mp_obj_t new_jclass(jclass jc);
-STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool is_constr, size_t n_args, const mp_obj_t *args);
-STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out);
+static mp_obj_t new_jobject(jobject jo);
+static mp_obj_t new_jclass(jclass jc);
+static mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool is_constr, size_t n_args, const mp_obj_t *args);
+static bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out);
typedef struct _mp_obj_jclass_t {
mp_obj_base_t base;
@@ -87,7 +87,7 @@ typedef struct _mp_obj_jmethod_t {
// Utility functions
-STATIC bool is_object_type(const char *jtypesig) {
+static bool is_object_type(const char *jtypesig) {
while (*jtypesig != ' ' && *jtypesig) {
if (*jtypesig == '.') {
return true;
@@ -97,7 +97,7 @@ STATIC bool is_object_type(const char *jtypesig) {
return false;
}
-STATIC void check_exception(void) {
+static void check_exception(void) {
jobject exc = JJ1(ExceptionOccurred);
if (exc) {
// JJ1(ExceptionDescribe);
@@ -110,7 +110,7 @@ STATIC void check_exception(void) {
}
}
-STATIC void print_jobject(const mp_print_t *print, jobject obj) {
+static void print_jobject(const mp_print_t *print, jobject obj) {
jobject str_o = JJ(CallObjectMethod, obj, Object_toString_mid);
const char *str = JJ(GetStringUTFChars, str_o, NULL);
mp_printf(print, str);
@@ -119,7 +119,7 @@ STATIC void print_jobject(const mp_print_t *print, jobject obj) {
// jclass
-STATIC void jclass_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void jclass_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_obj_jclass_t *self = MP_OBJ_TO_PTR(self_in);
if (kind == PRINT_REPR) {
mp_printf(print, "<jclass @%p \"", self->cls);
@@ -130,7 +130,7 @@ STATIC void jclass_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin
}
}
-STATIC void jclass_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
+static void jclass_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
if (dest[0] == MP_OBJ_NULL) {
// load attribute
mp_obj_jclass_t *self = MP_OBJ_TO_PTR(self_in);
@@ -156,7 +156,7 @@ STATIC void jclass_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
}
}
-STATIC mp_obj_t jclass_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t jclass_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
if (n_kw != 0) {
mp_raise_TypeError(MP_ERROR_TEXT("kwargs not supported"));
}
@@ -167,14 +167,14 @@ STATIC mp_obj_t jclass_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
return call_method(self->cls, NULL, methods, true, n_args, args);
}
-STATIC const mp_rom_map_elem_t jclass_locals_dict_table[] = {
+static const mp_rom_map_elem_t jclass_locals_dict_table[] = {
// { MP_ROM_QSTR(MP_QSTR_get), MP_ROM_PTR(&ffivar_get_obj) },
// { MP_ROM_QSTR(MP_QSTR_set), MP_ROM_PTR(&ffivar_set_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(jclass_locals_dict, jclass_locals_dict_table);
+static MP_DEFINE_CONST_DICT(jclass_locals_dict, jclass_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
jclass_type,
MP_QSTR_jclass,
MP_TYPE_FLAG_NONE,
@@ -184,7 +184,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &jclass_locals_dict
);
-STATIC mp_obj_t new_jclass(jclass jc) {
+static mp_obj_t new_jclass(jclass jc) {
mp_obj_jclass_t *o = mp_obj_malloc(mp_obj_jclass_t, &jclass_type);
o->cls = jc;
return MP_OBJ_FROM_PTR(o);
@@ -192,7 +192,7 @@ STATIC mp_obj_t new_jclass(jclass jc) {
// jobject
-STATIC void jobject_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void jobject_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_obj_jobject_t *self = MP_OBJ_TO_PTR(self_in);
if (kind == PRINT_REPR) {
mp_printf(print, "<jobject @%p \"", self->obj);
@@ -203,7 +203,7 @@ STATIC void jobject_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
}
}
-STATIC void jobject_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
+static void jobject_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
if (dest[0] == MP_OBJ_NULL) {
// load attribute
mp_obj_jobject_t *self = MP_OBJ_TO_PTR(self_in);
@@ -233,7 +233,7 @@ STATIC void jobject_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
}
}
-STATIC void get_jclass_name(jobject obj, char *buf) {
+static void get_jclass_name(jobject obj, char *buf) {
jclass obj_class = JJ(GetObjectClass, obj);
jstring name = JJ(CallObjectMethod, obj_class, Class_getName_mid);
jint len = JJ(GetStringLength, name);
@@ -241,7 +241,7 @@ STATIC void get_jclass_name(jobject obj, char *buf) {
check_exception();
}
-STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_jobject_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t idx = mp_obj_get_int(index);
char class_name[64];
@@ -291,7 +291,7 @@ STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
return MP_OBJ_NULL;
}
-STATIC mp_obj_t jobject_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t jobject_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_jobject_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -309,19 +309,19 @@ STATIC mp_obj_t jobject_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
// TODO: subscr_load_adaptor & subscr_getiter convenience functions
// should be moved to common location for reuse.
-STATIC mp_obj_t subscr_load_adaptor(mp_obj_t self_in, mp_obj_t index_in) {
+static mp_obj_t subscr_load_adaptor(mp_obj_t self_in, mp_obj_t index_in) {
return mp_obj_subscr(self_in, index_in, MP_OBJ_SENTINEL);
}
MP_DEFINE_CONST_FUN_OBJ_2(subscr_load_adaptor_obj, subscr_load_adaptor);
// .getiter special method which returns iterator which works in terms
// of object subscription.
-STATIC mp_obj_t subscr_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t subscr_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
mp_obj_t dest[2] = {MP_OBJ_FROM_PTR(&subscr_load_adaptor_obj), self_in};
return mp_obj_new_getitem_iter(dest, iter_buf);
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
jobject_type,
MP_QSTR_jobject,
MP_TYPE_FLAG_ITER_IS_GETITER,
@@ -332,7 +332,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
iter, subscr_getiter
);
-STATIC mp_obj_t new_jobject(jobject jo) {
+static mp_obj_t new_jobject(jobject jo) {
if (jo == NULL) {
return mp_const_none;
} else if (JJ(IsInstanceOf, jo, String_class)) {
@@ -353,7 +353,7 @@ STATIC mp_obj_t new_jobject(jobject jo) {
// jmethod
-STATIC void jmethod_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void jmethod_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_jmethod_t *self = MP_OBJ_TO_PTR(self_in);
// Variable value printed as cast to int
@@ -368,14 +368,14 @@ STATIC void jmethod_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
} \
arg_type += sizeof(java_type_name) - 1;
-STATIC const char *strprev(const char *s, char c) {
+static const char *strprev(const char *s, char c) {
while (*s != c) {
s--;
}
return s;
}
-STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
+static bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
const char *arg_type = *jtypesig;
const mp_obj_type_t *type = mp_obj_get_type(arg);
@@ -442,7 +442,7 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
// perspective, it's aggregate object which may require passing via stack
// instead of registers. Work that around by passing jobject and typecasting
// it.
-STATIC mp_obj_t jvalue2py(const char *jtypesig, jobject arg) {
+static mp_obj_t jvalue2py(const char *jtypesig, jobject arg) {
if (arg == NULL || MATCH(jtypesig, "void")) {
return mp_const_none;
} else if (MATCH(jtypesig, "boolean")) {
@@ -460,7 +460,7 @@ STATIC mp_obj_t jvalue2py(const char *jtypesig, jobject arg) {
}
#endif
-STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool is_constr, size_t n_args, const mp_obj_t *args) {
+static mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool is_constr, size_t n_args, const mp_obj_t *args) {
jvalue jargs[n_args];
// printf("methods=%p\n", methods);
jsize num_methods = JJ(GetArrayLength, methods);
@@ -550,7 +550,7 @@ STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool
}
-STATIC mp_obj_t jmethod_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t jmethod_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
if (n_kw != 0) {
mp_raise_TypeError(MP_ERROR_TEXT("kwargs not supported"));
}
@@ -568,7 +568,7 @@ STATIC mp_obj_t jmethod_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
return call_method(self->obj, name, methods, false, n_args, args);
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
jmethod_type,
MP_QSTR_jmethod,
MP_TYPE_FLAG_NONE,
@@ -582,7 +582,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
#define LIBJVM_SO "libjvm.so"
#endif
-STATIC void create_jvm(void) {
+static void create_jvm(void) {
JavaVMInitArgs args;
JavaVMOption options;
options.optionString = "-Djava.class.path=.";
@@ -635,7 +635,7 @@ STATIC void create_jvm(void) {
IndexException_class = JJ(FindClass, "java/lang/IndexOutOfBoundsException");
}
-STATIC mp_obj_t mod_jni_cls(mp_obj_t cls_name_in) {
+static mp_obj_t mod_jni_cls(mp_obj_t cls_name_in) {
const char *cls_name = mp_obj_str_get_str(cls_name_in);
if (!env) {
create_jvm();
@@ -648,7 +648,7 @@ STATIC mp_obj_t mod_jni_cls(mp_obj_t cls_name_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mod_jni_cls_obj, mod_jni_cls);
-STATIC mp_obj_t mod_jni_array(mp_obj_t type_in, mp_obj_t size_in) {
+static mp_obj_t mod_jni_array(mp_obj_t type_in, mp_obj_t size_in) {
if (!env) {
create_jvm();
}
@@ -696,19 +696,19 @@ STATIC mp_obj_t mod_jni_array(mp_obj_t type_in, mp_obj_t size_in) {
MP_DEFINE_CONST_FUN_OBJ_2(mod_jni_array_obj, mod_jni_array);
-STATIC mp_obj_t mod_jni_env(void) {
+static mp_obj_t mod_jni_env(void) {
return mp_obj_new_int((mp_int_t)(uintptr_t)env);
}
MP_DEFINE_CONST_FUN_OBJ_0(mod_jni_env_obj, mod_jni_env);
-STATIC const mp_rom_map_elem_t mp_module_jni_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_jni_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_jni) },
{ MP_ROM_QSTR(MP_QSTR_cls), MP_ROM_PTR(&mod_jni_cls_obj) },
{ MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mod_jni_array_obj) },
{ MP_ROM_QSTR(MP_QSTR_env), MP_ROM_PTR(&mod_jni_env_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_jni_globals, mp_module_jni_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_jni_globals, mp_module_jni_globals_table);
const mp_obj_module_t mp_module_jni = {
.base = { &mp_type_module },
diff --git a/ports/unix/modmachine.c b/ports/unix/modmachine.c
index 40d08d9111..6f3ab80944 100644
--- a/ports/unix/modmachine.c
+++ b/ports/unix/modmachine.c
@@ -70,7 +70,7 @@ uintptr_t mod_machine_mem_get_addr(mp_obj_t addr_o, uint align) {
return addr;
}
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
#ifdef MICROPY_UNIX_MACHINE_IDLE
MICROPY_UNIX_MACHINE_IDLE
#else
diff --git a/ports/unix/modos.c b/ports/unix/modos.c
index 1d5e2afef4..d5e963583b 100644
--- a/ports/unix/modos.c
+++ b/ports/unix/modos.c
@@ -32,7 +32,7 @@
#include "py/runtime.h"
#include "py/mphal.h"
-STATIC mp_obj_t mp_os_getenv(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_os_getenv(size_t n_args, const mp_obj_t *args) {
const char *s = getenv(mp_obj_str_get_str(args[0]));
if (s == NULL) {
if (n_args == 2) {
@@ -42,9 +42,9 @@ STATIC mp_obj_t mp_os_getenv(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_str(s, strlen(s));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_getenv_obj, 1, 2, mp_os_getenv);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_getenv_obj, 1, 2, mp_os_getenv);
-STATIC mp_obj_t mp_os_putenv(mp_obj_t key_in, mp_obj_t value_in) {
+static mp_obj_t mp_os_putenv(mp_obj_t key_in, mp_obj_t value_in) {
const char *key = mp_obj_str_get_str(key_in);
const char *value = mp_obj_str_get_str(value_in);
int ret;
@@ -60,9 +60,9 @@ STATIC mp_obj_t mp_os_putenv(mp_obj_t key_in, mp_obj_t value_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_os_putenv_obj, mp_os_putenv);
+static MP_DEFINE_CONST_FUN_OBJ_2(mp_os_putenv_obj, mp_os_putenv);
-STATIC mp_obj_t mp_os_unsetenv(mp_obj_t key_in) {
+static mp_obj_t mp_os_unsetenv(mp_obj_t key_in) {
const char *key = mp_obj_str_get_str(key_in);
int ret;
@@ -77,9 +77,9 @@ STATIC mp_obj_t mp_os_unsetenv(mp_obj_t key_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_unsetenv_obj, mp_os_unsetenv);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_unsetenv_obj, mp_os_unsetenv);
-STATIC mp_obj_t mp_os_system(mp_obj_t cmd_in) {
+static mp_obj_t mp_os_system(mp_obj_t cmd_in) {
const char *cmd = mp_obj_str_get_str(cmd_in);
MP_THREAD_GIL_EXIT();
@@ -90,18 +90,18 @@ STATIC mp_obj_t mp_os_system(mp_obj_t cmd_in) {
return MP_OBJ_NEW_SMALL_INT(r);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_system_obj, mp_os_system);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_system_obj, mp_os_system);
-STATIC mp_obj_t mp_os_urandom(mp_obj_t num) {
+static mp_obj_t mp_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
vstr_init_len(&vstr, n);
mp_hal_get_random(n, vstr.buf);
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_urandom_obj, mp_os_urandom);
-STATIC mp_obj_t mp_os_errno(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_os_errno(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
return MP_OBJ_NEW_SMALL_INT(errno);
}
@@ -109,4 +109,4 @@ STATIC mp_obj_t mp_os_errno(size_t n_args, const mp_obj_t *args) {
errno = mp_obj_get_int(args[0]);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_errno_obj, 0, 1, mp_os_errno);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_errno_obj, 0, 1, mp_os_errno);
diff --git a/ports/unix/modsocket.c b/ports/unix/modsocket.c
index 5c935d2299..6d6059ae44 100644
--- a/ports/unix/modsocket.c
+++ b/ports/unix/modsocket.c
@@ -82,7 +82,7 @@ static inline mp_obj_t mp_obj_from_sockaddr(const struct sockaddr *addr, socklen
return mp_obj_new_bytes((const byte *)addr, len);
}
-STATIC mp_obj_socket_t *socket_new(int fd) {
+static mp_obj_socket_t *socket_new(int fd) {
mp_obj_socket_t *o = mp_obj_malloc(mp_obj_socket_t, &mp_type_socket);
o->fd = fd;
o->blocking = true;
@@ -90,13 +90,13 @@ STATIC mp_obj_socket_t *socket_new(int fd) {
}
-STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<_socket %d>", self->fd);
}
-STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_socket_t *o = MP_OBJ_TO_PTR(o_in);
ssize_t r;
MP_HAL_RETRY_SYSCALL(r, read(o->fd, buf, size), {
@@ -112,7 +112,7 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
return (mp_uint_t)r;
}
-STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_socket_t *o = MP_OBJ_TO_PTR(o_in);
ssize_t r;
MP_HAL_RETRY_SYSCALL(r, write(o->fd, buf, size), {
@@ -128,7 +128,7 @@ STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, in
return (mp_uint_t)r;
}
-STATIC mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(o_in);
(void)arg;
switch (request) {
@@ -186,13 +186,13 @@ STATIC mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, i
}
}
-STATIC mp_obj_t socket_fileno(mp_obj_t self_in) {
+static mp_obj_t socket_fileno(mp_obj_t self_in) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(self->fd);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
+static MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
-STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(addr_in, &bufinfo, MP_BUFFER_READ);
@@ -220,9 +220,9 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
-STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(addr_in, &bufinfo, MP_BUFFER_READ);
@@ -232,10 +232,10 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
RAISE_ERRNO(r, errno);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
// method socket.listen([backlog])
-STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int backlog = MICROPY_PY_SOCKET_LISTEN_BACKLOG_DEFAULT;
@@ -250,9 +250,9 @@ STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
RAISE_ERRNO(r, errno);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
-STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
+static mp_obj_t socket_accept(mp_obj_t self_in) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
// sockaddr_storage isn't stack-friendly (129 bytes or so)
// struct sockaddr_storage addr;
@@ -273,12 +273,12 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
+static MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
// Note: besides flag param, this differs from read() in that
// this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) -
// these would be thrown as exceptions.
-STATIC mp_obj_t socket_recv(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_recv(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int sz = MP_OBJ_SMALL_INT_VALUE(args[1]);
int flags = 0;
@@ -294,9 +294,9 @@ STATIC mp_obj_t socket_recv(size_t n_args, const mp_obj_t *args) {
m_del(char, buf, sz);
return ret;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_obj, 2, 3, socket_recv);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_obj, 2, 3, socket_recv);
-STATIC mp_obj_t socket_recvfrom(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_recvfrom(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int sz = MP_OBJ_SMALL_INT_VALUE(args[1]);
int flags = 0;
@@ -321,12 +321,12 @@ STATIC mp_obj_t socket_recvfrom(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recvfrom_obj, 2, 3, socket_recvfrom);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recvfrom_obj, 2, 3, socket_recvfrom);
// Note: besides flag param, this differs from write() in that
// this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) -
// these would be thrown as exceptions.
-STATIC mp_obj_t socket_send(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_send(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int flags = 0;
@@ -341,9 +341,9 @@ STATIC mp_obj_t socket_send(size_t n_args, const mp_obj_t *args) {
mp_raise_OSError(err));
return MP_OBJ_NEW_SMALL_INT(out_sz);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_send_obj, 2, 3, socket_send);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_send_obj, 2, 3, socket_send);
-STATIC mp_obj_t socket_sendto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_sendto(size_t n_args, const mp_obj_t *args) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int flags = 0;
@@ -361,9 +361,9 @@ STATIC mp_obj_t socket_sendto(size_t n_args, const mp_obj_t *args) {
(struct sockaddr *)addr_bi.buf, addr_bi.len), mp_raise_OSError(err));
return MP_OBJ_NEW_SMALL_INT(out_sz);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_sendto_obj, 3, 4, socket_sendto);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_sendto_obj, 3, 4, socket_sendto);
-STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
(void)n_args; // always 4
mp_obj_socket_t *self = MP_OBJ_TO_PTR(args[0]);
int level = MP_OBJ_SMALL_INT_VALUE(args[1]);
@@ -388,9 +388,9 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
RAISE_ERRNO(r, errno);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
-STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
+static mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
int val = mp_obj_is_true(flag_in);
MP_THREAD_GIL_EXIT();
@@ -410,9 +410,9 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
self->blocking = val;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
-STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
+static mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
struct timeval tv = {0, };
bool new_blocking = true;
@@ -455,9 +455,9 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
-STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
// TODO: CPython explicitly says that closing returned object doesn't close
// the original socket (Python2 at all says that fd is dup()ed). But we
// save on the bloat.
@@ -467,9 +467,9 @@ STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
new_args[0] = MP_OBJ_NEW_SMALL_INT(self->fd);
return mp_vfs_open(n_args, new_args, (mp_map_t *)&mp_const_empty_map);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
-STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t socket_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
(void)n_kw;
@@ -497,7 +497,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type_in, size_t n_args, siz
return MP_OBJ_FROM_PTR(socket_new(fd));
}
-STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_fileno), MP_ROM_PTR(&socket_fileno_obj) },
{ MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&socket_makefile_obj) },
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
@@ -518,9 +518,9 @@ STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
-STATIC const mp_stream_p_t socket_stream_p = {
+static const mp_stream_p_t socket_stream_p = {
.read = socket_read,
.write = socket_write,
.ioctl = socket_ioctl,
@@ -537,7 +537,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
);
#define BINADDR_MAX_LEN sizeof(struct in6_addr)
-STATIC mp_obj_t mod_socket_inet_pton(mp_obj_t family_in, mp_obj_t addr_in) {
+static mp_obj_t mod_socket_inet_pton(mp_obj_t family_in, mp_obj_t addr_in) {
int family = mp_obj_get_int(family_in);
byte binaddr[BINADDR_MAX_LEN];
int r = inet_pton(family, mp_obj_str_get_str(addr_in), binaddr);
@@ -556,9 +556,9 @@ STATIC mp_obj_t mod_socket_inet_pton(mp_obj_t family_in, mp_obj_t addr_in) {
}
return mp_obj_new_bytes(binaddr, binaddr_len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_pton_obj, mod_socket_inet_pton);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_pton_obj, mod_socket_inet_pton);
-STATIC mp_obj_t mod_socket_inet_ntop(mp_obj_t family_in, mp_obj_t binaddr_in) {
+static mp_obj_t mod_socket_inet_ntop(mp_obj_t family_in, mp_obj_t binaddr_in) {
int family = mp_obj_get_int(family_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(binaddr_in, &bufinfo, MP_BUFFER_READ);
@@ -570,9 +570,9 @@ STATIC mp_obj_t mod_socket_inet_ntop(mp_obj_t family_in, mp_obj_t binaddr_in) {
vstr.len = strlen(vstr.buf);
return mp_obj_new_str_from_utf8_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_ntop_obj, mod_socket_inet_ntop);
+static MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_ntop_obj, mod_socket_inet_ntop);
-STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
const char *host = mp_obj_str_get_str(args[0]);
const char *serv = NULL;
@@ -647,9 +647,9 @@ STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
freeaddrinfo(addr_list);
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 6, mod_socket_getaddrinfo);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 6, mod_socket_getaddrinfo);
-STATIC mp_obj_t mod_socket_sockaddr(mp_obj_t sockaddr_in) {
+static mp_obj_t mod_socket_sockaddr(mp_obj_t sockaddr_in) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(sockaddr_in, &bufinfo, MP_BUFFER_READ);
switch (((struct sockaddr *)bufinfo.buf)->sa_family) {
@@ -681,9 +681,9 @@ STATIC mp_obj_t mod_socket_sockaddr(mp_obj_t sockaddr_in) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_sockaddr_obj, mod_socket_sockaddr);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_sockaddr_obj, mod_socket_sockaddr);
-STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) },
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&mp_type_socket) },
{ MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&mod_socket_getaddrinfo_obj) },
@@ -711,7 +711,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
#undef C
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
const mp_obj_module_t mp_module_socket = {
.base = { &mp_type_module },
diff --git a/ports/unix/modtermios.c b/ports/unix/modtermios.c
index 8a79bc3a59..b1ad9a450e 100644
--- a/ports/unix/modtermios.c
+++ b/ports/unix/modtermios.c
@@ -35,7 +35,7 @@
#include "py/runtime.h"
#include "py/mphal.h"
-STATIC mp_obj_t mod_termios_tcgetattr(mp_obj_t fd_in) {
+static mp_obj_t mod_termios_tcgetattr(mp_obj_t fd_in) {
struct termios term;
int fd = mp_obj_get_int(fd_in);
@@ -65,9 +65,9 @@ STATIC mp_obj_t mod_termios_tcgetattr(mp_obj_t fd_in) {
}
return MP_OBJ_FROM_PTR(r);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_termios_tcgetattr_obj, mod_termios_tcgetattr);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_termios_tcgetattr_obj, mod_termios_tcgetattr);
-STATIC mp_obj_t mod_termios_tcsetattr(mp_obj_t fd_in, mp_obj_t when_in, mp_obj_t attrs_in) {
+static mp_obj_t mod_termios_tcsetattr(mp_obj_t fd_in, mp_obj_t when_in, mp_obj_t attrs_in) {
struct termios term;
int fd = mp_obj_get_int(fd_in);
int when = mp_obj_get_int(when_in);
@@ -105,9 +105,9 @@ STATIC mp_obj_t mod_termios_tcsetattr(mp_obj_t fd_in, mp_obj_t when_in, mp_obj_t
RAISE_ERRNO(res, errno);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_termios_tcsetattr_obj, mod_termios_tcsetattr);
+static MP_DEFINE_CONST_FUN_OBJ_3(mod_termios_tcsetattr_obj, mod_termios_tcsetattr);
-STATIC mp_obj_t mod_termios_setraw(mp_obj_t fd_in) {
+static mp_obj_t mod_termios_setraw(mp_obj_t fd_in) {
struct termios term;
int fd = mp_obj_get_int(fd_in);
int res = tcgetattr(fd, &term);
@@ -123,9 +123,9 @@ STATIC mp_obj_t mod_termios_setraw(mp_obj_t fd_in) {
RAISE_ERRNO(res, errno);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_termios_setraw_obj, mod_termios_setraw);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_termios_setraw_obj, mod_termios_setraw);
-STATIC const mp_rom_map_elem_t mp_module_termios_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_termios_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_termios) },
{ MP_ROM_QSTR(MP_QSTR_tcgetattr), MP_ROM_PTR(&mod_termios_tcgetattr_obj) },
{ MP_ROM_QSTR(MP_QSTR_tcsetattr), MP_ROM_PTR(&mod_termios_tcsetattr_obj) },
@@ -144,7 +144,7 @@ STATIC const mp_rom_map_elem_t mp_module_termios_globals_table[] = {
#undef C
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_termios_globals, mp_module_termios_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_termios_globals, mp_module_termios_globals_table);
const mp_obj_module_t mp_module_termios = {
.base = { &mp_type_module },
diff --git a/ports/unix/modtime.c b/ports/unix/modtime.c
index b6fbae0d1c..fbd94b5ecd 100644
--- a/ports/unix/modtime.c
+++ b/ports/unix/modtime.c
@@ -61,7 +61,7 @@ static inline int msec_sleep_tv(struct timeval *tv) {
#error Unsupported clock() implementation
#endif
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
#if MICROPY_PY_BUILTINS_FLOAT && MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
struct timeval tv;
gettimeofday(&tv, NULL);
@@ -73,7 +73,7 @@ STATIC mp_obj_t mp_time_time_get(void) {
}
// Note: this is deprecated since CPy3.3, but pystone still uses it.
-STATIC mp_obj_t mod_time_clock(void) {
+static mp_obj_t mod_time_clock(void) {
#if MICROPY_PY_BUILTINS_FLOAT
// float cannot represent full range of int32 precisely, so we pre-divide
// int to reduce resolution, and then actually do float division hoping
@@ -83,9 +83,9 @@ STATIC mp_obj_t mod_time_clock(void) {
return mp_obj_new_int((mp_int_t)clock());
#endif
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_time_clock_obj, mod_time_clock);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_time_clock_obj, mod_time_clock);
-STATIC mp_obj_t mp_time_sleep(mp_obj_t arg) {
+static mp_obj_t mp_time_sleep(mp_obj_t arg) {
#if MICROPY_PY_BUILTINS_FLOAT
struct timeval tv;
mp_float_t val = mp_obj_get_float(arg);
@@ -125,7 +125,7 @@ STATIC mp_obj_t mp_time_sleep(mp_obj_t arg) {
return mp_const_none;
}
-STATIC mp_obj_t mod_time_gm_local_time(size_t n_args, const mp_obj_t *args, struct tm *(*time_func)(const time_t *timep)) {
+static mp_obj_t mod_time_gm_local_time(size_t n_args, const mp_obj_t *args, struct tm *(*time_func)(const time_t *timep)) {
time_t t;
if (n_args == 0) {
t = time(NULL);
@@ -159,17 +159,17 @@ STATIC mp_obj_t mod_time_gm_local_time(size_t n_args, const mp_obj_t *args, stru
return ret;
}
-STATIC mp_obj_t mod_time_gmtime(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_time_gmtime(size_t n_args, const mp_obj_t *args) {
return mod_time_gm_local_time(n_args, args, gmtime);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_time_gmtime_obj, 0, 1, mod_time_gmtime);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_time_gmtime_obj, 0, 1, mod_time_gmtime);
-STATIC mp_obj_t mod_time_localtime(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_time_localtime(size_t n_args, const mp_obj_t *args) {
return mod_time_gm_local_time(n_args, args, localtime);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_time_localtime_obj, 0, 1, mod_time_localtime);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_time_localtime_obj, 0, 1, mod_time_localtime);
-STATIC mp_obj_t mod_time_mktime(mp_obj_t tuple) {
+static mp_obj_t mod_time_mktime(mp_obj_t tuple) {
size_t len;
mp_obj_t *elem;
mp_obj_get_array(tuple, &len, &elem);
diff --git a/ports/unix/mpbthciport.c b/ports/unix/mpbthciport.c
index 8813ce147c..95c39f5599 100644
--- a/ports/unix/mpbthciport.c
+++ b/ports/unix/mpbthciport.c
@@ -54,7 +54,7 @@
uint8_t mp_bluetooth_hci_cmd_buf[4 + 256];
-STATIC int uart_fd = -1;
+static int uart_fd = -1;
// Must be provided by the stack bindings (e.g. mpnimbleport.c or mpbtstackport.c).
extern bool mp_bluetooth_hci_poll(void);
@@ -68,9 +68,9 @@ extern bool mp_bluetooth_hci_poll(void);
extern bool mp_bluetooth_hci_active(void);
// Prevent double-enqueuing of the scheduled task.
-STATIC volatile bool events_task_is_scheduled = false;
+static volatile bool events_task_is_scheduled = false;
-STATIC mp_obj_t run_events_scheduled_task(mp_obj_t none_in) {
+static mp_obj_t run_events_scheduled_task(mp_obj_t none_in) {
(void)none_in;
MICROPY_PY_BLUETOOTH_ENTER
events_task_is_scheduled = false;
@@ -78,14 +78,14 @@ STATIC mp_obj_t run_events_scheduled_task(mp_obj_t none_in) {
mp_bluetooth_hci_poll();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(run_events_scheduled_task_obj, run_events_scheduled_task);
+static MP_DEFINE_CONST_FUN_OBJ_1(run_events_scheduled_task_obj, run_events_scheduled_task);
#endif // MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
-STATIC const useconds_t UART_POLL_INTERVAL_US = 1000;
-STATIC pthread_t hci_poll_thread_id;
+static const useconds_t UART_POLL_INTERVAL_US = 1000;
+static pthread_t hci_poll_thread_id;
-STATIC void *hci_poll_thread(void *arg) {
+static void *hci_poll_thread(void *arg) {
(void)arg;
DEBUG_printf("hci_poll_thread: starting\n");
@@ -118,7 +118,7 @@ STATIC void *hci_poll_thread(void *arg) {
return NULL;
}
-STATIC int configure_uart(void) {
+static int configure_uart(void) {
struct termios toptions;
// Get existing config.
diff --git a/ports/unix/mpbtstackport_h4.c b/ports/unix/mpbtstackport_h4.c
index a2038c16a9..14d418c63f 100644
--- a/ports/unix/mpbtstackport_h4.c
+++ b/ports/unix/mpbtstackport_h4.c
@@ -44,7 +44,7 @@
#define DEBUG_printf(...) // printf(__VA_ARGS__)
-STATIC hci_transport_config_uart_t hci_transport_config_uart = {
+static hci_transport_config_uart_t hci_transport_config_uart = {
.type = HCI_TRANSPORT_CONFIG_UART,
.baudrate_init = 1000000,
.baudrate_main = 0,
diff --git a/ports/unix/mpbtstackport_usb.c b/ports/unix/mpbtstackport_usb.c
index 1793e2bacd..8b1d1fff21 100644
--- a/ports/unix/mpbtstackport_usb.c
+++ b/ports/unix/mpbtstackport_usb.c
@@ -49,7 +49,7 @@
#error Unix btstack requires MICROPY_PY_THREAD
#endif
-STATIC const useconds_t USB_POLL_INTERVAL_US = 1000;
+static const useconds_t USB_POLL_INTERVAL_US = 1000;
void mp_bluetooth_btstack_port_init_usb(void) {
// MICROPYBTUSB can be a ':'' or '-' separated port list.
@@ -73,7 +73,7 @@ void mp_bluetooth_btstack_port_init_usb(void) {
hci_init(hci_transport_usb_instance(), NULL);
}
-STATIC pthread_t bstack_thread_id;
+static pthread_t bstack_thread_id;
void mp_bluetooth_btstack_port_deinit(void) {
hci_power_control(HCI_POWER_OFF);
@@ -86,7 +86,7 @@ void mp_bluetooth_btstack_port_deinit(void) {
// Provided by mpbstackport_common.c.
extern bool mp_bluetooth_hci_poll(void);
-STATIC void *btstack_thread(void *arg) {
+static void *btstack_thread(void *arg) {
(void)arg;
hci_power_control(HCI_POWER_ON);
diff --git a/ports/unix/mpthreadport.c b/ports/unix/mpthreadport.c
index 2190bf4ad1..16ac4da8bf 100644
--- a/ports/unix/mpthreadport.c
+++ b/ports/unix/mpthreadport.c
@@ -60,21 +60,21 @@ typedef struct _mp_thread_t {
struct _mp_thread_t *next;
} mp_thread_t;
-STATIC pthread_key_t tls_key;
+static pthread_key_t tls_key;
// The mutex is used for any code in this port that needs to be thread safe.
// Specifically for thread management, access to the linked list is one example.
// But also, e.g. scheduler state.
-STATIC pthread_mutex_t thread_mutex;
-STATIC mp_thread_t *thread;
+static pthread_mutex_t thread_mutex;
+static mp_thread_t *thread;
// this is used to synchronise the signal handler of the thread
// it's needed because we can't use any pthread calls in a signal handler
#if defined(__APPLE__)
-STATIC char thread_signal_done_name[25];
-STATIC sem_t *thread_signal_done_p;
+static char thread_signal_done_name[25];
+static sem_t *thread_signal_done_p;
#else
-STATIC sem_t thread_signal_done;
+static sem_t thread_signal_done;
#endif
void mp_thread_unix_begin_atomic_section(void) {
@@ -86,7 +86,7 @@ void mp_thread_unix_end_atomic_section(void) {
}
// this signal handler is used to scan the regs and stack of a thread
-STATIC void mp_thread_gc(int signo, siginfo_t *info, void *context) {
+static void mp_thread_gc(int signo, siginfo_t *info, void *context) {
(void)info; // unused
(void)context; // unused
if (signo == MP_THREAD_GC_SIGNAL) {
diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c
index 24c0fa3cda..5f5abc2e05 100644
--- a/ports/unix/unix_mphal.c
+++ b/ports/unix/unix_mphal.c
@@ -46,7 +46,7 @@
#ifndef _WIN32
#include <signal.h>
-STATIC void sighandler(int signum) {
+static void sighandler(int signum) {
if (signum == SIGINT) {
#if MICROPY_ASYNC_KBD_INTR
#if MICROPY_PY_THREAD_GIL
diff --git a/ports/webassembly/main.c b/ports/webassembly/main.c
index c3cb8c1974..0aacf1ee09 100644
--- a/ports/webassembly/main.c
+++ b/ports/webassembly/main.c
@@ -112,7 +112,7 @@ void mp_js_init_repl() {
pyexec_event_repl_init();
}
-STATIC void gc_scan_func(void *begin, void *end) {
+static void gc_scan_func(void *begin, void *end) {
gc_collect_root((void **)begin, (void **)end - (void **)begin + 1);
}
diff --git a/ports/windows/fmode.c b/ports/windows/fmode.c
index a7976b87e3..128c951ec4 100644
--- a/ports/windows/fmode.c
+++ b/ports/windows/fmode.c
@@ -31,7 +31,7 @@
// Workaround for setting file translation mode: we must distinguish toolsets
// since mingw has no _set_fmode, and altering msvc's _fmode directly has no effect
-STATIC int set_fmode_impl(int mode) {
+static int set_fmode_impl(int mode) {
#ifndef _MSC_VER
_fmode = mode;
return 0;
diff --git a/ports/windows/windows_mphal.c b/ports/windows/windows_mphal.c
index dcee20784e..b636393f54 100644
--- a/ports/windows/windows_mphal.c
+++ b/ports/windows/windows_mphal.c
@@ -38,14 +38,14 @@ HANDLE std_in = NULL;
HANDLE con_out = NULL;
DWORD orig_mode = 0;
-STATIC void assure_stdin_handle() {
+static void assure_stdin_handle() {
if (!std_in) {
std_in = GetStdHandle(STD_INPUT_HANDLE);
assert(std_in != INVALID_HANDLE_VALUE);
}
}
-STATIC void assure_conout_handle() {
+static void assure_conout_handle() {
if (!con_out) {
con_out = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -143,7 +143,7 @@ typedef struct item_t {
} item_t;
// map virtual key codes to key sequences known by MicroPython's readline implementation
-STATIC item_t keyCodeMap[] = {
+static item_t keyCodeMap[] = {
{VK_UP, "[A"},
{VK_DOWN, "[B"},
{VK_RIGHT, "[C"},
@@ -155,7 +155,7 @@ STATIC item_t keyCodeMap[] = {
};
// likewise, but with Ctrl key down
-STATIC item_t ctrlKeyCodeMap[] = {
+static item_t ctrlKeyCodeMap[] = {
{VK_LEFT, "b"},
{VK_RIGHT, "f"},
{VK_DELETE, "d"},
@@ -163,9 +163,9 @@ STATIC item_t ctrlKeyCodeMap[] = {
{0, ""} // sentinel
};
-STATIC const char *cur_esc_seq = NULL;
+static const char *cur_esc_seq = NULL;
-STATIC int esc_seq_process_vk(WORD vk, bool ctrl_key_down) {
+static int esc_seq_process_vk(WORD vk, bool ctrl_key_down) {
for (item_t *p = (ctrl_key_down ? ctrlKeyCodeMap : keyCodeMap); p->vkey != 0; ++p) {
if (p->vkey == vk) {
cur_esc_seq = p->seq;
@@ -175,7 +175,7 @@ STATIC int esc_seq_process_vk(WORD vk, bool ctrl_key_down) {
return 0; // nothing found
}
-STATIC int esc_seq_chr() {
+static int esc_seq_chr() {
if (cur_esc_seq) {
const char c = *cur_esc_seq++;
if (c) {
diff --git a/ports/zephyr/machine_i2c.c b/ports/zephyr/machine_i2c.c
index 36d88204f4..27c0a63a0e 100644
--- a/ports/zephyr/machine_i2c.c
+++ b/ports/zephyr/machine_i2c.c
@@ -46,7 +46,7 @@ typedef struct _machine_hard_i2c_obj_t {
bool restart;
} machine_hard_i2c_obj_t;
-STATIC void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_i2c_obj_t *self = self_in;
mp_printf(print, "%s", self->dev->name);
}
@@ -90,7 +90,7 @@ mp_obj_t machine_hard_i2c_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC int machine_hard_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
+static int machine_hard_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) {
machine_hard_i2c_obj_t *self = (machine_hard_i2c_obj_t *)self_in;
struct i2c_msg msg;
int ret;
@@ -120,7 +120,7 @@ STATIC int machine_hard_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t add
return (ret < 0) ? -MP_EIO : len;
}
-STATIC const mp_machine_i2c_p_t machine_hard_i2c_p = {
+static const mp_machine_i2c_p_t machine_hard_i2c_p = {
.transfer = mp_machine_i2c_transfer_adaptor,
.transfer_single = machine_hard_i2c_transfer_single,
};
diff --git a/ports/zephyr/machine_pin.c b/ports/zephyr/machine_pin.c
index d27b590092..97a852be8a 100644
--- a/ports/zephyr/machine_pin.c
+++ b/ports/zephyr/machine_pin.c
@@ -47,7 +47,7 @@ typedef struct _machine_pin_irq_obj_t {
struct gpio_callback callback;
} machine_pin_irq_obj_t;
-STATIC const mp_irq_methods_t machine_pin_irq_methods;
+static const mp_irq_methods_t machine_pin_irq_methods;
const mp_obj_base_t machine_pin_obj_template = {&machine_pin_type};
void machine_pin_deinit(void) {
@@ -59,7 +59,7 @@ void machine_pin_deinit(void) {
MP_STATE_PORT(machine_pin_irq_list) = NULL;
}
-STATIC void gpio_callback_handler(const struct device *port, struct gpio_callback *cb, gpio_port_pins_t pins) {
+static void gpio_callback_handler(const struct device *port, struct gpio_callback *cb, gpio_port_pins_t pins) {
machine_pin_irq_obj_t *irq = CONTAINER_OF(cb, machine_pin_irq_obj_t, callback);
#if MICROPY_STACK_CHECK
@@ -80,13 +80,13 @@ STATIC void gpio_callback_handler(const struct device *port, struct gpio_callbac
#endif
}
-STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_pin_obj_t *self = self_in;
mp_printf(print, "<Pin %p %d>", self->port, self->pin);
}
// pin.init(mode, pull=None, *, value)
-STATIC mp_obj_t machine_pin_obj_init_helper(machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init_helper(machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mode, ARG_pull, ARG_value };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT },
@@ -154,7 +154,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
}
// fast method for getting/setting pin value
-STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
machine_pin_obj_t *self = self_in;
if (n_args == 0) {
@@ -167,33 +167,33 @@ STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, size_t n_args, size_t n_kw, c
}
// pin.init(mode, pull)
-STATIC mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_init_obj, 1, machine_pin_obj_init);
// pin.value([value])
-STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) {
return machine_pin_call(args[0], n_args - 1, 0, args + 1);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value);
-STATIC mp_obj_t machine_pin_off(mp_obj_t self_in) {
+static mp_obj_t machine_pin_off(mp_obj_t self_in) {
machine_pin_obj_t *self = self_in;
(void)gpio_pin_set_raw(self->port, self->pin, 0);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_off_obj, machine_pin_off);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_off_obj, machine_pin_off);
-STATIC mp_obj_t machine_pin_on(mp_obj_t self_in) {
+static mp_obj_t machine_pin_on(mp_obj_t self_in) {
machine_pin_obj_t *self = self_in;
(void)gpio_pin_set_raw(self->port, self->pin, 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_on_obj, machine_pin_on);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_on_obj, machine_pin_on);
// pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING, hard=False)
-STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_handler, ARG_trigger, ARG_hard };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -246,9 +246,9 @@ STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_
return MP_OBJ_FROM_PTR(self->irq);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
+static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
-STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
machine_pin_obj_t *self = self_in;
@@ -263,7 +263,7 @@ STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return -1;
}
-STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
+static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
// instance methods
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pin_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&machine_pin_value_obj) },
@@ -280,9 +280,9 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_INT_EDGE_FALLING) },
};
-STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
+static MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
-STATIC const mp_pin_p_t machine_pin_pin_p = {
+static const mp_pin_p_t machine_pin_pin_p = {
.ioctl = machine_pin_ioctl,
};
@@ -297,7 +297,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &machine_pin_locals_dict
);
-STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
+static mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (new_trigger == 0) {
new_trigger = GPIO_INT_DISABLE;
@@ -309,7 +309,7 @@ STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger
return 0;
}
-STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
+static mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (info_type == MP_IRQ_INFO_FLAGS) {
return gpio_get_pending_int(self->port);
@@ -319,7 +319,7 @@ STATIC mp_uint_t machine_pin_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
return 0;
}
-STATIC const mp_irq_methods_t machine_pin_irq_methods = {
+static const mp_irq_methods_t machine_pin_irq_methods = {
.trigger = machine_pin_irq_trigger,
.info = machine_pin_irq_info,
};
diff --git a/ports/zephyr/machine_spi.c b/ports/zephyr/machine_spi.c
index 5c882a6ae3..5c090e15cf 100644
--- a/ports/zephyr/machine_spi.c
+++ b/ports/zephyr/machine_spi.c
@@ -52,7 +52,7 @@ typedef struct _machine_hard_spi_obj_t {
struct spi_config config;
} machine_hard_spi_obj_t;
-STATIC void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void machine_hard_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_hard_spi_obj_t *self = self_in;
mp_printf(print, "SPI(%s, baudrate=%u, polarity=%u, phase=%u, bits=%u, firstbit=%s)",
self->dev->name,
@@ -112,7 +112,7 @@ mp_obj_t machine_hard_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz
return MP_OBJ_FROM_PTR(self);
}
-STATIC void machine_hard_spi_init(mp_obj_base_t *obj, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void machine_hard_spi_init(mp_obj_base_t *obj, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit};
static const mp_arg_t allowed_args[] = {
@@ -163,7 +163,7 @@ STATIC void machine_hard_spi_init(mp_obj_base_t *obj, size_t n_args, const mp_ob
self->config = cfg;
}
-STATIC void machine_hard_spi_transfer(mp_obj_base_t *obj, size_t len, const uint8_t *src, uint8_t *dest) {
+static void machine_hard_spi_transfer(mp_obj_base_t *obj, size_t len, const uint8_t *src, uint8_t *dest) {
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t *)obj;
int ret;
@@ -191,7 +191,7 @@ STATIC void machine_hard_spi_transfer(mp_obj_base_t *obj, size_t len, const uint
}
}
-STATIC const mp_machine_spi_p_t machine_hard_spi_p = {
+static const mp_machine_spi_p_t machine_hard_spi_p = {
.init = machine_hard_spi_init,
.transfer = machine_hard_spi_transfer,
};
diff --git a/ports/zephyr/machine_uart.c b/ports/zephyr/machine_uart.c
index 2c4b3a470b..bd40137a3e 100644
--- a/ports/zephyr/machine_uart.c
+++ b/ports/zephyr/machine_uart.c
@@ -43,12 +43,12 @@ typedef struct _machine_uart_obj_t {
uint16_t timeout_char; // timeout waiting between chars (in ms)
} machine_uart_obj_t;
-STATIC const char *_parity_name[] = {"None", "Odd", "Even", "Mark", "Space"};
-STATIC const char *_stop_bits_name[] = {"0.5", "1", "1.5", "2"};
-STATIC const char *_data_bits_name[] = {"5", "6", "7", "8", "9"};
-STATIC const char *_flow_control_name[] = {"None", "RTS/CTS", "DTR/DSR"};
+static const char *_parity_name[] = {"None", "Odd", "Even", "Mark", "Space"};
+static const char *_stop_bits_name[] = {"0.5", "1", "1.5", "2"};
+static const char *_data_bits_name[] = {"5", "6", "7", "8", "9"};
+static const char *_flow_control_name[] = {"None", "RTS/CTS", "DTR/DSR"};
-STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
struct uart_config config;
uart_config_get(self->dev, &config);
@@ -58,7 +58,7 @@ STATIC void mp_machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_
self->timeout, self->timeout_char);
}
-STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_timeout, ARG_timeout_char };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
@@ -71,7 +71,7 @@ STATIC void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
self->timeout_char = args[ARG_timeout_char].u_int;
}
-STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
machine_uart_obj_t *self = mp_obj_malloc(machine_uart_obj_t, &machine_uart_type);
@@ -87,21 +87,21 @@ STATIC mp_obj_t mp_machine_uart_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
-STATIC void mp_machine_uart_deinit(machine_uart_obj_t *self) {
+static void mp_machine_uart_deinit(machine_uart_obj_t *self) {
(void)self;
}
-STATIC mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
+static mp_int_t mp_machine_uart_any(machine_uart_obj_t *self) {
(void)self;
mp_raise_NotImplementedError(NULL); // TODO
}
-STATIC bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
+static bool mp_machine_uart_txdone(machine_uart_obj_t *self) {
(void)self;
mp_raise_NotImplementedError(NULL); // TODO
}
-STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t *buffer = (uint8_t *)buf_in;
uint8_t data;
@@ -122,7 +122,7 @@ STATIC mp_uint_t mp_machine_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t
return bytes_read;
}
-STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
+static mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint8_t *buffer = (uint8_t *)buf_in;
@@ -133,7 +133,7 @@ STATIC mp_uint_t mp_machine_uart_write(mp_obj_t self_in, const void *buf_in, mp_
return size;
}
-STATIC mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t mp_machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c
index 36bc628bbe..314bbfd263 100644
--- a/ports/zephyr/main.c
+++ b/ports/zephyr/main.c
@@ -96,7 +96,7 @@ void init_zephyr(void) {
}
#if MICROPY_VFS
-STATIC void vfs_init(void) {
+static void vfs_init(void) {
mp_obj_t bdev = NULL;
mp_obj_t mount_point;
const char *mount_point_str = NULL;
diff --git a/ports/zephyr/modbluetooth_zephyr.c b/ports/zephyr/modbluetooth_zephyr.c
index 279e4ca9a0..b427a6cd98 100644
--- a/ports/zephyr/modbluetooth_zephyr.c
+++ b/ports/zephyr/modbluetooth_zephyr.c
@@ -61,21 +61,21 @@ typedef struct _mp_bluetooth_zephyr_root_pointers_t {
mp_gatts_db_t gatts_db;
} mp_bluetooth_zephyr_root_pointers_t;
-STATIC int mp_bluetooth_zephyr_ble_state;
+static int mp_bluetooth_zephyr_ble_state;
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
-STATIC int mp_bluetooth_zephyr_gap_scan_state;
-STATIC struct k_timer mp_bluetooth_zephyr_gap_scan_timer;
-STATIC struct bt_le_scan_cb mp_bluetooth_zephyr_gap_scan_cb_struct;
+static int mp_bluetooth_zephyr_gap_scan_state;
+static struct k_timer mp_bluetooth_zephyr_gap_scan_timer;
+static struct bt_le_scan_cb mp_bluetooth_zephyr_gap_scan_cb_struct;
#endif
-STATIC int bt_err_to_errno(int err) {
+static int bt_err_to_errno(int err) {
// Zephyr uses errno codes directly, but they are negative.
return -err;
}
// modbluetooth (and the layers above it) work in BE for addresses, Zephyr works in LE.
-STATIC void reverse_addr_byte_order(uint8_t *addr_out, const bt_addr_le_t *addr_in) {
+static void reverse_addr_byte_order(uint8_t *addr_out, const bt_addr_le_t *addr_in) {
for (int i = 0; i < 6; ++i) {
addr_out[i] = addr_in->a.val[5 - i];
}
@@ -98,12 +98,12 @@ void gap_scan_cb_recv(const struct bt_le_scan_recv_info *info, struct net_buf_si
mp_bluetooth_gap_on_scan_result(info->addr->type, addr, info->adv_type, info->rssi, buf->data, buf->len);
}
-STATIC mp_obj_t gap_scan_stop(mp_obj_t unused) {
+static mp_obj_t gap_scan_stop(mp_obj_t unused) {
(void)unused;
mp_bluetooth_gap_scan_stop();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(gap_scan_stop_obj, gap_scan_stop);
+static MP_DEFINE_CONST_FUN_OBJ_1(gap_scan_stop_obj, gap_scan_stop);
void gap_scan_cb_timeout(struct k_timer *timer_id) {
DEBUG_printf("gap_scan_cb_timeout\n");
@@ -212,7 +212,7 @@ int mp_bluetooth_gap_set_device_name(const uint8_t *buf, size_t len) {
// Zephyr takes advertising/scan data as an array of (type, len, payload) packets,
// and this function constructs such an array from raw advertising/scan data.
-STATIC void mp_bluetooth_prepare_bt_data(const uint8_t *data, size_t len, struct bt_data *bt_data, size_t *bt_len) {
+static void mp_bluetooth_prepare_bt_data(const uint8_t *data, size_t len, struct bt_data *bt_data, size_t *bt_len) {
size_t i = 0;
const uint8_t *d = data;
while (d < data + len && i < *bt_len) {
diff --git a/ports/zephyr/modmachine.c b/ports/zephyr/modmachine.c
index 7015989784..bbb9280a5d 100644
--- a/ports/zephyr/modmachine.c
+++ b/ports/zephyr/modmachine.c
@@ -45,19 +45,19 @@
{ MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) }, \
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, \
-STATIC mp_obj_t machine_reset(void) {
+static mp_obj_t machine_reset(void) {
sys_reboot(SYS_REBOOT_COLD);
// Won't get here, Zephyr has infiniloop on its side
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
-STATIC mp_obj_t machine_reset_cause(void) {
+static mp_obj_t machine_reset_cause(void) {
printf("Warning: %s is not implemented\n", __func__);
return MP_OBJ_NEW_SMALL_INT(42);
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
-STATIC void mp_machine_idle(void) {
+static void mp_machine_idle(void) {
k_yield();
}
diff --git a/ports/zephyr/modsocket.c b/ports/zephyr/modsocket.c
index 3d91fa9769..12c4c934bc 100644
--- a/ports/zephyr/modsocket.c
+++ b/ports/zephyr/modsocket.c
@@ -59,21 +59,21 @@ typedef struct _socket_obj_t {
int8_t state;
} socket_obj_t;
-STATIC const mp_obj_type_t socket_type;
+static const mp_obj_type_t socket_type;
// Helper functions
#define RAISE_ERRNO(x) { int _err = x; if (_err < 0) mp_raise_OSError(-_err); }
#define RAISE_SOCK_ERRNO(x) { if ((int)(x) == -1) mp_raise_OSError(errno); }
-STATIC void socket_check_closed(socket_obj_t *socket) {
+static void socket_check_closed(socket_obj_t *socket) {
if (socket->ctx == -1) {
// already closed
mp_raise_OSError(EBADF);
}
}
-STATIC void parse_inet_addr(socket_obj_t *socket, mp_obj_t addr_in, struct sockaddr *sockaddr) {
+static void parse_inet_addr(socket_obj_t *socket, mp_obj_t addr_in, struct sockaddr *sockaddr) {
// We employ the fact that port and address offsets are the same for IPv4 & IPv6
struct sockaddr_in *sockaddr_in = (struct sockaddr_in *)sockaddr;
@@ -85,7 +85,7 @@ STATIC void parse_inet_addr(socket_obj_t *socket, mp_obj_t addr_in, struct socka
sockaddr_in->sin_port = htons(mp_obj_get_int(addr_items[1]));
}
-STATIC mp_obj_t format_inet_addr(struct sockaddr *addr, mp_obj_t port) {
+static mp_obj_t format_inet_addr(struct sockaddr *addr, mp_obj_t port) {
// We employ the fact that port and address offsets are the same for IPv4 & IPv6
struct sockaddr_in6 *sockaddr_in6 = (struct sockaddr_in6 *)addr;
char buf[40];
@@ -114,7 +114,7 @@ socket_obj_t *socket_new(void) {
// Methods
-STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
socket_obj_t *self = self_in;
if (self->ctx == -1) {
mp_printf(print, "<socket NULL>");
@@ -124,7 +124,7 @@ STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin
}
}
-STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 4, false);
socket_obj_t *socket = socket_new();
@@ -156,7 +156,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(socket);
}
-STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
socket_obj_t *socket = self_in;
socket_check_closed(socket);
@@ -168,9 +168,9 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
-STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
+static mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
socket_obj_t *socket = self_in;
socket_check_closed(socket);
@@ -182,10 +182,10 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
// method socket.listen([backlog])
-STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
socket_obj_t *socket = args[0];
socket_check_closed(socket);
@@ -200,9 +200,9 @@ STATIC mp_obj_t socket_listen(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
-STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
+static mp_obj_t socket_accept(mp_obj_t self_in) {
socket_obj_t *socket = self_in;
socket_check_closed(socket);
@@ -220,9 +220,9 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
return MP_OBJ_FROM_PTR(client);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
+static MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
-STATIC mp_uint_t sock_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t sock_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
socket_obj_t *socket = self_in;
if (socket->ctx == -1) {
// already closed
@@ -239,7 +239,7 @@ STATIC mp_uint_t sock_write(mp_obj_t self_in, const void *buf, mp_uint_t size, i
return len;
}
-STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
+static mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
int err = 0;
@@ -249,9 +249,9 @@ STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
}
return mp_obj_new_int_from_uint(len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
-STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *errcode) {
+static mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *errcode) {
socket_obj_t *socket = self_in;
if (socket->ctx == -1) {
// already closed
@@ -268,7 +268,7 @@ STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *
return recv_len;
}
-STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
+static mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
mp_int_t max_len = mp_obj_get_int(len_in);
vstr_t vstr;
// +1 to accommodate for trailing \0
@@ -290,22 +290,22 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
vstr.len = len;
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
+static MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
-STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
(void)n_args; // always 4
mp_warning(MP_WARN_CAT(RuntimeWarning), "setsockopt() not implemented");
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
-STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return args[0];
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
-STATIC mp_uint_t sock_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t sock_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
socket_obj_t *socket = o_in;
(void)arg;
switch (request) {
@@ -327,7 +327,7 @@ STATIC mp_uint_t sock_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int
}
}
-STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
+static const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socket_bind_obj) },
@@ -344,15 +344,15 @@ STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&socket_makefile_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
+static MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
-STATIC const mp_stream_p_t socket_stream_p = {
+static const mp_stream_p_t socket_stream_p = {
.read = sock_read,
.write = sock_write,
.ioctl = sock_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
socket_type,
MP_QSTR_socket,
MP_TYPE_FLAG_NONE,
@@ -397,7 +397,7 @@ void dns_resolve_cb(enum dns_resolve_status status, struct dns_addrinfo *info, v
mp_obj_list_append(state->result, MP_OBJ_FROM_PTR(tuple));
}
-STATIC mp_obj_t mod_getaddrinfo(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_getaddrinfo(size_t n_args, const mp_obj_t *args) {
mp_obj_t host_in = args[0], port_in = args[1];
const char *host = mp_obj_str_get_str(host_in);
mp_int_t family = 0;
@@ -431,10 +431,10 @@ STATIC mp_obj_t mod_getaddrinfo(size_t n_args, const mp_obj_t *args) {
return state.result;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_getaddrinfo_obj, 2, 3, mod_getaddrinfo);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_getaddrinfo_obj, 2, 3, mod_getaddrinfo);
-STATIC mp_obj_t pkt_get_info(void) {
+static mp_obj_t pkt_get_info(void) {
struct k_mem_slab *rx, *tx;
struct net_buf_pool *rx_data, *tx_data;
net_pkt_get_info(&rx, &tx, &rx_data, &tx_data);
@@ -445,9 +445,9 @@ STATIC mp_obj_t pkt_get_info(void) {
t->items[3] = MP_OBJ_NEW_SMALL_INT(tx_data->avail_count);
return MP_OBJ_FROM_PTR(t);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(pkt_get_info_obj, pkt_get_info);
+static MP_DEFINE_CONST_FUN_OBJ_0(pkt_get_info_obj, pkt_get_info);
-STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socket) },
// objects
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) },
@@ -465,7 +465,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_pkt_get_info), MP_ROM_PTR(&pkt_get_info_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
const mp_obj_module_t mp_module_socket = {
.base = { &mp_type_module },
diff --git a/ports/zephyr/modtime.c b/ports/zephyr/modtime.c
index 65ba1e6e69..f1181232ae 100644
--- a/ports/zephyr/modtime.c
+++ b/ports/zephyr/modtime.c
@@ -29,7 +29,7 @@
#include "py/obj.h"
-STATIC mp_obj_t mp_time_time_get(void) {
+static mp_obj_t mp_time_time_get(void) {
/* The absence of FP support is deliberate. The Zephyr port uses
* single precision floats so the fraction component will start to
* lose precision on devices with a long uptime.
diff --git a/ports/zephyr/modzephyr.c b/ports/zephyr/modzephyr.c
index f87e2e33f3..2e3fc2fecf 100644
--- a/ports/zephyr/modzephyr.c
+++ b/ports/zephyr/modzephyr.c
@@ -37,34 +37,34 @@
#include "modzephyr.h"
#include "py/runtime.h"
-STATIC mp_obj_t mod_is_preempt_thread(void) {
+static mp_obj_t mod_is_preempt_thread(void) {
return mp_obj_new_bool(k_is_preempt_thread());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_is_preempt_thread_obj, mod_is_preempt_thread);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_is_preempt_thread_obj, mod_is_preempt_thread);
-STATIC mp_obj_t mod_current_tid(void) {
+static mp_obj_t mod_current_tid(void) {
return MP_OBJ_NEW_SMALL_INT(k_current_get());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_current_tid_obj, mod_current_tid);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_current_tid_obj, mod_current_tid);
#ifdef CONFIG_THREAD_ANALYZER
-STATIC mp_obj_t mod_thread_analyze(void) {
+static mp_obj_t mod_thread_analyze(void) {
thread_analyzer_print();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_analyze_obj, mod_thread_analyze);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_analyze_obj, mod_thread_analyze);
#endif
#ifdef CONFIG_SHELL_BACKEND_SERIAL
-STATIC mp_obj_t mod_shell_exec(mp_obj_t cmd_in) {
+static mp_obj_t mod_shell_exec(mp_obj_t cmd_in) {
const char *cmd = mp_obj_str_get_str(cmd_in);
shell_execute_cmd(shell_backend_uart_get_ptr(), cmd);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_shell_exec_obj, mod_shell_exec);
+static MP_DEFINE_CONST_FUN_OBJ_1(mod_shell_exec_obj, mod_shell_exec);
#endif // CONFIG_SHELL_BACKEND_SERIAL
-STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_time_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_zephyr) },
{ MP_ROM_QSTR(MP_QSTR_is_preempt_thread), MP_ROM_PTR(&mod_is_preempt_thread_obj) },
{ MP_ROM_QSTR(MP_QSTR_current_tid), MP_ROM_PTR(&mod_current_tid_obj) },
@@ -82,7 +82,7 @@ STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);
const mp_obj_module_t mp_module_zephyr = {
.base = { &mp_type_module },
diff --git a/ports/zephyr/modzsensor.c b/ports/zephyr/modzsensor.c
index 5b55f0ebba..2a7278a614 100644
--- a/ports/zephyr/modzsensor.c
+++ b/ports/zephyr/modzsensor.c
@@ -38,7 +38,7 @@ typedef struct _mp_obj_sensor_t {
const struct device *dev;
} mp_obj_sensor_t;
-STATIC mp_obj_t sensor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t sensor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
mp_obj_sensor_t *o = mp_obj_malloc(mp_obj_sensor_t, type);
o->dev = device_get_binding(mp_obj_str_get_str(args[0]));
@@ -48,7 +48,7 @@ STATIC mp_obj_t sensor_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t sensor_measure(mp_obj_t self_in) {
+static mp_obj_t sensor_measure(mp_obj_t self_in) {
mp_obj_sensor_t *self = MP_OBJ_TO_PTR(self_in);
int st = sensor_sample_fetch(self->dev);
if (st != 0) {
@@ -58,7 +58,7 @@ STATIC mp_obj_t sensor_measure(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(sensor_measure_obj, sensor_measure);
-STATIC void sensor_get_internal(mp_obj_t self_in, mp_obj_t channel_in, struct sensor_value *res) {
+static void sensor_get_internal(mp_obj_t self_in, mp_obj_t channel_in, struct sensor_value *res) {
mp_obj_sensor_t *self = MP_OBJ_TO_PTR(self_in);
int st = sensor_channel_get(self->dev, mp_obj_get_int(channel_in), res);
@@ -67,35 +67,35 @@ STATIC void sensor_get_internal(mp_obj_t self_in, mp_obj_t channel_in, struct se
}
}
-STATIC mp_obj_t sensor_get_float(mp_obj_t self_in, mp_obj_t channel_in) {
+static mp_obj_t sensor_get_float(mp_obj_t self_in, mp_obj_t channel_in) {
struct sensor_value val;
sensor_get_internal(self_in, channel_in, &val);
return mp_obj_new_float(val.val1 + (mp_float_t)val.val2 / 1000000);
}
MP_DEFINE_CONST_FUN_OBJ_2(sensor_get_float_obj, sensor_get_float);
-STATIC mp_obj_t sensor_get_micros(mp_obj_t self_in, mp_obj_t channel_in) {
+static mp_obj_t sensor_get_micros(mp_obj_t self_in, mp_obj_t channel_in) {
struct sensor_value val;
sensor_get_internal(self_in, channel_in, &val);
return MP_OBJ_NEW_SMALL_INT(val.val1 * 1000000 + val.val2);
}
MP_DEFINE_CONST_FUN_OBJ_2(sensor_get_micros_obj, sensor_get_micros);
-STATIC mp_obj_t sensor_get_millis(mp_obj_t self_in, mp_obj_t channel_in) {
+static mp_obj_t sensor_get_millis(mp_obj_t self_in, mp_obj_t channel_in) {
struct sensor_value val;
sensor_get_internal(self_in, channel_in, &val);
return MP_OBJ_NEW_SMALL_INT(val.val1 * 1000 + val.val2 / 1000);
}
MP_DEFINE_CONST_FUN_OBJ_2(sensor_get_millis_obj, sensor_get_millis);
-STATIC mp_obj_t sensor_get_int(mp_obj_t self_in, mp_obj_t channel_in) {
+static mp_obj_t sensor_get_int(mp_obj_t self_in, mp_obj_t channel_in) {
struct sensor_value val;
sensor_get_internal(self_in, channel_in, &val);
return MP_OBJ_NEW_SMALL_INT(val.val1);
}
MP_DEFINE_CONST_FUN_OBJ_2(sensor_get_int_obj, sensor_get_int);
-STATIC const mp_rom_map_elem_t sensor_locals_dict_table[] = {
+static const mp_rom_map_elem_t sensor_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_measure), MP_ROM_PTR(&sensor_measure_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_float), MP_ROM_PTR(&sensor_get_float_obj) },
{ MP_ROM_QSTR(MP_QSTR_get_micros), MP_ROM_PTR(&sensor_get_micros_obj) },
@@ -103,9 +103,9 @@ STATIC const mp_rom_map_elem_t sensor_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_get_int), MP_ROM_PTR(&sensor_get_int_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(sensor_locals_dict, sensor_locals_dict_table);
+static MP_DEFINE_CONST_DICT(sensor_locals_dict, sensor_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
sensor_type,
MP_QSTR_Sensor,
MP_TYPE_FLAG_NONE,
@@ -113,7 +113,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &sensor_locals_dict
);
-STATIC const mp_rom_map_elem_t mp_module_zsensor_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_zsensor_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_zsensor) },
{ MP_ROM_QSTR(MP_QSTR_Sensor), MP_ROM_PTR(&sensor_type) },
@@ -136,7 +136,7 @@ STATIC const mp_rom_map_elem_t mp_module_zsensor_globals_table[] = {
#undef C
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_zsensor_globals, mp_module_zsensor_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_zsensor_globals, mp_module_zsensor_globals_table);
const mp_obj_module_t mp_module_zsensor = {
.base = { &mp_type_module },
diff --git a/ports/zephyr/zephyr_storage.c b/ports/zephyr/zephyr_storage.c
index 498fea6fb1..af1772205e 100644
--- a/ports/zephyr/zephyr_storage.c
+++ b/ports/zephyr/zephyr_storage.c
@@ -47,12 +47,12 @@ typedef struct _zephyr_disk_access_obj_t {
int block_count;
} zephyr_disk_access_obj_t;
-STATIC void zephyr_disk_access_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void zephyr_disk_access_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
zephyr_disk_access_obj_t *self = self_in;
mp_printf(print, "DiskAccess(%s)", self->pdrv);
}
-STATIC mp_obj_t zephyr_disk_access_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t zephyr_disk_access_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
zephyr_disk_access_obj_t *self = mp_obj_malloc(zephyr_disk_access_obj_t, type);
self->pdrv = mp_obj_str_get_str(args[0]);
@@ -72,7 +72,7 @@ STATIC mp_obj_t zephyr_disk_access_make_new(const mp_obj_type_t *type, size_t n_
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t zephyr_disk_access_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t zephyr_disk_access_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
zephyr_disk_access_obj_t *self = self_in;
mp_buffer_info_t bufinfo;
int ret;
@@ -81,9 +81,9 @@ STATIC mp_obj_t zephyr_disk_access_readblocks(mp_obj_t self_in, mp_obj_t block_n
ret = disk_access_read(self->pdrv, bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / self->block_size);
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(zephyr_disk_access_readblocks_obj, zephyr_disk_access_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(zephyr_disk_access_readblocks_obj, zephyr_disk_access_readblocks);
-STATIC mp_obj_t zephyr_disk_access_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
+static mp_obj_t zephyr_disk_access_writeblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf) {
zephyr_disk_access_obj_t *self = self_in;
mp_buffer_info_t bufinfo;
int ret;
@@ -92,9 +92,9 @@ STATIC mp_obj_t zephyr_disk_access_writeblocks(mp_obj_t self_in, mp_obj_t block_
ret = disk_access_write(self->pdrv, bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / self->block_size);
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(zephyr_disk_access_writeblocks_obj, zephyr_disk_access_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_3(zephyr_disk_access_writeblocks_obj, zephyr_disk_access_writeblocks);
-STATIC mp_obj_t zephyr_disk_access_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t zephyr_disk_access_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
zephyr_disk_access_obj_t *self = self_in;
mp_int_t cmd = mp_obj_get_int(cmd_in);
int buf;
@@ -119,14 +119,14 @@ STATIC mp_obj_t zephyr_disk_access_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_o
return MP_OBJ_NEW_SMALL_INT(-1);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(zephyr_disk_access_ioctl_obj, zephyr_disk_access_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(zephyr_disk_access_ioctl_obj, zephyr_disk_access_ioctl);
-STATIC const mp_rom_map_elem_t zephyr_disk_access_locals_dict_table[] = {
+static const mp_rom_map_elem_t zephyr_disk_access_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&zephyr_disk_access_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&zephyr_disk_access_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&zephyr_disk_access_ioctl_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(zephyr_disk_access_locals_dict, zephyr_disk_access_locals_dict_table);
+static MP_DEFINE_CONST_DICT(zephyr_disk_access_locals_dict, zephyr_disk_access_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
zephyr_disk_access_type,
@@ -149,12 +149,12 @@ typedef struct _zephyr_flash_area_obj_t {
uint8_t id;
} zephyr_flash_area_obj_t;
-STATIC void zephyr_flash_area_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void zephyr_flash_area_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
zephyr_flash_area_obj_t *self = self_in;
mp_printf(print, "FlashArea(%d)", self->id);
}
-STATIC mp_obj_t zephyr_flash_area_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t zephyr_flash_area_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, 2, false);
zephyr_flash_area_obj_t *self = mp_obj_malloc(zephyr_flash_area_obj_t, type);
self->id = mp_obj_get_int(args[0]);
@@ -173,7 +173,7 @@ STATIC mp_obj_t zephyr_flash_area_make_new(const mp_obj_type_t *type, size_t n_a
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t zephyr_flash_area_readblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t zephyr_flash_area_readblocks(size_t n_args, const mp_obj_t *args) {
zephyr_flash_area_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t block_num = mp_obj_get_int(args[1]);
off_t offset = block_num * self->block_size;
@@ -188,9 +188,9 @@ STATIC mp_obj_t zephyr_flash_area_readblocks(size_t n_args, const mp_obj_t *args
ret = flash_area_read(self->area, offset, bufinfo.buf, bufinfo.len);
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(zephyr_flash_area_readblocks_obj, 3, 4, zephyr_flash_area_readblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(zephyr_flash_area_readblocks_obj, 3, 4, zephyr_flash_area_readblocks);
-STATIC mp_obj_t zephyr_flash_area_writeblocks(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t zephyr_flash_area_writeblocks(size_t n_args, const mp_obj_t *args) {
zephyr_flash_area_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint32_t block_num = mp_obj_get_int(args[1]);
off_t offset = block_num * self->block_size;
@@ -210,9 +210,9 @@ STATIC mp_obj_t zephyr_flash_area_writeblocks(size_t n_args, const mp_obj_t *arg
ret = flash_area_write(self->area, offset, bufinfo.buf, bufinfo.len);
return MP_OBJ_NEW_SMALL_INT(ret);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(zephyr_flash_area_writeblocks_obj, 3, 4, zephyr_flash_area_writeblocks);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(zephyr_flash_area_writeblocks_obj, 3, 4, zephyr_flash_area_writeblocks);
-STATIC mp_obj_t zephyr_flash_area_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
+static mp_obj_t zephyr_flash_area_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) {
zephyr_flash_area_obj_t *self = self_in;
mp_int_t cmd = mp_obj_get_int(cmd_in);
mp_int_t block_num = mp_obj_get_int(arg_in);
@@ -238,9 +238,9 @@ STATIC mp_obj_t zephyr_flash_area_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_ob
return MP_OBJ_NEW_SMALL_INT(-1);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(zephyr_flash_area_ioctl_obj, zephyr_flash_area_ioctl);
+static MP_DEFINE_CONST_FUN_OBJ_3(zephyr_flash_area_ioctl_obj, zephyr_flash_area_ioctl);
-STATIC const mp_rom_map_elem_t zephyr_flash_area_locals_dict_table[] = {
+static const mp_rom_map_elem_t zephyr_flash_area_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&zephyr_flash_area_readblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&zephyr_flash_area_writeblocks_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&zephyr_flash_area_ioctl_obj) },
@@ -248,7 +248,7 @@ STATIC const mp_rom_map_elem_t zephyr_flash_area_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_STORAGE), MP_ROM_INT(FLASH_AREA_ID(storage)) },
#endif
};
-STATIC MP_DEFINE_CONST_DICT(zephyr_flash_area_locals_dict, zephyr_flash_area_locals_dict_table);
+static MP_DEFINE_CONST_DICT(zephyr_flash_area_locals_dict, zephyr_flash_area_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
zephyr_flash_area_type,
diff --git a/py/asmarm.c b/py/asmarm.c
index 42724e4d4b..cd346949eb 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -39,7 +39,7 @@
#define SIGNED_FIT24(x) (((x) & 0xff800000) == 0) || (((x) & 0xff000000) == 0xff000000)
// Insert word into instruction flow
-STATIC void emit(asm_arm_t *as, uint op) {
+static void emit(asm_arm_t *as, uint op) {
uint8_t *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 4);
if (c != NULL) {
*(uint32_t *)c = op;
@@ -47,73 +47,73 @@ STATIC void emit(asm_arm_t *as, uint op) {
}
// Insert word into instruction flow, add "ALWAYS" condition code
-STATIC void emit_al(asm_arm_t *as, uint op) {
+static void emit_al(asm_arm_t *as, uint op) {
emit(as, op | ASM_ARM_CC_AL);
}
// Basic instructions without condition code
-STATIC uint asm_arm_op_push(uint reglist) {
+static uint asm_arm_op_push(uint reglist) {
// stmfd sp!, {reglist}
return 0x92d0000 | (reglist & 0xFFFF);
}
-STATIC uint asm_arm_op_pop(uint reglist) {
+static uint asm_arm_op_pop(uint reglist) {
// ldmfd sp!, {reglist}
return 0x8bd0000 | (reglist & 0xFFFF);
}
-STATIC uint asm_arm_op_mov_reg(uint rd, uint rn) {
+static uint asm_arm_op_mov_reg(uint rd, uint rn) {
// mov rd, rn
return 0x1a00000 | (rd << 12) | rn;
}
-STATIC uint asm_arm_op_mov_imm(uint rd, uint imm) {
+static uint asm_arm_op_mov_imm(uint rd, uint imm) {
// mov rd, #imm
return 0x3a00000 | (rd << 12) | imm;
}
-STATIC uint asm_arm_op_mvn_imm(uint rd, uint imm) {
+static uint asm_arm_op_mvn_imm(uint rd, uint imm) {
// mvn rd, #imm
return 0x3e00000 | (rd << 12) | imm;
}
-STATIC uint asm_arm_op_add_imm(uint rd, uint rn, uint imm) {
+static uint asm_arm_op_add_imm(uint rd, uint rn, uint imm) {
// add rd, rn, #imm
return 0x2800000 | (rn << 16) | (rd << 12) | (imm & 0xFF);
}
-STATIC uint asm_arm_op_add_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_add_reg(uint rd, uint rn, uint rm) {
// add rd, rn, rm
return 0x0800000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_sub_imm(uint rd, uint rn, uint imm) {
+static uint asm_arm_op_sub_imm(uint rd, uint rn, uint imm) {
// sub rd, rn, #imm
return 0x2400000 | (rn << 16) | (rd << 12) | (imm & 0xFF);
}
-STATIC uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
// sub rd, rn, rm
return 0x0400000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_mul_reg(uint rd, uint rm, uint rs) {
+static uint asm_arm_op_mul_reg(uint rd, uint rm, uint rs) {
// mul rd, rm, rs
assert(rd != rm);
return 0x0000090 | (rd << 16) | (rs << 8) | rm;
}
-STATIC uint asm_arm_op_and_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_and_reg(uint rd, uint rn, uint rm) {
// and rd, rn, rm
return 0x0000000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_eor_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_eor_reg(uint rd, uint rn, uint rm) {
// eor rd, rn, rm
return 0x0200000 | (rn << 16) | (rd << 12) | rm;
}
-STATIC uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
+static uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
// orr rd, rn, rm
return 0x1800000 | (rn << 16) | (rd << 12) | rm;
}
diff --git a/py/asmthumb.c b/py/asmthumb.c
index 395134028a..0df79e5fd6 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -79,7 +79,7 @@ static inline byte *asm_thumb_get_cur_to_write_bytes(asm_thumb_t *as, int n) {
}
/*
-STATIC void asm_thumb_write_byte_1(asm_thumb_t *as, byte b1) {
+static void asm_thumb_write_byte_1(asm_thumb_t *as, byte b1) {
byte *c = asm_thumb_get_cur_to_write_bytes(as, 1);
c[0] = b1;
}
@@ -91,7 +91,7 @@ STATIC void asm_thumb_write_byte_1(asm_thumb_t *as, byte b1) {
#define IMM32_L2(x) (((x) >> 16) & 0xff)
#define IMM32_L3(x) (((x) >> 24) & 0xff)
-STATIC void asm_thumb_write_word32(asm_thumb_t *as, int w32) {
+static void asm_thumb_write_word32(asm_thumb_t *as, int w32) {
byte *c = asm_thumb_get_cur_to_write_bytes(as, 4);
c[0] = IMM32_L0(w32);
c[1] = IMM32_L1(w32);
@@ -216,7 +216,7 @@ void asm_thumb_exit(asm_thumb_t *as) {
asm_thumb_op16(as, OP_POP_RLIST_PC(as->push_reglist));
}
-STATIC mp_uint_t get_label_dest(asm_thumb_t *as, uint label) {
+static mp_uint_t get_label_dest(asm_thumb_t *as, uint label) {
assert(label < as->base.max_num_labels);
return as->base.label_offsets[label];
}
diff --git a/py/asmx64.c b/py/asmx64.c
index 5c923a523c..abddc16269 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -123,14 +123,14 @@ static inline byte *asm_x64_get_cur_to_write_bytes(asm_x64_t *as, int n) {
return mp_asm_base_get_cur_to_write_bytes(&as->base, n);
}
-STATIC void asm_x64_write_byte_1(asm_x64_t *as, byte b1) {
+static void asm_x64_write_byte_1(asm_x64_t *as, byte b1) {
byte *c = asm_x64_get_cur_to_write_bytes(as, 1);
if (c != NULL) {
c[0] = b1;
}
}
-STATIC void asm_x64_write_byte_2(asm_x64_t *as, byte b1, byte b2) {
+static void asm_x64_write_byte_2(asm_x64_t *as, byte b1, byte b2) {
byte *c = asm_x64_get_cur_to_write_bytes(as, 2);
if (c != NULL) {
c[0] = b1;
@@ -138,7 +138,7 @@ STATIC void asm_x64_write_byte_2(asm_x64_t *as, byte b1, byte b2) {
}
}
-STATIC void asm_x64_write_byte_3(asm_x64_t *as, byte b1, byte b2, byte b3) {
+static void asm_x64_write_byte_3(asm_x64_t *as, byte b1, byte b2, byte b3) {
byte *c = asm_x64_get_cur_to_write_bytes(as, 3);
if (c != NULL) {
c[0] = b1;
@@ -147,7 +147,7 @@ STATIC void asm_x64_write_byte_3(asm_x64_t *as, byte b1, byte b2, byte b3) {
}
}
-STATIC void asm_x64_write_word32(asm_x64_t *as, int w32) {
+static void asm_x64_write_word32(asm_x64_t *as, int w32) {
byte *c = asm_x64_get_cur_to_write_bytes(as, 4);
if (c != NULL) {
c[0] = IMM32_L0(w32);
@@ -157,7 +157,7 @@ STATIC void asm_x64_write_word32(asm_x64_t *as, int w32) {
}
}
-STATIC void asm_x64_write_word64(asm_x64_t *as, int64_t w64) {
+static void asm_x64_write_word64(asm_x64_t *as, int64_t w64) {
byte *c = asm_x64_get_cur_to_write_bytes(as, 8);
if (c != NULL) {
c[0] = IMM32_L0(w64);
@@ -172,7 +172,7 @@ STATIC void asm_x64_write_word64(asm_x64_t *as, int64_t w64) {
}
/* unused
-STATIC void asm_x64_write_word32_to(asm_x64_t *as, int offset, int w32) {
+static void asm_x64_write_word32_to(asm_x64_t *as, int offset, int w32) {
byte* c;
assert(offset + 4 <= as->code_size);
c = as->code_base + offset;
@@ -183,7 +183,7 @@ STATIC void asm_x64_write_word32_to(asm_x64_t *as, int offset, int w32) {
}
*/
-STATIC void asm_x64_write_r64_disp(asm_x64_t *as, int r64, int disp_r64, int disp_offset) {
+static void asm_x64_write_r64_disp(asm_x64_t *as, int r64, int disp_r64, int disp_offset) {
uint8_t rm_disp;
if (disp_offset == 0 && (disp_r64 & 7) != ASM_X64_REG_RBP) {
rm_disp = MODRM_RM_DISP0;
@@ -204,7 +204,7 @@ STATIC void asm_x64_write_r64_disp(asm_x64_t *as, int r64, int disp_r64, int dis
}
}
-STATIC void asm_x64_generic_r64_r64(asm_x64_t *as, int dest_r64, int src_r64, int op) {
+static void asm_x64_generic_r64_r64(asm_x64_t *as, int dest_r64, int src_r64, int op) {
asm_x64_write_byte_3(as, REX_PREFIX | REX_W | REX_R_FROM_R64(src_r64) | REX_B_FROM_R64(dest_r64), op, MODRM_R64(src_r64) | MODRM_RM_REG | MODRM_RM_R64(dest_r64));
}
@@ -243,7 +243,7 @@ void asm_x64_pop_r64(asm_x64_t *as, int dest_r64) {
}
}
-STATIC void asm_x64_ret(asm_x64_t *as) {
+static void asm_x64_ret(asm_x64_t *as) {
asm_x64_write_byte_1(as, OPCODE_RET);
}
@@ -317,7 +317,7 @@ void asm_x64_mov_mem64_to_r64(asm_x64_t *as, int src_r64, int src_disp, int dest
asm_x64_write_r64_disp(as, dest_r64, src_r64, src_disp);
}
-STATIC void asm_x64_lea_disp_to_r64(asm_x64_t *as, int src_r64, int src_disp, int dest_r64) {
+static void asm_x64_lea_disp_to_r64(asm_x64_t *as, int src_r64, int src_disp, int dest_r64) {
// use REX prefix for 64 bit operation
asm_x64_write_byte_2(as, REX_PREFIX | REX_W | REX_R_FROM_R64(dest_r64) | REX_B_FROM_R64(src_r64), OPCODE_LEA_MEM_TO_R64);
asm_x64_write_r64_disp(as, dest_r64, src_r64, src_disp);
@@ -414,7 +414,7 @@ void asm_x64_sub_i32_from_r32(asm_x64_t *as, int src_i32, int dest_r32) {
}
*/
-STATIC void asm_x64_sub_r64_i32(asm_x64_t *as, int dest_r64, int src_i32) {
+static void asm_x64_sub_r64_i32(asm_x64_t *as, int dest_r64, int src_i32) {
assert(dest_r64 < 8);
if (SIGNED_FIT8(src_i32)) {
// use REX prefix for 64 bit operation
@@ -480,7 +480,7 @@ void asm_x64_jmp_reg(asm_x64_t *as, int src_r64) {
asm_x64_write_byte_2(as, OPCODE_JMP_RM64, MODRM_R64(4) | MODRM_RM_REG | MODRM_RM_R64(src_r64));
}
-STATIC mp_uint_t get_label_dest(asm_x64_t *as, mp_uint_t label) {
+static mp_uint_t get_label_dest(asm_x64_t *as, mp_uint_t label) {
assert(label < as->base.max_num_labels);
return as->base.label_offsets[label];
}
@@ -560,7 +560,7 @@ void asm_x64_exit(asm_x64_t *as) {
// ^ ^
// | low address | high address in RAM
//
-STATIC int asm_x64_local_offset_from_rsp(asm_x64_t *as, int local_num) {
+static int asm_x64_local_offset_from_rsp(asm_x64_t *as, int local_num) {
(void)as;
// Stack is full descending, RSP points to local0
return local_num * WORD_SIZE;
diff --git a/py/asmx86.c b/py/asmx86.c
index 4b0f8047f6..94e0213d65 100644
--- a/py/asmx86.c
+++ b/py/asmx86.c
@@ -103,14 +103,14 @@
#define SIGNED_FIT8(x) (((x) & 0xffffff80) == 0) || (((x) & 0xffffff80) == 0xffffff80)
-STATIC void asm_x86_write_byte_1(asm_x86_t *as, byte b1) {
+static void asm_x86_write_byte_1(asm_x86_t *as, byte b1) {
byte *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 1);
if (c != NULL) {
c[0] = b1;
}
}
-STATIC void asm_x86_write_byte_2(asm_x86_t *as, byte b1, byte b2) {
+static void asm_x86_write_byte_2(asm_x86_t *as, byte b1, byte b2) {
byte *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 2);
if (c != NULL) {
c[0] = b1;
@@ -118,7 +118,7 @@ STATIC void asm_x86_write_byte_2(asm_x86_t *as, byte b1, byte b2) {
}
}
-STATIC void asm_x86_write_byte_3(asm_x86_t *as, byte b1, byte b2, byte b3) {
+static void asm_x86_write_byte_3(asm_x86_t *as, byte b1, byte b2, byte b3) {
byte *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 3);
if (c != NULL) {
c[0] = b1;
@@ -127,7 +127,7 @@ STATIC void asm_x86_write_byte_3(asm_x86_t *as, byte b1, byte b2, byte b3) {
}
}
-STATIC void asm_x86_write_word32(asm_x86_t *as, int w32) {
+static void asm_x86_write_word32(asm_x86_t *as, int w32) {
byte *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 4);
if (c != NULL) {
c[0] = IMM32_L0(w32);
@@ -137,7 +137,7 @@ STATIC void asm_x86_write_word32(asm_x86_t *as, int w32) {
}
}
-STATIC void asm_x86_write_r32_disp(asm_x86_t *as, int r32, int disp_r32, int disp_offset) {
+static void asm_x86_write_r32_disp(asm_x86_t *as, int r32, int disp_r32, int disp_offset) {
uint8_t rm_disp;
if (disp_offset == 0 && disp_r32 != ASM_X86_REG_EBP) {
rm_disp = MODRM_RM_DISP0;
@@ -158,17 +158,17 @@ STATIC void asm_x86_write_r32_disp(asm_x86_t *as, int r32, int disp_r32, int dis
}
}
-STATIC void asm_x86_generic_r32_r32(asm_x86_t *as, int dest_r32, int src_r32, int op) {
+static void asm_x86_generic_r32_r32(asm_x86_t *as, int dest_r32, int src_r32, int op) {
asm_x86_write_byte_2(as, op, MODRM_R32(src_r32) | MODRM_RM_REG | MODRM_RM_R32(dest_r32));
}
#if 0
-STATIC void asm_x86_nop(asm_x86_t *as) {
+static void asm_x86_nop(asm_x86_t *as) {
asm_x86_write_byte_1(as, OPCODE_NOP);
}
#endif
-STATIC void asm_x86_push_r32(asm_x86_t *as, int src_r32) {
+static void asm_x86_push_r32(asm_x86_t *as, int src_r32) {
asm_x86_write_byte_1(as, OPCODE_PUSH_R32 | src_r32);
}
@@ -184,11 +184,11 @@ void asm_x86_push_disp(asm_x86_t *as, int src_r32, int src_offset) {
}
#endif
-STATIC void asm_x86_pop_r32(asm_x86_t *as, int dest_r32) {
+static void asm_x86_pop_r32(asm_x86_t *as, int dest_r32) {
asm_x86_write_byte_1(as, OPCODE_POP_R32 | dest_r32);
}
-STATIC void asm_x86_ret(asm_x86_t *as) {
+static void asm_x86_ret(asm_x86_t *as) {
asm_x86_write_byte_1(as, OPCODE_RET);
}
@@ -226,7 +226,7 @@ void asm_x86_mov_mem32_to_r32(asm_x86_t *as, int src_r32, int src_disp, int dest
asm_x86_write_r32_disp(as, dest_r32, src_r32, src_disp);
}
-STATIC void asm_x86_lea_disp_to_r32(asm_x86_t *as, int src_r32, int src_disp, int dest_r32) {
+static void asm_x86_lea_disp_to_r32(asm_x86_t *as, int src_r32, int src_disp, int dest_r32) {
asm_x86_write_byte_1(as, OPCODE_LEA_MEM_TO_R32);
asm_x86_write_r32_disp(as, dest_r32, src_r32, src_disp);
}
@@ -272,7 +272,7 @@ void asm_x86_add_r32_r32(asm_x86_t *as, int dest_r32, int src_r32) {
asm_x86_generic_r32_r32(as, dest_r32, src_r32, OPCODE_ADD_R32_TO_RM32);
}
-STATIC void asm_x86_add_i32_to_r32(asm_x86_t *as, int src_i32, int dest_r32) {
+static void asm_x86_add_i32_to_r32(asm_x86_t *as, int src_i32, int dest_r32) {
if (SIGNED_FIT8(src_i32)) {
asm_x86_write_byte_2(as, OPCODE_ADD_I8_TO_RM32, MODRM_R32(0) | MODRM_RM_REG | MODRM_RM_R32(dest_r32));
asm_x86_write_byte_1(as, src_i32 & 0xff);
@@ -286,7 +286,7 @@ void asm_x86_sub_r32_r32(asm_x86_t *as, int dest_r32, int src_r32) {
asm_x86_generic_r32_r32(as, dest_r32, src_r32, OPCODE_SUB_R32_FROM_RM32);
}
-STATIC void asm_x86_sub_r32_i32(asm_x86_t *as, int dest_r32, int src_i32) {
+static void asm_x86_sub_r32_i32(asm_x86_t *as, int dest_r32, int src_i32) {
if (SIGNED_FIT8(src_i32)) {
// defaults to 32 bit operation
asm_x86_write_byte_2(as, OPCODE_SUB_I8_FROM_RM32, MODRM_R32(5) | MODRM_RM_REG | MODRM_RM_R32(dest_r32));
@@ -353,7 +353,7 @@ void asm_x86_jmp_reg(asm_x86_t *as, int src_r32) {
asm_x86_write_byte_2(as, OPCODE_JMP_RM32, MODRM_R32(4) | MODRM_RM_REG | MODRM_RM_R32(src_r32));
}
-STATIC mp_uint_t get_label_dest(asm_x86_t *as, mp_uint_t label) {
+static mp_uint_t get_label_dest(asm_x86_t *as, mp_uint_t label) {
assert(label < as->base.max_num_labels);
return as->base.label_offsets[label];
}
@@ -422,7 +422,7 @@ void asm_x86_exit(asm_x86_t *as) {
asm_x86_ret(as);
}
-STATIC int asm_x86_arg_offset_from_esp(asm_x86_t *as, size_t arg_num) {
+static int asm_x86_arg_offset_from_esp(asm_x86_t *as, size_t arg_num) {
// Above esp are: locals, 4 saved registers, return eip, arguments
return (as->num_locals + 4 + 1 + arg_num) * WORD_SIZE;
}
@@ -454,7 +454,7 @@ void asm_x86_mov_r32_to_arg(asm_x86_t *as, int src_r32, int dest_arg_num) {
// ^ ^
// | low address | high address in RAM
//
-STATIC int asm_x86_local_offset_from_esp(asm_x86_t *as, int local_num) {
+static int asm_x86_local_offset_from_esp(asm_x86_t *as, int local_num) {
(void)as;
// Stack is full descending, ESP points to local0
return local_num * WORD_SIZE;
diff --git a/py/asmxtensa.c b/py/asmxtensa.c
index 8ac914ec41..84018402f6 100644
--- a/py/asmxtensa.c
+++ b/py/asmxtensa.c
@@ -117,7 +117,7 @@ void asm_xtensa_exit_win(asm_xtensa_t *as) {
asm_xtensa_op_retw_n(as);
}
-STATIC uint32_t get_label_dest(asm_xtensa_t *as, uint label) {
+static uint32_t get_label_dest(asm_xtensa_t *as, uint label) {
assert(label < as->base.max_num_labels);
return as->base.label_offsets[label];
}
diff --git a/py/bc.c b/py/bc.c
index dc70fddf2b..899dbd6a07 100644
--- a/py/bc.c
+++ b/py/bc.c
@@ -88,7 +88,7 @@ const byte *mp_decode_uint_skip(const byte *ptr) {
return ptr;
}
-STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, size_t expected, size_t given) {
+static NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, size_t expected, size_t given) {
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
// generic message, used also for other argument issues
(void)f;
@@ -107,7 +107,7 @@ STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, size_t expected,
}
#if DEBUG_PRINT
-STATIC void dump_args(const mp_obj_t *a, size_t sz) {
+static void dump_args(const mp_obj_t *a, size_t sz) {
DEBUG_printf("%p: ", a);
for (size_t i = 0; i < sz; i++) {
DEBUG_printf("%p ", a[i]);
@@ -124,7 +124,7 @@ STATIC void dump_args(const mp_obj_t *a, size_t sz) {
// - code_state->ip should contain a pointer to the beginning of the prelude
// - code_state->sp should be: &code_state->state[0] - 1
// - code_state->n_state should be the number of objects in the local state
-STATIC void mp_setup_code_state_helper(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static void mp_setup_code_state_helper(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// This function is pretty complicated. It's main aim is to be efficient in speed and RAM
// usage for the common case of positional only args.
diff --git a/py/builtinevex.c b/py/builtinevex.c
index 7737e67f2c..e25cbd4d08 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -38,13 +38,13 @@ typedef struct _mp_obj_code_t {
mp_obj_t module_fun;
} mp_obj_code_t;
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_code,
MP_QSTR_code,
MP_TYPE_FLAG_NONE
);
-STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj_dict_t *locals) {
+static mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj_dict_t *locals) {
// save context
nlr_jump_callback_node_globals_locals_t ctx;
ctx.globals = mp_globals_get();
@@ -78,7 +78,7 @@ STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj
return ret;
}
-STATIC mp_obj_t mp_builtin_compile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_compile(size_t n_args, const mp_obj_t *args) {
(void)n_args;
// get the source
@@ -118,7 +118,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_compile_obj, 3, 6, mp_builtin_com
#if MICROPY_PY_BUILTINS_EVAL_EXEC
-STATIC mp_obj_t eval_exec_helper(size_t n_args, const mp_obj_t *args, mp_parse_input_kind_t parse_input_kind) {
+static mp_obj_t eval_exec_helper(size_t n_args, const mp_obj_t *args, mp_parse_input_kind_t parse_input_kind) {
// work out the context
mp_obj_dict_t *globals = mp_globals_get();
mp_obj_dict_t *locals = mp_locals_get();
@@ -158,12 +158,12 @@ STATIC mp_obj_t eval_exec_helper(size_t n_args, const mp_obj_t *args, mp_parse_i
return mp_parse_compile_execute(lex, parse_input_kind, globals, locals);
}
-STATIC mp_obj_t mp_builtin_eval(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_eval(size_t n_args, const mp_obj_t *args) {
return eval_exec_helper(n_args, args, MP_PARSE_EVAL_INPUT);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_eval_obj, 1, 3, mp_builtin_eval);
-STATIC mp_obj_t mp_builtin_exec(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_exec(size_t n_args, const mp_obj_t *args) {
return eval_exec_helper(n_args, args, MP_PARSE_FILE_INPUT);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec);
@@ -171,7 +171,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec);
#endif // MICROPY_PY_BUILTINS_EVAL_EXEC
#if MICROPY_PY_BUILTINS_EXECFILE
-STATIC mp_obj_t mp_builtin_execfile(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_execfile(size_t n_args, const mp_obj_t *args) {
// MP_PARSE_SINGLE_INPUT is used to indicate a file input
return eval_exec_helper(n_args, args, MP_PARSE_SINGLE_INPUT);
}
diff --git a/py/builtinhelp.c b/py/builtinhelp.c
index 9bd56cca09..a3fcc4dfb7 100644
--- a/py/builtinhelp.c
+++ b/py/builtinhelp.c
@@ -47,7 +47,7 @@ const char mp_help_default_text[] =
"For further help on a specific object, type help(obj)\n"
;
-STATIC void mp_help_print_info_about_object(mp_obj_t name_o, mp_obj_t value) {
+static void mp_help_print_info_about_object(mp_obj_t name_o, mp_obj_t value) {
mp_print_str(MP_PYTHON_PRINTER, " ");
mp_obj_print(name_o, PRINT_STR);
mp_print_str(MP_PYTHON_PRINTER, " -- ");
@@ -56,7 +56,7 @@ STATIC void mp_help_print_info_about_object(mp_obj_t name_o, mp_obj_t value) {
}
#if MICROPY_PY_BUILTINS_HELP_MODULES
-STATIC void mp_help_add_from_map(mp_obj_t list, const mp_map_t *map) {
+static void mp_help_add_from_map(mp_obj_t list, const mp_map_t *map) {
for (size_t i = 0; i < map->alloc; i++) {
if (mp_map_slot_is_filled(map, i)) {
mp_obj_list_append(list, map->table[i].key);
@@ -65,7 +65,7 @@ STATIC void mp_help_add_from_map(mp_obj_t list, const mp_map_t *map) {
}
#if MICROPY_MODULE_FROZEN
-STATIC void mp_help_add_from_names(mp_obj_t list, const char *name) {
+static void mp_help_add_from_names(mp_obj_t list, const char *name) {
while (*name) {
size_t len = strlen(name);
// name should end in '.py' and we strip it off
@@ -75,7 +75,7 @@ STATIC void mp_help_add_from_names(mp_obj_t list, const char *name) {
}
#endif
-STATIC void mp_help_print_modules(void) {
+static void mp_help_print_modules(void) {
mp_obj_t list = mp_obj_new_list(0, NULL);
mp_help_add_from_map(list, &mp_builtin_module_map);
@@ -122,7 +122,7 @@ STATIC void mp_help_print_modules(void) {
}
#endif
-STATIC void mp_help_print_obj(const mp_obj_t obj) {
+static void mp_help_print_obj(const mp_obj_t obj) {
#if MICROPY_PY_BUILTINS_HELP_MODULES
if (obj == MP_OBJ_NEW_QSTR(MP_QSTR_modules)) {
mp_help_print_modules();
@@ -158,7 +158,7 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
}
}
-STATIC mp_obj_t mp_builtin_help(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_help(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
// print a general help message
mp_print_str(MP_PYTHON_PRINTER, MICROPY_PY_BUILTINS_HELP_TEXT);
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 002a5cb853..0611926fdd 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -57,7 +57,7 @@
// uses mp_vfs_import_stat) to also search frozen modules. Given an exact
// path to a file or directory (e.g. "foo/bar", foo/bar.py" or "foo/bar.mpy"),
// will return whether the path is a file, directory, or doesn't exist.
-STATIC mp_import_stat_t stat_path(vstr_t *path) {
+static mp_import_stat_t stat_path(vstr_t *path) {
const char *str = vstr_null_terminated_str(path);
#if MICROPY_MODULE_FROZEN
// Only try and load as a frozen module if it starts with .frozen/.
@@ -75,7 +75,7 @@ STATIC mp_import_stat_t stat_path(vstr_t *path) {
// argument. This is the logic that makes .py files take precedent over .mpy
// files. This uses stat_path above, rather than mp_import_stat directly, so
// that the .frozen path prefix is handled.
-STATIC mp_import_stat_t stat_file_py_or_mpy(vstr_t *path) {
+static mp_import_stat_t stat_file_py_or_mpy(vstr_t *path) {
mp_import_stat_t stat = stat_path(path);
if (stat == MP_IMPORT_STAT_FILE) {
return stat;
@@ -99,7 +99,7 @@ STATIC mp_import_stat_t stat_file_py_or_mpy(vstr_t *path) {
// or "foo/bar.(m)py" in either the filesystem or frozen modules. If the
// result is a file, the path argument will be updated to include the file
// extension.
-STATIC mp_import_stat_t stat_module(vstr_t *path) {
+static mp_import_stat_t stat_module(vstr_t *path) {
mp_import_stat_t stat = stat_path(path);
DEBUG_printf("stat %s: %d\n", vstr_str(path), stat);
if (stat == MP_IMPORT_STAT_DIR) {
@@ -114,7 +114,7 @@ STATIC mp_import_stat_t stat_module(vstr_t *path) {
// Given a top-level module name, try and find it in each of the sys.path
// entries. Note: On success, the dest argument will be updated to the matching
// path (i.e. "<entry>/mod_name(.py)").
-STATIC mp_import_stat_t stat_top_level(qstr mod_name, vstr_t *dest) {
+static mp_import_stat_t stat_top_level(qstr mod_name, vstr_t *dest) {
DEBUG_printf("stat_top_level: '%s'\n", qstr_str(mod_name));
#if MICROPY_PY_SYS
size_t path_num;
@@ -152,7 +152,7 @@ STATIC mp_import_stat_t stat_top_level(qstr mod_name, vstr_t *dest) {
}
#if MICROPY_MODULE_FROZEN_STR || MICROPY_ENABLE_COMPILER
-STATIC void do_load_from_lexer(mp_module_context_t *context, mp_lexer_t *lex) {
+static void do_load_from_lexer(mp_module_context_t *context, mp_lexer_t *lex) {
#if MICROPY_PY___FILE__
qstr source_name = lex->source_name;
mp_store_attr(MP_OBJ_FROM_PTR(&context->module), MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
@@ -165,7 +165,7 @@ STATIC void do_load_from_lexer(mp_module_context_t *context, mp_lexer_t *lex) {
#endif
#if (MICROPY_HAS_FILE_READER && MICROPY_PERSISTENT_CODE_LOAD) || MICROPY_MODULE_FROZEN_MPY
-STATIC void do_execute_proto_fun(const mp_module_context_t *context, mp_proto_fun_t proto_fun, qstr source_name) {
+static void do_execute_proto_fun(const mp_module_context_t *context, mp_proto_fun_t proto_fun, qstr source_name) {
#if MICROPY_PY___FILE__
mp_store_attr(MP_OBJ_FROM_PTR(&context->module), MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
#else
@@ -196,7 +196,7 @@ STATIC void do_execute_proto_fun(const mp_module_context_t *context, mp_proto_fu
}
#endif
-STATIC void do_load(mp_module_context_t *module_obj, vstr_t *file) {
+static void do_load(mp_module_context_t *module_obj, vstr_t *file) {
#if MICROPY_MODULE_FROZEN || MICROPY_ENABLE_COMPILER || (MICROPY_PERSISTENT_CODE_LOAD && MICROPY_HAS_FILE_READER)
const char *file_str = vstr_null_terminated_str(file);
#endif
@@ -267,7 +267,7 @@ STATIC void do_load(mp_module_context_t *module_obj, vstr_t *file) {
// Convert a relative (to the current module) import, going up "level" levels,
// into an absolute import.
-STATIC void evaluate_relative_import(mp_int_t level, const char **module_name, size_t *module_name_len) {
+static void evaluate_relative_import(mp_int_t level, const char **module_name, size_t *module_name_len) {
// What we want to do here is to take the name of the current module,
// remove <level> trailing components, and concatenate the passed-in
// module name.
@@ -350,7 +350,7 @@ typedef struct _nlr_jump_callback_node_unregister_module_t {
qstr name;
} nlr_jump_callback_node_unregister_module_t;
-STATIC void unregister_module_from_nlr_jump_callback(void *ctx_in) {
+static void unregister_module_from_nlr_jump_callback(void *ctx_in) {
nlr_jump_callback_node_unregister_module_t *ctx = ctx_in;
mp_map_t *mp_loaded_modules_map = &MP_STATE_VM(mp_loaded_modules_dict).map;
mp_map_lookup(mp_loaded_modules_map, MP_OBJ_NEW_QSTR(ctx->name), MP_MAP_LOOKUP_REMOVE_IF_FOUND);
@@ -363,7 +363,7 @@ STATIC void unregister_module_from_nlr_jump_callback(void *ctx_in) {
// attribute on it) (or MP_OBJ_NULL for top-level).
// override_main: Whether to set the __name__ to "__main__" (and use __main__
// for the actual path).
-STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, mp_obj_t outer_module_obj, bool override_main) {
+static mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, mp_obj_t outer_module_obj, bool override_main) {
// Immediately return if the module at this level is already loaded.
mp_map_elem_t *elem;
diff --git a/py/compile.c b/py/compile.c
index fe7ad6e13c..7a359e662e 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -90,7 +90,7 @@ typedef enum {
#define NATIVE_EMITTER(f) emit_native_table[mp_dynamic_compiler.native_arch]->emit_##f
#define NATIVE_EMITTER_TABLE (emit_native_table[mp_dynamic_compiler.native_arch])
-STATIC const emit_method_table_t *emit_native_table[] = {
+static const emit_method_table_t *emit_native_table[] = {
NULL,
&emit_native_x86_method_table,
&emit_native_x64_method_table,
@@ -129,7 +129,7 @@ STATIC const emit_method_table_t *emit_native_table[] = {
#define ASM_EMITTER(f) emit_asm_table[mp_dynamic_compiler.native_arch]->asm_##f
#define ASM_EMITTER_TABLE emit_asm_table[mp_dynamic_compiler.native_arch]
-STATIC const emit_inline_asm_method_table_t *emit_asm_table[] = {
+static const emit_inline_asm_method_table_t *emit_asm_table[] = {
NULL,
NULL,
NULL,
@@ -200,7 +200,7 @@ typedef struct _compiler_t {
// mp_emit_common_t helper functions
// These are defined here so they can be inlined, to reduce code size.
-STATIC void mp_emit_common_init(mp_emit_common_t *emit, qstr source_file) {
+static void mp_emit_common_init(mp_emit_common_t *emit, qstr source_file) {
#if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE
mp_map_init(&emit->qstr_map, 1);
@@ -211,7 +211,7 @@ STATIC void mp_emit_common_init(mp_emit_common_t *emit, qstr source_file) {
mp_obj_list_init(&emit->const_obj_list, 0);
}
-STATIC void mp_emit_common_start_pass(mp_emit_common_t *emit, pass_kind_t pass) {
+static void mp_emit_common_start_pass(mp_emit_common_t *emit, pass_kind_t pass) {
emit->pass = pass;
if (pass == MP_PASS_CODE_SIZE) {
if (emit->ct_cur_child == 0) {
@@ -223,7 +223,7 @@ STATIC void mp_emit_common_start_pass(mp_emit_common_t *emit, pass_kind_t pass)
emit->ct_cur_child = 0;
}
-STATIC void mp_emit_common_populate_module_context(mp_emit_common_t *emit, qstr source_file, mp_module_context_t *context) {
+static void mp_emit_common_populate_module_context(mp_emit_common_t *emit, qstr source_file, mp_module_context_t *context) {
#if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE
size_t qstr_map_used = emit->qstr_map.used;
mp_module_context_alloc_tables(context, qstr_map_used, emit->const_obj_list.len);
@@ -246,14 +246,14 @@ STATIC void mp_emit_common_populate_module_context(mp_emit_common_t *emit, qstr
/******************************************************************************/
-STATIC void compile_error_set_line(compiler_t *comp, mp_parse_node_t pn) {
+static void compile_error_set_line(compiler_t *comp, mp_parse_node_t pn) {
// if the line of the error is unknown then try to update it from the pn
if (comp->compile_error_line == 0 && MP_PARSE_NODE_IS_STRUCT(pn)) {
comp->compile_error_line = ((mp_parse_node_struct_t *)pn)->source_line;
}
}
-STATIC void compile_syntax_error(compiler_t *comp, mp_parse_node_t pn, mp_rom_error_text_t msg) {
+static void compile_syntax_error(compiler_t *comp, mp_parse_node_t pn, mp_rom_error_text_t msg) {
// only register the error if there has been no other error
if (comp->compile_error == MP_OBJ_NULL) {
comp->compile_error = mp_obj_new_exception_msg(&mp_type_SyntaxError, msg);
@@ -261,17 +261,17 @@ STATIC void compile_syntax_error(compiler_t *comp, mp_parse_node_t pn, mp_rom_er
}
}
-STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_arglist, bool is_method_call, int n_positional_extra);
-STATIC void compile_comprehension(compiler_t *comp, mp_parse_node_struct_t *pns, scope_kind_t kind);
-STATIC void compile_atom_brace_helper(compiler_t *comp, mp_parse_node_struct_t *pns, bool create_map);
-STATIC void compile_node(compiler_t *comp, mp_parse_node_t pn);
+static void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_arglist, bool is_method_call, int n_positional_extra);
+static void compile_comprehension(compiler_t *comp, mp_parse_node_struct_t *pns, scope_kind_t kind);
+static void compile_atom_brace_helper(compiler_t *comp, mp_parse_node_struct_t *pns, bool create_map);
+static void compile_node(compiler_t *comp, mp_parse_node_t pn);
-STATIC uint comp_next_label(compiler_t *comp) {
+static uint comp_next_label(compiler_t *comp) {
return comp->next_label++;
}
#if MICROPY_EMIT_NATIVE
-STATIC void reserve_labels_for_native(compiler_t *comp, int n) {
+static void reserve_labels_for_native(compiler_t *comp, int n) {
if (comp->scope_cur->emit_options != MP_EMIT_OPT_BYTECODE) {
comp->next_label += n;
}
@@ -280,7 +280,7 @@ STATIC void reserve_labels_for_native(compiler_t *comp, int n) {
#define reserve_labels_for_native(comp, n)
#endif
-STATIC void compile_increase_except_level(compiler_t *comp, uint label, int kind) {
+static void compile_increase_except_level(compiler_t *comp, uint label, int kind) {
EMIT_ARG(setup_block, label, kind);
comp->cur_except_level += 1;
if (comp->cur_except_level > comp->scope_cur->exc_stack_size) {
@@ -288,14 +288,14 @@ STATIC void compile_increase_except_level(compiler_t *comp, uint label, int kind
}
}
-STATIC void compile_decrease_except_level(compiler_t *comp) {
+static void compile_decrease_except_level(compiler_t *comp) {
assert(comp->cur_except_level > 0);
comp->cur_except_level -= 1;
EMIT(end_finally);
reserve_labels_for_native(comp, 1);
}
-STATIC scope_t *scope_new_and_link(compiler_t *comp, scope_kind_t kind, mp_parse_node_t pn, uint emit_options) {
+static scope_t *scope_new_and_link(compiler_t *comp, scope_kind_t kind, mp_parse_node_t pn, uint emit_options) {
scope_t *scope = scope_new(kind, pn, emit_options);
scope->parent = comp->scope_cur;
scope->next = NULL;
@@ -313,7 +313,7 @@ STATIC scope_t *scope_new_and_link(compiler_t *comp, scope_kind_t kind, mp_parse
typedef void (*apply_list_fun_t)(compiler_t *comp, mp_parse_node_t pn);
-STATIC void apply_to_single_or_list(compiler_t *comp, mp_parse_node_t pn, pn_kind_t pn_list_kind, apply_list_fun_t f) {
+static void apply_to_single_or_list(compiler_t *comp, mp_parse_node_t pn, pn_kind_t pn_list_kind, apply_list_fun_t f) {
if (MP_PARSE_NODE_IS_STRUCT_KIND(pn, pn_list_kind)) {
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t *)pn;
int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
@@ -325,7 +325,7 @@ STATIC void apply_to_single_or_list(compiler_t *comp, mp_parse_node_t pn, pn_kin
}
}
-STATIC void compile_generic_all_nodes(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_generic_all_nodes(compiler_t *comp, mp_parse_node_struct_t *pns) {
int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
for (int i = 0; i < num_nodes; i++) {
compile_node(comp, pns->nodes[i]);
@@ -337,7 +337,7 @@ STATIC void compile_generic_all_nodes(compiler_t *comp, mp_parse_node_struct_t *
}
}
-STATIC void compile_load_id(compiler_t *comp, qstr qst) {
+static void compile_load_id(compiler_t *comp, qstr qst) {
if (comp->pass == MP_PASS_SCOPE) {
mp_emit_common_get_id_for_load(comp->scope_cur, qst);
} else {
@@ -349,7 +349,7 @@ STATIC void compile_load_id(compiler_t *comp, qstr qst) {
}
}
-STATIC void compile_store_id(compiler_t *comp, qstr qst) {
+static void compile_store_id(compiler_t *comp, qstr qst) {
if (comp->pass == MP_PASS_SCOPE) {
mp_emit_common_get_id_for_modification(comp->scope_cur, qst);
} else {
@@ -361,7 +361,7 @@ STATIC void compile_store_id(compiler_t *comp, qstr qst) {
}
}
-STATIC void compile_delete_id(compiler_t *comp, qstr qst) {
+static void compile_delete_id(compiler_t *comp, qstr qst) {
if (comp->pass == MP_PASS_SCOPE) {
mp_emit_common_get_id_for_modification(comp->scope_cur, qst);
} else {
@@ -373,7 +373,7 @@ STATIC void compile_delete_id(compiler_t *comp, qstr qst) {
}
}
-STATIC void compile_generic_tuple(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_generic_tuple(compiler_t *comp, mp_parse_node_struct_t *pns) {
// a simple tuple expression
size_t num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
for (size_t i = 0; i < num_nodes; i++) {
@@ -382,7 +382,7 @@ STATIC void compile_generic_tuple(compiler_t *comp, mp_parse_node_struct_t *pns)
EMIT_ARG(build, num_nodes, MP_EMIT_BUILD_TUPLE);
}
-STATIC void c_if_cond(compiler_t *comp, mp_parse_node_t pn, bool jump_if, int label) {
+static void c_if_cond(compiler_t *comp, mp_parse_node_t pn, bool jump_if, int label) {
if (mp_parse_node_is_const_false(pn)) {
if (jump_if == false) {
EMIT_ARG(jump, label);
@@ -430,9 +430,9 @@ STATIC void c_if_cond(compiler_t *comp, mp_parse_node_t pn, bool jump_if, int la
}
typedef enum { ASSIGN_STORE, ASSIGN_AUG_LOAD, ASSIGN_AUG_STORE } assign_kind_t;
-STATIC void c_assign(compiler_t *comp, mp_parse_node_t pn, assign_kind_t kind);
+static void c_assign(compiler_t *comp, mp_parse_node_t pn, assign_kind_t kind);
-STATIC void c_assign_atom_expr(compiler_t *comp, mp_parse_node_struct_t *pns, assign_kind_t assign_kind) {
+static void c_assign_atom_expr(compiler_t *comp, mp_parse_node_struct_t *pns, assign_kind_t assign_kind) {
if (assign_kind != ASSIGN_AUG_STORE) {
compile_node(comp, pns->nodes[0]);
}
@@ -481,7 +481,7 @@ STATIC void c_assign_atom_expr(compiler_t *comp, mp_parse_node_struct_t *pns, as
compile_syntax_error(comp, (mp_parse_node_t)pns, MP_ERROR_TEXT("can't assign to expression"));
}
-STATIC void c_assign_tuple(compiler_t *comp, uint num_tail, mp_parse_node_t *nodes_tail) {
+static void c_assign_tuple(compiler_t *comp, uint num_tail, mp_parse_node_t *nodes_tail) {
// look for star expression
uint have_star_index = -1;
for (uint i = 0; i < num_tail; i++) {
@@ -508,7 +508,7 @@ STATIC void c_assign_tuple(compiler_t *comp, uint num_tail, mp_parse_node_t *nod
}
// assigns top of stack to pn
-STATIC void c_assign(compiler_t *comp, mp_parse_node_t pn, assign_kind_t assign_kind) {
+static void c_assign(compiler_t *comp, mp_parse_node_t pn, assign_kind_t assign_kind) {
assert(!MP_PARSE_NODE_IS_NULL(pn));
if (MP_PARSE_NODE_IS_LEAF(pn)) {
if (MP_PARSE_NODE_IS_ID(pn)) {
@@ -599,7 +599,7 @@ cannot_assign:
// if n_pos_defaults > 0 then there is a tuple on the stack with the positional defaults
// if n_kw_defaults > 0 then there is a dictionary on the stack with the keyword defaults
// if both exist, the tuple is above the dictionary (ie the first pop gets the tuple)
-STATIC void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int n_pos_defaults, int n_kw_defaults) {
+static void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int n_pos_defaults, int n_kw_defaults) {
assert(n_pos_defaults >= 0);
assert(n_kw_defaults >= 0);
@@ -641,7 +641,7 @@ STATIC void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int
}
}
-STATIC void compile_funcdef_lambdef_param(compiler_t *comp, mp_parse_node_t pn) {
+static void compile_funcdef_lambdef_param(compiler_t *comp, mp_parse_node_t pn) {
// For efficiency of the code below we extract the parse-node kind here
int pn_kind;
if (MP_PARSE_NODE_IS_ID(pn)) {
@@ -732,7 +732,7 @@ STATIC void compile_funcdef_lambdef_param(compiler_t *comp, mp_parse_node_t pn)
}
}
-STATIC void compile_funcdef_lambdef(compiler_t *comp, scope_t *scope, mp_parse_node_t pn_params, pn_kind_t pn_list_kind) {
+static void compile_funcdef_lambdef(compiler_t *comp, scope_t *scope, mp_parse_node_t pn_params, pn_kind_t pn_list_kind) {
// When we call compile_funcdef_lambdef_param below it can compile an arbitrary
// expression for default arguments, which may contain a lambda. The lambda will
// call here in a nested way, so we must save and restore the relevant state.
@@ -768,7 +768,7 @@ STATIC void compile_funcdef_lambdef(compiler_t *comp, scope_t *scope, mp_parse_n
// leaves function object on stack
// returns function name
-STATIC qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
+static qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
if (comp->pass == MP_PASS_SCOPE) {
// create a new scope for this function
scope_t *s = scope_new_and_link(comp, SCOPE_FUNCTION, (mp_parse_node_t)pns, emit_options);
@@ -788,7 +788,7 @@ STATIC qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns
// leaves class object on stack
// returns class name
-STATIC qstr compile_classdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
+static qstr compile_classdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns, uint emit_options) {
if (comp->pass == MP_PASS_SCOPE) {
// create a new scope for this class
scope_t *s = scope_new_and_link(comp, SCOPE_CLASS, (mp_parse_node_t)pns, emit_options);
@@ -820,7 +820,7 @@ STATIC qstr compile_classdef_helper(compiler_t *comp, mp_parse_node_struct_t *pn
}
// returns true if it was a built-in decorator (even if the built-in had an error)
-STATIC bool compile_built_in_decorator(compiler_t *comp, size_t name_len, mp_parse_node_t *name_nodes, uint *emit_options) {
+static bool compile_built_in_decorator(compiler_t *comp, size_t name_len, mp_parse_node_t *name_nodes, uint *emit_options) {
if (MP_PARSE_NODE_LEAF_ARG(name_nodes[0]) != MP_QSTR_micropython) {
return false;
}
@@ -869,7 +869,7 @@ STATIC bool compile_built_in_decorator(compiler_t *comp, size_t name_len, mp_par
return true;
}
-STATIC void compile_decorated(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_decorated(compiler_t *comp, mp_parse_node_struct_t *pns) {
// get the list of decorators
mp_parse_node_t *nodes;
size_t n = mp_parse_node_extract_list(&pns->nodes[0], PN_decorators, &nodes);
@@ -937,13 +937,13 @@ STATIC void compile_decorated(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_store_id(comp, body_name);
}
-STATIC void compile_funcdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_funcdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
qstr fname = compile_funcdef_helper(comp, pns, comp->scope_cur->emit_options);
// store function object into function name
compile_store_id(comp, fname);
}
-STATIC void c_del_stmt(compiler_t *comp, mp_parse_node_t pn) {
+static void c_del_stmt(compiler_t *comp, mp_parse_node_t pn) {
if (MP_PARSE_NODE_IS_ID(pn)) {
compile_delete_id(comp, MP_PARSE_NODE_LEAF_ARG(pn));
} else if (MP_PARSE_NODE_IS_STRUCT_KIND(pn, PN_atom_expr_normal)) {
@@ -999,11 +999,11 @@ cannot_delete:
compile_syntax_error(comp, (mp_parse_node_t)pn, MP_ERROR_TEXT("can't delete expression"));
}
-STATIC void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
apply_to_single_or_list(comp, pns->nodes[0], PN_exprlist, c_del_stmt);
}
-STATIC void compile_break_cont_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_break_cont_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
uint16_t label;
if (MP_PARSE_NODE_STRUCT_KIND(pns) == PN_break_stmt) {
label = comp->break_label;
@@ -1017,7 +1017,7 @@ STATIC void compile_break_cont_stmt(compiler_t *comp, mp_parse_node_struct_t *pn
EMIT_ARG(unwind_jump, label, comp->cur_except_level - comp->break_continue_except_level);
}
-STATIC void compile_return_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_return_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
#if MICROPY_CPYTHON_COMPAT
if (comp->scope_cur->kind != SCOPE_FUNCTION) {
compile_syntax_error(comp, (mp_parse_node_t)pns, MP_ERROR_TEXT("'return' outside function"));
@@ -1045,12 +1045,12 @@ STATIC void compile_return_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
EMIT(return_value);
}
-STATIC void compile_yield_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_yield_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pns->nodes[0]);
EMIT(pop_top);
}
-STATIC void compile_raise_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_raise_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
// raise
EMIT_ARG(raise_varargs, 0);
@@ -1070,7 +1070,7 @@ STATIC void compile_raise_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// q_base holds the base of the name
// eg a -> q_base=a
// a.b.c -> q_base=a
-STATIC void do_import_name(compiler_t *comp, mp_parse_node_t pn, qstr *q_base) {
+static void do_import_name(compiler_t *comp, mp_parse_node_t pn, qstr *q_base) {
bool is_as = false;
if (MP_PARSE_NODE_IS_STRUCT_KIND(pn, PN_dotted_as_name)) {
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t *)pn;
@@ -1131,7 +1131,7 @@ STATIC void do_import_name(compiler_t *comp, mp_parse_node_t pn, qstr *q_base) {
}
}
-STATIC void compile_dotted_as_name(compiler_t *comp, mp_parse_node_t pn) {
+static void compile_dotted_as_name(compiler_t *comp, mp_parse_node_t pn) {
EMIT_ARG(load_const_small_int, 0); // level 0 import
EMIT_ARG(load_const_tok, MP_TOKEN_KW_NONE); // not importing from anything
qstr q_base;
@@ -1139,11 +1139,11 @@ STATIC void compile_dotted_as_name(compiler_t *comp, mp_parse_node_t pn) {
compile_store_id(comp, q_base);
}
-STATIC void compile_import_name(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_import_name(compiler_t *comp, mp_parse_node_struct_t *pns) {
apply_to_single_or_list(comp, pns->nodes[0], PN_dotted_as_names, compile_dotted_as_name);
}
-STATIC void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
mp_parse_node_t pn_import_source = pns->nodes[0];
// extract the preceding .'s (if any) for a relative import, to compute the import level
@@ -1231,7 +1231,7 @@ STATIC void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
}
-STATIC void compile_declare_global(compiler_t *comp, mp_parse_node_t pn, id_info_t *id_info) {
+static void compile_declare_global(compiler_t *comp, mp_parse_node_t pn, id_info_t *id_info) {
if (id_info->kind != ID_INFO_KIND_UNDECIDED && id_info->kind != ID_INFO_KIND_GLOBAL_EXPLICIT) {
compile_syntax_error(comp, pn, MP_ERROR_TEXT("identifier redefined as global"));
return;
@@ -1245,7 +1245,7 @@ STATIC void compile_declare_global(compiler_t *comp, mp_parse_node_t pn, id_info
}
}
-STATIC void compile_declare_nonlocal(compiler_t *comp, mp_parse_node_t pn, id_info_t *id_info) {
+static void compile_declare_nonlocal(compiler_t *comp, mp_parse_node_t pn, id_info_t *id_info) {
if (id_info->kind == ID_INFO_KIND_UNDECIDED) {
id_info->kind = ID_INFO_KIND_GLOBAL_IMPLICIT;
scope_check_to_close_over(comp->scope_cur, id_info);
@@ -1257,7 +1257,7 @@ STATIC void compile_declare_nonlocal(compiler_t *comp, mp_parse_node_t pn, id_in
}
}
-STATIC void compile_declare_global_or_nonlocal(compiler_t *comp, mp_parse_node_t pn, id_info_t *id_info, bool is_global) {
+static void compile_declare_global_or_nonlocal(compiler_t *comp, mp_parse_node_t pn, id_info_t *id_info, bool is_global) {
if (is_global) {
compile_declare_global(comp, pn, id_info);
} else {
@@ -1265,7 +1265,7 @@ STATIC void compile_declare_global_or_nonlocal(compiler_t *comp, mp_parse_node_t
}
}
-STATIC void compile_global_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_global_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (comp->pass == MP_PASS_SCOPE) {
bool is_global = MP_PARSE_NODE_STRUCT_KIND(pns) == PN_global_stmt;
@@ -1284,7 +1284,7 @@ STATIC void compile_global_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_
}
}
-STATIC void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// with optimisations enabled we don't compile assertions
if (MP_STATE_VM(mp_optimise_value) != 0) {
return;
@@ -1302,7 +1302,7 @@ STATIC void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
EMIT_ARG(label_assign, l_end);
}
-STATIC void compile_if_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_if_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
uint l_end = comp_next_label(comp);
// optimisation: don't emit anything when "if False"
@@ -1372,7 +1372,7 @@ done:
comp->continue_label = old_continue_label; \
comp->break_continue_except_level = old_break_continue_except_level;
-STATIC void compile_while_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_while_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
START_BREAK_CONTINUE_BLOCK
if (!mp_parse_node_is_const_false(pns->nodes[0])) { // optimisation: don't emit anything for "while False"
@@ -1410,7 +1410,7 @@ STATIC void compile_while_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// If <end> is a small-int, then the stack during the for-loop contains just
// the current value of <var>. Otherwise, the stack contains <end> then the
// current value of <var>.
-STATIC void compile_for_stmt_optimised_range(compiler_t *comp, mp_parse_node_t pn_var, mp_parse_node_t pn_start, mp_parse_node_t pn_end, mp_parse_node_t pn_step, mp_parse_node_t pn_body, mp_parse_node_t pn_else) {
+static void compile_for_stmt_optimised_range(compiler_t *comp, mp_parse_node_t pn_var, mp_parse_node_t pn_start, mp_parse_node_t pn_end, mp_parse_node_t pn_step, mp_parse_node_t pn_body, mp_parse_node_t pn_else) {
START_BREAK_CONTINUE_BLOCK
uint top_label = comp_next_label(comp);
@@ -1492,7 +1492,7 @@ STATIC void compile_for_stmt_optimised_range(compiler_t *comp, mp_parse_node_t p
}
}
-STATIC void compile_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// this bit optimises: for <x> in range(...), turning it into an explicitly incremented variable
// this is actually slower, but uses no heap memory
// for viper it will be much, much faster
@@ -1572,7 +1572,7 @@ STATIC void compile_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
EMIT_ARG(label_assign, break_label);
}
-STATIC void compile_try_except(compiler_t *comp, mp_parse_node_t pn_body, int n_except, mp_parse_node_t *pn_excepts, mp_parse_node_t pn_else) {
+static void compile_try_except(compiler_t *comp, mp_parse_node_t pn_body, int n_except, mp_parse_node_t *pn_excepts, mp_parse_node_t pn_else) {
// setup code
uint l1 = comp_next_label(comp);
uint success_label = comp_next_label(comp);
@@ -1669,7 +1669,7 @@ STATIC void compile_try_except(compiler_t *comp, mp_parse_node_t pn_body, int n_
EMIT_ARG(label_assign, l2);
}
-STATIC void compile_try_finally(compiler_t *comp, mp_parse_node_t pn_body, int n_except, mp_parse_node_t *pn_except, mp_parse_node_t pn_else, mp_parse_node_t pn_finally) {
+static void compile_try_finally(compiler_t *comp, mp_parse_node_t pn_body, int n_except, mp_parse_node_t *pn_except, mp_parse_node_t pn_else, mp_parse_node_t pn_finally) {
uint l_finally_block = comp_next_label(comp);
compile_increase_except_level(comp, l_finally_block, MP_EMIT_SETUP_BLOCK_FINALLY);
@@ -1698,7 +1698,7 @@ STATIC void compile_try_finally(compiler_t *comp, mp_parse_node_t pn_body, int n
compile_decrease_except_level(comp);
}
-STATIC void compile_try_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_try_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
assert(MP_PARSE_NODE_IS_STRUCT(pns->nodes[1])); // should be
{
mp_parse_node_struct_t *pns2 = (mp_parse_node_struct_t *)pns->nodes[1];
@@ -1725,7 +1725,7 @@ STATIC void compile_try_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
}
-STATIC void compile_with_stmt_helper(compiler_t *comp, size_t n, mp_parse_node_t *nodes, mp_parse_node_t body) {
+static void compile_with_stmt_helper(compiler_t *comp, size_t n, mp_parse_node_t *nodes, mp_parse_node_t body) {
if (n == 0) {
// no more pre-bits, compile the body of the with
compile_node(comp, body);
@@ -1752,7 +1752,7 @@ STATIC void compile_with_stmt_helper(compiler_t *comp, size_t n, mp_parse_node_t
}
}
-STATIC void compile_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// get the nodes for the pre-bit of the with (the a as b, c as d, ... bit)
mp_parse_node_t *nodes;
size_t n = mp_parse_node_extract_list(&pns->nodes[0], PN_with_stmt_list, &nodes);
@@ -1762,7 +1762,7 @@ STATIC void compile_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_with_stmt_helper(comp, n, nodes, pns->nodes[1]);
}
-STATIC void compile_yield_from(compiler_t *comp) {
+static void compile_yield_from(compiler_t *comp) {
EMIT_ARG(get_iter, false);
EMIT_ARG(load_const_tok, MP_TOKEN_KW_NONE);
EMIT_ARG(yield, MP_EMIT_YIELD_FROM);
@@ -1770,13 +1770,13 @@ STATIC void compile_yield_from(compiler_t *comp) {
}
#if MICROPY_PY_ASYNC_AWAIT
-STATIC void compile_await_object_method(compiler_t *comp, qstr method) {
+static void compile_await_object_method(compiler_t *comp, qstr method) {
EMIT_ARG(load_method, method, false);
EMIT_ARG(call_method, 0, 0, 0);
compile_yield_from(comp);
}
-STATIC void compile_async_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_async_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// Allocate labels.
uint while_else_label = comp_next_label(comp);
uint try_exception_label = comp_next_label(comp);
@@ -1843,7 +1843,7 @@ STATIC void compile_async_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns
// Stack: (...)
}
-STATIC void compile_async_with_stmt_helper(compiler_t *comp, size_t n, mp_parse_node_t *nodes, mp_parse_node_t body) {
+static void compile_async_with_stmt_helper(compiler_t *comp, size_t n, mp_parse_node_t *nodes, mp_parse_node_t body) {
if (n == 0) {
// no more pre-bits, compile the body of the with
compile_node(comp, body);
@@ -1955,7 +1955,7 @@ STATIC void compile_async_with_stmt_helper(compiler_t *comp, size_t n, mp_parse_
}
}
-STATIC void compile_async_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_async_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// get the nodes for the pre-bit of the with (the a as b, c as d, ... bit)
mp_parse_node_t *nodes;
size_t n = mp_parse_node_extract_list(&pns->nodes[0], PN_with_stmt_list, &nodes);
@@ -1965,7 +1965,7 @@ STATIC void compile_async_with_stmt(compiler_t *comp, mp_parse_node_struct_t *pn
compile_async_with_stmt_helper(comp, n, nodes, pns->nodes[1]);
}
-STATIC void compile_async_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_async_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
assert(MP_PARSE_NODE_IS_STRUCT(pns->nodes[0]));
mp_parse_node_struct_t *pns0 = (mp_parse_node_struct_t *)pns->nodes[0];
if (MP_PARSE_NODE_STRUCT_KIND(pns0) == PN_funcdef) {
@@ -1994,7 +1994,7 @@ STATIC void compile_async_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
#endif
-STATIC void compile_expr_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_expr_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
mp_parse_node_t pn_rhs = pns->nodes[1];
if (MP_PARSE_NODE_IS_NULL(pn_rhs)) {
if (comp->is_repl && comp->scope_cur->kind == SCOPE_MODULE) {
@@ -2109,7 +2109,7 @@ STATIC void compile_expr_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
}
-STATIC void compile_test_if_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_test_if_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
assert(MP_PARSE_NODE_IS_STRUCT_KIND(pns->nodes[1], PN_test_if_else));
mp_parse_node_struct_t *pns_test_if_else = (mp_parse_node_struct_t *)pns->nodes[1];
@@ -2124,7 +2124,7 @@ STATIC void compile_test_if_expr(compiler_t *comp, mp_parse_node_struct_t *pns)
EMIT_ARG(label_assign, l_end);
}
-STATIC void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (comp->pass == MP_PASS_SCOPE) {
// create a new scope for this lambda
scope_t *s = scope_new_and_link(comp, SCOPE_LAMBDA, (mp_parse_node_t)pns, comp->scope_cur->emit_options);
@@ -2140,7 +2140,7 @@ STATIC void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
#if MICROPY_PY_ASSIGN_EXPR
-STATIC void compile_namedexpr_helper(compiler_t *comp, mp_parse_node_t pn_name, mp_parse_node_t pn_expr) {
+static void compile_namedexpr_helper(compiler_t *comp, mp_parse_node_t pn_name, mp_parse_node_t pn_expr) {
if (!MP_PARSE_NODE_IS_ID(pn_name)) {
compile_syntax_error(comp, (mp_parse_node_t)pn_name, MP_ERROR_TEXT("can't assign to expression"));
}
@@ -2172,12 +2172,12 @@ STATIC void compile_namedexpr_helper(compiler_t *comp, mp_parse_node_t pn_name,
compile_store_id(comp, target);
}
-STATIC void compile_namedexpr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_namedexpr(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_namedexpr_helper(comp, pns->nodes[0], pns->nodes[1]);
}
#endif
-STATIC void compile_or_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_or_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
bool cond = MP_PARSE_NODE_STRUCT_KIND(pns) == PN_or_test;
uint l_end = comp_next_label(comp);
int n = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
@@ -2190,12 +2190,12 @@ STATIC void compile_or_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
EMIT_ARG(label_assign, l_end);
}
-STATIC void compile_not_test_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_not_test_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pns->nodes[0]);
EMIT_ARG(unary_op, MP_UNARY_OP_NOT);
}
-STATIC void compile_comparison(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_comparison(compiler_t *comp, mp_parse_node_struct_t *pns) {
int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
compile_node(comp, pns->nodes[0]);
bool multi = (num_nodes > 3);
@@ -2248,11 +2248,11 @@ STATIC void compile_comparison(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
}
-STATIC void compile_star_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_star_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_syntax_error(comp, (mp_parse_node_t)pns, MP_ERROR_TEXT("*x must be assignment target"));
}
-STATIC void compile_binary_op(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_binary_op(compiler_t *comp, mp_parse_node_struct_t *pns) {
MP_STATIC_ASSERT(MP_BINARY_OP_OR + PN_xor_expr - PN_expr == MP_BINARY_OP_XOR);
MP_STATIC_ASSERT(MP_BINARY_OP_OR + PN_and_expr - PN_expr == MP_BINARY_OP_AND);
mp_binary_op_t binary_op = MP_BINARY_OP_OR + MP_PARSE_NODE_STRUCT_KIND(pns) - PN_expr;
@@ -2264,7 +2264,7 @@ STATIC void compile_binary_op(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
}
-STATIC void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
compile_node(comp, pns->nodes[0]);
for (int i = 1; i + 1 < num_nodes; i += 2) {
@@ -2275,7 +2275,7 @@ STATIC void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
}
-STATIC void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pns->nodes[1]);
mp_token_kind_t tok = MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]);
mp_unary_op_t op;
@@ -2288,7 +2288,7 @@ STATIC void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
EMIT_ARG(unary_op, op);
}
-STATIC void compile_atom_expr_normal(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_atom_expr_normal(compiler_t *comp, mp_parse_node_struct_t *pns) {
// compile the subject of the expression
compile_node(comp, pns->nodes[0]);
@@ -2384,12 +2384,12 @@ STATIC void compile_atom_expr_normal(compiler_t *comp, mp_parse_node_struct_t *p
}
}
-STATIC void compile_power(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_power(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_generic_all_nodes(comp, pns); // 2 nodes, arguments of power
EMIT_ARG(binary_op, MP_BINARY_OP_POWER);
}
-STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_arglist, bool is_method_call, int n_positional_extra) {
+static void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_arglist, bool is_method_call, int n_positional_extra) {
// function to call is on top of stack
// get the list of arguments
@@ -2484,7 +2484,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar
}
// pns needs to have 2 nodes, first is lhs of comprehension, second is PN_comp_for node
-STATIC void compile_comprehension(compiler_t *comp, mp_parse_node_struct_t *pns, scope_kind_t kind) {
+static void compile_comprehension(compiler_t *comp, mp_parse_node_struct_t *pns, scope_kind_t kind) {
assert(MP_PARSE_NODE_STRUCT_NUM_NODES(pns) == 2);
assert(MP_PARSE_NODE_IS_STRUCT_KIND(pns->nodes[1], PN_comp_for));
mp_parse_node_struct_t *pns_comp_for = (mp_parse_node_struct_t *)pns->nodes[1];
@@ -2509,7 +2509,7 @@ STATIC void compile_comprehension(compiler_t *comp, mp_parse_node_struct_t *pns,
EMIT_ARG(call_function, 1, 0, 0);
}
-STATIC void compile_atom_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_atom_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
// an empty tuple
EMIT_ARG(build, 0, MP_EMIT_BUILD_TUPLE);
@@ -2526,7 +2526,7 @@ STATIC void compile_atom_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
}
-STATIC void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
// empty list
EMIT_ARG(build, 0, MP_EMIT_BUILD_LIST);
@@ -2547,7 +2547,7 @@ STATIC void compile_atom_bracket(compiler_t *comp, mp_parse_node_struct_t *pns)
}
}
-STATIC void compile_atom_brace_helper(compiler_t *comp, mp_parse_node_struct_t *pns, bool create_map) {
+static void compile_atom_brace_helper(compiler_t *comp, mp_parse_node_struct_t *pns, bool create_map) {
mp_parse_node_t pn = pns->nodes[0];
if (MP_PARSE_NODE_IS_NULL(pn)) {
// empty dict
@@ -2649,27 +2649,27 @@ STATIC void compile_atom_brace_helper(compiler_t *comp, mp_parse_node_struct_t *
}
}
-STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_atom_brace_helper(comp, pns, true);
}
-STATIC void compile_trailer_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_trailer_paren(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_trailer_paren_helper(comp, pns->nodes[0], false, 0);
}
-STATIC void compile_trailer_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_trailer_bracket(compiler_t *comp, mp_parse_node_struct_t *pns) {
// object who's index we want is on top of stack
compile_node(comp, pns->nodes[0]); // the index
EMIT_ARG(subscr, MP_EMIT_SUBSCR_LOAD);
}
-STATIC void compile_trailer_period(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_trailer_period(compiler_t *comp, mp_parse_node_struct_t *pns) {
// object who's attribute we want is on top of stack
EMIT_ARG(attr, MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]), MP_EMIT_ATTR_LOAD); // attribute to get
}
#if MICROPY_PY_BUILTINS_SLICE
-STATIC void compile_subscript(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_subscript(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (MP_PARSE_NODE_STRUCT_KIND(pns) == PN_subscript_2) {
compile_node(comp, pns->nodes[0]); // start of slice
assert(MP_PARSE_NODE_IS_STRUCT(pns->nodes[1])); // should always be
@@ -2724,19 +2724,19 @@ STATIC void compile_subscript(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
#endif // MICROPY_PY_BUILTINS_SLICE
-STATIC void compile_dictorsetmaker_item(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_dictorsetmaker_item(compiler_t *comp, mp_parse_node_struct_t *pns) {
// if this is called then we are compiling a dict key:value pair
compile_node(comp, pns->nodes[1]); // value
compile_node(comp, pns->nodes[0]); // key
}
-STATIC void compile_classdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_classdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
qstr cname = compile_classdef_helper(comp, pns, comp->scope_cur->emit_options);
// store class object into class name
compile_store_id(comp, cname);
}
-STATIC void compile_yield_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_yield_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (comp->scope_cur->kind != SCOPE_FUNCTION && comp->scope_cur->kind != SCOPE_LAMBDA) {
compile_syntax_error(comp, (mp_parse_node_t)pns, MP_ERROR_TEXT("'yield' outside function"));
return;
@@ -2757,7 +2757,7 @@ STATIC void compile_yield_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
#if MICROPY_PY_ASYNC_AWAIT
-STATIC void compile_atom_expr_await(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_atom_expr_await(compiler_t *comp, mp_parse_node_struct_t *pns) {
if (comp->scope_cur->kind != SCOPE_FUNCTION && comp->scope_cur->kind != SCOPE_LAMBDA) {
compile_syntax_error(comp, (mp_parse_node_t)pns, MP_ERROR_TEXT("'await' outside function"));
return;
@@ -2767,16 +2767,16 @@ STATIC void compile_atom_expr_await(compiler_t *comp, mp_parse_node_struct_t *pn
}
#endif
-STATIC mp_obj_t get_const_object(mp_parse_node_struct_t *pns) {
+static mp_obj_t get_const_object(mp_parse_node_struct_t *pns) {
return mp_parse_node_extract_const_object(pns);
}
-STATIC void compile_const_object(compiler_t *comp, mp_parse_node_struct_t *pns) {
+static void compile_const_object(compiler_t *comp, mp_parse_node_struct_t *pns) {
EMIT_ARG(load_const_obj, get_const_object(pns));
}
typedef void (*compile_function_t)(compiler_t *, mp_parse_node_struct_t *);
-STATIC const compile_function_t compile_function[] = {
+static const compile_function_t compile_function[] = {
// only define rules with a compile function
#define c(f) compile_##f
#define DEF_RULE(rule, comp, kind, ...) comp,
@@ -2788,7 +2788,7 @@ STATIC const compile_function_t compile_function[] = {
compile_const_object,
};
-STATIC void compile_node(compiler_t *comp, mp_parse_node_t pn) {
+static void compile_node(compiler_t *comp, mp_parse_node_t pn) {
if (MP_PARSE_NODE_IS_NULL(pn)) {
// pass
} else if (MP_PARSE_NODE_IS_SMALL_INT(pn)) {
@@ -2824,7 +2824,7 @@ STATIC void compile_node(compiler_t *comp, mp_parse_node_t pn) {
}
#if MICROPY_EMIT_NATIVE
-STATIC int compile_viper_type_annotation(compiler_t *comp, mp_parse_node_t pn_annotation) {
+static int compile_viper_type_annotation(compiler_t *comp, mp_parse_node_t pn_annotation) {
int native_type = MP_NATIVE_TYPE_OBJ;
if (MP_PARSE_NODE_IS_NULL(pn_annotation)) {
// No annotation, type defaults to object
@@ -2842,7 +2842,7 @@ STATIC int compile_viper_type_annotation(compiler_t *comp, mp_parse_node_t pn_an
}
#endif
-STATIC void compile_scope_func_lambda_param(compiler_t *comp, mp_parse_node_t pn, pn_kind_t pn_name, pn_kind_t pn_star, pn_kind_t pn_dbl_star) {
+static void compile_scope_func_lambda_param(compiler_t *comp, mp_parse_node_t pn, pn_kind_t pn_name, pn_kind_t pn_star, pn_kind_t pn_dbl_star) {
(void)pn_dbl_star;
// check that **kw is last
@@ -2929,15 +2929,15 @@ STATIC void compile_scope_func_lambda_param(compiler_t *comp, mp_parse_node_t pn
}
}
-STATIC void compile_scope_func_param(compiler_t *comp, mp_parse_node_t pn) {
+static void compile_scope_func_param(compiler_t *comp, mp_parse_node_t pn) {
compile_scope_func_lambda_param(comp, pn, PN_typedargslist_name, PN_typedargslist_star, PN_typedargslist_dbl_star);
}
-STATIC void compile_scope_lambda_param(compiler_t *comp, mp_parse_node_t pn) {
+static void compile_scope_lambda_param(compiler_t *comp, mp_parse_node_t pn) {
compile_scope_func_lambda_param(comp, pn, PN_varargslist_name, PN_varargslist_star, PN_varargslist_dbl_star);
}
-STATIC void compile_scope_comp_iter(compiler_t *comp, mp_parse_node_struct_t *pns_comp_for, mp_parse_node_t pn_inner_expr, int for_depth) {
+static void compile_scope_comp_iter(compiler_t *comp, mp_parse_node_struct_t *pns_comp_for, mp_parse_node_t pn_inner_expr, int for_depth) {
uint l_top = comp_next_label(comp);
uint l_end = comp_next_label(comp);
EMIT_ARG(label_assign, l_top);
@@ -2976,7 +2976,7 @@ tail_recursion:
EMIT(for_iter_end);
}
-STATIC void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) {
+static void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) {
#if MICROPY_ENABLE_DOC_STRING
// see http://www.python.org/dev/peps/pep-0257/
@@ -3021,7 +3021,7 @@ STATIC void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) {
#endif
}
-STATIC bool compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
+static bool compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
comp->pass = pass;
comp->scope_cur = scope;
comp->next_label = 0;
@@ -3186,7 +3186,7 @@ STATIC bool compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
#if MICROPY_EMIT_INLINE_ASM
// requires 3 passes: SCOPE, CODE_SIZE, EMIT
-STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
+static void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
comp->pass = pass;
comp->scope_cur = scope;
comp->next_label = 0;
@@ -3361,7 +3361,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
}
#endif
-STATIC void scope_compute_things(scope_t *scope) {
+static void scope_compute_things(scope_t *scope) {
// in MicroPython we put the *x parameter after all other parameters (except **y)
if (scope->scope_flags & MP_SCOPE_FLAG_VARARGS) {
id_info_t *id_param = NULL;
@@ -3455,7 +3455,7 @@ STATIC void scope_compute_things(scope_t *scope) {
}
#if !MICROPY_PERSISTENT_CODE_SAVE
-STATIC
+static
#endif
void mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl, mp_compiled_module_t *cm) {
// put compiler state on the stack, it's relatively small
diff --git a/py/emitbc.c b/py/emitbc.c
index 85fc5f218b..05754cfabf 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -92,7 +92,7 @@ void emit_bc_free(emit_t *emit) {
}
// all functions must go through this one to emit code info
-STATIC uint8_t *emit_get_cur_to_write_code_info(void *emit_in, size_t num_bytes_to_write) {
+static uint8_t *emit_get_cur_to_write_code_info(void *emit_in, size_t num_bytes_to_write) {
emit_t *emit = emit_in;
if (emit->pass < MP_PASS_EMIT) {
emit->code_info_offset += num_bytes_to_write;
@@ -105,16 +105,16 @@ STATIC uint8_t *emit_get_cur_to_write_code_info(void *emit_in, size_t num_bytes_
}
}
-STATIC void emit_write_code_info_byte(emit_t *emit, byte val) {
+static void emit_write_code_info_byte(emit_t *emit, byte val) {
*emit_get_cur_to_write_code_info(emit, 1) = val;
}
-STATIC void emit_write_code_info_qstr(emit_t *emit, qstr qst) {
+static void emit_write_code_info_qstr(emit_t *emit, qstr qst) {
mp_encode_uint(emit, emit_get_cur_to_write_code_info, mp_emit_common_use_qstr(emit->emit_common, qst));
}
#if MICROPY_ENABLE_SOURCE_LINE
-STATIC void emit_write_code_info_bytes_lines(emit_t *emit, mp_uint_t bytes_to_skip, mp_uint_t lines_to_skip) {
+static void emit_write_code_info_bytes_lines(emit_t *emit, mp_uint_t bytes_to_skip, mp_uint_t lines_to_skip) {
assert(bytes_to_skip > 0 || lines_to_skip > 0);
while (bytes_to_skip > 0 || lines_to_skip > 0) {
mp_uint_t b, l;
@@ -143,7 +143,7 @@ STATIC void emit_write_code_info_bytes_lines(emit_t *emit, mp_uint_t bytes_to_sk
#endif
// all functions must go through this one to emit byte code
-STATIC uint8_t *emit_get_cur_to_write_bytecode(void *emit_in, size_t num_bytes_to_write) {
+static uint8_t *emit_get_cur_to_write_bytecode(void *emit_in, size_t num_bytes_to_write) {
emit_t *emit = emit_in;
if (emit->suppress) {
return emit->dummy_data;
@@ -159,19 +159,19 @@ STATIC uint8_t *emit_get_cur_to_write_bytecode(void *emit_in, size_t num_bytes_t
}
}
-STATIC void emit_write_bytecode_raw_byte(emit_t *emit, byte b1) {
+static void emit_write_bytecode_raw_byte(emit_t *emit, byte b1) {
byte *c = emit_get_cur_to_write_bytecode(emit, 1);
c[0] = b1;
}
-STATIC void emit_write_bytecode_byte(emit_t *emit, int stack_adj, byte b1) {
+static void emit_write_bytecode_byte(emit_t *emit, int stack_adj, byte b1) {
mp_emit_bc_adjust_stack_size(emit, stack_adj);
byte *c = emit_get_cur_to_write_bytecode(emit, 1);
c[0] = b1;
}
// Similar to mp_encode_uint(), just some extra handling to encode sign
-STATIC void emit_write_bytecode_byte_int(emit_t *emit, int stack_adj, byte b1, mp_int_t num) {
+static void emit_write_bytecode_byte_int(emit_t *emit, int stack_adj, byte b1, mp_int_t num) {
emit_write_bytecode_byte(emit, stack_adj, b1);
// We store each 7 bits in a separate byte, and that's how many bytes needed
@@ -197,24 +197,24 @@ STATIC void emit_write_bytecode_byte_int(emit_t *emit, int stack_adj, byte b1, m
*c = *p;
}
-STATIC void emit_write_bytecode_byte_uint(emit_t *emit, int stack_adj, byte b, mp_uint_t val) {
+static void emit_write_bytecode_byte_uint(emit_t *emit, int stack_adj, byte b, mp_uint_t val) {
emit_write_bytecode_byte(emit, stack_adj, b);
mp_encode_uint(emit, emit_get_cur_to_write_bytecode, val);
}
-STATIC void emit_write_bytecode_byte_const(emit_t *emit, int stack_adj, byte b, mp_uint_t n) {
+static void emit_write_bytecode_byte_const(emit_t *emit, int stack_adj, byte b, mp_uint_t n) {
emit_write_bytecode_byte_uint(emit, stack_adj, b, n);
}
-STATIC void emit_write_bytecode_byte_qstr(emit_t *emit, int stack_adj, byte b, qstr qst) {
+static void emit_write_bytecode_byte_qstr(emit_t *emit, int stack_adj, byte b, qstr qst) {
emit_write_bytecode_byte_uint(emit, stack_adj, b, mp_emit_common_use_qstr(emit->emit_common, qst));
}
-STATIC void emit_write_bytecode_byte_obj(emit_t *emit, int stack_adj, byte b, mp_obj_t obj) {
+static void emit_write_bytecode_byte_obj(emit_t *emit, int stack_adj, byte b, mp_obj_t obj) {
emit_write_bytecode_byte_const(emit, stack_adj, b, mp_emit_common_use_const_obj(emit->emit_common, obj));
}
-STATIC void emit_write_bytecode_byte_child(emit_t *emit, int stack_adj, byte b, mp_raw_code_t *rc) {
+static void emit_write_bytecode_byte_child(emit_t *emit, int stack_adj, byte b, mp_raw_code_t *rc) {
emit_write_bytecode_byte_const(emit, stack_adj, b,
mp_emit_common_alloc_const_child(emit->emit_common, rc));
#if MICROPY_PY_SYS_SETTRACE
@@ -227,7 +227,7 @@ STATIC void emit_write_bytecode_byte_child(emit_t *emit, int stack_adj, byte b,
// The offset is encoded as either 1 or 2 bytes, depending on how big it is.
// The encoding of this jump opcode can change size from one pass to the next,
// but it must only ever decrease in size on successive passes.
-STATIC void emit_write_bytecode_byte_label(emit_t *emit, int stack_adj, byte b1, mp_uint_t label) {
+static void emit_write_bytecode_byte_label(emit_t *emit, int stack_adj, byte b1, mp_uint_t label) {
mp_emit_bc_adjust_stack_size(emit, stack_adj);
if (emit->suppress) {
@@ -768,7 +768,7 @@ void mp_emit_bc_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_ov
}
}
-STATIC void emit_bc_call_function_method_helper(emit_t *emit, int stack_adj, mp_uint_t bytecode_base, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) {
+static void emit_bc_call_function_method_helper(emit_t *emit, int stack_adj, mp_uint_t bytecode_base, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) {
if (star_flags) {
// each positional arg is one object, each kwarg is two objects, the key
// and the value and one extra object for the star args bitmap.
diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c
index 29487f1048..7818bb4f46 100644
--- a/py/emitinlinethumb.c
+++ b/py/emitinlinethumb.c
@@ -74,11 +74,11 @@ static inline bool emit_inline_thumb_allow_float(emit_inline_asm_t *emit) {
#endif
-STATIC void emit_inline_thumb_error_msg(emit_inline_asm_t *emit, mp_rom_error_text_t msg) {
+static void emit_inline_thumb_error_msg(emit_inline_asm_t *emit, mp_rom_error_text_t msg) {
*emit->error_slot = mp_obj_new_exception_msg(&mp_type_SyntaxError, msg);
}
-STATIC void emit_inline_thumb_error_exc(emit_inline_asm_t *emit, mp_obj_t exc) {
+static void emit_inline_thumb_error_exc(emit_inline_asm_t *emit, mp_obj_t exc) {
*emit->error_slot = exc;
}
@@ -97,7 +97,7 @@ void emit_inline_thumb_free(emit_inline_asm_t *emit) {
m_del_obj(emit_inline_asm_t, emit);
}
-STATIC void emit_inline_thumb_start_pass(emit_inline_asm_t *emit, pass_kind_t pass, mp_obj_t *error_slot) {
+static void emit_inline_thumb_start_pass(emit_inline_asm_t *emit, pass_kind_t pass, mp_obj_t *error_slot) {
emit->pass = pass;
emit->error_slot = error_slot;
if (emit->pass == MP_PASS_CODE_SIZE) {
@@ -107,12 +107,12 @@ STATIC void emit_inline_thumb_start_pass(emit_inline_asm_t *emit, pass_kind_t pa
asm_thumb_entry(&emit->as, 0);
}
-STATIC void emit_inline_thumb_end_pass(emit_inline_asm_t *emit, mp_uint_t type_sig) {
+static void emit_inline_thumb_end_pass(emit_inline_asm_t *emit, mp_uint_t type_sig) {
asm_thumb_exit(&emit->as);
asm_thumb_end_pass(&emit->as);
}
-STATIC mp_uint_t emit_inline_thumb_count_params(emit_inline_asm_t *emit, mp_uint_t n_params, mp_parse_node_t *pn_params) {
+static mp_uint_t emit_inline_thumb_count_params(emit_inline_asm_t *emit, mp_uint_t n_params, mp_parse_node_t *pn_params) {
if (n_params > 4) {
emit_inline_thumb_error_msg(emit, MP_ERROR_TEXT("can only have up to 4 parameters to Thumb assembly"));
return 0;
@@ -131,7 +131,7 @@ STATIC mp_uint_t emit_inline_thumb_count_params(emit_inline_asm_t *emit, mp_uint
return n_params;
}
-STATIC bool emit_inline_thumb_label(emit_inline_asm_t *emit, mp_uint_t label_num, qstr label_id) {
+static bool emit_inline_thumb_label(emit_inline_asm_t *emit, mp_uint_t label_num, qstr label_id) {
assert(label_num < emit->max_num_labels);
if (emit->pass == MP_PASS_CODE_SIZE) {
// check for duplicate label on first pass
@@ -149,7 +149,7 @@ STATIC bool emit_inline_thumb_label(emit_inline_asm_t *emit, mp_uint_t label_num
typedef struct _reg_name_t { byte reg;
byte name[3];
} reg_name_t;
-STATIC const reg_name_t reg_name_table[] = {
+static const reg_name_t reg_name_table[] = {
{0, "r0\0"},
{1, "r1\0"},
{2, "r2\0"},
@@ -177,14 +177,14 @@ STATIC const reg_name_t reg_name_table[] = {
typedef struct _special_reg_name_t { byte reg;
char name[MAX_SPECIAL_REGISTER_NAME_LENGTH + 1];
} special_reg_name_t;
-STATIC const special_reg_name_t special_reg_name_table[] = {
+static const special_reg_name_t special_reg_name_table[] = {
{5, "IPSR"},
{17, "BASEPRI"},
};
// return empty string in case of error, so we can attempt to parse the string
// without a special check if it was in fact a string
-STATIC const char *get_arg_str(mp_parse_node_t pn) {
+static const char *get_arg_str(mp_parse_node_t pn) {
if (MP_PARSE_NODE_IS_ID(pn)) {
qstr qst = MP_PARSE_NODE_LEAF_ARG(pn);
return qstr_str(qst);
@@ -193,7 +193,7 @@ STATIC const char *get_arg_str(mp_parse_node_t pn) {
}
}
-STATIC mp_uint_t get_arg_reg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, mp_uint_t max_reg) {
+static mp_uint_t get_arg_reg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, mp_uint_t max_reg) {
const char *reg_str = get_arg_str(pn);
for (mp_uint_t i = 0; i < MP_ARRAY_SIZE(reg_name_table); i++) {
const reg_name_t *r = &reg_name_table[i];
@@ -217,7 +217,7 @@ STATIC mp_uint_t get_arg_reg(emit_inline_asm_t *emit, const char *op, mp_parse_n
return 0;
}
-STATIC mp_uint_t get_arg_special_reg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
+static mp_uint_t get_arg_special_reg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
const char *reg_str = get_arg_str(pn);
for (mp_uint_t i = 0; i < MP_ARRAY_SIZE(special_reg_name_table); i++) {
const special_reg_name_t *r = &special_reg_name_table[i];
@@ -231,7 +231,7 @@ STATIC mp_uint_t get_arg_special_reg(emit_inline_asm_t *emit, const char *op, mp
return 0;
}
-STATIC mp_uint_t get_arg_vfpreg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
+static mp_uint_t get_arg_vfpreg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
const char *reg_str = get_arg_str(pn);
if (reg_str[0] == 's' && reg_str[1] != '\0') {
mp_uint_t regno = 0;
@@ -258,7 +258,7 @@ malformed:
return 0;
}
-STATIC mp_uint_t get_arg_reglist(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
+static mp_uint_t get_arg_reglist(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
// a register list looks like {r0, r1, r2} and is parsed as a Python set
if (!MP_PARSE_NODE_IS_STRUCT_KIND(pn, PN_atom_brace)) {
@@ -310,7 +310,7 @@ bad_arg:
return 0;
}
-STATIC uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, uint32_t fit_mask) {
+static uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, uint32_t fit_mask) {
mp_obj_t o;
if (!mp_parse_node_get_int_maybe(pn, &o)) {
emit_inline_thumb_error_exc(emit, mp_obj_new_exception_msg_varg(&mp_type_SyntaxError, MP_ERROR_TEXT("'%s' expects an integer"), op));
@@ -324,7 +324,7 @@ STATIC uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node
return i;
}
-STATIC bool get_arg_addr(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, mp_parse_node_t *pn_base, mp_parse_node_t *pn_offset) {
+static bool get_arg_addr(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, mp_parse_node_t *pn_base, mp_parse_node_t *pn_offset) {
if (!MP_PARSE_NODE_IS_STRUCT_KIND(pn, PN_atom_bracket)) {
goto bad_arg;
}
@@ -346,7 +346,7 @@ bad_arg:
return false;
}
-STATIC int get_arg_label(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
+static int get_arg_label(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
if (!MP_PARSE_NODE_IS_ID(pn)) {
emit_inline_thumb_error_exc(emit, mp_obj_new_exception_msg_varg(&mp_type_SyntaxError, MP_ERROR_TEXT("'%s' expects a label"), op));
return 0;
@@ -367,7 +367,7 @@ STATIC int get_arg_label(emit_inline_asm_t *emit, const char *op, mp_parse_node_
typedef struct _cc_name_t { byte cc;
byte name[2];
} cc_name_t;
-STATIC const cc_name_t cc_name_table[] = {
+static const cc_name_t cc_name_table[] = {
{ ASM_THUMB_CC_EQ, "eq" },
{ ASM_THUMB_CC_NE, "ne" },
{ ASM_THUMB_CC_CS, "cs" },
@@ -388,7 +388,7 @@ typedef struct _format_4_op_t { byte op;
char name[3];
} format_4_op_t;
#define X(x) (((x) >> 4) & 0xff) // only need 1 byte to distinguish these ops
-STATIC const format_4_op_t format_4_op_table[] = {
+static const format_4_op_t format_4_op_table[] = {
{ X(ASM_THUMB_FORMAT_4_EOR), "eor" },
{ X(ASM_THUMB_FORMAT_4_LSL), "lsl" },
{ X(ASM_THUMB_FORMAT_4_LSR), "lsr" },
@@ -412,7 +412,7 @@ typedef struct _format_9_10_op_t { uint16_t op;
uint16_t name;
} format_9_10_op_t;
#define X(x) (x)
-STATIC const format_9_10_op_t format_9_10_op_table[] = {
+static const format_9_10_op_t format_9_10_op_table[] = {
{ X(ASM_THUMB_FORMAT_9_LDR | ASM_THUMB_FORMAT_9_WORD_TRANSFER), MP_QSTR_ldr },
{ X(ASM_THUMB_FORMAT_9_LDR | ASM_THUMB_FORMAT_9_BYTE_TRANSFER), MP_QSTR_ldrb },
{ X(ASM_THUMB_FORMAT_10_LDRH), MP_QSTR_ldrh },
@@ -427,7 +427,7 @@ typedef struct _format_vfp_op_t {
byte op;
char name[3];
} format_vfp_op_t;
-STATIC const format_vfp_op_t format_vfp_op_table[] = {
+static const format_vfp_op_t format_vfp_op_table[] = {
{ 0x30, "add" },
{ 0x34, "sub" },
{ 0x20, "mul" },
@@ -437,7 +437,7 @@ STATIC const format_vfp_op_t format_vfp_op_table[] = {
// shorthand alias for whether we allow ARMv7-M instructions
#define ARMV7M asm_thumb_allow_armv7m(&emit->as)
-STATIC void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_args, mp_parse_node_t *pn_args) {
+static void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_args, mp_parse_node_t *pn_args) {
// TODO perhaps make two tables:
// one_args =
// "b", LAB, asm_thumb_b_n,
diff --git a/py/emitinlinextensa.c b/py/emitinlinextensa.c
index 5dac2ae390..57056d597a 100644
--- a/py/emitinlinextensa.c
+++ b/py/emitinlinextensa.c
@@ -43,11 +43,11 @@ struct _emit_inline_asm_t {
qstr *label_lookup;
};
-STATIC void emit_inline_xtensa_error_msg(emit_inline_asm_t *emit, mp_rom_error_text_t msg) {
+static void emit_inline_xtensa_error_msg(emit_inline_asm_t *emit, mp_rom_error_text_t msg) {
*emit->error_slot = mp_obj_new_exception_msg(&mp_type_SyntaxError, msg);
}
-STATIC void emit_inline_xtensa_error_exc(emit_inline_asm_t *emit, mp_obj_t exc) {
+static void emit_inline_xtensa_error_exc(emit_inline_asm_t *emit, mp_obj_t exc) {
*emit->error_slot = exc;
}
@@ -66,7 +66,7 @@ void emit_inline_xtensa_free(emit_inline_asm_t *emit) {
m_del_obj(emit_inline_asm_t, emit);
}
-STATIC void emit_inline_xtensa_start_pass(emit_inline_asm_t *emit, pass_kind_t pass, mp_obj_t *error_slot) {
+static void emit_inline_xtensa_start_pass(emit_inline_asm_t *emit, pass_kind_t pass, mp_obj_t *error_slot) {
emit->pass = pass;
emit->error_slot = error_slot;
if (emit->pass == MP_PASS_CODE_SIZE) {
@@ -76,12 +76,12 @@ STATIC void emit_inline_xtensa_start_pass(emit_inline_asm_t *emit, pass_kind_t p
asm_xtensa_entry(&emit->as, 0);
}
-STATIC void emit_inline_xtensa_end_pass(emit_inline_asm_t *emit, mp_uint_t type_sig) {
+static void emit_inline_xtensa_end_pass(emit_inline_asm_t *emit, mp_uint_t type_sig) {
asm_xtensa_exit(&emit->as);
asm_xtensa_end_pass(&emit->as);
}
-STATIC mp_uint_t emit_inline_xtensa_count_params(emit_inline_asm_t *emit, mp_uint_t n_params, mp_parse_node_t *pn_params) {
+static mp_uint_t emit_inline_xtensa_count_params(emit_inline_asm_t *emit, mp_uint_t n_params, mp_parse_node_t *pn_params) {
if (n_params > 4) {
emit_inline_xtensa_error_msg(emit, MP_ERROR_TEXT("can only have up to 4 parameters to Xtensa assembly"));
return 0;
@@ -100,7 +100,7 @@ STATIC mp_uint_t emit_inline_xtensa_count_params(emit_inline_asm_t *emit, mp_uin
return n_params;
}
-STATIC bool emit_inline_xtensa_label(emit_inline_asm_t *emit, mp_uint_t label_num, qstr label_id) {
+static bool emit_inline_xtensa_label(emit_inline_asm_t *emit, mp_uint_t label_num, qstr label_id) {
assert(label_num < emit->max_num_labels);
if (emit->pass == MP_PASS_CODE_SIZE) {
// check for duplicate label on first pass
@@ -118,7 +118,7 @@ STATIC bool emit_inline_xtensa_label(emit_inline_asm_t *emit, mp_uint_t label_nu
typedef struct _reg_name_t { byte reg;
byte name[3];
} reg_name_t;
-STATIC const reg_name_t reg_name_table[] = {
+static const reg_name_t reg_name_table[] = {
{0, "a0\0"},
{1, "a1\0"},
{2, "a2\0"},
@@ -139,7 +139,7 @@ STATIC const reg_name_t reg_name_table[] = {
// return empty string in case of error, so we can attempt to parse the string
// without a special check if it was in fact a string
-STATIC const char *get_arg_str(mp_parse_node_t pn) {
+static const char *get_arg_str(mp_parse_node_t pn) {
if (MP_PARSE_NODE_IS_ID(pn)) {
qstr qst = MP_PARSE_NODE_LEAF_ARG(pn);
return qstr_str(qst);
@@ -148,7 +148,7 @@ STATIC const char *get_arg_str(mp_parse_node_t pn) {
}
}
-STATIC mp_uint_t get_arg_reg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
+static mp_uint_t get_arg_reg(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
const char *reg_str = get_arg_str(pn);
for (mp_uint_t i = 0; i < MP_ARRAY_SIZE(reg_name_table); i++) {
const reg_name_t *r = &reg_name_table[i];
@@ -165,7 +165,7 @@ STATIC mp_uint_t get_arg_reg(emit_inline_asm_t *emit, const char *op, mp_parse_n
return 0;
}
-STATIC uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, int min, int max) {
+static uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn, int min, int max) {
mp_obj_t o;
if (!mp_parse_node_get_int_maybe(pn, &o)) {
emit_inline_xtensa_error_exc(emit, mp_obj_new_exception_msg_varg(&mp_type_SyntaxError, MP_ERROR_TEXT("'%s' expects an integer"), op));
@@ -179,7 +179,7 @@ STATIC uint32_t get_arg_i(emit_inline_asm_t *emit, const char *op, mp_parse_node
return i;
}
-STATIC int get_arg_label(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
+static int get_arg_label(emit_inline_asm_t *emit, const char *op, mp_parse_node_t pn) {
if (!MP_PARSE_NODE_IS_ID(pn)) {
emit_inline_xtensa_error_exc(emit, mp_obj_new_exception_msg_varg(&mp_type_SyntaxError, MP_ERROR_TEXT("'%s' expects a label"), op));
return 0;
@@ -208,7 +208,7 @@ typedef struct _opcode_table_3arg_t {
uint8_t a1 : 4;
} opcode_table_3arg_t;
-STATIC const opcode_table_3arg_t opcode_table_3arg[] = {
+static const opcode_table_3arg_t opcode_table_3arg[] = {
// arithmetic opcodes: reg, reg, reg
{MP_QSTR_and_, RRR, 0, 1},
{MP_QSTR_or_, RRR, 0, 2},
@@ -242,7 +242,7 @@ STATIC const opcode_table_3arg_t opcode_table_3arg[] = {
{MP_QSTR_bnone, RRI8_B, ASM_XTENSA_CC_NONE, 0},
};
-STATIC void emit_inline_xtensa_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_args, mp_parse_node_t *pn_args) {
+static void emit_inline_xtensa_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_args, mp_parse_node_t *pn_args) {
size_t op_len;
const char *op_str = (const char *)qstr_data(op, &op_len);
diff --git a/py/emitnative.c b/py/emitnative.c
index 6b5c9452ae..f80461dd42 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -156,7 +156,7 @@
#define REG_QSTR_TABLE (REG_LOCAL_3)
#define MAX_REGS_FOR_LOCAL_VARS (2)
-STATIC const uint8_t reg_local_table[MAX_REGS_FOR_LOCAL_VARS] = {REG_LOCAL_1, REG_LOCAL_2};
+static const uint8_t reg_local_table[MAX_REGS_FOR_LOCAL_VARS] = {REG_LOCAL_1, REG_LOCAL_2};
#else
@@ -168,7 +168,7 @@ STATIC const uint8_t reg_local_table[MAX_REGS_FOR_LOCAL_VARS] = {REG_LOCAL_1, RE
#define REG_GENERATOR_STATE (REG_LOCAL_3)
#define MAX_REGS_FOR_LOCAL_VARS (3)
-STATIC const uint8_t reg_local_table[MAX_REGS_FOR_LOCAL_VARS] = {REG_LOCAL_1, REG_LOCAL_2, REG_LOCAL_3};
+static const uint8_t reg_local_table[MAX_REGS_FOR_LOCAL_VARS] = {REG_LOCAL_1, REG_LOCAL_2, REG_LOCAL_3};
#endif
@@ -202,7 +202,7 @@ typedef enum {
VTYPE_BUILTIN_CAST = 0x70 | MP_NATIVE_TYPE_OBJ,
} vtype_kind_t;
-STATIC qstr vtype_to_qstr(vtype_kind_t vtype) {
+static qstr vtype_to_qstr(vtype_kind_t vtype) {
switch (vtype) {
case VTYPE_PYOBJ:
return MP_QSTR_object;
@@ -280,10 +280,10 @@ struct _emit_t {
ASM_T *as;
};
-STATIC void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj);
-STATIC void emit_native_global_exc_entry(emit_t *emit);
-STATIC void emit_native_global_exc_exit(emit_t *emit);
-STATIC void emit_native_load_const_obj(emit_t *emit, mp_obj_t obj);
+static void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj);
+static void emit_native_global_exc_entry(emit_t *emit);
+static void emit_native_global_exc_exit(emit_t *emit);
+static void emit_native_load_const_obj(emit_t *emit, mp_obj_t obj);
emit_t *EXPORT_FUN(new)(mp_emit_common_t * emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels) {
emit_t *emit = m_new0(emit_t, 1);
@@ -308,13 +308,13 @@ void EXPORT_FUN(free)(emit_t * emit) {
m_del_obj(emit_t, emit);
}
-STATIC void emit_call_with_imm_arg(emit_t *emit, mp_fun_kind_t fun_kind, mp_int_t arg_val, int arg_reg);
+static void emit_call_with_imm_arg(emit_t *emit, mp_fun_kind_t fun_kind, mp_int_t arg_val, int arg_reg);
-STATIC void emit_native_mov_reg_const(emit_t *emit, int reg_dest, int const_val) {
+static void emit_native_mov_reg_const(emit_t *emit, int reg_dest, int const_val) {
ASM_LOAD_REG_REG_OFFSET(emit->as, reg_dest, REG_FUN_TABLE, const_val);
}
-STATIC void emit_native_mov_state_reg(emit_t *emit, int local_num, int reg_src) {
+static void emit_native_mov_state_reg(emit_t *emit, int local_num, int reg_src) {
if (emit->scope->scope_flags & MP_SCOPE_FLAG_GENERATOR) {
ASM_STORE_REG_REG_OFFSET(emit->as, reg_src, REG_GENERATOR_STATE, local_num);
} else {
@@ -322,7 +322,7 @@ STATIC void emit_native_mov_state_reg(emit_t *emit, int local_num, int reg_src)
}
}
-STATIC void emit_native_mov_reg_state(emit_t *emit, int reg_dest, int local_num) {
+static void emit_native_mov_reg_state(emit_t *emit, int reg_dest, int local_num) {
if (emit->scope->scope_flags & MP_SCOPE_FLAG_GENERATOR) {
ASM_LOAD_REG_REG_OFFSET(emit->as, reg_dest, REG_GENERATOR_STATE, local_num);
} else {
@@ -330,7 +330,7 @@ STATIC void emit_native_mov_reg_state(emit_t *emit, int reg_dest, int local_num)
}
}
-STATIC void emit_native_mov_reg_state_addr(emit_t *emit, int reg_dest, int local_num) {
+static void emit_native_mov_reg_state_addr(emit_t *emit, int reg_dest, int local_num) {
if (emit->scope->scope_flags & MP_SCOPE_FLAG_GENERATOR) {
ASM_MOV_REG_IMM(emit->as, reg_dest, local_num * ASM_WORD_SIZE);
ASM_ADD_REG_REG(emit->as, reg_dest, REG_GENERATOR_STATE);
@@ -339,7 +339,7 @@ STATIC void emit_native_mov_reg_state_addr(emit_t *emit, int reg_dest, int local
}
}
-STATIC void emit_native_mov_reg_qstr(emit_t *emit, int arg_reg, qstr qst) {
+static void emit_native_mov_reg_qstr(emit_t *emit, int arg_reg, qstr qst) {
#if MICROPY_PERSISTENT_CODE_SAVE
ASM_LOAD16_REG_REG_OFFSET(emit->as, arg_reg, REG_QSTR_TABLE, mp_emit_common_use_qstr(emit->emit_common, qst));
#else
@@ -347,7 +347,7 @@ STATIC void emit_native_mov_reg_qstr(emit_t *emit, int arg_reg, qstr qst) {
#endif
}
-STATIC void emit_native_mov_reg_qstr_obj(emit_t *emit, int reg_dest, qstr qst) {
+static void emit_native_mov_reg_qstr_obj(emit_t *emit, int reg_dest, qstr qst) {
#if MICROPY_PERSISTENT_CODE_SAVE
emit_load_reg_with_object(emit, reg_dest, MP_OBJ_NEW_QSTR(qst));
#else
@@ -361,7 +361,7 @@ STATIC void emit_native_mov_reg_qstr_obj(emit_t *emit, int reg_dest, qstr qst) {
emit_native_mov_state_reg((emit), (local_num), (reg_temp)); \
} while (false)
-STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) {
+static void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) {
DEBUG_printf("start_pass(pass=%u, scope=%p)\n", pass, scope);
emit->pass = pass;
@@ -632,7 +632,7 @@ static inline void emit_native_write_code_info_qstr(emit_t *emit, qstr qst) {
mp_encode_uint(&emit->as->base, mp_asm_base_get_cur_to_write_bytes, mp_emit_common_use_qstr(emit->emit_common, qst));
}
-STATIC bool emit_native_end_pass(emit_t *emit) {
+static bool emit_native_end_pass(emit_t *emit) {
emit_native_global_exc_exit(emit);
if (!emit->do_viper_types) {
@@ -723,7 +723,7 @@ STATIC bool emit_native_end_pass(emit_t *emit) {
return true;
}
-STATIC void ensure_extra_stack(emit_t *emit, size_t delta) {
+static void ensure_extra_stack(emit_t *emit, size_t delta) {
if (emit->stack_size + delta > emit->stack_info_alloc) {
size_t new_alloc = (emit->stack_size + delta + 8) & ~3;
emit->stack_info = m_renew(stack_info_t, emit->stack_info, emit->stack_info_alloc, new_alloc);
@@ -731,7 +731,7 @@ STATIC void ensure_extra_stack(emit_t *emit, size_t delta) {
}
}
-STATIC void adjust_stack(emit_t *emit, mp_int_t stack_size_delta) {
+static void adjust_stack(emit_t *emit, mp_int_t stack_size_delta) {
assert((mp_int_t)emit->stack_size + stack_size_delta >= 0);
assert((mp_int_t)emit->stack_size + stack_size_delta <= (mp_int_t)emit->stack_info_alloc);
emit->stack_size += stack_size_delta;
@@ -748,7 +748,7 @@ STATIC void adjust_stack(emit_t *emit, mp_int_t stack_size_delta) {
#endif
}
-STATIC void emit_native_adjust_stack_size(emit_t *emit, mp_int_t delta) {
+static void emit_native_adjust_stack_size(emit_t *emit, mp_int_t delta) {
DEBUG_printf("adjust_stack_size(" INT_FMT ")\n", delta);
if (delta > 0) {
ensure_extra_stack(emit, delta);
@@ -772,23 +772,23 @@ STATIC void emit_native_adjust_stack_size(emit_t *emit, mp_int_t delta) {
adjust_stack(emit, delta);
}
-STATIC void emit_native_set_source_line(emit_t *emit, mp_uint_t source_line) {
+static void emit_native_set_source_line(emit_t *emit, mp_uint_t source_line) {
(void)emit;
(void)source_line;
}
// this must be called at start of emit functions
-STATIC void emit_native_pre(emit_t *emit) {
+static void emit_native_pre(emit_t *emit) {
(void)emit;
}
// depth==0 is top, depth==1 is before top, etc
-STATIC stack_info_t *peek_stack(emit_t *emit, mp_uint_t depth) {
+static stack_info_t *peek_stack(emit_t *emit, mp_uint_t depth) {
return &emit->stack_info[emit->stack_size - 1 - depth];
}
// depth==0 is top, depth==1 is before top, etc
-STATIC vtype_kind_t peek_vtype(emit_t *emit, mp_uint_t depth) {
+static vtype_kind_t peek_vtype(emit_t *emit, mp_uint_t depth) {
if (emit->do_viper_types) {
return peek_stack(emit, depth)->vtype;
} else {
@@ -799,7 +799,7 @@ STATIC vtype_kind_t peek_vtype(emit_t *emit, mp_uint_t depth) {
// pos=1 is TOS, pos=2 is next, etc
// use pos=0 for no skipping
-STATIC void need_reg_single(emit_t *emit, int reg_needed, int skip_stack_pos) {
+static void need_reg_single(emit_t *emit, int reg_needed, int skip_stack_pos) {
skip_stack_pos = emit->stack_size - skip_stack_pos;
for (int i = 0; i < emit->stack_size; i++) {
if (i != skip_stack_pos) {
@@ -814,7 +814,7 @@ STATIC void need_reg_single(emit_t *emit, int reg_needed, int skip_stack_pos) {
// Ensures all unsettled registers that hold Python values are copied to the
// concrete Python stack. All registers are then free to use.
-STATIC void need_reg_all(emit_t *emit) {
+static void need_reg_all(emit_t *emit) {
for (int i = 0; i < emit->stack_size; i++) {
stack_info_t *si = &emit->stack_info[i];
if (si->kind == STACK_REG) {
@@ -825,7 +825,7 @@ STATIC void need_reg_all(emit_t *emit) {
}
}
-STATIC vtype_kind_t load_reg_stack_imm(emit_t *emit, int reg_dest, const stack_info_t *si, bool convert_to_pyobj) {
+static vtype_kind_t load_reg_stack_imm(emit_t *emit, int reg_dest, const stack_info_t *si, bool convert_to_pyobj) {
if (!convert_to_pyobj && emit->do_viper_types) {
ASM_MOV_REG_IMM(emit->as, reg_dest, si->data.u_imm);
return si->vtype;
@@ -849,7 +849,7 @@ STATIC vtype_kind_t load_reg_stack_imm(emit_t *emit, int reg_dest, const stack_i
// concrete Python stack. This ensures the concrete Python stack holds valid
// values for the current stack_size.
// This function may clobber REG_TEMP1.
-STATIC void need_stack_settled(emit_t *emit) {
+static void need_stack_settled(emit_t *emit) {
DEBUG_printf(" need_stack_settled; stack_size=%d\n", emit->stack_size);
need_reg_all(emit);
for (int i = 0; i < emit->stack_size; i++) {
@@ -865,7 +865,7 @@ STATIC void need_stack_settled(emit_t *emit) {
}
// pos=1 is TOS, pos=2 is next, etc
-STATIC void emit_access_stack(emit_t *emit, int pos, vtype_kind_t *vtype, int reg_dest) {
+static void emit_access_stack(emit_t *emit, int pos, vtype_kind_t *vtype, int reg_dest) {
need_reg_single(emit, reg_dest, pos);
stack_info_t *si = &emit->stack_info[emit->stack_size - pos];
*vtype = si->vtype;
@@ -888,7 +888,7 @@ STATIC void emit_access_stack(emit_t *emit, int pos, vtype_kind_t *vtype, int re
// does an efficient X=pop(); discard(); push(X)
// needs a (non-temp) register in case the popped element was stored in the stack
-STATIC void emit_fold_stack_top(emit_t *emit, int reg_dest) {
+static void emit_fold_stack_top(emit_t *emit, int reg_dest) {
stack_info_t *si = &emit->stack_info[emit->stack_size - 2];
si[0] = si[1];
if (si->kind == STACK_VALUE) {
@@ -902,7 +902,7 @@ STATIC void emit_fold_stack_top(emit_t *emit, int reg_dest) {
// If stacked value is in a register and the register is not r1 or r2, then
// *reg_dest is set to that register. Otherwise the value is put in *reg_dest.
-STATIC void emit_pre_pop_reg_flexible(emit_t *emit, vtype_kind_t *vtype, int *reg_dest, int not_r1, int not_r2) {
+static void emit_pre_pop_reg_flexible(emit_t *emit, vtype_kind_t *vtype, int *reg_dest, int not_r1, int not_r2) {
stack_info_t *si = peek_stack(emit, 0);
if (si->kind == STACK_REG && si->data.u_reg != not_r1 && si->data.u_reg != not_r2) {
*vtype = si->vtype;
@@ -914,36 +914,36 @@ STATIC void emit_pre_pop_reg_flexible(emit_t *emit, vtype_kind_t *vtype, int *re
adjust_stack(emit, -1);
}
-STATIC void emit_pre_pop_discard(emit_t *emit) {
+static void emit_pre_pop_discard(emit_t *emit) {
adjust_stack(emit, -1);
}
-STATIC void emit_pre_pop_reg(emit_t *emit, vtype_kind_t *vtype, int reg_dest) {
+static void emit_pre_pop_reg(emit_t *emit, vtype_kind_t *vtype, int reg_dest) {
emit_access_stack(emit, 1, vtype, reg_dest);
adjust_stack(emit, -1);
}
-STATIC void emit_pre_pop_reg_reg(emit_t *emit, vtype_kind_t *vtypea, int rega, vtype_kind_t *vtypeb, int regb) {
+static void emit_pre_pop_reg_reg(emit_t *emit, vtype_kind_t *vtypea, int rega, vtype_kind_t *vtypeb, int regb) {
emit_pre_pop_reg(emit, vtypea, rega);
emit_pre_pop_reg(emit, vtypeb, regb);
}
-STATIC void emit_pre_pop_reg_reg_reg(emit_t *emit, vtype_kind_t *vtypea, int rega, vtype_kind_t *vtypeb, int regb, vtype_kind_t *vtypec, int regc) {
+static void emit_pre_pop_reg_reg_reg(emit_t *emit, vtype_kind_t *vtypea, int rega, vtype_kind_t *vtypeb, int regb, vtype_kind_t *vtypec, int regc) {
emit_pre_pop_reg(emit, vtypea, rega);
emit_pre_pop_reg(emit, vtypeb, regb);
emit_pre_pop_reg(emit, vtypec, regc);
}
-STATIC void emit_post(emit_t *emit) {
+static void emit_post(emit_t *emit) {
(void)emit;
}
-STATIC void emit_post_top_set_vtype(emit_t *emit, vtype_kind_t new_vtype) {
+static void emit_post_top_set_vtype(emit_t *emit, vtype_kind_t new_vtype) {
stack_info_t *si = &emit->stack_info[emit->stack_size - 1];
si->vtype = new_vtype;
}
-STATIC void emit_post_push_reg(emit_t *emit, vtype_kind_t vtype, int reg) {
+static void emit_post_push_reg(emit_t *emit, vtype_kind_t vtype, int reg) {
ensure_extra_stack(emit, 1);
stack_info_t *si = &emit->stack_info[emit->stack_size];
si->vtype = vtype;
@@ -952,7 +952,7 @@ STATIC void emit_post_push_reg(emit_t *emit, vtype_kind_t vtype, int reg) {
adjust_stack(emit, 1);
}
-STATIC void emit_post_push_imm(emit_t *emit, vtype_kind_t vtype, mp_int_t imm) {
+static void emit_post_push_imm(emit_t *emit, vtype_kind_t vtype, mp_int_t imm) {
ensure_extra_stack(emit, 1);
stack_info_t *si = &emit->stack_info[emit->stack_size];
si->vtype = vtype;
@@ -961,43 +961,43 @@ STATIC void emit_post_push_imm(emit_t *emit, vtype_kind_t vtype, mp_int_t imm) {
adjust_stack(emit, 1);
}
-STATIC void emit_post_push_reg_reg(emit_t *emit, vtype_kind_t vtypea, int rega, vtype_kind_t vtypeb, int regb) {
+static void emit_post_push_reg_reg(emit_t *emit, vtype_kind_t vtypea, int rega, vtype_kind_t vtypeb, int regb) {
emit_post_push_reg(emit, vtypea, rega);
emit_post_push_reg(emit, vtypeb, regb);
}
-STATIC void emit_post_push_reg_reg_reg(emit_t *emit, vtype_kind_t vtypea, int rega, vtype_kind_t vtypeb, int regb, vtype_kind_t vtypec, int regc) {
+static void emit_post_push_reg_reg_reg(emit_t *emit, vtype_kind_t vtypea, int rega, vtype_kind_t vtypeb, int regb, vtype_kind_t vtypec, int regc) {
emit_post_push_reg(emit, vtypea, rega);
emit_post_push_reg(emit, vtypeb, regb);
emit_post_push_reg(emit, vtypec, regc);
}
-STATIC void emit_post_push_reg_reg_reg_reg(emit_t *emit, vtype_kind_t vtypea, int rega, vtype_kind_t vtypeb, int regb, vtype_kind_t vtypec, int regc, vtype_kind_t vtyped, int regd) {
+static void emit_post_push_reg_reg_reg_reg(emit_t *emit, vtype_kind_t vtypea, int rega, vtype_kind_t vtypeb, int regb, vtype_kind_t vtypec, int regc, vtype_kind_t vtyped, int regd) {
emit_post_push_reg(emit, vtypea, rega);
emit_post_push_reg(emit, vtypeb, regb);
emit_post_push_reg(emit, vtypec, regc);
emit_post_push_reg(emit, vtyped, regd);
}
-STATIC void emit_call(emit_t *emit, mp_fun_kind_t fun_kind) {
+static void emit_call(emit_t *emit, mp_fun_kind_t fun_kind) {
need_reg_all(emit);
ASM_CALL_IND(emit->as, fun_kind);
}
-STATIC void emit_call_with_imm_arg(emit_t *emit, mp_fun_kind_t fun_kind, mp_int_t arg_val, int arg_reg) {
+static void emit_call_with_imm_arg(emit_t *emit, mp_fun_kind_t fun_kind, mp_int_t arg_val, int arg_reg) {
need_reg_all(emit);
ASM_MOV_REG_IMM(emit->as, arg_reg, arg_val);
ASM_CALL_IND(emit->as, fun_kind);
}
-STATIC void emit_call_with_2_imm_args(emit_t *emit, mp_fun_kind_t fun_kind, mp_int_t arg_val1, int arg_reg1, mp_int_t arg_val2, int arg_reg2) {
+static void emit_call_with_2_imm_args(emit_t *emit, mp_fun_kind_t fun_kind, mp_int_t arg_val1, int arg_reg1, mp_int_t arg_val2, int arg_reg2) {
need_reg_all(emit);
ASM_MOV_REG_IMM(emit->as, arg_reg1, arg_val1);
ASM_MOV_REG_IMM(emit->as, arg_reg2, arg_val2);
ASM_CALL_IND(emit->as, fun_kind);
}
-STATIC void emit_call_with_qstr_arg(emit_t *emit, mp_fun_kind_t fun_kind, qstr qst, int arg_reg) {
+static void emit_call_with_qstr_arg(emit_t *emit, mp_fun_kind_t fun_kind, qstr qst, int arg_reg) {
need_reg_all(emit);
emit_native_mov_reg_qstr(emit, arg_reg, qst);
ASM_CALL_IND(emit->as, fun_kind);
@@ -1007,7 +1007,7 @@ STATIC void emit_call_with_qstr_arg(emit_t *emit, mp_fun_kind_t fun_kind, qstr q
// Will convert any items that are not VTYPE_PYOBJ to this type and put them back on the stack.
// If any conversions of non-immediate values are needed, then it uses REG_ARG_1, REG_ARG_2 and REG_RET.
// Otherwise, it does not use any temporary registers (but may use reg_dest before loading it with stack pointer).
-STATIC void emit_get_stack_pointer_to_reg_for_pop(emit_t *emit, mp_uint_t reg_dest, mp_uint_t n_pop) {
+static void emit_get_stack_pointer_to_reg_for_pop(emit_t *emit, mp_uint_t reg_dest, mp_uint_t n_pop) {
need_reg_all(emit);
// First, store any immediate values to their respective place on the stack.
@@ -1044,7 +1044,7 @@ STATIC void emit_get_stack_pointer_to_reg_for_pop(emit_t *emit, mp_uint_t reg_de
}
// vtype of all n_push objects is VTYPE_PYOBJ
-STATIC void emit_get_stack_pointer_to_reg_for_push(emit_t *emit, mp_uint_t reg_dest, mp_uint_t n_push) {
+static void emit_get_stack_pointer_to_reg_for_push(emit_t *emit, mp_uint_t reg_dest, mp_uint_t n_push) {
need_reg_all(emit);
ensure_extra_stack(emit, n_push);
for (mp_uint_t i = 0; i < n_push; i++) {
@@ -1055,7 +1055,7 @@ STATIC void emit_get_stack_pointer_to_reg_for_push(emit_t *emit, mp_uint_t reg_d
adjust_stack(emit, n_push);
}
-STATIC void emit_native_push_exc_stack(emit_t *emit, uint label, bool is_finally) {
+static void emit_native_push_exc_stack(emit_t *emit, uint label, bool is_finally) {
if (emit->exc_stack_size + 1 > emit->exc_stack_alloc) {
size_t new_alloc = emit->exc_stack_alloc + 4;
emit->exc_stack = m_renew(exc_stack_entry_t, emit->exc_stack, emit->exc_stack_alloc, new_alloc);
@@ -1072,7 +1072,7 @@ STATIC void emit_native_push_exc_stack(emit_t *emit, uint label, bool is_finally
ASM_MOV_LOCAL_REG(emit->as, LOCAL_IDX_EXC_HANDLER_PC(emit), REG_RET);
}
-STATIC void emit_native_leave_exc_stack(emit_t *emit, bool start_of_handler) {
+static void emit_native_leave_exc_stack(emit_t *emit, bool start_of_handler) {
assert(emit->exc_stack_size > 0);
// Get current exception handler and deactivate it
@@ -1098,14 +1098,14 @@ STATIC void emit_native_leave_exc_stack(emit_t *emit, bool start_of_handler) {
ASM_MOV_LOCAL_REG(emit->as, LOCAL_IDX_EXC_HANDLER_PC(emit), REG_RET);
}
-STATIC exc_stack_entry_t *emit_native_pop_exc_stack(emit_t *emit) {
+static exc_stack_entry_t *emit_native_pop_exc_stack(emit_t *emit) {
assert(emit->exc_stack_size > 0);
exc_stack_entry_t *e = &emit->exc_stack[--emit->exc_stack_size];
assert(e->is_active == false);
return e;
}
-STATIC void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj) {
+static void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj) {
emit->scope->scope_flags |= MP_SCOPE_FLAG_HASCONSTS;
size_t table_off = mp_emit_common_use_const_obj(emit->emit_common, obj);
emit_native_mov_reg_state(emit, REG_TEMP0, LOCAL_IDX_FUN_OBJ(emit));
@@ -1114,14 +1114,14 @@ STATIC void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj) {
ASM_LOAD_REG_REG_OFFSET(emit->as, reg, REG_TEMP0, table_off);
}
-STATIC void emit_load_reg_with_child(emit_t *emit, int reg, mp_raw_code_t *rc) {
+static void emit_load_reg_with_child(emit_t *emit, int reg, mp_raw_code_t *rc) {
size_t table_off = mp_emit_common_alloc_const_child(emit->emit_common, rc);
emit_native_mov_reg_state(emit, REG_TEMP0, LOCAL_IDX_FUN_OBJ(emit));
ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_OBJ_FUN_BC_CHILD_TABLE);
ASM_LOAD_REG_REG_OFFSET(emit->as, reg, REG_TEMP0, table_off);
}
-STATIC void emit_native_label_assign(emit_t *emit, mp_uint_t l) {
+static void emit_native_label_assign(emit_t *emit, mp_uint_t l) {
DEBUG_printf("label_assign(" UINT_FMT ")\n", l);
bool is_finally = false;
@@ -1149,7 +1149,7 @@ STATIC void emit_native_label_assign(emit_t *emit, mp_uint_t l) {
}
}
-STATIC void emit_native_global_exc_entry(emit_t *emit) {
+static void emit_native_global_exc_entry(emit_t *emit) {
// Note: 4 labels are reserved for this function, starting at *emit->label_slot
emit->exit_label = *emit->label_slot;
@@ -1251,7 +1251,7 @@ STATIC void emit_native_global_exc_entry(emit_t *emit) {
}
}
-STATIC void emit_native_global_exc_exit(emit_t *emit) {
+static void emit_native_global_exc_exit(emit_t *emit) {
// Label for end of function
emit_native_label_assign(emit, emit->exit_label);
@@ -1286,7 +1286,7 @@ STATIC void emit_native_global_exc_exit(emit_t *emit) {
ASM_EXIT(emit->as);
}
-STATIC void emit_native_import_name(emit_t *emit, qstr qst) {
+static void emit_native_import_name(emit_t *emit, qstr qst) {
DEBUG_printf("import_name %s\n", qstr_str(qst));
// get arguments from stack: arg2 = fromlist, arg3 = level
@@ -1305,7 +1305,7 @@ STATIC void emit_native_import_name(emit_t *emit, qstr qst) {
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_import_from(emit_t *emit, qstr qst) {
+static void emit_native_import_from(emit_t *emit, qstr qst) {
DEBUG_printf("import_from %s\n", qstr_str(qst));
emit_native_pre(emit);
vtype_kind_t vtype_module;
@@ -1315,7 +1315,7 @@ STATIC void emit_native_import_from(emit_t *emit, qstr qst) {
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_import_star(emit_t *emit) {
+static void emit_native_import_star(emit_t *emit) {
DEBUG_printf("import_star\n");
vtype_kind_t vtype_module;
emit_pre_pop_reg(emit, &vtype_module, REG_ARG_1); // arg1 = module
@@ -1324,7 +1324,7 @@ STATIC void emit_native_import_star(emit_t *emit) {
emit_post(emit);
}
-STATIC void emit_native_import(emit_t *emit, qstr qst, int kind) {
+static void emit_native_import(emit_t *emit, qstr qst, int kind) {
if (kind == MP_EMIT_IMPORT_NAME) {
emit_native_import_name(emit, qst);
} else if (kind == MP_EMIT_IMPORT_FROM) {
@@ -1334,7 +1334,7 @@ STATIC void emit_native_import(emit_t *emit, qstr qst, int kind) {
}
}
-STATIC void emit_native_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
+static void emit_native_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
DEBUG_printf("load_const_tok(tok=%u)\n", tok);
if (tok == MP_TOKEN_ELLIPSIS) {
emit_native_load_const_obj(emit, MP_OBJ_FROM_PTR(&mp_const_ellipsis_obj));
@@ -1348,13 +1348,13 @@ STATIC void emit_native_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
}
}
-STATIC void emit_native_load_const_small_int(emit_t *emit, mp_int_t arg) {
+static void emit_native_load_const_small_int(emit_t *emit, mp_int_t arg) {
DEBUG_printf("load_const_small_int(int=" INT_FMT ")\n", arg);
emit_native_pre(emit);
emit_post_push_imm(emit, VTYPE_INT, arg);
}
-STATIC void emit_native_load_const_str(emit_t *emit, qstr qst) {
+static void emit_native_load_const_str(emit_t *emit, qstr qst) {
emit_native_pre(emit);
// TODO: Eventually we want to be able to work with raw pointers in viper to
// do native array access. For now we just load them as any other object.
@@ -1371,19 +1371,19 @@ STATIC void emit_native_load_const_str(emit_t *emit, qstr qst) {
}
}
-STATIC void emit_native_load_const_obj(emit_t *emit, mp_obj_t obj) {
+static void emit_native_load_const_obj(emit_t *emit, mp_obj_t obj) {
emit_native_pre(emit);
need_reg_single(emit, REG_RET, 0);
emit_load_reg_with_object(emit, REG_RET, obj);
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_load_null(emit_t *emit) {
+static void emit_native_load_null(emit_t *emit) {
emit_native_pre(emit);
emit_post_push_imm(emit, VTYPE_PYOBJ, 0);
}
-STATIC void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
+static void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
DEBUG_printf("load_fast(%s, " UINT_FMT ")\n", qstr_str(qst), local_num);
vtype_kind_t vtype = emit->local_vtype[local_num];
if (vtype == VTYPE_UNBOUND) {
@@ -1399,7 +1399,7 @@ STATIC void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
}
}
-STATIC void emit_native_load_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
+static void emit_native_load_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
DEBUG_printf("load_deref(%s, " UINT_FMT ")\n", qstr_str(qst), local_num);
need_reg_single(emit, REG_RET, 0);
emit_native_load_fast(emit, qst, local_num);
@@ -1411,7 +1411,7 @@ STATIC void emit_native_load_deref(emit_t *emit, qstr qst, mp_uint_t local_num)
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_load_local(emit_t *emit, qstr qst, mp_uint_t local_num, int kind) {
+static void emit_native_load_local(emit_t *emit, qstr qst, mp_uint_t local_num, int kind) {
if (kind == MP_EMIT_IDOP_LOCAL_FAST) {
emit_native_load_fast(emit, qst, local_num);
} else {
@@ -1419,7 +1419,7 @@ STATIC void emit_native_load_local(emit_t *emit, qstr qst, mp_uint_t local_num,
}
}
-STATIC void emit_native_load_global(emit_t *emit, qstr qst, int kind) {
+static void emit_native_load_global(emit_t *emit, qstr qst, int kind) {
MP_STATIC_ASSERT(MP_F_LOAD_NAME + MP_EMIT_IDOP_GLOBAL_NAME == MP_F_LOAD_NAME);
MP_STATIC_ASSERT(MP_F_LOAD_NAME + MP_EMIT_IDOP_GLOBAL_GLOBAL == MP_F_LOAD_GLOBAL);
emit_native_pre(emit);
@@ -1440,7 +1440,7 @@ STATIC void emit_native_load_global(emit_t *emit, qstr qst, int kind) {
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_load_attr(emit_t *emit, qstr qst) {
+static void emit_native_load_attr(emit_t *emit, qstr qst) {
// depends on type of subject:
// - integer, function, pointer to integers: error
// - pointer to structure: get member, quite easy
@@ -1452,7 +1452,7 @@ STATIC void emit_native_load_attr(emit_t *emit, qstr qst) {
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_load_method(emit_t *emit, qstr qst, bool is_super) {
+static void emit_native_load_method(emit_t *emit, qstr qst, bool is_super) {
if (is_super) {
emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_2, 3); // arg2 = dest ptr
emit_get_stack_pointer_to_reg_for_push(emit, REG_ARG_2, 2); // arg2 = dest ptr
@@ -1466,13 +1466,13 @@ STATIC void emit_native_load_method(emit_t *emit, qstr qst, bool is_super) {
}
}
-STATIC void emit_native_load_build_class(emit_t *emit) {
+static void emit_native_load_build_class(emit_t *emit) {
emit_native_pre(emit);
emit_call(emit, MP_F_LOAD_BUILD_CLASS);
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_load_subscr(emit_t *emit) {
+static void emit_native_load_subscr(emit_t *emit) {
DEBUG_printf("load_subscr\n");
// need to compile: base[index]
@@ -1612,7 +1612,7 @@ STATIC void emit_native_load_subscr(emit_t *emit) {
}
}
-STATIC void emit_native_store_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
+static void emit_native_store_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
vtype_kind_t vtype;
if (local_num < MAX_REGS_FOR_LOCAL_VARS && CAN_USE_REGS_FOR_LOCALS(emit)) {
emit_pre_pop_reg(emit, &vtype, reg_local_table[local_num]);
@@ -1634,7 +1634,7 @@ STATIC void emit_native_store_fast(emit_t *emit, qstr qst, mp_uint_t local_num)
}
}
-STATIC void emit_native_store_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
+static void emit_native_store_deref(emit_t *emit, qstr qst, mp_uint_t local_num) {
DEBUG_printf("store_deref(%s, " UINT_FMT ")\n", qstr_str(qst), local_num);
need_reg_single(emit, REG_TEMP0, 0);
need_reg_single(emit, REG_TEMP1, 0);
@@ -1648,7 +1648,7 @@ STATIC void emit_native_store_deref(emit_t *emit, qstr qst, mp_uint_t local_num)
emit_post(emit);
}
-STATIC void emit_native_store_local(emit_t *emit, qstr qst, mp_uint_t local_num, int kind) {
+static void emit_native_store_local(emit_t *emit, qstr qst, mp_uint_t local_num, int kind) {
if (kind == MP_EMIT_IDOP_LOCAL_FAST) {
emit_native_store_fast(emit, qst, local_num);
} else {
@@ -1656,7 +1656,7 @@ STATIC void emit_native_store_local(emit_t *emit, qstr qst, mp_uint_t local_num,
}
}
-STATIC void emit_native_store_global(emit_t *emit, qstr qst, int kind) {
+static void emit_native_store_global(emit_t *emit, qstr qst, int kind) {
MP_STATIC_ASSERT(MP_F_STORE_NAME + MP_EMIT_IDOP_GLOBAL_NAME == MP_F_STORE_NAME);
MP_STATIC_ASSERT(MP_F_STORE_NAME + MP_EMIT_IDOP_GLOBAL_GLOBAL == MP_F_STORE_GLOBAL);
if (kind == MP_EMIT_IDOP_GLOBAL_NAME) {
@@ -1678,7 +1678,7 @@ STATIC void emit_native_store_global(emit_t *emit, qstr qst, int kind) {
emit_post(emit);
}
-STATIC void emit_native_store_attr(emit_t *emit, qstr qst) {
+static void emit_native_store_attr(emit_t *emit, qstr qst) {
vtype_kind_t vtype_base;
vtype_kind_t vtype_val = peek_vtype(emit, 1);
if (vtype_val == VTYPE_PYOBJ) {
@@ -1695,7 +1695,7 @@ STATIC void emit_native_store_attr(emit_t *emit, qstr qst) {
emit_post(emit);
}
-STATIC void emit_native_store_subscr(emit_t *emit) {
+static void emit_native_store_subscr(emit_t *emit) {
DEBUG_printf("store_subscr\n");
// need to compile: base[index] = value
@@ -1872,7 +1872,7 @@ STATIC void emit_native_store_subscr(emit_t *emit) {
}
}
-STATIC void emit_native_delete_local(emit_t *emit, qstr qst, mp_uint_t local_num, int kind) {
+static void emit_native_delete_local(emit_t *emit, qstr qst, mp_uint_t local_num, int kind) {
if (kind == MP_EMIT_IDOP_LOCAL_FAST) {
// TODO: This is not compliant implementation. We could use MP_OBJ_SENTINEL
// to mark deleted vars but then every var would need to be checked on
@@ -1884,7 +1884,7 @@ STATIC void emit_native_delete_local(emit_t *emit, qstr qst, mp_uint_t local_num
}
}
-STATIC void emit_native_delete_global(emit_t *emit, qstr qst, int kind) {
+static void emit_native_delete_global(emit_t *emit, qstr qst, int kind) {
MP_STATIC_ASSERT(MP_F_DELETE_NAME + MP_EMIT_IDOP_GLOBAL_NAME == MP_F_DELETE_NAME);
MP_STATIC_ASSERT(MP_F_DELETE_NAME + MP_EMIT_IDOP_GLOBAL_GLOBAL == MP_F_DELETE_GLOBAL);
emit_native_pre(emit);
@@ -1892,7 +1892,7 @@ STATIC void emit_native_delete_global(emit_t *emit, qstr qst, int kind) {
emit_post(emit);
}
-STATIC void emit_native_delete_attr(emit_t *emit, qstr qst) {
+static void emit_native_delete_attr(emit_t *emit, qstr qst) {
vtype_kind_t vtype_base;
emit_pre_pop_reg(emit, &vtype_base, REG_ARG_1); // arg1 = base
assert(vtype_base == VTYPE_PYOBJ);
@@ -1901,7 +1901,7 @@ STATIC void emit_native_delete_attr(emit_t *emit, qstr qst) {
emit_post(emit);
}
-STATIC void emit_native_delete_subscr(emit_t *emit) {
+static void emit_native_delete_subscr(emit_t *emit) {
vtype_kind_t vtype_index, vtype_base;
emit_pre_pop_reg_reg(emit, &vtype_index, REG_ARG_2, &vtype_base, REG_ARG_1); // index, base
assert(vtype_index == VTYPE_PYOBJ);
@@ -1909,7 +1909,7 @@ STATIC void emit_native_delete_subscr(emit_t *emit) {
emit_call_with_imm_arg(emit, MP_F_OBJ_SUBSCR, (mp_uint_t)MP_OBJ_NULL, REG_ARG_3);
}
-STATIC void emit_native_subscr(emit_t *emit, int kind) {
+static void emit_native_subscr(emit_t *emit, int kind) {
if (kind == MP_EMIT_SUBSCR_LOAD) {
emit_native_load_subscr(emit);
} else if (kind == MP_EMIT_SUBSCR_STORE) {
@@ -1919,7 +1919,7 @@ STATIC void emit_native_subscr(emit_t *emit, int kind) {
}
}
-STATIC void emit_native_attr(emit_t *emit, qstr qst, int kind) {
+static void emit_native_attr(emit_t *emit, qstr qst, int kind) {
if (kind == MP_EMIT_ATTR_LOAD) {
emit_native_load_attr(emit, qst);
} else if (kind == MP_EMIT_ATTR_STORE) {
@@ -1929,7 +1929,7 @@ STATIC void emit_native_attr(emit_t *emit, qstr qst, int kind) {
}
}
-STATIC void emit_native_dup_top(emit_t *emit) {
+static void emit_native_dup_top(emit_t *emit) {
DEBUG_printf("dup_top\n");
vtype_kind_t vtype;
int reg = REG_TEMP0;
@@ -1937,33 +1937,33 @@ STATIC void emit_native_dup_top(emit_t *emit) {
emit_post_push_reg_reg(emit, vtype, reg, vtype, reg);
}
-STATIC void emit_native_dup_top_two(emit_t *emit) {
+static void emit_native_dup_top_two(emit_t *emit) {
vtype_kind_t vtype0, vtype1;
emit_pre_pop_reg_reg(emit, &vtype0, REG_TEMP0, &vtype1, REG_TEMP1);
emit_post_push_reg_reg_reg_reg(emit, vtype1, REG_TEMP1, vtype0, REG_TEMP0, vtype1, REG_TEMP1, vtype0, REG_TEMP0);
}
-STATIC void emit_native_pop_top(emit_t *emit) {
+static void emit_native_pop_top(emit_t *emit) {
DEBUG_printf("pop_top\n");
emit_pre_pop_discard(emit);
emit_post(emit);
}
-STATIC void emit_native_rot_two(emit_t *emit) {
+static void emit_native_rot_two(emit_t *emit) {
DEBUG_printf("rot_two\n");
vtype_kind_t vtype0, vtype1;
emit_pre_pop_reg_reg(emit, &vtype0, REG_TEMP0, &vtype1, REG_TEMP1);
emit_post_push_reg_reg(emit, vtype0, REG_TEMP0, vtype1, REG_TEMP1);
}
-STATIC void emit_native_rot_three(emit_t *emit) {
+static void emit_native_rot_three(emit_t *emit) {
DEBUG_printf("rot_three\n");
vtype_kind_t vtype0, vtype1, vtype2;
emit_pre_pop_reg_reg_reg(emit, &vtype0, REG_TEMP0, &vtype1, REG_TEMP1, &vtype2, REG_TEMP2);
emit_post_push_reg_reg_reg(emit, vtype0, REG_TEMP0, vtype2, REG_TEMP2, vtype1, REG_TEMP1);
}
-STATIC void emit_native_jump(emit_t *emit, mp_uint_t label) {
+static void emit_native_jump(emit_t *emit, mp_uint_t label) {
DEBUG_printf("jump(label=" UINT_FMT ")\n", label);
emit_native_pre(emit);
// need to commit stack because we are jumping elsewhere
@@ -1973,7 +1973,7 @@ STATIC void emit_native_jump(emit_t *emit, mp_uint_t label) {
mp_asm_base_suppress_code(&emit->as->base);
}
-STATIC void emit_native_jump_helper(emit_t *emit, bool cond, mp_uint_t label, bool pop) {
+static void emit_native_jump_helper(emit_t *emit, bool cond, mp_uint_t label, bool pop) {
vtype_kind_t vtype = peek_vtype(emit, 0);
if (vtype == VTYPE_PYOBJ) {
emit_pre_pop_reg(emit, &vtype, REG_ARG_1);
@@ -2010,17 +2010,17 @@ STATIC void emit_native_jump_helper(emit_t *emit, bool cond, mp_uint_t label, bo
emit_post(emit);
}
-STATIC void emit_native_pop_jump_if(emit_t *emit, bool cond, mp_uint_t label) {
+static void emit_native_pop_jump_if(emit_t *emit, bool cond, mp_uint_t label) {
DEBUG_printf("pop_jump_if(cond=%u, label=" UINT_FMT ")\n", cond, label);
emit_native_jump_helper(emit, cond, label, true);
}
-STATIC void emit_native_jump_if_or_pop(emit_t *emit, bool cond, mp_uint_t label) {
+static void emit_native_jump_if_or_pop(emit_t *emit, bool cond, mp_uint_t label) {
DEBUG_printf("jump_if_or_pop(cond=%u, label=" UINT_FMT ")\n", cond, label);
emit_native_jump_helper(emit, cond, label, false);
}
-STATIC void emit_native_unwind_jump(emit_t *emit, mp_uint_t label, mp_uint_t except_depth) {
+static void emit_native_unwind_jump(emit_t *emit, mp_uint_t label, mp_uint_t except_depth) {
if (except_depth > 0) {
exc_stack_entry_t *first_finally = NULL;
exc_stack_entry_t *prev_finally = NULL;
@@ -2063,7 +2063,7 @@ STATIC void emit_native_unwind_jump(emit_t *emit, mp_uint_t label, mp_uint_t exc
emit_native_jump(emit, label & ~MP_EMIT_BREAK_FROM_FOR);
}
-STATIC void emit_native_setup_with(emit_t *emit, mp_uint_t label) {
+static void emit_native_setup_with(emit_t *emit, mp_uint_t label) {
// the context manager is on the top of the stack
// stack: (..., ctx_mgr)
@@ -2102,7 +2102,7 @@ STATIC void emit_native_setup_with(emit_t *emit, mp_uint_t label) {
// stack: (..., __exit__, self, as_value, as_value)
}
-STATIC void emit_native_setup_block(emit_t *emit, mp_uint_t label, int kind) {
+static void emit_native_setup_block(emit_t *emit, mp_uint_t label, int kind) {
if (kind == MP_EMIT_SETUP_BLOCK_WITH) {
emit_native_setup_with(emit, label);
} else {
@@ -2114,7 +2114,7 @@ STATIC void emit_native_setup_block(emit_t *emit, mp_uint_t label, int kind) {
}
}
-STATIC void emit_native_with_cleanup(emit_t *emit, mp_uint_t label) {
+static void emit_native_with_cleanup(emit_t *emit, mp_uint_t label) {
// Note: 3 labels are reserved for this function, starting at *emit->label_slot
// stack: (..., __exit__, self, as_value)
@@ -2181,7 +2181,7 @@ STATIC void emit_native_with_cleanup(emit_t *emit, mp_uint_t label) {
// Exception is in nlr_buf.ret_val slot
}
-STATIC void emit_native_end_finally(emit_t *emit) {
+static void emit_native_end_finally(emit_t *emit) {
// logic:
// exc = pop_stack
// if exc == None: pass
@@ -2207,7 +2207,7 @@ STATIC void emit_native_end_finally(emit_t *emit) {
emit_post(emit);
}
-STATIC void emit_native_get_iter(emit_t *emit, bool use_stack) {
+static void emit_native_get_iter(emit_t *emit, bool use_stack) {
// perhaps the difficult one, as we want to rewrite for loops using native code
// in cases where we iterate over a Python object, can we use normal runtime calls?
@@ -2225,7 +2225,7 @@ STATIC void emit_native_get_iter(emit_t *emit, bool use_stack) {
}
}
-STATIC void emit_native_for_iter(emit_t *emit, mp_uint_t label) {
+static void emit_native_for_iter(emit_t *emit, mp_uint_t label) {
emit_native_pre(emit);
emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_1, MP_OBJ_ITER_BUF_NSLOTS);
adjust_stack(emit, MP_OBJ_ITER_BUF_NSLOTS);
@@ -2240,14 +2240,14 @@ STATIC void emit_native_for_iter(emit_t *emit, mp_uint_t label) {
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_for_iter_end(emit_t *emit) {
+static void emit_native_for_iter_end(emit_t *emit) {
// adjust stack counter (we get here from for_iter ending, which popped the value for us)
emit_native_pre(emit);
adjust_stack(emit, -MP_OBJ_ITER_BUF_NSLOTS);
emit_post(emit);
}
-STATIC void emit_native_pop_except_jump(emit_t *emit, mp_uint_t label, bool within_exc_handler) {
+static void emit_native_pop_except_jump(emit_t *emit, mp_uint_t label, bool within_exc_handler) {
if (within_exc_handler) {
// Cancel any active exception so subsequent handlers don't see it
ASM_MOV_REG_IMM(emit->as, REG_TEMP0, (mp_uint_t)MP_OBJ_NULL);
@@ -2258,7 +2258,7 @@ STATIC void emit_native_pop_except_jump(emit_t *emit, mp_uint_t label, bool with
emit_native_jump(emit, label);
}
-STATIC void emit_native_unary_op(emit_t *emit, mp_unary_op_t op) {
+static void emit_native_unary_op(emit_t *emit, mp_unary_op_t op) {
vtype_kind_t vtype;
emit_pre_pop_reg(emit, &vtype, REG_ARG_2);
if (vtype == VTYPE_PYOBJ) {
@@ -2271,7 +2271,7 @@ STATIC void emit_native_unary_op(emit_t *emit, mp_unary_op_t op) {
}
}
-STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
+static void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
DEBUG_printf("binary_op(" UINT_FMT ")\n", op);
vtype_kind_t vtype_lhs = peek_vtype(emit, 1);
vtype_kind_t vtype_rhs = peek_vtype(emit, 0);
@@ -2534,10 +2534,10 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
}
#if MICROPY_PY_BUILTINS_SLICE
-STATIC void emit_native_build_slice(emit_t *emit, mp_uint_t n_args);
+static void emit_native_build_slice(emit_t *emit, mp_uint_t n_args);
#endif
-STATIC void emit_native_build(emit_t *emit, mp_uint_t n_args, int kind) {
+static void emit_native_build(emit_t *emit, mp_uint_t n_args, int kind) {
// for viper: call runtime, with types of args
// if wrapped in byte_array, or something, allocates memory and fills it
MP_STATIC_ASSERT(MP_F_BUILD_TUPLE + MP_EMIT_BUILD_TUPLE == MP_F_BUILD_TUPLE);
@@ -2558,7 +2558,7 @@ STATIC void emit_native_build(emit_t *emit, mp_uint_t n_args, int kind) {
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); // new tuple/list/map/set
}
-STATIC void emit_native_store_map(emit_t *emit) {
+static void emit_native_store_map(emit_t *emit) {
vtype_kind_t vtype_key, vtype_value, vtype_map;
emit_pre_pop_reg_reg_reg(emit, &vtype_key, REG_ARG_2, &vtype_value, REG_ARG_3, &vtype_map, REG_ARG_1); // key, value, map
assert(vtype_key == VTYPE_PYOBJ);
@@ -2569,7 +2569,7 @@ STATIC void emit_native_store_map(emit_t *emit) {
}
#if MICROPY_PY_BUILTINS_SLICE
-STATIC void emit_native_build_slice(emit_t *emit, mp_uint_t n_args) {
+static void emit_native_build_slice(emit_t *emit, mp_uint_t n_args) {
DEBUG_printf("build_slice %d\n", n_args);
if (n_args == 2) {
vtype_kind_t vtype_start, vtype_stop;
@@ -2590,7 +2590,7 @@ STATIC void emit_native_build_slice(emit_t *emit, mp_uint_t n_args) {
}
#endif
-STATIC void emit_native_store_comp(emit_t *emit, scope_kind_t kind, mp_uint_t collection_index) {
+static void emit_native_store_comp(emit_t *emit, scope_kind_t kind, mp_uint_t collection_index) {
mp_fun_kind_t f;
if (kind == SCOPE_LIST_COMP) {
vtype_kind_t vtype_item;
@@ -2619,7 +2619,7 @@ STATIC void emit_native_store_comp(emit_t *emit, scope_kind_t kind, mp_uint_t co
emit_post(emit);
}
-STATIC void emit_native_unpack_sequence(emit_t *emit, mp_uint_t n_args) {
+static void emit_native_unpack_sequence(emit_t *emit, mp_uint_t n_args) {
DEBUG_printf("unpack_sequence %d\n", n_args);
vtype_kind_t vtype_base;
emit_pre_pop_reg(emit, &vtype_base, REG_ARG_1); // arg1 = seq
@@ -2628,7 +2628,7 @@ STATIC void emit_native_unpack_sequence(emit_t *emit, mp_uint_t n_args) {
emit_call_with_imm_arg(emit, MP_F_UNPACK_SEQUENCE, n_args, REG_ARG_2); // arg2 = n_args
}
-STATIC void emit_native_unpack_ex(emit_t *emit, mp_uint_t n_left, mp_uint_t n_right) {
+static void emit_native_unpack_ex(emit_t *emit, mp_uint_t n_left, mp_uint_t n_right) {
DEBUG_printf("unpack_ex %d %d\n", n_left, n_right);
vtype_kind_t vtype_base;
emit_pre_pop_reg(emit, &vtype_base, REG_ARG_1); // arg1 = seq
@@ -2637,7 +2637,7 @@ STATIC void emit_native_unpack_ex(emit_t *emit, mp_uint_t n_left, mp_uint_t n_ri
emit_call_with_imm_arg(emit, MP_F_UNPACK_EX, n_left | (n_right << 8), REG_ARG_2); // arg2 = n_left + n_right
}
-STATIC void emit_native_make_function(emit_t *emit, scope_t *scope, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) {
+static void emit_native_make_function(emit_t *emit, scope_t *scope, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) {
// call runtime, with type info for args, or don't support dict/default params, or only support Python objects for them
emit_native_pre(emit);
emit_native_mov_reg_state(emit, REG_ARG_2, LOCAL_IDX_FUN_OBJ(emit));
@@ -2654,7 +2654,7 @@ STATIC void emit_native_make_function(emit_t *emit, scope_t *scope, mp_uint_t n_
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_over, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) {
+static void emit_native_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_over, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) {
// make function
emit_native_pre(emit);
emit_native_mov_reg_state(emit, REG_ARG_2, LOCAL_IDX_FUN_OBJ(emit));
@@ -2683,7 +2683,7 @@ STATIC void emit_native_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_c
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
-STATIC void emit_native_call_function(emit_t *emit, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) {
+static void emit_native_call_function(emit_t *emit, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) {
DEBUG_printf("call_function(n_pos=" UINT_FMT ", n_kw=" UINT_FMT ", star_flags=" UINT_FMT ")\n", n_positional, n_keyword, star_flags);
// TODO: in viper mode, call special runtime routine with type info for args,
@@ -2738,7 +2738,7 @@ STATIC void emit_native_call_function(emit_t *emit, mp_uint_t n_positional, mp_u
}
}
-STATIC void emit_native_call_method(emit_t *emit, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) {
+static void emit_native_call_method(emit_t *emit, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) {
if (star_flags) {
emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_positional + 2 * n_keyword + 3); // pointer to args
emit_call_with_2_imm_args(emit, MP_F_CALL_METHOD_N_KW_VAR, 1, REG_ARG_1, n_positional | (n_keyword << 8), REG_ARG_2);
@@ -2751,7 +2751,7 @@ STATIC void emit_native_call_method(emit_t *emit, mp_uint_t n_positional, mp_uin
}
}
-STATIC void emit_native_return_value(emit_t *emit) {
+static void emit_native_return_value(emit_t *emit) {
DEBUG_printf("return_value\n");
if (emit->scope->scope_flags & MP_SCOPE_FLAG_GENERATOR) {
@@ -2804,7 +2804,7 @@ STATIC void emit_native_return_value(emit_t *emit) {
emit_native_unwind_jump(emit, emit->exit_label, emit->exc_stack_size);
}
-STATIC void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
+static void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
(void)n_args;
assert(n_args == 1);
vtype_kind_t vtype_exc;
@@ -2817,7 +2817,7 @@ STATIC void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
mp_asm_base_suppress_code(&emit->as->base);
}
-STATIC void emit_native_yield(emit_t *emit, int kind) {
+static void emit_native_yield(emit_t *emit, int kind) {
// Note: 1 (yield) or 3 (yield from) labels are reserved for this function, starting at *emit->label_slot
if (emit->do_viper_types) {
@@ -2900,7 +2900,7 @@ STATIC void emit_native_yield(emit_t *emit, int kind) {
}
}
-STATIC void emit_native_start_except_handler(emit_t *emit) {
+static void emit_native_start_except_handler(emit_t *emit) {
// Protected block has finished so leave the current exception handler
emit_native_leave_exc_stack(emit, true);
@@ -2909,7 +2909,7 @@ STATIC void emit_native_start_except_handler(emit_t *emit) {
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_TEMP0);
}
-STATIC void emit_native_end_except_handler(emit_t *emit) {
+static void emit_native_end_except_handler(emit_t *emit) {
adjust_stack(emit, -1); // pop the exception (end_finally didn't use it)
}
diff --git a/py/emitnx86.c b/py/emitnx86.c
index cb2b7f19ea..1d2aefa792 100644
--- a/py/emitnx86.c
+++ b/py/emitnx86.c
@@ -13,7 +13,7 @@
#define NLR_BUF_IDX_LOCAL_1 (5) // ebx
// x86 needs a table to know how many args a given function has
-STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
+static byte mp_f_n_args[MP_F_NUMBER_OF] = {
[MP_F_CONVERT_OBJ_TO_NATIVE] = 2,
[MP_F_CONVERT_NATIVE_TO_OBJ] = 2,
[MP_F_NATIVE_SWAP_GLOBALS] = 1,
diff --git a/py/gc.c b/py/gc.c
index b6969dfd42..8a03ce5264 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -121,7 +121,7 @@
#endif
// TODO waste less memory; currently requires that all entries in alloc_table have a corresponding block in pool
-STATIC void gc_setup_area(mp_state_mem_area_t *area, void *start, void *end) {
+static void gc_setup_area(mp_state_mem_area_t *area, void *start, void *end) {
// calculate parameters for GC (T=total, A=alloc table, F=finaliser table, P=pool; all in bytes):
// T = A + F + P
// F = A * BLOCKS_PER_ATB / BLOCKS_PER_FTB
@@ -239,7 +239,7 @@ void gc_add(void *start, void *end) {
#if MICROPY_GC_SPLIT_HEAP_AUTO
// Try to automatically add a heap area large enough to fulfill 'failed_alloc'.
-STATIC bool gc_try_add_heap(size_t failed_alloc) {
+static bool gc_try_add_heap(size_t failed_alloc) {
// 'needed' is the size of a heap large enough to hold failed_alloc, with
// the additional metadata overheads as calculated in gc_setup_area().
//
@@ -349,7 +349,7 @@ bool gc_is_locked(void) {
#if MICROPY_GC_SPLIT_HEAP
// Returns the area to which this pointer belongs, or NULL if it isn't
// allocated on the GC-managed heap.
-STATIC inline mp_state_mem_area_t *gc_get_ptr_area(const void *ptr) {
+static inline mp_state_mem_area_t *gc_get_ptr_area(const void *ptr) {
if (((uintptr_t)(ptr) & (BYTES_PER_BLOCK - 1)) != 0) { // must be aligned on a block
return NULL;
}
@@ -383,9 +383,9 @@ STATIC inline mp_state_mem_area_t *gc_get_ptr_area(const void *ptr) {
// blocks on the stack. When all children have been checked, pop off the
// topmost block on the stack and repeat with that one.
#if MICROPY_GC_SPLIT_HEAP
-STATIC void gc_mark_subtree(mp_state_mem_area_t *area, size_t block)
+static void gc_mark_subtree(mp_state_mem_area_t *area, size_t block)
#else
-STATIC void gc_mark_subtree(size_t block)
+static void gc_mark_subtree(size_t block)
#endif
{
// Start with the block passed in the argument.
@@ -456,7 +456,7 @@ STATIC void gc_mark_subtree(size_t block)
}
}
-STATIC void gc_deal_with_stack_overflow(void) {
+static void gc_deal_with_stack_overflow(void) {
while (MP_STATE_MEM(gc_stack_overflow)) {
MP_STATE_MEM(gc_stack_overflow) = 0;
@@ -477,7 +477,7 @@ STATIC void gc_deal_with_stack_overflow(void) {
}
}
-STATIC void gc_sweep(void) {
+static void gc_sweep(void) {
#if MICROPY_PY_GC_COLLECT_RETVAL
MP_STATE_MEM(gc_collected) = 0;
#endif
diff --git a/py/lexer.c b/py/lexer.c
index 5e911a1a23..bff8e63765 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -42,74 +42,74 @@
#define MP_LEXER_EOF ((unichar)MP_READER_EOF)
#define CUR_CHAR(lex) ((lex)->chr0)
-STATIC bool is_end(mp_lexer_t *lex) {
+static bool is_end(mp_lexer_t *lex) {
return lex->chr0 == MP_LEXER_EOF;
}
-STATIC bool is_physical_newline(mp_lexer_t *lex) {
+static bool is_physical_newline(mp_lexer_t *lex) {
return lex->chr0 == '\n';
}
-STATIC bool is_char(mp_lexer_t *lex, byte c) {
+static bool is_char(mp_lexer_t *lex, byte c) {
return lex->chr0 == c;
}
-STATIC bool is_char_or(mp_lexer_t *lex, byte c1, byte c2) {
+static bool is_char_or(mp_lexer_t *lex, byte c1, byte c2) {
return lex->chr0 == c1 || lex->chr0 == c2;
}
-STATIC bool is_char_or3(mp_lexer_t *lex, byte c1, byte c2, byte c3) {
+static bool is_char_or3(mp_lexer_t *lex, byte c1, byte c2, byte c3) {
return lex->chr0 == c1 || lex->chr0 == c2 || lex->chr0 == c3;
}
#if MICROPY_PY_FSTRINGS
-STATIC bool is_char_or4(mp_lexer_t *lex, byte c1, byte c2, byte c3, byte c4) {
+static bool is_char_or4(mp_lexer_t *lex, byte c1, byte c2, byte c3, byte c4) {
return lex->chr0 == c1 || lex->chr0 == c2 || lex->chr0 == c3 || lex->chr0 == c4;
}
#endif
-STATIC bool is_char_following(mp_lexer_t *lex, byte c) {
+static bool is_char_following(mp_lexer_t *lex, byte c) {
return lex->chr1 == c;
}
-STATIC bool is_char_following_or(mp_lexer_t *lex, byte c1, byte c2) {
+static bool is_char_following_or(mp_lexer_t *lex, byte c1, byte c2) {
return lex->chr1 == c1 || lex->chr1 == c2;
}
-STATIC bool is_char_following_following_or(mp_lexer_t *lex, byte c1, byte c2) {
+static bool is_char_following_following_or(mp_lexer_t *lex, byte c1, byte c2) {
return lex->chr2 == c1 || lex->chr2 == c2;
}
-STATIC bool is_char_and(mp_lexer_t *lex, byte c1, byte c2) {
+static bool is_char_and(mp_lexer_t *lex, byte c1, byte c2) {
return lex->chr0 == c1 && lex->chr1 == c2;
}
-STATIC bool is_whitespace(mp_lexer_t *lex) {
+static bool is_whitespace(mp_lexer_t *lex) {
return unichar_isspace(lex->chr0);
}
-STATIC bool is_letter(mp_lexer_t *lex) {
+static bool is_letter(mp_lexer_t *lex) {
return unichar_isalpha(lex->chr0);
}
-STATIC bool is_digit(mp_lexer_t *lex) {
+static bool is_digit(mp_lexer_t *lex) {
return unichar_isdigit(lex->chr0);
}
-STATIC bool is_following_digit(mp_lexer_t *lex) {
+static bool is_following_digit(mp_lexer_t *lex) {
return unichar_isdigit(lex->chr1);
}
-STATIC bool is_following_base_char(mp_lexer_t *lex) {
+static bool is_following_base_char(mp_lexer_t *lex) {
const unichar chr1 = lex->chr1 | 0x20;
return chr1 == 'b' || chr1 == 'o' || chr1 == 'x';
}
-STATIC bool is_following_odigit(mp_lexer_t *lex) {
+static bool is_following_odigit(mp_lexer_t *lex) {
return lex->chr1 >= '0' && lex->chr1 <= '7';
}
-STATIC bool is_string_or_bytes(mp_lexer_t *lex) {
+static bool is_string_or_bytes(mp_lexer_t *lex) {
return is_char_or(lex, '\'', '\"')
#if MICROPY_PY_FSTRINGS
|| (is_char_or4(lex, 'r', 'u', 'b', 'f') && is_char_following_or(lex, '\'', '\"'))
@@ -123,15 +123,15 @@ STATIC bool is_string_or_bytes(mp_lexer_t *lex) {
}
// to easily parse utf-8 identifiers we allow any raw byte with high bit set
-STATIC bool is_head_of_identifier(mp_lexer_t *lex) {
+static bool is_head_of_identifier(mp_lexer_t *lex) {
return is_letter(lex) || lex->chr0 == '_' || lex->chr0 >= 0x80;
}
-STATIC bool is_tail_of_identifier(mp_lexer_t *lex) {
+static bool is_tail_of_identifier(mp_lexer_t *lex) {
return is_head_of_identifier(lex) || is_digit(lex);
}
-STATIC void next_char(mp_lexer_t *lex) {
+static void next_char(mp_lexer_t *lex) {
if (lex->chr0 == '\n') {
// a new line
++lex->line;
@@ -189,7 +189,7 @@ STATIC void next_char(mp_lexer_t *lex) {
}
}
-STATIC void indent_push(mp_lexer_t *lex, size_t indent) {
+static void indent_push(mp_lexer_t *lex, size_t indent) {
if (lex->num_indent_level >= lex->alloc_indent_level) {
lex->indent_level = m_renew(uint16_t, lex->indent_level, lex->alloc_indent_level, lex->alloc_indent_level + MICROPY_ALLOC_LEXEL_INDENT_INC);
lex->alloc_indent_level += MICROPY_ALLOC_LEXEL_INDENT_INC;
@@ -197,11 +197,11 @@ STATIC void indent_push(mp_lexer_t *lex, size_t indent) {
lex->indent_level[lex->num_indent_level++] = indent;
}
-STATIC size_t indent_top(mp_lexer_t *lex) {
+static size_t indent_top(mp_lexer_t *lex) {
return lex->indent_level[lex->num_indent_level - 1];
}
-STATIC void indent_pop(mp_lexer_t *lex) {
+static void indent_pop(mp_lexer_t *lex) {
lex->num_indent_level -= 1;
}
@@ -211,7 +211,7 @@ STATIC void indent_pop(mp_lexer_t *lex) {
// c<op> = continue with <op>, if this opchar matches then continue matching
// this means if the start of two ops are the same then they are equal til the last char
-STATIC const char *const tok_enc =
+static const char *const tok_enc =
"()[]{},;~" // singles
":e=" // : :=
"<e=c<e=" // < <= << <<=
@@ -229,7 +229,7 @@ STATIC const char *const tok_enc =
"!."; // start of special cases: != . ...
// TODO static assert that number of tokens is less than 256 so we can safely make this table with byte sized entries
-STATIC const uint8_t tok_enc_kind[] = {
+static const uint8_t tok_enc_kind[] = {
MP_TOKEN_DEL_PAREN_OPEN, MP_TOKEN_DEL_PAREN_CLOSE,
MP_TOKEN_DEL_BRACKET_OPEN, MP_TOKEN_DEL_BRACKET_CLOSE,
MP_TOKEN_DEL_BRACE_OPEN, MP_TOKEN_DEL_BRACE_CLOSE,
@@ -252,7 +252,7 @@ STATIC const uint8_t tok_enc_kind[] = {
// must have the same order as enum in lexer.h
// must be sorted according to strcmp
-STATIC const char *const tok_kw[] = {
+static const char *const tok_kw[] = {
"False",
"None",
"True",
@@ -296,7 +296,7 @@ STATIC const char *const tok_kw[] = {
// This is called with CUR_CHAR() before first hex digit, and should return with
// it pointing to last hex digit
// num_digits must be greater than zero
-STATIC bool get_hex(mp_lexer_t *lex, size_t num_digits, mp_uint_t *result) {
+static bool get_hex(mp_lexer_t *lex, size_t num_digits, mp_uint_t *result) {
mp_uint_t num = 0;
while (num_digits-- != 0) {
next_char(lex);
@@ -310,7 +310,7 @@ STATIC bool get_hex(mp_lexer_t *lex, size_t num_digits, mp_uint_t *result) {
return true;
}
-STATIC void parse_string_literal(mp_lexer_t *lex, bool is_raw, bool is_fstring) {
+static void parse_string_literal(mp_lexer_t *lex, bool is_raw, bool is_fstring) {
// get first quoting character
char quote_char = '\'';
if (is_char(lex, '\"')) {
@@ -529,7 +529,7 @@ STATIC void parse_string_literal(mp_lexer_t *lex, bool is_raw, bool is_fstring)
// This function returns whether it has crossed a newline or not.
// It therefore always return true if stop_at_newline is true
-STATIC bool skip_whitespace(mp_lexer_t *lex, bool stop_at_newline) {
+static bool skip_whitespace(mp_lexer_t *lex, bool stop_at_newline) {
while (!is_end(lex)) {
if (is_physical_newline(lex)) {
if (stop_at_newline && lex->nested_bracket_level == 0) {
diff --git a/py/malloc.c b/py/malloc.c
index ddf139e386..f557ade44f 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -69,7 +69,7 @@
#error MICROPY_ENABLE_FINALISER requires MICROPY_ENABLE_GC
#endif
-STATIC void *realloc_ext(void *ptr, size_t n_bytes, bool allow_move) {
+static void *realloc_ext(void *ptr, size_t n_bytes, bool allow_move) {
if (allow_move) {
return realloc(ptr, n_bytes);
} else {
@@ -221,7 +221,7 @@ typedef struct _m_tracked_node_t {
} m_tracked_node_t;
#if MICROPY_DEBUG_VERBOSE
-STATIC size_t m_tracked_count_links(size_t *nb) {
+static size_t m_tracked_count_links(size_t *nb) {
m_tracked_node_t *node = MP_STATE_VM(m_tracked_head);
size_t n = 0;
*nb = 0;
diff --git a/py/map.c b/py/map.c
index c18df5a9f3..d40e3dc4d0 100644
--- a/py/map.c
+++ b/py/map.c
@@ -65,14 +65,14 @@
// The first set of sizes are chosen so the allocation fits exactly in a
// 4-word GC block, and it's not so important for these small values to be
// prime. The latter sizes are prime and increase at an increasing rate.
-STATIC const uint16_t hash_allocation_sizes[] = {
+static const uint16_t hash_allocation_sizes[] = {
0, 2, 4, 6, 8, 10, 12, // +2
17, 23, 29, 37, 47, 59, 73, // *1.25
97, 127, 167, 223, 293, 389, 521, 691, 919, 1223, 1627, 2161, // *1.33
3229, 4831, 7243, 10861, 16273, 24407, 36607, 54907, // *1.5
};
-STATIC size_t get_hash_alloc_greater_or_equal_to(size_t x) {
+static size_t get_hash_alloc_greater_or_equal_to(size_t x) {
for (size_t i = 0; i < MP_ARRAY_SIZE(hash_allocation_sizes); i++) {
if (hash_allocation_sizes[i] >= x) {
return hash_allocation_sizes[i];
@@ -128,7 +128,7 @@ void mp_map_clear(mp_map_t *map) {
map->table = NULL;
}
-STATIC void mp_map_rehash(mp_map_t *map) {
+static void mp_map_rehash(mp_map_t *map) {
size_t old_alloc = map->alloc;
size_t new_alloc = get_hash_alloc_greater_or_equal_to(map->alloc + 1);
DEBUG_printf("mp_map_rehash(%p): " UINT_FMT " -> " UINT_FMT "\n", map, old_alloc, new_alloc);
@@ -332,7 +332,7 @@ void mp_set_init(mp_set_t *set, size_t n) {
set->table = m_new0(mp_obj_t, set->alloc);
}
-STATIC void mp_set_rehash(mp_set_t *set) {
+static void mp_set_rehash(mp_set_t *set) {
size_t old_alloc = set->alloc;
mp_obj_t *old_table = set->table;
set->alloc = get_hash_alloc_greater_or_equal_to(set->alloc + 1);
diff --git a/py/modarray.c b/py/modarray.c
index ac2e56ed38..116c844e8e 100644
--- a/py/modarray.c
+++ b/py/modarray.c
@@ -28,12 +28,12 @@
#if MICROPY_PY_ARRAY
-STATIC const mp_rom_map_elem_t mp_module_array_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_array_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_array) },
{ MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mp_type_array) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_array_globals, mp_module_array_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_array_globals, mp_module_array_globals_table);
const mp_obj_module_t mp_module_array = {
.base = { &mp_type_module },
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 4ff7d44509..51cf3137bf 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -46,7 +46,7 @@ extern struct _mp_dummy_t mp_sys_stdout_obj; // type is irrelevant, just need po
// args[0] is function from class body
// args[1] is class name
// args[2:] are base objects
-STATIC mp_obj_t mp_builtin___build_class__(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin___build_class__(size_t n_args, const mp_obj_t *args) {
assert(2 <= n_args);
// set the new classes __locals__ object
@@ -88,12 +88,12 @@ STATIC mp_obj_t mp_builtin___build_class__(size_t n_args, const mp_obj_t *args)
}
MP_DEFINE_CONST_FUN_OBJ_VAR(mp_builtin___build_class___obj, 2, mp_builtin___build_class__);
-STATIC mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
return mp_unary_op(MP_UNARY_OP_ABS, o_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_abs_obj, mp_builtin_abs);
-STATIC mp_obj_t mp_builtin_all(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_all(mp_obj_t o_in) {
mp_obj_iter_buf_t iter_buf;
mp_obj_t iterable = mp_getiter(o_in, &iter_buf);
mp_obj_t item;
@@ -106,7 +106,7 @@ STATIC mp_obj_t mp_builtin_all(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_all_obj, mp_builtin_all);
-STATIC mp_obj_t mp_builtin_any(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_any(mp_obj_t o_in) {
mp_obj_iter_buf_t iter_buf;
mp_obj_t iterable = mp_getiter(o_in, &iter_buf);
mp_obj_t item;
@@ -119,13 +119,13 @@ STATIC mp_obj_t mp_builtin_any(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_any_obj, mp_builtin_any);
-STATIC mp_obj_t mp_builtin_bin(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_bin(mp_obj_t o_in) {
mp_obj_t args[] = { MP_OBJ_NEW_QSTR(MP_QSTR__brace_open__colon__hash_b_brace_close_), o_in };
return mp_obj_str_format(MP_ARRAY_SIZE(args), args, NULL);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_bin_obj, mp_builtin_bin);
-STATIC mp_obj_t mp_builtin_callable(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_callable(mp_obj_t o_in) {
if (mp_obj_is_callable(o_in)) {
return mp_const_true;
} else {
@@ -134,7 +134,7 @@ STATIC mp_obj_t mp_builtin_callable(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_callable_obj, mp_builtin_callable);
-STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
#if MICROPY_PY_BUILTINS_STR_UNICODE
mp_uint_t c = mp_obj_get_int(o_in);
if (c >= 0x110000) {
@@ -155,7 +155,7 @@ STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_chr_obj, mp_builtin_chr);
-STATIC mp_obj_t mp_builtin_dir(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_dir(size_t n_args, const mp_obj_t *args) {
mp_obj_t dir = mp_obj_new_list(0, NULL);
if (n_args == 0) {
// Make a list of names in the local namespace
@@ -188,18 +188,18 @@ STATIC mp_obj_t mp_builtin_dir(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_dir_obj, 0, 1, mp_builtin_dir);
-STATIC mp_obj_t mp_builtin_divmod(mp_obj_t o1_in, mp_obj_t o2_in) {
+static mp_obj_t mp_builtin_divmod(mp_obj_t o1_in, mp_obj_t o2_in) {
return mp_binary_op(MP_BINARY_OP_DIVMOD, o1_in, o2_in);
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_divmod_obj, mp_builtin_divmod);
-STATIC mp_obj_t mp_builtin_hash(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_hash(mp_obj_t o_in) {
// result is guaranteed to be a (small) int
return mp_unary_op(MP_UNARY_OP_HASH, o_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hash_obj, mp_builtin_hash);
-STATIC mp_obj_t mp_builtin_hex(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_hex(mp_obj_t o_in) {
#if MICROPY_PY_BUILTINS_STR_OP_MODULO
return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent__hash_x), o_in);
#else
@@ -219,7 +219,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hex_obj, mp_builtin_hex);
#define mp_hal_readline readline
#endif
-STATIC mp_obj_t mp_builtin_input(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_input(size_t n_args, const mp_obj_t *args) {
if (n_args == 1) {
mp_obj_print(args[0], PRINT_STR);
}
@@ -238,14 +238,14 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_input_obj, 0, 1, mp_builtin_input
#endif
-STATIC mp_obj_t mp_builtin_iter(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_iter(mp_obj_t o_in) {
return mp_getiter(o_in, NULL);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_iter_obj, mp_builtin_iter);
#if MICROPY_PY_BUILTINS_MIN_MAX
-STATIC mp_obj_t mp_builtin_min_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs, mp_uint_t op) {
+static mp_obj_t mp_builtin_min_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs, mp_uint_t op) {
mp_map_elem_t *key_elem = mp_map_lookup(kwargs, MP_OBJ_NEW_QSTR(MP_QSTR_key), MP_MAP_LOOKUP);
mp_map_elem_t *default_elem;
mp_obj_t key_fn = key_elem == NULL ? MP_OBJ_NULL : key_elem->value;
@@ -287,12 +287,12 @@ STATIC mp_obj_t mp_builtin_min_max(size_t n_args, const mp_obj_t *args, mp_map_t
}
}
-STATIC mp_obj_t mp_builtin_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t mp_builtin_max(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_MORE);
}
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_max_obj, 1, mp_builtin_max);
-STATIC mp_obj_t mp_builtin_min(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t mp_builtin_min(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_builtin_min_max(n_args, args, kwargs, MP_BINARY_OP_LESS);
}
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_min_obj, 1, mp_builtin_min);
@@ -300,7 +300,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_min_obj, 1, mp_builtin_min);
#endif
#if MICROPY_PY_BUILTINS_NEXT2
-STATIC mp_obj_t mp_builtin_next(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_next(size_t n_args, const mp_obj_t *args) {
if (n_args == 1) {
mp_obj_t ret = mp_iternext_allow_raise(args[0]);
if (ret == MP_OBJ_STOP_ITERATION) {
@@ -315,7 +315,7 @@ STATIC mp_obj_t mp_builtin_next(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_next_obj, 1, 2, mp_builtin_next);
#else
-STATIC mp_obj_t mp_builtin_next(mp_obj_t o) {
+static mp_obj_t mp_builtin_next(mp_obj_t o) {
mp_obj_t ret = mp_iternext_allow_raise(o);
if (ret == MP_OBJ_STOP_ITERATION) {
mp_raise_StopIteration(MP_STATE_THREAD(stop_iteration_arg));
@@ -326,7 +326,7 @@ STATIC mp_obj_t mp_builtin_next(mp_obj_t o) {
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_next_obj, mp_builtin_next);
#endif
-STATIC mp_obj_t mp_builtin_oct(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_oct(mp_obj_t o_in) {
#if MICROPY_PY_BUILTINS_STR_OP_MODULO
return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent__hash_o), o_in);
#else
@@ -336,7 +336,7 @@ STATIC mp_obj_t mp_builtin_oct(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_oct_obj, mp_builtin_oct);
-STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
size_t len;
const byte *str = (const byte *)mp_obj_str_get_data(o_in, &len);
#if MICROPY_PY_BUILTINS_STR_UNICODE
@@ -363,7 +363,7 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord);
-STATIC mp_obj_t mp_builtin_pow(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_pow(size_t n_args, const mp_obj_t *args) {
switch (n_args) {
case 2:
return mp_binary_op(MP_BINARY_OP_POWER, args[0], args[1]);
@@ -379,7 +379,7 @@ STATIC mp_obj_t mp_builtin_pow(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj, 2, 3, mp_builtin_pow);
-STATIC mp_obj_t mp_builtin_print(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mp_builtin_print(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_sep, ARG_end, ARG_file };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_sep, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_QSTR(MP_QSTR__space_)} },
@@ -430,7 +430,7 @@ STATIC mp_obj_t mp_builtin_print(size_t n_args, const mp_obj_t *pos_args, mp_map
}
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_print_obj, 0, mp_builtin_print);
-STATIC mp_obj_t mp_builtin___repl_print__(mp_obj_t o) {
+static mp_obj_t mp_builtin___repl_print__(mp_obj_t o) {
if (o != mp_const_none) {
mp_obj_print_helper(MP_PYTHON_PRINTER, o, PRINT_REPR);
mp_print_str(MP_PYTHON_PRINTER, "\n");
@@ -444,7 +444,7 @@ STATIC mp_obj_t mp_builtin___repl_print__(mp_obj_t o) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin___repl_print___obj, mp_builtin___repl_print__);
-STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
+static mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
vstr_t vstr;
mp_print_t print;
vstr_init_print(&vstr, 16, &print);
@@ -453,7 +453,7 @@ STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr);
-STATIC mp_obj_t mp_builtin_round(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_round(size_t n_args, const mp_obj_t *args) {
mp_obj_t o_in = args[0];
if (mp_obj_is_int(o_in)) {
if (n_args <= 1) {
@@ -505,7 +505,7 @@ STATIC mp_obj_t mp_builtin_round(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_round_obj, 1, 2, mp_builtin_round);
-STATIC mp_obj_t mp_builtin_sum(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_sum(size_t n_args, const mp_obj_t *args) {
mp_obj_t value;
switch (n_args) {
case 1:
@@ -525,7 +525,7 @@ STATIC mp_obj_t mp_builtin_sum(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj, 1, 2, mp_builtin_sum);
-STATIC mp_obj_t mp_builtin_sorted(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t mp_builtin_sorted(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
if (n_args > 1) {
mp_raise_TypeError(MP_ERROR_TEXT("must use keyword argument for key function"));
}
@@ -556,7 +556,7 @@ static inline mp_obj_t mp_load_attr_default(mp_obj_t base, qstr attr, mp_obj_t d
}
}
-STATIC mp_obj_t mp_builtin_getattr(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_builtin_getattr(size_t n_args, const mp_obj_t *args) {
mp_obj_t defval = MP_OBJ_NULL;
if (n_args > 2) {
defval = args[2];
@@ -565,20 +565,20 @@ STATIC mp_obj_t mp_builtin_getattr(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_getattr_obj, 2, 3, mp_builtin_getattr);
-STATIC mp_obj_t mp_builtin_setattr(mp_obj_t base, mp_obj_t attr, mp_obj_t value) {
+static mp_obj_t mp_builtin_setattr(mp_obj_t base, mp_obj_t attr, mp_obj_t value) {
mp_store_attr(base, mp_obj_str_get_qstr(attr), value);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_3(mp_builtin_setattr_obj, mp_builtin_setattr);
#if MICROPY_CPYTHON_COMPAT
-STATIC mp_obj_t mp_builtin_delattr(mp_obj_t base, mp_obj_t attr) {
+static mp_obj_t mp_builtin_delattr(mp_obj_t base, mp_obj_t attr) {
return mp_builtin_setattr(base, attr, MP_OBJ_NULL);
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_delattr_obj, mp_builtin_delattr);
#endif
-STATIC mp_obj_t mp_builtin_hasattr(mp_obj_t object_in, mp_obj_t attr_in) {
+static mp_obj_t mp_builtin_hasattr(mp_obj_t object_in, mp_obj_t attr_in) {
qstr attr = mp_obj_str_get_qstr(attr_in);
mp_obj_t dest[2];
mp_load_method_protected(object_in, attr, dest, false);
@@ -586,12 +586,12 @@ STATIC mp_obj_t mp_builtin_hasattr(mp_obj_t object_in, mp_obj_t attr_in) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_hasattr_obj, mp_builtin_hasattr);
-STATIC mp_obj_t mp_builtin_globals(void) {
+static mp_obj_t mp_builtin_globals(void) {
return MP_OBJ_FROM_PTR(mp_globals_get());
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_globals_obj, mp_builtin_globals);
-STATIC mp_obj_t mp_builtin_locals(void) {
+static mp_obj_t mp_builtin_locals(void) {
return MP_OBJ_FROM_PTR(mp_locals_get());
}
MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_locals_obj, mp_builtin_locals);
@@ -600,7 +600,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_locals_obj, mp_builtin_locals);
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_id_obj, mp_obj_id);
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_len_obj, mp_obj_len);
-STATIC const mp_rom_map_elem_t mp_module_builtins_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_builtins_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_builtins) },
// built-in core functions
diff --git a/py/modcmath.c b/py/modcmath.c
index 1418362ad9..33cb00cbe7 100644
--- a/py/modcmath.c
+++ b/py/modcmath.c
@@ -31,15 +31,15 @@
#include <math.h>
// phase(z): returns the phase of the number z in the range (-pi, +pi]
-STATIC mp_obj_t mp_cmath_phase(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_phase(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_float(MICROPY_FLOAT_C_FUN(atan2)(imag, real));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_phase_obj, mp_cmath_phase);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_phase_obj, mp_cmath_phase);
// polar(z): returns the polar form of z as a tuple
-STATIC mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
mp_obj_t tuple[2] = {
@@ -48,71 +48,71 @@ STATIC mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
};
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_polar_obj, mp_cmath_polar);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_polar_obj, mp_cmath_polar);
// rect(r, phi): returns the complex number with modulus r and phase phi
-STATIC mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
+static mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
mp_float_t r = mp_obj_get_float(r_obj);
mp_float_t phi = mp_obj_get_float(phi_obj);
return mp_obj_new_complex(r * MICROPY_FLOAT_C_FUN(cos)(phi), r * MICROPY_FLOAT_C_FUN(sin)(phi));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_cmath_rect_obj, mp_cmath_rect);
+static MP_DEFINE_CONST_FUN_OBJ_2(mp_cmath_rect_obj, mp_cmath_rect);
// exp(z): return the exponential of z
-STATIC mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
mp_float_t exp_real = MICROPY_FLOAT_C_FUN(exp)(real);
return mp_obj_new_complex(exp_real * MICROPY_FLOAT_C_FUN(cos)(imag), exp_real * MICROPY_FLOAT_C_FUN(sin)(imag));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_exp_obj, mp_cmath_exp);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_exp_obj, mp_cmath_exp);
// log(z): return the natural logarithm of z, with branch cut along the negative real axis
// TODO can take second argument, being the base
-STATIC mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(MICROPY_FLOAT_CONST(0.5) * MICROPY_FLOAT_C_FUN(log)(real * real + imag * imag), MICROPY_FLOAT_C_FUN(atan2)(imag, real));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log_obj, mp_cmath_log);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log_obj, mp_cmath_log);
#if MICROPY_PY_MATH_SPECIAL_FUNCTIONS
// log10(z): return the base-10 logarithm of z, with branch cut along the negative real axis
-STATIC mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(MICROPY_FLOAT_CONST(0.5) * MICROPY_FLOAT_C_FUN(log10)(real * real + imag * imag), MICROPY_FLOAT_CONST(0.4342944819032518) * MICROPY_FLOAT_C_FUN(atan2)(imag, real));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log10_obj, mp_cmath_log10);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log10_obj, mp_cmath_log10);
#endif
// sqrt(z): return the square-root of z
-STATIC mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
mp_float_t sqrt_abs = MICROPY_FLOAT_C_FUN(pow)(real * real + imag * imag, MICROPY_FLOAT_CONST(0.25));
mp_float_t theta = MICROPY_FLOAT_CONST(0.5) * MICROPY_FLOAT_C_FUN(atan2)(imag, real);
return mp_obj_new_complex(sqrt_abs * MICROPY_FLOAT_C_FUN(cos)(theta), sqrt_abs * MICROPY_FLOAT_C_FUN(sin)(theta));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_sqrt_obj, mp_cmath_sqrt);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_sqrt_obj, mp_cmath_sqrt);
// cos(z): return the cosine of z
-STATIC mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(MICROPY_FLOAT_C_FUN(cos)(real) * MICROPY_FLOAT_C_FUN(cosh)(imag), -MICROPY_FLOAT_C_FUN(sin)(real) * MICROPY_FLOAT_C_FUN(sinh)(imag));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_cos_obj, mp_cmath_cos);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_cos_obj, mp_cmath_cos);
// sin(z): return the sine of z
-STATIC mp_obj_t mp_cmath_sin(mp_obj_t z_obj) {
+static mp_obj_t mp_cmath_sin(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(MICROPY_FLOAT_C_FUN(sin)(real) * MICROPY_FLOAT_C_FUN(cosh)(imag), MICROPY_FLOAT_C_FUN(cos)(real) * MICROPY_FLOAT_C_FUN(sinh)(imag));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_sin_obj, mp_cmath_sin);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_sin_obj, mp_cmath_sin);
-STATIC const mp_rom_map_elem_t mp_module_cmath_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_cmath_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cmath) },
{ MP_ROM_QSTR(MP_QSTR_e), mp_const_float_e },
{ MP_ROM_QSTR(MP_QSTR_pi), mp_const_float_pi },
@@ -142,7 +142,7 @@ STATIC const mp_rom_map_elem_t mp_module_cmath_globals_table[] = {
// { MP_ROM_QSTR(MP_QSTR_isnan), MP_ROM_PTR(&mp_cmath_isnan_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_cmath_globals, mp_module_cmath_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_cmath_globals, mp_module_cmath_globals_table);
const mp_obj_module_t mp_module_cmath = {
.base = { &mp_type_module },
diff --git a/py/modcollections.c b/py/modcollections.c
index 30a5881bc2..46326d13ee 100644
--- a/py/modcollections.c
+++ b/py/modcollections.c
@@ -28,7 +28,7 @@
#if MICROPY_PY_COLLECTIONS
-STATIC const mp_rom_map_elem_t mp_module_collections_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_collections_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_collections) },
#if MICROPY_PY_COLLECTIONS_DEQUE
{ MP_ROM_QSTR(MP_QSTR_deque), MP_ROM_PTR(&mp_type_deque) },
@@ -39,7 +39,7 @@ STATIC const mp_rom_map_elem_t mp_module_collections_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_collections_globals, mp_module_collections_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_collections_globals, mp_module_collections_globals_table);
const mp_obj_module_t mp_module_collections = {
.base = { &mp_type_module },
diff --git a/py/moderrno.c b/py/moderrno.c
index 4f0673a23a..58a141c102 100644
--- a/py/moderrno.c
+++ b/py/moderrno.c
@@ -62,13 +62,13 @@
#endif
#if MICROPY_PY_ERRNO_ERRORCODE
-STATIC const mp_rom_map_elem_t errorcode_table[] = {
+static const mp_rom_map_elem_t errorcode_table[] = {
#define X(e) { MP_ROM_INT(MP_##e), MP_ROM_QSTR(MP_QSTR_##e) },
MICROPY_PY_ERRNO_LIST
#undef X
};
-STATIC const mp_obj_dict_t errorcode_dict = {
+static const mp_obj_dict_t errorcode_dict = {
.base = {&mp_type_dict},
.map = {
.all_keys_are_qstrs = 0, // keys are integers
@@ -81,7 +81,7 @@ STATIC const mp_obj_dict_t errorcode_dict = {
};
#endif
-STATIC const mp_rom_map_elem_t mp_module_errno_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_errno_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_errno) },
#if MICROPY_PY_ERRNO_ERRORCODE
{ MP_ROM_QSTR(MP_QSTR_errorcode), MP_ROM_PTR(&errorcode_dict) },
@@ -92,7 +92,7 @@ STATIC const mp_rom_map_elem_t mp_module_errno_globals_table[] = {
#undef X
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_errno_globals, mp_module_errno_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_errno_globals, mp_module_errno_globals_table);
const mp_obj_module_t mp_module_errno = {
.base = { &mp_type_module },
diff --git a/py/modgc.c b/py/modgc.c
index 7b18045b08..47902d8c95 100644
--- a/py/modgc.c
+++ b/py/modgc.c
@@ -31,7 +31,7 @@
#if MICROPY_PY_GC && MICROPY_ENABLE_GC
// collect(): run a garbage collection
-STATIC mp_obj_t py_gc_collect(void) {
+static mp_obj_t py_gc_collect(void) {
gc_collect();
#if MICROPY_PY_GC_COLLECT_RETVAL
return MP_OBJ_NEW_SMALL_INT(MP_STATE_MEM(gc_collected));
@@ -42,26 +42,26 @@ STATIC mp_obj_t py_gc_collect(void) {
MP_DEFINE_CONST_FUN_OBJ_0(gc_collect_obj, py_gc_collect);
// disable(): disable the garbage collector
-STATIC mp_obj_t gc_disable(void) {
+static mp_obj_t gc_disable(void) {
MP_STATE_MEM(gc_auto_collect_enabled) = 0;
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(gc_disable_obj, gc_disable);
// enable(): enable the garbage collector
-STATIC mp_obj_t gc_enable(void) {
+static mp_obj_t gc_enable(void) {
MP_STATE_MEM(gc_auto_collect_enabled) = 1;
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(gc_enable_obj, gc_enable);
-STATIC mp_obj_t gc_isenabled(void) {
+static mp_obj_t gc_isenabled(void) {
return mp_obj_new_bool(MP_STATE_MEM(gc_auto_collect_enabled));
}
MP_DEFINE_CONST_FUN_OBJ_0(gc_isenabled_obj, gc_isenabled);
// mem_free(): return the number of bytes of available heap RAM
-STATIC mp_obj_t gc_mem_free(void) {
+static mp_obj_t gc_mem_free(void) {
gc_info_t info;
gc_info(&info);
#if MICROPY_GC_SPLIT_HEAP_AUTO
@@ -74,7 +74,7 @@ STATIC mp_obj_t gc_mem_free(void) {
MP_DEFINE_CONST_FUN_OBJ_0(gc_mem_free_obj, gc_mem_free);
// mem_alloc(): return the number of bytes of heap RAM that are allocated
-STATIC mp_obj_t gc_mem_alloc(void) {
+static mp_obj_t gc_mem_alloc(void) {
gc_info_t info;
gc_info(&info);
return MP_OBJ_NEW_SMALL_INT(info.used);
@@ -82,7 +82,7 @@ STATIC mp_obj_t gc_mem_alloc(void) {
MP_DEFINE_CONST_FUN_OBJ_0(gc_mem_alloc_obj, gc_mem_alloc);
#if MICROPY_GC_ALLOC_THRESHOLD
-STATIC mp_obj_t gc_threshold(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t gc_threshold(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
if (MP_STATE_MEM(gc_alloc_threshold) == (size_t)-1) {
return MP_OBJ_NEW_SMALL_INT(-1);
@@ -100,7 +100,7 @@ STATIC mp_obj_t gc_threshold(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gc_threshold_obj, 0, 1, gc_threshold);
#endif
-STATIC const mp_rom_map_elem_t mp_module_gc_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_gc_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gc) },
{ MP_ROM_QSTR(MP_QSTR_collect), MP_ROM_PTR(&gc_collect_obj) },
{ MP_ROM_QSTR(MP_QSTR_disable), MP_ROM_PTR(&gc_disable_obj) },
@@ -113,7 +113,7 @@ STATIC const mp_rom_map_elem_t mp_module_gc_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_gc_globals, mp_module_gc_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_gc_globals, mp_module_gc_globals_table);
const mp_obj_module_t mp_module_gc = {
.base = { &mp_type_module },
diff --git a/py/modio.c b/py/modio.c
index 37eff3c41c..d3e563dbcf 100644
--- a/py/modio.c
+++ b/py/modio.c
@@ -39,11 +39,11 @@
#if MICROPY_PY_IO_IOBASE
-STATIC const mp_obj_type_t mp_type_iobase;
+static const mp_obj_type_t mp_type_iobase;
-STATIC const mp_obj_base_t iobase_singleton = {&mp_type_iobase};
+static const mp_obj_base_t iobase_singleton = {&mp_type_iobase};
-STATIC mp_obj_t iobase_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t iobase_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type;
(void)n_args;
(void)n_kw;
@@ -51,7 +51,7 @@ STATIC mp_obj_t iobase_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(&iobase_singleton);
}
-STATIC mp_uint_t iobase_read_write(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode, qstr qst) {
+static mp_uint_t iobase_read_write(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode, qstr qst) {
mp_obj_t dest[3];
mp_load_method(obj, qst, dest);
mp_obj_array_t ar = {{&mp_type_bytearray}, BYTEARRAY_TYPECODE, 0, size, buf};
@@ -69,15 +69,15 @@ STATIC mp_uint_t iobase_read_write(mp_obj_t obj, void *buf, mp_uint_t size, int
return MP_STREAM_ERROR;
}
}
-STATIC mp_uint_t iobase_read(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t iobase_read(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode) {
return iobase_read_write(obj, buf, size, errcode, MP_QSTR_readinto);
}
-STATIC mp_uint_t iobase_write(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t iobase_write(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode) {
return iobase_read_write(obj, (void *)buf, size, errcode, MP_QSTR_write);
}
-STATIC mp_uint_t iobase_ioctl(mp_obj_t obj, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t iobase_ioctl(mp_obj_t obj, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_t dest[4];
mp_load_method(obj, MP_QSTR_ioctl, dest);
dest[2] = mp_obj_new_int_from_uint(request);
@@ -91,13 +91,13 @@ STATIC mp_uint_t iobase_ioctl(mp_obj_t obj, mp_uint_t request, uintptr_t arg, in
}
}
-STATIC const mp_stream_p_t iobase_p = {
+static const mp_stream_p_t iobase_p = {
.read = iobase_read,
.write = iobase_write,
.ioctl = iobase_ioctl,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_iobase,
MP_QSTR_IOBase,
MP_TYPE_FLAG_NONE,
@@ -116,7 +116,7 @@ typedef struct _mp_obj_bufwriter_t {
byte buf[0];
} mp_obj_bufwriter_t;
-STATIC mp_obj_t bufwriter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t bufwriter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, 2, false);
size_t alloc = mp_obj_get_int(args[1]);
mp_obj_bufwriter_t *o = mp_obj_malloc_var(mp_obj_bufwriter_t, buf, byte, alloc, type);
@@ -126,7 +126,7 @@ STATIC mp_obj_t bufwriter_make_new(const mp_obj_type_t *type, size_t n_args, siz
return o;
}
-STATIC mp_uint_t bufwriter_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t bufwriter_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_bufwriter_t *self = MP_OBJ_TO_PTR(self_in);
mp_uint_t org_size = size;
@@ -162,7 +162,7 @@ STATIC mp_uint_t bufwriter_write(mp_obj_t self_in, const void *buf, mp_uint_t si
return org_size;
}
-STATIC mp_obj_t bufwriter_flush(mp_obj_t self_in) {
+static mp_obj_t bufwriter_flush(mp_obj_t self_in) {
mp_obj_bufwriter_t *self = MP_OBJ_TO_PTR(self_in);
if (self->len != 0) {
@@ -180,19 +180,19 @@ STATIC mp_obj_t bufwriter_flush(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(bufwriter_flush_obj, bufwriter_flush);
+static MP_DEFINE_CONST_FUN_OBJ_1(bufwriter_flush_obj, bufwriter_flush);
-STATIC const mp_rom_map_elem_t bufwriter_locals_dict_table[] = {
+static const mp_rom_map_elem_t bufwriter_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&bufwriter_flush_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(bufwriter_locals_dict, bufwriter_locals_dict_table);
+static MP_DEFINE_CONST_DICT(bufwriter_locals_dict, bufwriter_locals_dict_table);
-STATIC const mp_stream_p_t bufwriter_stream_p = {
+static const mp_stream_p_t bufwriter_stream_p = {
.write = bufwriter_write,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_bufwriter,
MP_QSTR_BufferedWriter,
MP_TYPE_FLAG_NONE,
@@ -202,7 +202,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif // MICROPY_PY_IO_BUFFEREDWRITER
-STATIC const mp_rom_map_elem_t mp_module_io_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_io_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_io) },
// Note: mp_builtin_open_obj should be defined by port, it's not
// part of the core.
@@ -219,7 +219,7 @@ STATIC const mp_rom_map_elem_t mp_module_io_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_io_globals, mp_module_io_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_io_globals, mp_module_io_globals_table);
const mp_obj_module_t mp_module_io = {
.base = { &mp_type_module },
diff --git a/py/modmath.c b/py/modmath.c
index 861a23b48b..db30f0e625 100644
--- a/py/modmath.c
+++ b/py/modmath.c
@@ -37,11 +37,11 @@
#define MP_PI_4 MICROPY_FLOAT_CONST(0.78539816339744830962)
#define MP_3_PI_4 MICROPY_FLOAT_CONST(2.35619449019234492885)
-STATIC NORETURN void math_error(void) {
+static NORETURN void math_error(void) {
mp_raise_ValueError(MP_ERROR_TEXT("math domain error"));
}
-STATIC mp_obj_t math_generic_1(mp_obj_t x_obj, mp_float_t (*f)(mp_float_t)) {
+static mp_obj_t math_generic_1(mp_obj_t x_obj, mp_float_t (*f)(mp_float_t)) {
mp_float_t x = mp_obj_get_float(x_obj);
mp_float_t ans = f(x);
if ((isnan(ans) && !isnan(x)) || (isinf(ans) && !isinf(x))) {
@@ -50,7 +50,7 @@ STATIC mp_obj_t math_generic_1(mp_obj_t x_obj, mp_float_t (*f)(mp_float_t)) {
return mp_obj_new_float(ans);
}
-STATIC mp_obj_t math_generic_2(mp_obj_t x_obj, mp_obj_t y_obj, mp_float_t (*f)(mp_float_t, mp_float_t)) {
+static mp_obj_t math_generic_2(mp_obj_t x_obj, mp_obj_t y_obj, mp_float_t (*f)(mp_float_t, mp_float_t)) {
mp_float_t x = mp_obj_get_float(x_obj);
mp_float_t y = mp_obj_get_float(y_obj);
mp_float_t ans = f(x, y);
@@ -61,30 +61,30 @@ STATIC mp_obj_t math_generic_2(mp_obj_t x_obj, mp_obj_t y_obj, mp_float_t (*f)(m
}
#define MATH_FUN_1(py_name, c_name) \
- STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { \
+ static mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { \
return math_generic_1(x_obj, MICROPY_FLOAT_C_FUN(c_name)); \
} \
- STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name);
+ static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name);
#define MATH_FUN_1_TO_BOOL(py_name, c_name) \
- STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { return mp_obj_new_bool(c_name(mp_obj_get_float(x_obj))); } \
- STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name);
+ static mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { return mp_obj_new_bool(c_name(mp_obj_get_float(x_obj))); } \
+ static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name);
#define MATH_FUN_1_TO_INT(py_name, c_name) \
- STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { return mp_obj_new_int_from_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj))); } \
- STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name);
+ static mp_obj_t mp_math_##py_name(mp_obj_t x_obj) { return mp_obj_new_int_from_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj))); } \
+ static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_##py_name##_obj, mp_math_##py_name);
#define MATH_FUN_2(py_name, c_name) \
- STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj, mp_obj_t y_obj) { \
+ static mp_obj_t mp_math_##py_name(mp_obj_t x_obj, mp_obj_t y_obj) { \
return math_generic_2(x_obj, y_obj, MICROPY_FLOAT_C_FUN(c_name)); \
} \
- STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_math_##py_name##_obj, mp_math_##py_name);
+ static MP_DEFINE_CONST_FUN_OBJ_2(mp_math_##py_name##_obj, mp_math_##py_name);
#define MATH_FUN_2_FLT_INT(py_name, c_name) \
- STATIC mp_obj_t mp_math_##py_name(mp_obj_t x_obj, mp_obj_t y_obj) { \
+ static mp_obj_t mp_math_##py_name(mp_obj_t x_obj, mp_obj_t y_obj) { \
return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj), mp_obj_get_int(y_obj))); \
} \
- STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_math_##py_name##_obj, mp_math_##py_name);
+ static MP_DEFINE_CONST_FUN_OBJ_2(mp_math_##py_name##_obj, mp_math_##py_name);
#if MP_NEED_LOG2
#undef log2
@@ -160,12 +160,12 @@ MATH_FUN_2(atan2, atan2)
// ceil(x)
MATH_FUN_1_TO_INT(ceil, ceil)
// copysign(x, y)
-STATIC mp_float_t MICROPY_FLOAT_C_FUN(copysign_func)(mp_float_t x, mp_float_t y) {
+static mp_float_t MICROPY_FLOAT_C_FUN(copysign_func)(mp_float_t x, mp_float_t y) {
return MICROPY_FLOAT_C_FUN(copysign)(x, y);
}
MATH_FUN_2(copysign, copysign_func)
// fabs(x)
-STATIC mp_float_t MICROPY_FLOAT_C_FUN(fabs_func)(mp_float_t x) {
+static mp_float_t MICROPY_FLOAT_C_FUN(fabs_func)(mp_float_t x) {
return MICROPY_FLOAT_C_FUN(fabs)(x);
}
MATH_FUN_1(fabs, fabs_func)
@@ -203,7 +203,7 @@ MATH_FUN_1(lgamma, lgamma)
// TODO: fsum
#if MICROPY_PY_MATH_ISCLOSE
-STATIC mp_obj_t mp_math_isclose(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t mp_math_isclose(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_rel_tol, ARG_abs_tol };
static const mp_arg_t allowed_args[] = {
{MP_QSTR_rel_tol, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}},
@@ -239,7 +239,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mp_math_isclose_obj, 2, mp_math_isclose);
// Function that takes a variable number of arguments
// log(x[, base])
-STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
mp_float_t x = mp_obj_get_float(args[0]);
if (x <= (mp_float_t)0.0) {
math_error();
@@ -257,12 +257,12 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base));
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_math_log_obj, 1, 2, mp_math_log);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_math_log_obj, 1, 2, mp_math_log);
// Functions that return a tuple
// frexp(x): converts a floating-point number to fractional and integral components
-STATIC mp_obj_t mp_math_frexp(mp_obj_t x_obj) {
+static mp_obj_t mp_math_frexp(mp_obj_t x_obj) {
int int_exponent = 0;
mp_float_t significand = MICROPY_FLOAT_C_FUN(frexp)(mp_obj_get_float(x_obj), &int_exponent);
mp_obj_t tuple[2];
@@ -270,10 +270,10 @@ STATIC mp_obj_t mp_math_frexp(mp_obj_t x_obj) {
tuple[1] = mp_obj_new_int(int_exponent);
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_frexp_obj, mp_math_frexp);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_frexp_obj, mp_math_frexp);
// modf(x)
-STATIC mp_obj_t mp_math_modf(mp_obj_t x_obj) {
+static mp_obj_t mp_math_modf(mp_obj_t x_obj) {
mp_float_t int_part = 0.0;
mp_float_t x = mp_obj_get_float(x_obj);
mp_float_t fractional_part = MICROPY_FLOAT_C_FUN(modf)(x, &int_part);
@@ -287,28 +287,28 @@ STATIC mp_obj_t mp_math_modf(mp_obj_t x_obj) {
tuple[1] = mp_obj_new_float(int_part);
return mp_obj_new_tuple(2, tuple);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_modf_obj, mp_math_modf);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_modf_obj, mp_math_modf);
// Angular conversions
// radians(x)
-STATIC mp_obj_t mp_math_radians(mp_obj_t x_obj) {
+static mp_obj_t mp_math_radians(mp_obj_t x_obj) {
return mp_obj_new_float(mp_obj_get_float(x_obj) * (MP_PI / MICROPY_FLOAT_CONST(180.0)));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_radians_obj, mp_math_radians);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_radians_obj, mp_math_radians);
// degrees(x)
-STATIC mp_obj_t mp_math_degrees(mp_obj_t x_obj) {
+static mp_obj_t mp_math_degrees(mp_obj_t x_obj) {
return mp_obj_new_float(mp_obj_get_float(x_obj) * (MICROPY_FLOAT_CONST(180.0) / MP_PI));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_degrees_obj, mp_math_degrees);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_degrees_obj, mp_math_degrees);
#if MICROPY_PY_MATH_FACTORIAL
#if MICROPY_OPT_MATH_FACTORIAL
// factorial(x): slightly efficient recursive implementation
-STATIC mp_obj_t mp_math_factorial_inner(mp_uint_t start, mp_uint_t end) {
+static mp_obj_t mp_math_factorial_inner(mp_uint_t start, mp_uint_t end) {
if (start == end) {
return mp_obj_new_int(start);
} else if (end - start == 1) {
@@ -326,7 +326,7 @@ STATIC mp_obj_t mp_math_factorial_inner(mp_uint_t start, mp_uint_t end) {
return mp_binary_op(MP_BINARY_OP_MULTIPLY, left, right);
}
}
-STATIC mp_obj_t mp_math_factorial(mp_obj_t x_obj) {
+static mp_obj_t mp_math_factorial(mp_obj_t x_obj) {
mp_int_t max = mp_obj_get_int(x_obj);
if (max < 0) {
mp_raise_ValueError(MP_ERROR_TEXT("negative factorial"));
@@ -340,7 +340,7 @@ STATIC mp_obj_t mp_math_factorial(mp_obj_t x_obj) {
// factorial(x): squared difference implementation
// based on http://www.luschny.de/math/factorial/index.html
-STATIC mp_obj_t mp_math_factorial(mp_obj_t x_obj) {
+static mp_obj_t mp_math_factorial(mp_obj_t x_obj) {
mp_int_t max = mp_obj_get_int(x_obj);
if (max < 0) {
mp_raise_ValueError(MP_ERROR_TEXT("negative factorial"));
@@ -363,11 +363,11 @@ STATIC mp_obj_t mp_math_factorial(mp_obj_t x_obj) {
#endif
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_math_factorial_obj, mp_math_factorial);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_math_factorial_obj, mp_math_factorial);
#endif
-STATIC const mp_rom_map_elem_t mp_module_math_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_math_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_math) },
{ MP_ROM_QSTR(MP_QSTR_e), mp_const_float_e },
{ MP_ROM_QSTR(MP_QSTR_pi), mp_const_float_pi },
@@ -428,7 +428,7 @@ STATIC const mp_rom_map_elem_t mp_module_math_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_math_globals, mp_module_math_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_math_globals, mp_module_math_globals_table);
const mp_obj_module_t mp_module_math = {
.base = { &mp_type_module },
diff --git a/py/modmicropython.c b/py/modmicropython.c
index bdb1e8b9b4..af6ad01795 100644
--- a/py/modmicropython.c
+++ b/py/modmicropython.c
@@ -38,7 +38,7 @@
// living in micropython module
#if MICROPY_ENABLE_COMPILER
-STATIC mp_obj_t mp_micropython_opt_level(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_micropython_opt_level(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
return MP_OBJ_NEW_SMALL_INT(MP_STATE_VM(mp_optimise_value));
} else {
@@ -46,26 +46,26 @@ STATIC mp_obj_t mp_micropython_opt_level(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_opt_level_obj, 0, 1, mp_micropython_opt_level);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_opt_level_obj, 0, 1, mp_micropython_opt_level);
#endif
#if MICROPY_PY_MICROPYTHON_MEM_INFO
#if MICROPY_MEM_STATS
-STATIC mp_obj_t mp_micropython_mem_total(void) {
+static mp_obj_t mp_micropython_mem_total(void) {
return MP_OBJ_NEW_SMALL_INT(m_get_total_bytes_allocated());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_total_obj, mp_micropython_mem_total);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_total_obj, mp_micropython_mem_total);
-STATIC mp_obj_t mp_micropython_mem_current(void) {
+static mp_obj_t mp_micropython_mem_current(void) {
return MP_OBJ_NEW_SMALL_INT(m_get_current_bytes_allocated());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_current_obj, mp_micropython_mem_current);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_current_obj, mp_micropython_mem_current);
-STATIC mp_obj_t mp_micropython_mem_peak(void) {
+static mp_obj_t mp_micropython_mem_peak(void) {
return MP_OBJ_NEW_SMALL_INT(m_get_peak_bytes_allocated());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_peak_obj, mp_micropython_mem_peak);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_mem_peak_obj, mp_micropython_mem_peak);
#endif
mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args) {
@@ -91,9 +91,9 @@ mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args) {
#endif
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_mem_info_obj, 0, 1, mp_micropython_mem_info);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_mem_info_obj, 0, 1, mp_micropython_mem_info);
-STATIC mp_obj_t mp_micropython_qstr_info(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_micropython_qstr_info(size_t n_args, const mp_obj_t *args) {
(void)args;
size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
@@ -105,68 +105,68 @@ STATIC mp_obj_t mp_micropython_qstr_info(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_qstr_info_obj, 0, 1, mp_micropython_qstr_info);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_qstr_info_obj, 0, 1, mp_micropython_qstr_info);
#endif // MICROPY_PY_MICROPYTHON_MEM_INFO
#if MICROPY_PY_MICROPYTHON_STACK_USE
-STATIC mp_obj_t mp_micropython_stack_use(void) {
+static mp_obj_t mp_micropython_stack_use(void) {
return MP_OBJ_NEW_SMALL_INT(mp_stack_usage());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_stack_use_obj, mp_micropython_stack_use);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_stack_use_obj, mp_micropython_stack_use);
#endif
#if MICROPY_ENABLE_PYSTACK
-STATIC mp_obj_t mp_micropython_pystack_use(void) {
+static mp_obj_t mp_micropython_pystack_use(void) {
return MP_OBJ_NEW_SMALL_INT(mp_pystack_usage());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_pystack_use_obj, mp_micropython_pystack_use);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_pystack_use_obj, mp_micropython_pystack_use);
#endif
#if MICROPY_ENABLE_GC
-STATIC mp_obj_t mp_micropython_heap_lock(void) {
+static mp_obj_t mp_micropython_heap_lock(void) {
gc_lock();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_heap_lock_obj, mp_micropython_heap_lock);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_heap_lock_obj, mp_micropython_heap_lock);
-STATIC mp_obj_t mp_micropython_heap_unlock(void) {
+static mp_obj_t mp_micropython_heap_unlock(void) {
gc_unlock();
return MP_OBJ_NEW_SMALL_INT(MP_STATE_THREAD(gc_lock_depth));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_heap_unlock_obj, mp_micropython_heap_unlock);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_heap_unlock_obj, mp_micropython_heap_unlock);
#if MICROPY_PY_MICROPYTHON_HEAP_LOCKED
-STATIC mp_obj_t mp_micropython_heap_locked(void) {
+static mp_obj_t mp_micropython_heap_locked(void) {
return MP_OBJ_NEW_SMALL_INT(MP_STATE_THREAD(gc_lock_depth));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_heap_locked_obj, mp_micropython_heap_locked);
+static MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_heap_locked_obj, mp_micropython_heap_locked);
#endif
#endif
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF && (MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE == 0)
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_alloc_emergency_exception_buf_obj, mp_alloc_emergency_exception_buf);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_alloc_emergency_exception_buf_obj, mp_alloc_emergency_exception_buf);
#endif
#if MICROPY_KBD_EXCEPTION
-STATIC mp_obj_t mp_micropython_kbd_intr(mp_obj_t int_chr_in) {
+static mp_obj_t mp_micropython_kbd_intr(mp_obj_t int_chr_in) {
mp_hal_set_interrupt_char(mp_obj_get_int(int_chr_in));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_micropython_kbd_intr_obj, mp_micropython_kbd_intr);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_micropython_kbd_intr_obj, mp_micropython_kbd_intr);
#endif
#if MICROPY_ENABLE_SCHEDULER
-STATIC mp_obj_t mp_micropython_schedule(mp_obj_t function, mp_obj_t arg) {
+static mp_obj_t mp_micropython_schedule(mp_obj_t function, mp_obj_t arg) {
if (!mp_sched_schedule(function, arg)) {
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("schedule queue full"));
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_micropython_schedule_obj, mp_micropython_schedule);
+static MP_DEFINE_CONST_FUN_OBJ_2(mp_micropython_schedule_obj, mp_micropython_schedule);
#endif
-STATIC const mp_rom_map_elem_t mp_module_micropython_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_micropython_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_micropython) },
{ MP_ROM_QSTR(MP_QSTR_const), MP_ROM_PTR(&mp_identity_obj) },
#if MICROPY_ENABLE_COMPILER
@@ -205,7 +205,7 @@ STATIC const mp_rom_map_elem_t mp_module_micropython_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_micropython_globals, mp_module_micropython_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_micropython_globals, mp_module_micropython_globals_table);
const mp_obj_module_t mp_module_micropython = {
.base = { &mp_type_module },
diff --git a/py/modstruct.c b/py/modstruct.c
index b3edc96328..3b9dd30aa7 100644
--- a/py/modstruct.c
+++ b/py/modstruct.c
@@ -52,7 +52,7 @@
character data".
*/
-STATIC char get_fmt_type(const char **fmt) {
+static char get_fmt_type(const char **fmt) {
char t = **fmt;
switch (t) {
case '!':
@@ -71,7 +71,7 @@ STATIC char get_fmt_type(const char **fmt) {
return t;
}
-STATIC mp_uint_t get_fmt_num(const char **p) {
+static mp_uint_t get_fmt_num(const char **p) {
const char *num = *p;
uint len = 1;
while (unichar_isdigit(*++num)) {
@@ -82,7 +82,7 @@ STATIC mp_uint_t get_fmt_num(const char **p) {
return val;
}
-STATIC size_t calc_size_items(const char *fmt, size_t *total_sz) {
+static size_t calc_size_items(const char *fmt, size_t *total_sz) {
char fmt_type = get_fmt_type(&fmt);
size_t total_cnt = 0;
size_t size;
@@ -112,7 +112,7 @@ STATIC size_t calc_size_items(const char *fmt, size_t *total_sz) {
return total_cnt;
}
-STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
+static mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
const char *fmt = mp_obj_str_get_str(fmt_in);
size_t size;
calc_size_items(fmt, &size);
@@ -120,7 +120,7 @@ STATIC mp_obj_t struct_calcsize(mp_obj_t fmt_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(struct_calcsize_obj, struct_calcsize);
-STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *args) {
// unpack requires that the buffer be exactly the right size.
// unpack_from requires that the buffer be "big enough".
// Since we implement unpack and unpack_from using the same function
@@ -180,7 +180,7 @@ STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_unpack_from_obj, 2, 3, struct_unpack_from);
// This function assumes there is enough room in p to store all the values
-STATIC void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, size_t n_args, const mp_obj_t *args) {
+static void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, size_t n_args, const mp_obj_t *args) {
const char *fmt = mp_obj_str_get_str(fmt_in);
char fmt_type = get_fmt_type(&fmt);
@@ -219,7 +219,7 @@ STATIC void struct_pack_into_internal(mp_obj_t fmt_in, byte *p, size_t n_args, c
}
}
-STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
// TODO: "The arguments must match the values required by the format exactly."
mp_int_t size = MP_OBJ_SMALL_INT_VALUE(struct_calcsize(args[0]));
vstr_t vstr;
@@ -231,7 +231,7 @@ STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack);
-STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE);
mp_int_t offset = mp_obj_get_int(args[2]);
@@ -257,7 +257,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_into_obj, 3, MP_OBJ_FUN_ARGS_MAX, struct_pack_into);
-STATIC const mp_rom_map_elem_t mp_module_struct_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_struct_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_struct) },
{ MP_ROM_QSTR(MP_QSTR_calcsize), MP_ROM_PTR(&struct_calcsize_obj) },
{ MP_ROM_QSTR(MP_QSTR_pack), MP_ROM_PTR(&struct_pack_obj) },
@@ -266,7 +266,7 @@ STATIC const mp_rom_map_elem_t mp_module_struct_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_unpack_from), MP_ROM_PTR(&struct_unpack_from_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_struct_globals, mp_module_struct_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_struct_globals, mp_module_struct_globals_table);
const mp_obj_module_t mp_module_struct = {
.base = { &mp_type_module },
diff --git a/py/modsys.c b/py/modsys.c
index 2af81046f4..e90ea2233a 100644
--- a/py/modsys.c
+++ b/py/modsys.c
@@ -56,15 +56,15 @@ const mp_print_t mp_sys_stdout_print = {&mp_sys_stdout_obj, mp_stream_write_adap
#endif
// version - Python language version that this implementation conforms to, as a string
-STATIC const MP_DEFINE_STR_OBJ(mp_sys_version_obj, "3.4.0; " MICROPY_BANNER_NAME_AND_VERSION);
+static const MP_DEFINE_STR_OBJ(mp_sys_version_obj, "3.4.0; " MICROPY_BANNER_NAME_AND_VERSION);
// version_info - Python language version that this implementation conforms to, as a tuple of ints
// TODO: CPython is now at 5-element array (major, minor, micro, releaselevel, serial), but save 2 els so far...
-STATIC const mp_rom_obj_tuple_t mp_sys_version_info_obj = {{&mp_type_tuple}, 3, {MP_ROM_INT(3), MP_ROM_INT(4), MP_ROM_INT(0)}};
+static const mp_rom_obj_tuple_t mp_sys_version_info_obj = {{&mp_type_tuple}, 3, {MP_ROM_INT(3), MP_ROM_INT(4), MP_ROM_INT(0)}};
// sys.implementation object
// this holds the MicroPython version
-STATIC const mp_rom_obj_tuple_t mp_sys_implementation_version_info_obj = {
+static const mp_rom_obj_tuple_t mp_sys_implementation_version_info_obj = {
{&mp_type_tuple},
4,
{
@@ -78,7 +78,7 @@ STATIC const mp_rom_obj_tuple_t mp_sys_implementation_version_info_obj = {
#endif
}
};
-STATIC const MP_DEFINE_STR_OBJ(mp_sys_implementation_machine_obj, MICROPY_BANNER_MACHINE);
+static const MP_DEFINE_STR_OBJ(mp_sys_implementation_machine_obj, MICROPY_BANNER_MACHINE);
#define SYS_IMPLEMENTATION_ELEMS_BASE \
MP_ROM_QSTR(MP_QSTR_micropython), \
MP_ROM_PTR(&mp_sys_implementation_version_info_obj), \
@@ -99,7 +99,7 @@ STATIC const MP_DEFINE_STR_OBJ(mp_sys_implementation_machine_obj, MICROPY_BANNER
#define SYS_IMPLEMENTATION_ELEMS__V2
#endif
-STATIC const qstr impl_fields[] = {
+static const qstr impl_fields[] = {
MP_QSTR_name,
MP_QSTR_version,
MP_QSTR__machine,
@@ -110,7 +110,7 @@ STATIC const qstr impl_fields[] = {
MP_QSTR__v2,
#endif
};
-STATIC MP_DEFINE_ATTRTUPLE(
+static MP_DEFINE_ATTRTUPLE(
mp_sys_implementation_obj,
impl_fields,
3 + MICROPY_PERSISTENT_CODE_LOAD + MICROPY_PREVIEW_VERSION_2,
@@ -119,7 +119,7 @@ STATIC MP_DEFINE_ATTRTUPLE(
SYS_IMPLEMENTATION_ELEMS__V2
);
#else
-STATIC const mp_rom_obj_tuple_t mp_sys_implementation_obj = {
+static const mp_rom_obj_tuple_t mp_sys_implementation_obj = {
{&mp_type_tuple},
3 + MICROPY_PERSISTENT_CODE_LOAD,
// Do not include SYS_IMPLEMENTATION_ELEMS__V2 because
@@ -138,7 +138,7 @@ STATIC const mp_rom_obj_tuple_t mp_sys_implementation_obj = {
#ifdef MICROPY_PY_SYS_PLATFORM
// platform - the platform that MicroPython is running on
-STATIC const MP_DEFINE_STR_OBJ(mp_sys_platform_obj, MICROPY_PY_SYS_PLATFORM);
+static const MP_DEFINE_STR_OBJ(mp_sys_platform_obj, MICROPY_PY_SYS_PLATFORM);
#endif
#ifdef MICROPY_PY_SYS_EXECUTABLE
@@ -152,7 +152,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_intern_obj, mp_obj_str_intern_checked);
#endif
// exit([retval]): raise SystemExit, with optional argument given to the exception
-STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
mp_raise_type(&mp_type_SystemExit);
} else {
@@ -161,7 +161,7 @@ STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);
-STATIC mp_obj_t mp_sys_print_exception(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_sys_print_exception(size_t n_args, const mp_obj_t *args) {
#if MICROPY_PY_IO && MICROPY_PY_SYS_STDFILES
void *stream_obj = &mp_sys_stdout_obj;
if (n_args > 1) {
@@ -181,7 +181,7 @@ STATIC mp_obj_t mp_sys_print_exception(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_print_exception_obj, 1, 2, mp_sys_print_exception);
#if MICROPY_PY_SYS_EXC_INFO
-STATIC mp_obj_t mp_sys_exc_info(void) {
+static mp_obj_t mp_sys_exc_info(void) {
mp_obj_t cur_exc = MP_OBJ_FROM_PTR(MP_STATE_VM(cur_exception));
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL));
@@ -201,25 +201,25 @@ MP_DEFINE_CONST_FUN_OBJ_0(mp_sys_exc_info_obj, mp_sys_exc_info);
#endif
#if MICROPY_PY_SYS_GETSIZEOF
-STATIC mp_obj_t mp_sys_getsizeof(mp_obj_t obj) {
+static mp_obj_t mp_sys_getsizeof(mp_obj_t obj) {
return mp_unary_op(MP_UNARY_OP_SIZEOF, obj);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_getsizeof_obj, mp_sys_getsizeof);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_getsizeof_obj, mp_sys_getsizeof);
#endif
#if MICROPY_PY_SYS_ATEXIT
// atexit(callback): Callback is called when sys.exit is called.
-STATIC mp_obj_t mp_sys_atexit(mp_obj_t obj) {
+static mp_obj_t mp_sys_atexit(mp_obj_t obj) {
mp_obj_t old = MP_STATE_VM(sys_exitfunc);
MP_STATE_VM(sys_exitfunc) = obj;
return old;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_atexit_obj, mp_sys_atexit);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_atexit_obj, mp_sys_atexit);
#endif
#if MICROPY_PY_SYS_SETTRACE
// settrace(tracefunc): Set the system's trace function.
-STATIC mp_obj_t mp_sys_settrace(mp_obj_t obj) {
+static mp_obj_t mp_sys_settrace(mp_obj_t obj) {
return mp_prof_settrace(obj);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace);
@@ -243,7 +243,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace);
#if MICROPY_PY_SYS_ATTR_DELEGATION
// Must be kept in sync with the enum at the top of mpstate.h.
-STATIC const uint16_t sys_mutable_keys[] = {
+static const uint16_t sys_mutable_keys[] = {
#if MICROPY_PY_SYS_PATH
// Code should access this (as an mp_obj_t) for use with e.g.
// mp_obj_list_append by using the `mp_sys_path` macro defined in runtime.h.
@@ -266,7 +266,7 @@ void mp_module_sys_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
#endif
-STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys) },
#if MICROPY_PY_SYS_ARGV
@@ -339,7 +339,7 @@ STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_sys_globals, mp_module_sys_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_sys_globals, mp_module_sys_globals_table);
const mp_obj_module_t mp_module_sys = {
.base = { &mp_type_module },
diff --git a/py/modthread.c b/py/modthread.c
index 9fc20570be..2826fadeaa 100644
--- a/py/modthread.c
+++ b/py/modthread.c
@@ -45,7 +45,7 @@
/****************************************************************/
// Lock object
-STATIC const mp_obj_type_t mp_type_thread_lock;
+static const mp_obj_type_t mp_type_thread_lock;
typedef struct _mp_obj_thread_lock_t {
mp_obj_base_t base;
@@ -53,14 +53,14 @@ typedef struct _mp_obj_thread_lock_t {
volatile bool locked;
} mp_obj_thread_lock_t;
-STATIC mp_obj_thread_lock_t *mp_obj_new_thread_lock(void) {
+static mp_obj_thread_lock_t *mp_obj_new_thread_lock(void) {
mp_obj_thread_lock_t *self = mp_obj_malloc(mp_obj_thread_lock_t, &mp_type_thread_lock);
mp_thread_mutex_init(&self->mutex);
self->locked = false;
return self;
}
-STATIC mp_obj_t thread_lock_acquire(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t thread_lock_acquire(size_t n_args, const mp_obj_t *args) {
mp_obj_thread_lock_t *self = MP_OBJ_TO_PTR(args[0]);
bool wait = true;
if (n_args > 1) {
@@ -79,9 +79,9 @@ STATIC mp_obj_t thread_lock_acquire(size_t n_args, const mp_obj_t *args) {
mp_raise_OSError(-ret);
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(thread_lock_acquire_obj, 1, 3, thread_lock_acquire);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(thread_lock_acquire_obj, 1, 3, thread_lock_acquire);
-STATIC mp_obj_t thread_lock_release(mp_obj_t self_in) {
+static mp_obj_t thread_lock_release(mp_obj_t self_in) {
mp_obj_thread_lock_t *self = MP_OBJ_TO_PTR(self_in);
if (!self->locked) {
mp_raise_msg(&mp_type_RuntimeError, NULL);
@@ -92,21 +92,21 @@ STATIC mp_obj_t thread_lock_release(mp_obj_t self_in) {
MP_THREAD_GIL_ENTER();
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(thread_lock_release_obj, thread_lock_release);
+static MP_DEFINE_CONST_FUN_OBJ_1(thread_lock_release_obj, thread_lock_release);
-STATIC mp_obj_t thread_lock_locked(mp_obj_t self_in) {
+static mp_obj_t thread_lock_locked(mp_obj_t self_in) {
mp_obj_thread_lock_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_bool(self->locked);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(thread_lock_locked_obj, thread_lock_locked);
+static MP_DEFINE_CONST_FUN_OBJ_1(thread_lock_locked_obj, thread_lock_locked);
-STATIC mp_obj_t thread_lock___exit__(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t thread_lock___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args; // unused
return thread_lock_release(args[0]);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(thread_lock___exit___obj, 4, 4, thread_lock___exit__);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(thread_lock___exit___obj, 4, 4, thread_lock___exit__);
-STATIC const mp_rom_map_elem_t thread_lock_locals_dict_table[] = {
+static const mp_rom_map_elem_t thread_lock_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_acquire), MP_ROM_PTR(&thread_lock_acquire_obj) },
{ MP_ROM_QSTR(MP_QSTR_release), MP_ROM_PTR(&thread_lock_release_obj) },
{ MP_ROM_QSTR(MP_QSTR_locked), MP_ROM_PTR(&thread_lock_locked_obj) },
@@ -114,9 +114,9 @@ STATIC const mp_rom_map_elem_t thread_lock_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&thread_lock___exit___obj) },
};
-STATIC MP_DEFINE_CONST_DICT(thread_lock_locals_dict, thread_lock_locals_dict_table);
+static MP_DEFINE_CONST_DICT(thread_lock_locals_dict, thread_lock_locals_dict_table);
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_thread_lock,
MP_QSTR_lock,
MP_TYPE_FLAG_NONE,
@@ -126,14 +126,14 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
/****************************************************************/
// _thread module
-STATIC size_t thread_stack_size = 0;
+static size_t thread_stack_size = 0;
-STATIC mp_obj_t mod_thread_get_ident(void) {
+static mp_obj_t mod_thread_get_ident(void) {
return mp_obj_new_int_from_uint(mp_thread_get_id());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_get_ident_obj, mod_thread_get_ident);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_get_ident_obj, mod_thread_get_ident);
-STATIC mp_obj_t mod_thread_stack_size(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_thread_stack_size(size_t n_args, const mp_obj_t *args) {
mp_obj_t ret = mp_obj_new_int_from_uint(thread_stack_size);
if (n_args == 0) {
thread_stack_size = 0;
@@ -142,7 +142,7 @@ STATIC mp_obj_t mod_thread_stack_size(size_t n_args, const mp_obj_t *args) {
}
return ret;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_thread_stack_size_obj, 0, 1, mod_thread_stack_size);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_thread_stack_size_obj, 0, 1, mod_thread_stack_size);
typedef struct _thread_entry_args_t {
mp_obj_dict_t *dict_locals;
@@ -154,7 +154,7 @@ typedef struct _thread_entry_args_t {
mp_obj_t args[];
} thread_entry_args_t;
-STATIC void *thread_entry(void *args_in) {
+static void *thread_entry(void *args_in) {
// Execution begins here for a new thread. We do not have the GIL.
thread_entry_args_t *args = (thread_entry_args_t *)args_in;
@@ -207,7 +207,7 @@ STATIC void *thread_entry(void *args_in) {
return NULL;
}
-STATIC mp_obj_t mod_thread_start_new_thread(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mod_thread_start_new_thread(size_t n_args, const mp_obj_t *args) {
// This structure holds the Python function and arguments for thread entry.
// We copy all arguments into this structure to keep ownership of them.
// We must be very careful about root pointers because this pointer may
@@ -258,19 +258,19 @@ STATIC mp_obj_t mod_thread_start_new_thread(size_t n_args, const mp_obj_t *args)
// spawn the thread!
return mp_obj_new_int_from_uint(mp_thread_create(thread_entry, th_args, &th_args->stack_size));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_thread_start_new_thread_obj, 2, 3, mod_thread_start_new_thread);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_thread_start_new_thread_obj, 2, 3, mod_thread_start_new_thread);
-STATIC mp_obj_t mod_thread_exit(void) {
+static mp_obj_t mod_thread_exit(void) {
mp_raise_type(&mp_type_SystemExit);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_exit_obj, mod_thread_exit);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_exit_obj, mod_thread_exit);
-STATIC mp_obj_t mod_thread_allocate_lock(void) {
+static mp_obj_t mod_thread_allocate_lock(void) {
return MP_OBJ_FROM_PTR(mp_obj_new_thread_lock());
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_allocate_lock_obj, mod_thread_allocate_lock);
+static MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_allocate_lock_obj, mod_thread_allocate_lock);
-STATIC const mp_rom_map_elem_t mp_module_thread_globals_table[] = {
+static const mp_rom_map_elem_t mp_module_thread_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__thread) },
{ MP_ROM_QSTR(MP_QSTR_LockType), MP_ROM_PTR(&mp_type_thread_lock) },
{ MP_ROM_QSTR(MP_QSTR_get_ident), MP_ROM_PTR(&mod_thread_get_ident_obj) },
@@ -280,7 +280,7 @@ STATIC const mp_rom_map_elem_t mp_module_thread_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_allocate_lock), MP_ROM_PTR(&mod_thread_allocate_lock_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_module_thread_globals, mp_module_thread_globals_table);
+static MP_DEFINE_CONST_DICT(mp_module_thread_globals, mp_module_thread_globals_table);
const mp_obj_module_t mp_module_thread = {
.base = { &mp_type_module },
diff --git a/py/mpconfig.h b/py/mpconfig.h
index e7b72c6422..90f8e592bf 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -1862,12 +1862,6 @@ typedef double mp_float_t;
#endif
#endif
-// Allow to override static modifier for global objects, e.g. to use with
-// object code analysis tools which don't support static symbols.
-#ifndef STATIC
-#define STATIC static
-#endif
-
// Number of bytes in an object word: mp_obj_t, mp_uint_t, mp_uint_t
#ifndef MP_BYTES_PER_OBJ_WORD
#define MP_BYTES_PER_OBJ_WORD (sizeof(mp_uint_t))
diff --git a/py/mpprint.c b/py/mpprint.c
index 3218bd2f4d..291e4145ff 100644
--- a/py/mpprint.c
+++ b/py/mpprint.c
@@ -43,7 +43,7 @@
static const char pad_spaces[] = " ";
static const char pad_zeroes[] = "0000000000000000";
-STATIC void plat_print_strn(void *env, const char *str, size_t len) {
+static void plat_print_strn(void *env, const char *str, size_t len) {
(void)env;
MP_PLAT_PRINT_STRN(str, len);
}
@@ -127,7 +127,7 @@ int mp_print_strn(const mp_print_t *print, const char *str, size_t len, int flag
// This function is used exclusively by mp_vprintf to format ints.
// It needs to be a separate function to mp_print_mp_int, since converting to a mp_int looses the MSB.
-STATIC int mp_print_int(const mp_print_t *print, mp_uint_t x, int sgn, int base, int base_char, int flags, char fill, int width) {
+static int mp_print_int(const mp_print_t *print, mp_uint_t x, int sgn, int base, int base_char, int flags, char fill, int width) {
char sign = 0;
if (sgn) {
if ((mp_int_t)x < 0) {
diff --git a/py/mpz.c b/py/mpz.c
index b61997e2fd..502d4e1c13 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -49,7 +49,7 @@
Definition of normalise: ?
*/
-STATIC size_t mpn_remove_trailing_zeros(mpz_dig_t *oidig, mpz_dig_t *idig) {
+static size_t mpn_remove_trailing_zeros(mpz_dig_t *oidig, mpz_dig_t *idig) {
for (--idig; idig >= oidig && *idig == 0; --idig) {
}
return idig + 1 - oidig;
@@ -59,7 +59,7 @@ STATIC size_t mpn_remove_trailing_zeros(mpz_dig_t *oidig, mpz_dig_t *idig) {
returns sign(i - j)
assumes i, j are normalised
*/
-STATIC int mpn_cmp(const mpz_dig_t *idig, size_t ilen, const mpz_dig_t *jdig, size_t jlen) {
+static int mpn_cmp(const mpz_dig_t *idig, size_t ilen, const mpz_dig_t *jdig, size_t jlen) {
if (ilen < jlen) {
return -1;
}
@@ -85,7 +85,7 @@ STATIC int mpn_cmp(const mpz_dig_t *idig, size_t ilen, const mpz_dig_t *jdig, si
assumes enough memory in i; assumes normalised j; assumes n > 0
can have i, j pointing to same memory
*/
-STATIC size_t mpn_shl(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mp_uint_t n) {
+static size_t mpn_shl(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mp_uint_t n) {
mp_uint_t n_whole = (n + DIG_SIZE - 1) / DIG_SIZE;
mp_uint_t n_part = n % DIG_SIZE;
if (n_part == 0) {
@@ -124,7 +124,7 @@ STATIC size_t mpn_shl(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mp_uint_t n
assumes enough memory in i; assumes normalised j; assumes n > 0
can have i, j pointing to same memory
*/
-STATIC size_t mpn_shr(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mp_uint_t n) {
+static size_t mpn_shr(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mp_uint_t n) {
mp_uint_t n_whole = n / DIG_SIZE;
mp_uint_t n_part = n % DIG_SIZE;
@@ -156,7 +156,7 @@ STATIC size_t mpn_shr(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mp_uint_t n
assumes enough memory in i; assumes normalised j, k; assumes jlen >= klen
can have i, j, k pointing to same memory
*/
-STATIC size_t mpn_add(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
+static size_t mpn_add(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
mpz_dig_t *oidig = idig;
mpz_dbl_dig_t carry = 0;
@@ -186,7 +186,7 @@ STATIC size_t mpn_add(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const
assumes enough memory in i; assumes normalised j, k; assumes j >= k
can have i, j, k pointing to same memory
*/
-STATIC size_t mpn_sub(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
+static size_t mpn_sub(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
mpz_dig_t *oidig = idig;
mpz_dbl_dig_signed_t borrow = 0;
@@ -214,7 +214,7 @@ STATIC size_t mpn_sub(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const
assumes enough memory in i; assumes normalised j, k; assumes jlen >= klen (jlen argument not needed)
can have i, j, k pointing to same memory
*/
-STATIC size_t mpn_and(mpz_dig_t *idig, const mpz_dig_t *jdig, const mpz_dig_t *kdig, size_t klen) {
+static size_t mpn_and(mpz_dig_t *idig, const mpz_dig_t *jdig, const mpz_dig_t *kdig, size_t klen) {
mpz_dig_t *oidig = idig;
for (; klen > 0; --klen, ++idig, ++jdig, ++kdig) {
@@ -235,7 +235,7 @@ STATIC size_t mpn_and(mpz_dig_t *idig, const mpz_dig_t *jdig, const mpz_dig_t *k
assumes enough memory in i; assumes normalised j, k; assumes length j >= length k
can have i, j, k pointing to same memory
*/
-STATIC size_t mpn_and_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
+static size_t mpn_and_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
mpz_dbl_dig_t carryi, mpz_dbl_dig_t carryj, mpz_dbl_dig_t carryk) {
mpz_dig_t *oidig = idig;
mpz_dig_t imask = (0 == carryi) ? 0 : DIG_MASK;
@@ -266,7 +266,7 @@ STATIC size_t mpn_and_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, c
assumes enough memory in i; assumes normalised j, k; assumes jlen >= klen
can have i, j, k pointing to same memory
*/
-STATIC size_t mpn_or(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
+static size_t mpn_or(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
mpz_dig_t *oidig = idig;
jlen -= klen;
@@ -296,7 +296,7 @@ STATIC size_t mpn_or(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const
#if MICROPY_OPT_MPZ_BITWISE
-STATIC size_t mpn_or_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
+static size_t mpn_or_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
mpz_dbl_dig_t carryj, mpz_dbl_dig_t carryk) {
mpz_dig_t *oidig = idig;
mpz_dbl_dig_t carryi = 1;
@@ -326,7 +326,7 @@ STATIC size_t mpn_or_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, co
#else
-STATIC size_t mpn_or_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
+static size_t mpn_or_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
mpz_dbl_dig_t carryi, mpz_dbl_dig_t carryj, mpz_dbl_dig_t carryk) {
mpz_dig_t *oidig = idig;
mpz_dig_t imask = (0 == carryi) ? 0 : DIG_MASK;
@@ -358,7 +358,7 @@ STATIC size_t mpn_or_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, co
assumes enough memory in i; assumes normalised j, k; assumes jlen >= klen
can have i, j, k pointing to same memory
*/
-STATIC size_t mpn_xor(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
+static size_t mpn_xor(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen) {
mpz_dig_t *oidig = idig;
jlen -= klen;
@@ -385,7 +385,7 @@ STATIC size_t mpn_xor(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const
assumes enough memory in i; assumes normalised j, k; assumes length j >= length k
can have i, j, k pointing to same memory
*/
-STATIC size_t mpn_xor_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
+static size_t mpn_xor_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, const mpz_dig_t *kdig, size_t klen,
mpz_dbl_dig_t carryi, mpz_dbl_dig_t carryj, mpz_dbl_dig_t carryk) {
mpz_dig_t *oidig = idig;
@@ -410,7 +410,7 @@ STATIC size_t mpn_xor_neg(mpz_dig_t *idig, const mpz_dig_t *jdig, size_t jlen, c
returns number of digits in i
assumes enough memory in i; assumes normalised i; assumes dmul != 0
*/
-STATIC size_t mpn_mul_dig_add_dig(mpz_dig_t *idig, size_t ilen, mpz_dig_t dmul, mpz_dig_t dadd) {
+static size_t mpn_mul_dig_add_dig(mpz_dig_t *idig, size_t ilen, mpz_dig_t dmul, mpz_dig_t dadd) {
mpz_dig_t *oidig = idig;
mpz_dbl_dig_t carry = dadd;
@@ -432,7 +432,7 @@ STATIC size_t mpn_mul_dig_add_dig(mpz_dig_t *idig, size_t ilen, mpz_dig_t dmul,
assumes enough memory in i; assumes i is zeroed; assumes normalised j, k
can have j, k point to same memory
*/
-STATIC size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t *kdig, size_t klen) {
+static size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t *kdig, size_t klen) {
mpz_dig_t *oidig = idig;
size_t ilen = 0;
@@ -463,7 +463,7 @@ STATIC size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t *
assumes quo_dig has enough memory (as many digits as num)
assumes quo_dig is filled with zeros
*/
-STATIC void mpn_div(mpz_dig_t *num_dig, size_t *num_len, const mpz_dig_t *den_dig, size_t den_len, mpz_dig_t *quo_dig, size_t *quo_len) {
+static void mpn_div(mpz_dig_t *num_dig, size_t *num_len, const mpz_dig_t *den_dig, size_t den_len, mpz_dig_t *quo_dig, size_t *quo_len) {
mpz_dig_t *orig_num_dig = num_dig;
mpz_dig_t *orig_quo_dig = quo_dig;
mpz_dig_t norm_shift = 0;
@@ -668,14 +668,14 @@ mpz_t *mpz_from_str(const char *str, size_t len, bool neg, unsigned int base) {
}
#endif
-STATIC void mpz_free(mpz_t *z) {
+static void mpz_free(mpz_t *z) {
if (z != NULL) {
m_del(mpz_dig_t, z->dig, z->alloc);
m_del_obj(mpz_t, z);
}
}
-STATIC void mpz_need_dig(mpz_t *z, size_t need) {
+static void mpz_need_dig(mpz_t *z, size_t need) {
if (need < MIN_ALLOC) {
need = MIN_ALLOC;
}
@@ -689,7 +689,7 @@ STATIC void mpz_need_dig(mpz_t *z, size_t need) {
}
}
-STATIC mpz_t *mpz_clone(const mpz_t *src) {
+static mpz_t *mpz_clone(const mpz_t *src) {
assert(src->alloc != 0);
mpz_t *z = m_new_obj(mpz_t);
z->neg = src->neg;
diff --git a/py/nativeglue.c b/py/nativeglue.c
index 074b1206ee..4cd090c0a2 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -139,7 +139,7 @@ mp_obj_t mp_obj_new_slice(mp_obj_t ostart, mp_obj_t ostop, mp_obj_t ostep) {
}
#endif
-STATIC mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals) {
+static mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals) {
if (new_globals == NULL) {
// Globals were the originally the same so don't restore them
return NULL;
@@ -155,20 +155,20 @@ STATIC mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals) {
// wrapper that accepts n_args and n_kw in one argument
// (native emitter can only pass at most 3 arguments to a function)
-STATIC mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, size_t n_args_kw, const mp_obj_t *args) {
+static mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, size_t n_args_kw, const mp_obj_t *args) {
return mp_call_function_n_kw(fun_in, n_args_kw & 0xff, (n_args_kw >> 8) & 0xff, args);
}
// wrapper that makes raise obj and raises it
// END_FINALLY opcode requires that we don't raise if o==None
-STATIC void mp_native_raise(mp_obj_t o) {
+static void mp_native_raise(mp_obj_t o) {
if (o != MP_OBJ_NULL && o != mp_const_none) {
nlr_raise(mp_make_raise_obj(o));
}
}
// wrapper that handles iterator buffer
-STATIC mp_obj_t mp_native_getiter(mp_obj_t obj, mp_obj_iter_buf_t *iter) {
+static mp_obj_t mp_native_getiter(mp_obj_t obj, mp_obj_iter_buf_t *iter) {
if (iter == NULL) {
return mp_getiter(obj, NULL);
} else {
@@ -183,7 +183,7 @@ STATIC mp_obj_t mp_native_getiter(mp_obj_t obj, mp_obj_iter_buf_t *iter) {
}
// wrapper that handles iterator buffer
-STATIC mp_obj_t mp_native_iternext(mp_obj_iter_buf_t *iter) {
+static mp_obj_t mp_native_iternext(mp_obj_iter_buf_t *iter) {
mp_obj_t obj;
if (iter->base.type == MP_OBJ_NULL) {
obj = iter->buf[0];
@@ -193,7 +193,7 @@ STATIC mp_obj_t mp_native_iternext(mp_obj_iter_buf_t *iter) {
return mp_iternext(obj);
}
-STATIC bool mp_native_yield_from(mp_obj_t gen, mp_obj_t send_value, mp_obj_t *ret_value) {
+static bool mp_native_yield_from(mp_obj_t gen, mp_obj_t send_value, mp_obj_t *ret_value) {
mp_vm_return_kind_t ret_kind;
nlr_buf_t nlr_buf;
mp_obj_t throw_value = *ret_value;
@@ -231,22 +231,22 @@ STATIC bool mp_native_yield_from(mp_obj_t gen, mp_obj_t send_value, mp_obj_t *re
#if !MICROPY_PY_BUILTINS_FLOAT
-STATIC mp_obj_t mp_obj_new_float_from_f(float f) {
+static mp_obj_t mp_obj_new_float_from_f(float f) {
(void)f;
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("float unsupported"));
}
-STATIC mp_obj_t mp_obj_new_float_from_d(double d) {
+static mp_obj_t mp_obj_new_float_from_d(double d) {
(void)d;
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("float unsupported"));
}
-STATIC float mp_obj_get_float_to_f(mp_obj_t o) {
+static float mp_obj_get_float_to_f(mp_obj_t o) {
(void)o;
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("float unsupported"));
}
-STATIC double mp_obj_get_float_to_d(mp_obj_t o) {
+static double mp_obj_get_float_to_d(mp_obj_t o) {
(void)o;
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("float unsupported"));
}
diff --git a/py/objarray.c b/py/objarray.c
index a3adb255e8..1fff234822 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -61,16 +61,16 @@
// so not defined to catch errors
#endif
-STATIC mp_obj_t array_iterator_new(mp_obj_t array_in, mp_obj_iter_buf_t *iter_buf);
-STATIC mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg);
-STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in);
-STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags);
+static mp_obj_t array_iterator_new(mp_obj_t array_in, mp_obj_iter_buf_t *iter_buf);
+static mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg);
+static mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in);
+static mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags);
/******************************************************************************/
// array
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
-STATIC void array_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void array_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_array_t *o = MP_OBJ_TO_PTR(o_in);
if (o->typecode == BYTEARRAY_TYPECODE) {
@@ -94,7 +94,7 @@ STATIC void array_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
#endif
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
-STATIC mp_obj_array_t *array_new(char typecode, size_t n) {
+static mp_obj_array_t *array_new(char typecode, size_t n) {
int typecode_size = mp_binary_get_size('@', typecode, NULL);
mp_obj_array_t *o = m_new_obj(mp_obj_array_t);
#if MICROPY_PY_BUILTINS_BYTEARRAY && MICROPY_PY_ARRAY
@@ -113,7 +113,7 @@ STATIC mp_obj_array_t *array_new(char typecode, size_t n) {
#endif
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
-STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
+static mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
// bytearrays can be raw-initialised from anything with the buffer protocol
// other arrays can only be raw-initialised from bytes and bytearray objects
mp_buffer_info_t bufinfo;
@@ -159,7 +159,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
#endif
#if MICROPY_PY_ARRAY
-STATIC mp_obj_t array_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t array_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 1, 2, false);
@@ -177,7 +177,7 @@ STATIC mp_obj_t array_make_new(const mp_obj_type_t *type_in, size_t n_args, size
#endif
#if MICROPY_PY_BUILTINS_BYTEARRAY
-STATIC mp_obj_t bytearray_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t bytearray_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
// Can take 2nd/3rd arg if constructs from str
mp_arg_check_num(n_args, n_kw, 0, 3, false);
@@ -214,7 +214,7 @@ mp_obj_t mp_obj_new_memoryview(byte typecode, size_t nitems, void *items) {
return MP_OBJ_FROM_PTR(self);
}
-STATIC mp_obj_t memoryview_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t memoryview_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
// TODO possibly allow memoryview constructor to take start/stop so that one
@@ -246,7 +246,7 @@ STATIC mp_obj_t memoryview_make_new(const mp_obj_type_t *type_in, size_t n_args,
}
#if MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE
-STATIC void memoryview_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void memoryview_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
return;
}
@@ -265,7 +265,7 @@ STATIC void memoryview_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
#endif
-STATIC mp_obj_t array_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
+static mp_obj_t array_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
mp_obj_array_t *o = MP_OBJ_TO_PTR(o_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -277,7 +277,7 @@ STATIC mp_obj_t array_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
}
}
-STATIC int typecode_for_comparison(int typecode, bool *is_unsigned) {
+static int typecode_for_comparison(int typecode, bool *is_unsigned) {
if (typecode == BYTEARRAY_TYPECODE) {
typecode = 'B';
}
@@ -288,7 +288,7 @@ STATIC int typecode_for_comparison(int typecode, bool *is_unsigned) {
return typecode;
}
-STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_obj_array_t *lhs = MP_OBJ_TO_PTR(lhs_in);
switch (op) {
case MP_BINARY_OP_ADD: {
@@ -383,7 +383,7 @@ STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
}
#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
-STATIC mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg) {
// self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
assert((MICROPY_PY_BUILTINS_BYTEARRAY && mp_obj_is_type(self_in, &mp_type_bytearray))
|| (MICROPY_PY_ARRAY && mp_obj_is_type(self_in, &mp_type_array)));
@@ -404,7 +404,7 @@ STATIC mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg) {
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_obj_array_append_obj, array_append);
-STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) {
+static mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) {
// self is not a memoryview, so we don't need to use (& TYPECODE_MASK)
assert((MICROPY_PY_BUILTINS_BYTEARRAY && mp_obj_is_type(self_in, &mp_type_bytearray))
|| (MICROPY_PY_ARRAY && mp_obj_is_type(self_in, &mp_type_array)));
@@ -437,7 +437,7 @@ STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) {
MP_DEFINE_CONST_FUN_OBJ_2(mp_obj_array_extend_obj, array_extend);
#endif
-STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
+static mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete item
// TODO implement
@@ -568,7 +568,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
}
}
-STATIC mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+static mp_int_t array_get_buffer(mp_obj_t o_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
mp_obj_array_t *o = MP_OBJ_TO_PTR(o_in);
size_t sz = mp_binary_get_size('@', o->typecode & TYPECODE_MASK, NULL);
bufinfo->buf = o->items;
@@ -682,7 +682,7 @@ typedef struct _mp_obj_array_it_t {
size_t cur;
} mp_obj_array_it_t;
-STATIC mp_obj_t array_it_iternext(mp_obj_t self_in) {
+static mp_obj_t array_it_iternext(mp_obj_t self_in) {
mp_obj_array_it_t *self = MP_OBJ_TO_PTR(self_in);
if (self->cur < self->array->len) {
return mp_binary_get_val_array(self->array->typecode & TYPECODE_MASK, self->array->items, self->offset + self->cur++);
@@ -691,14 +691,14 @@ STATIC mp_obj_t array_it_iternext(mp_obj_t self_in) {
}
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_array_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
iter, array_it_iternext
);
-STATIC mp_obj_t array_iterator_new(mp_obj_t array_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t array_iterator_new(mp_obj_t array_in, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_array_t) <= sizeof(mp_obj_iter_buf_t));
mp_obj_array_t *array = MP_OBJ_TO_PTR(array_in);
mp_obj_array_it_t *o = (mp_obj_array_it_t *)iter_buf;
diff --git a/py/objattrtuple.c b/py/objattrtuple.c
index 1ec9499893..1280e33089 100644
--- a/py/objattrtuple.c
+++ b/py/objattrtuple.c
@@ -30,7 +30,7 @@
// this helper function is used by collections.namedtuple
#if !MICROPY_PY_COLLECTIONS
-STATIC
+static
#endif
void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields, mp_obj_tuple_t *o) {
mp_print_str(print, "(");
@@ -48,14 +48,14 @@ void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields,
#if MICROPY_PY_ATTRTUPLE
-STATIC void mp_obj_attrtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void mp_obj_attrtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_tuple_t *o = MP_OBJ_TO_PTR(o_in);
const qstr *fields = (const qstr *)MP_OBJ_TO_PTR(o->items[o->len]);
mp_obj_attrtuple_print_helper(print, fields, o);
}
-STATIC void mp_obj_attrtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void mp_obj_attrtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] == MP_OBJ_NULL) {
// load attribute
mp_obj_tuple_t *self = MP_OBJ_TO_PTR(self_in);
diff --git a/py/objbool.c b/py/objbool.c
index 96f0e60dd1..5b3e3660e9 100644
--- a/py/objbool.c
+++ b/py/objbool.c
@@ -43,7 +43,7 @@ typedef struct _mp_obj_bool_t {
#endif
-STATIC void bool_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void bool_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
bool value = BOOL_VALUE(self_in);
if (MICROPY_PY_JSON && kind == PRINT_JSON) {
if (value) {
@@ -60,7 +60,7 @@ STATIC void bool_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_
}
}
-STATIC mp_obj_t bool_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t bool_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
@@ -71,7 +71,7 @@ STATIC mp_obj_t bool_make_new(const mp_obj_type_t *type_in, size_t n_args, size_
}
}
-STATIC mp_obj_t bool_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
+static mp_obj_t bool_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
if (op == MP_UNARY_OP_LEN) {
return MP_OBJ_NULL;
}
@@ -79,7 +79,7 @@ STATIC mp_obj_t bool_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
return mp_unary_op(op, MP_OBJ_NEW_SMALL_INT(value));
}
-STATIC mp_obj_t bool_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t bool_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
bool value = BOOL_VALUE(lhs_in);
return mp_binary_op(op, MP_OBJ_NEW_SMALL_INT(value), rhs_in);
}
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index b0be810c5c..e3503ff154 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -36,7 +36,7 @@ typedef struct _mp_obj_bound_meth_t {
} mp_obj_bound_meth_t;
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
-STATIC void bound_meth_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void bound_meth_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_bound_meth_t *o = MP_OBJ_TO_PTR(o_in);
mp_printf(print, "<bound_method %p ", o);
@@ -78,12 +78,12 @@ mp_obj_t mp_call_method_self_n_kw(mp_obj_t meth, mp_obj_t self, size_t n_args, s
return res;
}
-STATIC mp_obj_t bound_meth_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t bound_meth_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_obj_bound_meth_t *self = MP_OBJ_TO_PTR(self_in);
return mp_call_method_self_n_kw(self->meth, self->self, n_args, n_kw, args);
}
-STATIC mp_obj_t bound_meth_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t bound_meth_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_bound_meth_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_HASH:
@@ -93,7 +93,7 @@ STATIC mp_obj_t bound_meth_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_obj_t bound_meth_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t bound_meth_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
// The MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE flag is clear for this type, so if this
// function is called with MP_BINARY_OP_EQUAL then lhs_in and rhs_in must have the
// same type, which is mp_type_bound_meth.
@@ -106,7 +106,7 @@ STATIC mp_obj_t bound_meth_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_
}
#if MICROPY_PY_FUNCTION_ATTRS
-STATIC void bound_meth_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void bound_meth_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// not load attribute
return;
diff --git a/py/objcell.c b/py/objcell.c
index 0a74e29d20..95966c7917 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -27,7 +27,7 @@
#include "py/obj.h"
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
-STATIC void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_cell_t *o = MP_OBJ_TO_PTR(o_in);
mp_printf(print, "<cell %p ", o->obj);
@@ -46,7 +46,7 @@ STATIC void cell_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t k
#define CELL_TYPE_PRINT
#endif
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
// cell representation is just value in < >
mp_type_cell, MP_QSTR_, MP_TYPE_FLAG_NONE
CELL_TYPE_PRINT
diff --git a/py/objclosure.c b/py/objclosure.c
index 88109cc919..3ba507b959 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -36,7 +36,7 @@ typedef struct _mp_obj_closure_t {
mp_obj_t closed[];
} mp_obj_closure_t;
-STATIC mp_obj_t closure_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t closure_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_obj_closure_t *self = MP_OBJ_TO_PTR(self_in);
// need to concatenate closed-over-vars and args
@@ -60,7 +60,7 @@ STATIC mp_obj_t closure_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
}
#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
-STATIC void closure_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void closure_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_closure_t *o = MP_OBJ_TO_PTR(o_in);
mp_print_str(print, "<closure ");
@@ -79,7 +79,7 @@ STATIC void closure_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_
#endif
#if MICROPY_PY_FUNCTION_ATTRS
-STATIC void mp_obj_closure_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void mp_obj_closure_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
// forward to self_in->fun
mp_obj_closure_t *o = MP_OBJ_TO_PTR(self_in);
mp_load_method_maybe(o->fun, attr, dest);
diff --git a/py/objcomplex.c b/py/objcomplex.c
index ddd103eeb4..85b5852845 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -42,7 +42,7 @@ typedef struct _mp_obj_complex_t {
mp_float_t imag;
} mp_obj_complex_t;
-STATIC void complex_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void complex_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_complex_t *o = MP_OBJ_TO_PTR(o_in);
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
@@ -70,7 +70,7 @@ STATIC void complex_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_
}
}
-STATIC mp_obj_t complex_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t complex_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 2, false);
@@ -115,7 +115,7 @@ STATIC mp_obj_t complex_make_new(const mp_obj_type_t *type_in, size_t n_args, si
}
}
-STATIC mp_obj_t complex_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
+static mp_obj_t complex_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
mp_obj_complex_t *o = MP_OBJ_TO_PTR(o_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -133,12 +133,12 @@ STATIC mp_obj_t complex_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
}
}
-STATIC mp_obj_t complex_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t complex_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_obj_complex_t *lhs = MP_OBJ_TO_PTR(lhs_in);
return mp_obj_complex_binary_op(op, lhs->real, lhs->imag, rhs_in);
}
-STATIC void complex_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void complex_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// not load attribute
return;
diff --git a/py/objdeque.c b/py/objdeque.c
index 8b52b8d387..68e1621793 100644
--- a/py/objdeque.c
+++ b/py/objdeque.c
@@ -42,7 +42,7 @@ typedef struct _mp_obj_deque_t {
#define FLAG_CHECK_OVERFLOW 1
} mp_obj_deque_t;
-STATIC mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, 3, false);
/* Initialization from existing sequence is not supported, so an empty
@@ -69,7 +69,7 @@ STATIC mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t deque_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t deque_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -92,7 +92,7 @@ STATIC mp_obj_t deque_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_obj_t mp_obj_deque_append(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t mp_obj_deque_append(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
size_t new_i_put = self->i_put + 1;
@@ -115,9 +115,9 @@ STATIC mp_obj_t mp_obj_deque_append(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(deque_append_obj, mp_obj_deque_append);
+static MP_DEFINE_CONST_FUN_OBJ_2(deque_append_obj, mp_obj_deque_append);
-STATIC mp_obj_t deque_popleft(mp_obj_t self_in) {
+static mp_obj_t deque_popleft(mp_obj_t self_in) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
if (self->i_get == self->i_put) {
@@ -133,19 +133,19 @@ STATIC mp_obj_t deque_popleft(mp_obj_t self_in) {
return ret;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(deque_popleft_obj, deque_popleft);
+static MP_DEFINE_CONST_FUN_OBJ_1(deque_popleft_obj, deque_popleft);
#if 0
-STATIC mp_obj_t deque_clear(mp_obj_t self_in) {
+static mp_obj_t deque_clear(mp_obj_t self_in) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
self->i_get = self->i_put = 0;
mp_seq_clear(self->items, 0, self->alloc, sizeof(*self->items));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(deque_clear_obj, deque_clear);
+static MP_DEFINE_CONST_FUN_OBJ_1(deque_clear_obj, deque_clear);
#endif
-STATIC const mp_rom_map_elem_t deque_locals_dict_table[] = {
+static const mp_rom_map_elem_t deque_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&deque_append_obj) },
#if 0
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&deque_clear_obj) },
@@ -153,7 +153,7 @@ STATIC const mp_rom_map_elem_t deque_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_popleft), MP_ROM_PTR(&deque_popleft_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(deque_locals_dict, deque_locals_dict_table);
+static MP_DEFINE_CONST_DICT(deque_locals_dict, deque_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_deque,
diff --git a/py/objdict.c b/py/objdict.c
index 8aafe607d6..cf64fa9555 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -49,12 +49,12 @@ const mp_obj_dict_t mp_const_empty_dict_obj = {
}
};
-STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
+static mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
// This is a helper function to iterate through a dictionary. The state of
// the iteration is held in *cur and should be initialised with zero for the
// first call. Will return NULL when no more elements are available.
-STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) {
+static mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) {
size_t max = dict->map.alloc;
mp_map_t *map = &dict->map;
@@ -70,7 +70,7 @@ STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) {
return NULL;
}
-STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in);
bool first = true;
const char *item_separator = ", ";
@@ -129,7 +129,7 @@ mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
return dict_out;
}
-STATIC mp_obj_t dict_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t dict_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -147,7 +147,7 @@ STATIC mp_obj_t dict_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_obj_t dict_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t dict_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_obj_dict_t *o = MP_OBJ_TO_PTR(lhs_in);
switch (op) {
case MP_BINARY_OP_CONTAINS: {
@@ -218,7 +218,7 @@ mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index) {
}
}
-STATIC mp_obj_t dict_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t dict_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete
mp_obj_dict_delete(self_in, index);
@@ -242,13 +242,13 @@ STATIC mp_obj_t dict_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
/******************************************************************************/
/* dict methods */
-STATIC void mp_ensure_not_fixed(const mp_obj_dict_t *dict) {
+static void mp_ensure_not_fixed(const mp_obj_dict_t *dict) {
if (dict->map.is_fixed) {
mp_raise_TypeError(NULL);
}
}
-STATIC mp_obj_t dict_clear(mp_obj_t self_in) {
+static mp_obj_t dict_clear(mp_obj_t self_in) {
mp_check_self(mp_obj_is_dict_or_ordereddict(self_in));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in);
mp_ensure_not_fixed(self);
@@ -257,7 +257,7 @@ STATIC mp_obj_t dict_clear(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_clear_obj, dict_clear);
+static MP_DEFINE_CONST_FUN_OBJ_1(dict_clear_obj, dict_clear);
mp_obj_t mp_obj_dict_copy(mp_obj_t self_in) {
mp_check_self(mp_obj_is_dict_or_ordereddict(self_in));
@@ -272,11 +272,11 @@ mp_obj_t mp_obj_dict_copy(mp_obj_t self_in) {
memcpy(other->map.table, self->map.table, self->map.alloc * sizeof(mp_map_elem_t));
return other_out;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, mp_obj_dict_copy);
+static MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, mp_obj_dict_copy);
#if MICROPY_PY_BUILTINS_DICT_FROMKEYS
// this is a classmethod
-STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) {
mp_obj_t iter = mp_getiter(args[1], NULL);
mp_obj_t value = mp_const_none;
mp_obj_t next = MP_OBJ_NULL;
@@ -302,11 +302,11 @@ STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) {
return self_out;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_fromkeys_fun_obj, 2, 3, dict_fromkeys);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(dict_fromkeys_obj, MP_ROM_PTR(&dict_fromkeys_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_fromkeys_fun_obj, 2, 3, dict_fromkeys);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(dict_fromkeys_obj, MP_ROM_PTR(&dict_fromkeys_fun_obj));
#endif
-STATIC mp_obj_t dict_get_helper(size_t n_args, const mp_obj_t *args, mp_map_lookup_kind_t lookup_kind) {
+static mp_obj_t dict_get_helper(size_t n_args, const mp_obj_t *args, mp_map_lookup_kind_t lookup_kind) {
mp_check_self(mp_obj_is_dict_or_ordereddict(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
if (lookup_kind != MP_MAP_LOOKUP) {
@@ -336,22 +336,22 @@ STATIC mp_obj_t dict_get_helper(size_t n_args, const mp_obj_t *args, mp_map_look
return value;
}
-STATIC mp_obj_t dict_get(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t dict_get(size_t n_args, const mp_obj_t *args) {
return dict_get_helper(n_args, args, MP_MAP_LOOKUP);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get);
-STATIC mp_obj_t dict_pop(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t dict_pop(size_t n_args, const mp_obj_t *args) {
return dict_get_helper(n_args, args, MP_MAP_LOOKUP_REMOVE_IF_FOUND);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop);
-STATIC mp_obj_t dict_setdefault(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t dict_setdefault(size_t n_args, const mp_obj_t *args) {
return dict_get_helper(n_args, args, MP_MAP_LOOKUP_ADD_IF_NOT_FOUND);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_setdefault_obj, 2, 3, dict_setdefault);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_setdefault_obj, 2, 3, dict_setdefault);
-STATIC mp_obj_t dict_popitem(mp_obj_t self_in) {
+static mp_obj_t dict_popitem(mp_obj_t self_in) {
mp_check_self(mp_obj_is_dict_or_ordereddict(self_in));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in);
mp_ensure_not_fixed(self);
@@ -374,9 +374,9 @@ STATIC mp_obj_t dict_popitem(mp_obj_t self_in) {
return tuple;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_popitem_obj, dict_popitem);
+static MP_DEFINE_CONST_FUN_OBJ_1(dict_popitem_obj, dict_popitem);
-STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
mp_check_self(mp_obj_is_dict_or_ordereddict(args[0]));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
mp_ensure_not_fixed(self);
@@ -424,14 +424,14 @@ STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwarg
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dict_update_obj, 1, dict_update);
+static MP_DEFINE_CONST_FUN_OBJ_KW(dict_update_obj, 1, dict_update);
/******************************************************************************/
/* dict views */
-STATIC const mp_obj_type_t mp_type_dict_view;
-STATIC const mp_obj_type_t mp_type_dict_view_it;
+static const mp_obj_type_t mp_type_dict_view;
+static const mp_obj_type_t mp_type_dict_view_it;
typedef enum _mp_dict_view_kind_t {
MP_DICT_VIEW_ITEMS,
@@ -439,7 +439,7 @@ typedef enum _mp_dict_view_kind_t {
MP_DICT_VIEW_VALUES,
} mp_dict_view_kind_t;
-STATIC const char *const mp_dict_view_names[] = {"dict_items", "dict_keys", "dict_values"};
+static const char *const mp_dict_view_names[] = {"dict_items", "dict_keys", "dict_values"};
typedef struct _mp_obj_dict_view_it_t {
mp_obj_base_t base;
@@ -454,7 +454,7 @@ typedef struct _mp_obj_dict_view_t {
mp_dict_view_kind_t kind;
} mp_obj_dict_view_t;
-STATIC mp_obj_t dict_view_it_iternext(mp_obj_t self_in) {
+static mp_obj_t dict_view_it_iternext(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_dict_view_it));
mp_obj_dict_view_it_t *self = MP_OBJ_TO_PTR(self_in);
mp_map_elem_t *next = dict_iter_next(MP_OBJ_TO_PTR(self->dict), &self->cur);
@@ -476,14 +476,14 @@ STATIC mp_obj_t dict_view_it_iternext(mp_obj_t self_in) {
}
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_dict_view_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
iter, dict_view_it_iternext
);
-STATIC mp_obj_t dict_view_getiter(mp_obj_t view_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t dict_view_getiter(mp_obj_t view_in, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_dict_view_it_t) <= sizeof(mp_obj_iter_buf_t));
mp_check_self(mp_obj_is_type(view_in, &mp_type_dict_view));
mp_obj_dict_view_t *view = MP_OBJ_TO_PTR(view_in);
@@ -495,7 +495,7 @@ STATIC mp_obj_t dict_view_getiter(mp_obj_t view_in, mp_obj_iter_buf_t *iter_buf)
return MP_OBJ_FROM_PTR(o);
}
-STATIC void dict_view_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void dict_view_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_check_self(mp_obj_is_type(self_in, &mp_type_dict_view));
mp_obj_dict_view_t *self = MP_OBJ_TO_PTR(self_in);
@@ -515,7 +515,7 @@ STATIC void dict_view_print(const mp_print_t *print, mp_obj_t self_in, mp_print_
mp_print_str(print, "])");
}
-STATIC mp_obj_t dict_view_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
+static mp_obj_t dict_view_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
mp_obj_dict_view_t *o = MP_OBJ_TO_PTR(o_in);
// only dict.values() supports __hash__.
if (op == MP_UNARY_OP_HASH && o->kind == MP_DICT_VIEW_VALUES) {
@@ -524,7 +524,7 @@ STATIC mp_obj_t dict_view_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
return MP_OBJ_NULL;
}
-STATIC mp_obj_t dict_view_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t dict_view_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
// only supported for the 'keys' kind until sets and dicts are refactored
mp_obj_dict_view_t *o = MP_OBJ_TO_PTR(lhs_in);
if (o->kind != MP_DICT_VIEW_KEYS) {
@@ -536,7 +536,7 @@ STATIC mp_obj_t dict_view_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t
return dict_binary_op(op, o->dict, rhs_in);
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_dict_view,
MP_QSTR_dict_view,
MP_TYPE_FLAG_ITER_IS_GETITER,
@@ -546,37 +546,37 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
iter, dict_view_getiter
);
-STATIC mp_obj_t mp_obj_new_dict_view(mp_obj_t dict, mp_dict_view_kind_t kind) {
+static mp_obj_t mp_obj_new_dict_view(mp_obj_t dict, mp_dict_view_kind_t kind) {
mp_obj_dict_view_t *o = mp_obj_malloc(mp_obj_dict_view_t, &mp_type_dict_view);
o->dict = dict;
o->kind = kind;
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t dict_view(mp_obj_t self_in, mp_dict_view_kind_t kind) {
+static mp_obj_t dict_view(mp_obj_t self_in, mp_dict_view_kind_t kind) {
mp_check_self(mp_obj_is_dict_or_ordereddict(self_in));
return mp_obj_new_dict_view(self_in, kind);
}
-STATIC mp_obj_t dict_items(mp_obj_t self_in) {
+static mp_obj_t dict_items(mp_obj_t self_in) {
return dict_view(self_in, MP_DICT_VIEW_ITEMS);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_items_obj, dict_items);
+static MP_DEFINE_CONST_FUN_OBJ_1(dict_items_obj, dict_items);
-STATIC mp_obj_t dict_keys(mp_obj_t self_in) {
+static mp_obj_t dict_keys(mp_obj_t self_in) {
return dict_view(self_in, MP_DICT_VIEW_KEYS);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_keys_obj, dict_keys);
+static MP_DEFINE_CONST_FUN_OBJ_1(dict_keys_obj, dict_keys);
-STATIC mp_obj_t dict_values(mp_obj_t self_in) {
+static mp_obj_t dict_values(mp_obj_t self_in) {
return dict_view(self_in, MP_DICT_VIEW_VALUES);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_values_obj, dict_values);
+static MP_DEFINE_CONST_FUN_OBJ_1(dict_values_obj, dict_values);
/******************************************************************************/
/* dict iterator */
-STATIC mp_obj_t dict_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t dict_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_dict_view_it_t) <= sizeof(mp_obj_iter_buf_t));
mp_check_self(mp_obj_is_dict_or_ordereddict(self_in));
mp_obj_dict_view_it_t *o = (mp_obj_dict_view_it_t *)iter_buf;
@@ -590,7 +590,7 @@ STATIC mp_obj_t dict_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) {
/******************************************************************************/
/* dict constructors & public C API */
-STATIC const mp_rom_map_elem_t dict_locals_dict_table[] = {
+static const mp_rom_map_elem_t dict_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&dict_clear_obj) },
{ MP_ROM_QSTR(MP_QSTR_copy), MP_ROM_PTR(&dict_copy_obj) },
#if MICROPY_PY_BUILTINS_DICT_FROMKEYS
@@ -609,7 +609,7 @@ STATIC const mp_rom_map_elem_t dict_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___delitem__), MP_ROM_PTR(&mp_op_delitem_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(dict_locals_dict, dict_locals_dict_table);
+static MP_DEFINE_CONST_DICT(dict_locals_dict, dict_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_dict,
diff --git a/py/objenumerate.c b/py/objenumerate.c
index 40bed919ed..8217a0d4f9 100644
--- a/py/objenumerate.c
+++ b/py/objenumerate.c
@@ -37,9 +37,9 @@ typedef struct _mp_obj_enumerate_t {
mp_int_t cur;
} mp_obj_enumerate_t;
-STATIC mp_obj_t enumerate_iternext(mp_obj_t self_in);
+static mp_obj_t enumerate_iternext(mp_obj_t self_in);
-STATIC mp_obj_t enumerate_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t enumerate_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
#if MICROPY_CPYTHON_COMPAT
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_iterable, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -75,7 +75,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
iter, enumerate_iternext
);
-STATIC mp_obj_t enumerate_iternext(mp_obj_t self_in) {
+static mp_obj_t enumerate_iternext(mp_obj_t self_in) {
assert(mp_obj_is_type(self_in, &mp_type_enumerate));
mp_obj_enumerate_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t next = mp_iternext(self->iter);
diff --git a/py/objexcept.c b/py/objexcept.c
index fe74458cae..5bf4e672ba 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -117,7 +117,7 @@ bool mp_obj_is_native_exception_instance(mp_obj_t self_in) {
return MP_OBJ_TYPE_GET_SLOT_OR_NULL(mp_obj_get_type(self_in), make_new) == mp_obj_exception_make_new;
}
-STATIC mp_obj_exception_t *get_native_exception(mp_obj_t self_in) {
+static mp_obj_exception_t *get_native_exception(mp_obj_t self_in) {
assert(mp_obj_is_exception_instance(self_in));
if (mp_obj_is_native_exception_instance(self_in)) {
return MP_OBJ_TO_PTR(self_in);
@@ -126,7 +126,7 @@ STATIC mp_obj_exception_t *get_native_exception(mp_obj_t self_in) {
}
}
-STATIC void decompress_error_text_maybe(mp_obj_exception_t *o) {
+static void decompress_error_text_maybe(mp_obj_exception_t *o) {
#if MICROPY_ROM_TEXT_COMPRESSION
if (o->args->len == 1 && mp_obj_is_exact_type(o->args->items[0], &mp_type_str)) {
mp_obj_str_t *o_str = MP_OBJ_TO_PTR(o->args->items[0]);
@@ -439,7 +439,7 @@ struct _exc_printer_t {
byte *buf;
};
-STATIC void exc_add_strn(void *data, const char *str, size_t len) {
+static void exc_add_strn(void *data, const char *str, size_t len) {
struct _exc_printer_t *pr = data;
if (pr->len + len >= pr->alloc) {
// Not enough room for data plus a null byte so try to grow the buffer
diff --git a/py/objfilter.c b/py/objfilter.c
index 2a657fde4b..7f1f700f6a 100644
--- a/py/objfilter.c
+++ b/py/objfilter.c
@@ -34,7 +34,7 @@ typedef struct _mp_obj_filter_t {
mp_obj_t iter;
} mp_obj_filter_t;
-STATIC mp_obj_t filter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t filter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, 2, false);
mp_obj_filter_t *o = mp_obj_malloc(mp_obj_filter_t, type);
o->fun = args[0];
@@ -42,7 +42,7 @@ STATIC mp_obj_t filter_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t filter_iternext(mp_obj_t self_in) {
+static mp_obj_t filter_iternext(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_filter));
mp_obj_filter_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t next;
diff --git a/py/objfloat.c b/py/objfloat.c
index c862b4843b..5c90b1491c 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -102,7 +102,7 @@ mp_int_t mp_float_hash(mp_float_t src) {
}
#endif
-STATIC void float_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void float_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_float_t o_val = mp_obj_float_get(o_in);
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
@@ -124,7 +124,7 @@ STATIC void float_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
}
}
-STATIC mp_obj_t float_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t float_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
@@ -149,7 +149,7 @@ STATIC mp_obj_t float_make_new(const mp_obj_type_t *type_in, size_t n_args, size
}
}
-STATIC mp_obj_t float_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
+static mp_obj_t float_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
mp_float_t val = mp_obj_float_get(o_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -172,7 +172,7 @@ STATIC mp_obj_t float_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
}
}
-STATIC mp_obj_t float_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t float_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
mp_float_t lhs_val = mp_obj_float_get(lhs_in);
#if MICROPY_PY_BUILTINS_COMPLEX
if (mp_obj_is_type(rhs_in, &mp_type_complex)) {
@@ -208,7 +208,7 @@ mp_float_t mp_obj_float_get(mp_obj_t self_in) {
#endif
-STATIC void mp_obj_float_divmod(mp_float_t *x, mp_float_t *y) {
+static void mp_obj_float_divmod(mp_float_t *x, mp_float_t *y) {
// logic here follows that of CPython
// https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations
// x == (x//y)*y + (x%y)
diff --git a/py/objfun.c b/py/objfun.c
index 2e86aaa14d..1ebfa3d5af 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -48,7 +48,7 @@
/******************************************************************************/
/* builtin functions */
-STATIC mp_obj_t fun_builtin_0_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_builtin_0_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)args;
assert(mp_obj_is_type(self_in, &mp_type_fun_builtin_0));
mp_obj_fun_builtin_fixed_t *self = MP_OBJ_TO_PTR(self_in);
@@ -61,7 +61,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
call, fun_builtin_0_call
);
-STATIC mp_obj_t fun_builtin_1_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_builtin_1_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
assert(mp_obj_is_type(self_in, &mp_type_fun_builtin_1));
mp_obj_fun_builtin_fixed_t *self = MP_OBJ_TO_PTR(self_in);
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -73,7 +73,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
call, fun_builtin_1_call
);
-STATIC mp_obj_t fun_builtin_2_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_builtin_2_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
assert(mp_obj_is_type(self_in, &mp_type_fun_builtin_2));
mp_obj_fun_builtin_fixed_t *self = MP_OBJ_TO_PTR(self_in);
mp_arg_check_num(n_args, n_kw, 2, 2, false);
@@ -85,7 +85,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
call, fun_builtin_2_call
);
-STATIC mp_obj_t fun_builtin_3_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_builtin_3_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
assert(mp_obj_is_type(self_in, &mp_type_fun_builtin_3));
mp_obj_fun_builtin_fixed_t *self = MP_OBJ_TO_PTR(self_in);
mp_arg_check_num(n_args, n_kw, 3, 3, false);
@@ -97,7 +97,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
call, fun_builtin_3_call
);
-STATIC mp_obj_t fun_builtin_var_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_builtin_var_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
assert(mp_obj_is_type(self_in, &mp_type_fun_builtin_var));
mp_obj_fun_builtin_var_t *self = MP_OBJ_TO_PTR(self_in);
@@ -150,7 +150,7 @@ qstr mp_obj_fun_get_name(mp_const_obj_t fun_in) {
}
#if MICROPY_CPYTHON_COMPAT
-STATIC void fun_bc_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void fun_bc_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_fun_bc_t *o = MP_OBJ_TO_PTR(o_in);
mp_printf(print, "<function %q at 0x%p>", mp_obj_fun_get_name(o_in), o);
@@ -158,7 +158,7 @@ STATIC void fun_bc_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
#endif
#if DEBUG_PRINT
-STATIC void dump_args(const mp_obj_t *a, size_t sz) {
+static void dump_args(const mp_obj_t *a, size_t sz) {
DEBUG_printf("%p: ", a);
for (size_t i = 0; i < sz; i++) {
DEBUG_printf("%p ", a[i]);
@@ -224,7 +224,7 @@ mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t self_in, size_t n_args
}
#endif
-STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_bc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
MP_STACK_CHECK();
DEBUG_printf("Input n_args: " UINT_FMT ", n_kw: " UINT_FMT "\n", n_args, n_kw);
@@ -396,7 +396,7 @@ mp_obj_t mp_obj_new_fun_bc(const mp_obj_t *def_args, const byte *code, const mp_
#if MICROPY_EMIT_NATIVE
-STATIC mp_obj_t fun_native_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_native_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
MP_STACK_CHECK();
mp_obj_fun_bc_t *self = MP_OBJ_TO_PTR(self_in);
mp_call_fun_t fun = mp_obj_fun_native_get_function_start(self);
@@ -430,7 +430,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
#if MICROPY_EMIT_NATIVE
-STATIC mp_obj_t fun_viper_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_viper_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
MP_STACK_CHECK();
mp_obj_fun_bc_t *self = MP_OBJ_TO_PTR(self_in);
mp_call_fun_t fun = MICROPY_MAKE_POINTER_CALLABLE((void *)self->bytecode);
@@ -458,7 +458,7 @@ typedef mp_uint_t (*inline_asm_fun_3_t)(mp_uint_t, mp_uint_t, mp_uint_t);
typedef mp_uint_t (*inline_asm_fun_4_t)(mp_uint_t, mp_uint_t, mp_uint_t, mp_uint_t);
// convert a MicroPython object to a sensible value for inline asm
-STATIC mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) {
+static mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) {
// TODO for byte_array, pass pointer to the array
if (mp_obj_is_small_int(obj)) {
return MP_OBJ_SMALL_INT_VALUE(obj);
@@ -501,7 +501,7 @@ STATIC mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) {
}
}
-STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t fun_asm_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_obj_fun_asm_t *self = MP_OBJ_TO_PTR(self_in);
mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false);
diff --git a/py/objgenerator.c b/py/objgenerator.c
index e4acd5e49b..431cbad5a7 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -50,7 +50,7 @@ typedef struct _mp_obj_gen_instance_t {
mp_code_state_t code_state;
} mp_obj_gen_instance_t;
-STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// A generating function is just a bytecode function with type mp_type_gen_wrap
mp_obj_fun_bc_t *self_fun = MP_OBJ_TO_PTR(self_in);
@@ -96,7 +96,7 @@ typedef struct _mp_obj_gen_instance_native_t {
mp_code_state_native_t code_state;
} mp_obj_gen_instance_native_t;
-STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// The state for a native generating function is held in the same struct as a bytecode function
mp_obj_fun_bc_t *self_fun = MP_OBJ_TO_PTR(self_in);
@@ -144,7 +144,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
/******************************************************************************/
/* generator instance */
-STATIC void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<generator object '%q' at %p>", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self);
@@ -254,7 +254,7 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_
return ret_kind;
}
-STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, bool raise_stop_iteration) {
+static mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, bool raise_stop_iteration) {
mp_obj_t ret;
switch (mp_obj_gen_resume(self_in, send_value, throw_value, &ret)) {
case MP_VM_RETURN_NORMAL:
@@ -278,16 +278,16 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o
}
}
-STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) {
+static mp_obj_t gen_instance_iternext(mp_obj_t self_in) {
return gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL, false);
}
-STATIC mp_obj_t gen_instance_send(mp_obj_t self_in, mp_obj_t send_value) {
+static mp_obj_t gen_instance_send(mp_obj_t self_in, mp_obj_t send_value) {
return gen_resume_and_raise(self_in, send_value, MP_OBJ_NULL, true);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send);
+static MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send);
-STATIC mp_obj_t gen_instance_throw(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t gen_instance_throw(size_t n_args, const mp_obj_t *args) {
// The signature of this function is: throw(type[, value[, traceback]])
// CPython will pass all given arguments through the call chain and process them
// at the point they are used (native generators will handle them differently to
@@ -307,9 +307,9 @@ STATIC mp_obj_t gen_instance_throw(size_t n_args, const mp_obj_t *args) {
return gen_resume_and_raise(args[0], mp_const_none, exc, true);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gen_instance_throw_obj, 2, 4, gen_instance_throw);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gen_instance_throw_obj, 2, 4, gen_instance_throw);
-STATIC mp_obj_t gen_instance_close(mp_obj_t self_in) {
+static mp_obj_t gen_instance_close(mp_obj_t self_in) {
mp_obj_t ret;
switch (mp_obj_gen_resume(self_in, mp_const_none, MP_OBJ_FROM_PTR(&mp_const_GeneratorExit_obj), &ret)) {
case MP_VM_RETURN_YIELD:
@@ -328,10 +328,10 @@ STATIC mp_obj_t gen_instance_close(mp_obj_t self_in) {
return mp_const_none;
}
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(gen_instance_close_obj, gen_instance_close);
+static MP_DEFINE_CONST_FUN_OBJ_1(gen_instance_close_obj, gen_instance_close);
#if MICROPY_PY_GENERATOR_PEND_THROW
-STATIC mp_obj_t gen_instance_pend_throw(mp_obj_t self_in, mp_obj_t exc_in) {
+static mp_obj_t gen_instance_pend_throw(mp_obj_t self_in, mp_obj_t exc_in) {
mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in);
if (self->pend_exc == MP_OBJ_NULL) {
mp_raise_ValueError(MP_ERROR_TEXT("generator already executing"));
@@ -340,10 +340,10 @@ STATIC mp_obj_t gen_instance_pend_throw(mp_obj_t self_in, mp_obj_t exc_in) {
self->pend_exc = exc_in;
return prev;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_pend_throw_obj, gen_instance_pend_throw);
+static MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_pend_throw_obj, gen_instance_pend_throw);
#endif
-STATIC const mp_rom_map_elem_t gen_instance_locals_dict_table[] = {
+static const mp_rom_map_elem_t gen_instance_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&gen_instance_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&gen_instance_send_obj) },
{ MP_ROM_QSTR(MP_QSTR_throw), MP_ROM_PTR(&gen_instance_throw_obj) },
@@ -352,7 +352,7 @@ STATIC const mp_rom_map_elem_t gen_instance_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(gen_instance_locals_dict, gen_instance_locals_dict_table);
+static MP_DEFINE_CONST_DICT(gen_instance_locals_dict, gen_instance_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_gen_instance,
diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c
index c598d1daac..c735c65b65 100644
--- a/py/objgetitemiter.c
+++ b/py/objgetitemiter.c
@@ -35,7 +35,7 @@ typedef struct _mp_obj_getitem_iter_t {
mp_obj_t args[3];
} mp_obj_getitem_iter_t;
-STATIC mp_obj_t it_iternext(mp_obj_t self_in) {
+static mp_obj_t it_iternext(mp_obj_t self_in) {
mp_obj_getitem_iter_t *self = MP_OBJ_TO_PTR(self_in);
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
@@ -56,7 +56,7 @@ STATIC mp_obj_t it_iternext(mp_obj_t self_in) {
}
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
diff --git a/py/objint.c b/py/objint.c
index be5f4653a7..6caa608f33 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -40,7 +40,7 @@
#endif
// This dispatcher function is expected to be independent of the implementation of long int
-STATIC mp_obj_t mp_obj_int_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_obj_int_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 2, false);
@@ -83,7 +83,7 @@ typedef enum {
MP_FP_CLASS_OVERFLOW
} mp_fp_as_int_class_t;
-STATIC mp_fp_as_int_class_t mp_classify_fp_as_int(mp_float_t val) {
+static mp_fp_as_int_class_t mp_classify_fp_as_int(mp_float_t val) {
union {
mp_float_t f;
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
@@ -193,7 +193,7 @@ void mp_obj_int_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
}
}
-STATIC const uint8_t log_base2_floor[] = {
+static const uint8_t log_base2_floor[] = {
0, 1, 1, 2,
2, 2, 2, 3,
3, 3, 3, 3,
@@ -388,7 +388,7 @@ mp_obj_t mp_obj_int_binary_op_extra_cases(mp_binary_op_t op, mp_obj_t lhs_in, mp
}
// this is a classmethod
-STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
// TODO: Support signed param (assumes signed=False at the moment)
(void)n_args;
@@ -417,10 +417,10 @@ STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_int_from_uint(value);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 3, 4, int_from_bytes);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 3, 4, int_from_bytes);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj));
-STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
// TODO: Support signed param (assumes signed=False)
(void)n_args;
@@ -448,14 +448,14 @@ STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_bytes_from_vstr(&vstr);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_to_bytes_obj, 3, 4, int_to_bytes);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_to_bytes_obj, 3, 4, int_to_bytes);
-STATIC const mp_rom_map_elem_t int_locals_dict_table[] = {
+static const mp_rom_map_elem_t int_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_from_bytes), MP_ROM_PTR(&int_from_bytes_obj) },
{ MP_ROM_QSTR(MP_QSTR_to_bytes), MP_ROM_PTR(&int_to_bytes_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(int_locals_dict, int_locals_dict_table);
+static MP_DEFINE_CONST_DICT(int_locals_dict, int_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_int,
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 8078441d66..600316a42a 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -43,7 +43,7 @@
// Export value for sys.maxsize
// *FORMAT-OFF*
#define DIG_MASK ((MPZ_LONG_1 << MPZ_DIG_SIZE) - 1)
-STATIC const mpz_dig_t maxsize_dig[] = {
+static const mpz_dig_t maxsize_dig[] = {
#define NUM_DIG 1
(MP_SSIZE_MAX >> MPZ_DIG_SIZE * 0) & DIG_MASK,
#if (MP_SSIZE_MAX >> MPZ_DIG_SIZE * 0) > DIG_MASK
@@ -335,7 +335,7 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i
}
#if MICROPY_PY_BUILTINS_POW3
-STATIC mpz_t *mp_mpz_for_int(mp_obj_t arg, mpz_t *temp) {
+static mpz_t *mp_mpz_for_int(mp_obj_t arg, mpz_t *temp) {
if (mp_obj_is_small_int(arg)) {
mpz_init_from_int(temp, MP_OBJ_SMALL_INT_VALUE(arg));
return temp;
diff --git a/py/objlist.c b/py/objlist.c
index 1423cb1dee..2198beb839 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -31,10 +31,10 @@
#include "py/runtime.h"
#include "py/stackctrl.h"
-STATIC mp_obj_t mp_obj_new_list_iterator(mp_obj_t list, size_t cur, mp_obj_iter_buf_t *iter_buf);
-STATIC mp_obj_list_t *list_new(size_t n);
-STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in);
-STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args);
+static mp_obj_t mp_obj_new_list_iterator(mp_obj_t list, size_t cur, mp_obj_iter_buf_t *iter_buf);
+static mp_obj_list_t *list_new(size_t n);
+static mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in);
+static mp_obj_t list_pop(size_t n_args, const mp_obj_t *args);
// TODO: Move to mpconfig.h
#define LIST_MIN_ALLOC 4
@@ -42,7 +42,7 @@ STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args);
/******************************************************************************/
/* list */
-STATIC void list_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void list_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
mp_obj_list_t *o = MP_OBJ_TO_PTR(o_in);
const char *item_separator = ", ";
if (!(MICROPY_PY_JSON && kind == PRINT_JSON)) {
@@ -62,7 +62,7 @@ STATIC void list_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t k
mp_print_str(print, "]");
}
-STATIC mp_obj_t list_extend_from_iter(mp_obj_t list, mp_obj_t iterable) {
+static mp_obj_t list_extend_from_iter(mp_obj_t list, mp_obj_t iterable) {
mp_obj_t iter = mp_getiter(iterable, NULL);
mp_obj_t item;
while ((item = mp_iternext(iter)) != MP_OBJ_STOP_ITERATION) {
@@ -90,7 +90,7 @@ mp_obj_t mp_obj_list_make_new(const mp_obj_type_t *type_in, size_t n_args, size_
}
}
-STATIC mp_obj_t list_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t list_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -108,7 +108,7 @@ STATIC mp_obj_t list_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
+static mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
mp_obj_list_t *o = MP_OBJ_TO_PTR(lhs);
switch (op) {
case MP_BINARY_OP_ADD: {
@@ -158,7 +158,7 @@ STATIC mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
}
}
-STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete
#if MICROPY_PY_BUILTINS_SLICE
@@ -234,7 +234,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
}
}
-STATIC mp_obj_t list_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t list_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
return mp_obj_new_list_iterator(o_in, 0, iter_buf);
}
@@ -250,7 +250,7 @@ mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none; // return None, as per CPython
}
-STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in) {
+static mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_list));
if (mp_obj_is_type(arg_in, &mp_type_list)) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
@@ -271,7 +271,7 @@ STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in) {
return mp_const_none; // return None, as per CPython
}
-STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t list_pop(size_t n_args, const mp_obj_t *args) {
mp_check_self(mp_obj_is_type(args[0], &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]);
if (self->len == 0) {
@@ -290,7 +290,7 @@ STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args) {
return ret;
}
-STATIC void mp_quicksort(mp_obj_t *head, mp_obj_t *tail, mp_obj_t key_fn, mp_obj_t binop_less_result) {
+static void mp_quicksort(mp_obj_t *head, mp_obj_t *tail, mp_obj_t key_fn, mp_obj_t binop_less_result) {
MP_STACK_CHECK();
while (head < tail) {
mp_obj_t *h = head - 1;
@@ -348,7 +348,7 @@ mp_obj_t mp_obj_list_sort(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_
return mp_const_none;
}
-STATIC mp_obj_t list_clear(mp_obj_t self_in) {
+static mp_obj_t list_clear(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
self->len = 0;
@@ -358,25 +358,25 @@ STATIC mp_obj_t list_clear(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC mp_obj_t list_copy(mp_obj_t self_in) {
+static mp_obj_t list_copy(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_list(self->len, self->items);
}
-STATIC mp_obj_t list_count(mp_obj_t self_in, mp_obj_t value) {
+static mp_obj_t list_count(mp_obj_t self_in, mp_obj_t value) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
return mp_seq_count_obj(self->items, self->len, value);
}
-STATIC mp_obj_t list_index(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t list_index(size_t n_args, const mp_obj_t *args) {
mp_check_self(mp_obj_is_type(args[0], &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]);
return mp_seq_index_obj(self->items, self->len, n_args, args);
}
-STATIC mp_obj_t list_insert(mp_obj_t self_in, mp_obj_t idx, mp_obj_t obj) {
+static mp_obj_t list_insert(mp_obj_t self_in, mp_obj_t idx, mp_obj_t obj) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
// insert has its own strange index logic
@@ -410,7 +410,7 @@ mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value) {
return mp_const_none;
}
-STATIC mp_obj_t list_reverse(mp_obj_t self_in) {
+static mp_obj_t list_reverse(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
@@ -424,19 +424,19 @@ STATIC mp_obj_t list_reverse(mp_obj_t self_in) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(list_append_obj, mp_obj_list_append);
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(list_extend_obj, list_extend);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(list_clear_obj, list_clear);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(list_copy_obj, list_copy);
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(list_count_obj, list_count);
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_index_obj, 2, 4, list_index);
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(list_insert_obj, list_insert);
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_pop_obj, 1, 2, list_pop);
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(list_remove_obj, mp_obj_list_remove);
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(list_reverse_obj, list_reverse);
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, 1, mp_obj_list_sort);
-
-STATIC const mp_rom_map_elem_t list_locals_dict_table[] = {
+static MP_DEFINE_CONST_FUN_OBJ_2(list_append_obj, mp_obj_list_append);
+static MP_DEFINE_CONST_FUN_OBJ_2(list_extend_obj, list_extend);
+static MP_DEFINE_CONST_FUN_OBJ_1(list_clear_obj, list_clear);
+static MP_DEFINE_CONST_FUN_OBJ_1(list_copy_obj, list_copy);
+static MP_DEFINE_CONST_FUN_OBJ_2(list_count_obj, list_count);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_index_obj, 2, 4, list_index);
+static MP_DEFINE_CONST_FUN_OBJ_3(list_insert_obj, list_insert);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_pop_obj, 1, 2, list_pop);
+static MP_DEFINE_CONST_FUN_OBJ_2(list_remove_obj, mp_obj_list_remove);
+static MP_DEFINE_CONST_FUN_OBJ_1(list_reverse_obj, list_reverse);
+static MP_DEFINE_CONST_FUN_OBJ_KW(list_sort_obj, 1, mp_obj_list_sort);
+
+static const mp_rom_map_elem_t list_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&list_append_obj) },
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&list_clear_obj) },
{ MP_ROM_QSTR(MP_QSTR_copy), MP_ROM_PTR(&list_copy_obj) },
@@ -450,7 +450,7 @@ STATIC const mp_rom_map_elem_t list_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_sort), MP_ROM_PTR(&list_sort_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(list_locals_dict, list_locals_dict_table);
+static MP_DEFINE_CONST_DICT(list_locals_dict, list_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_list,
@@ -474,7 +474,7 @@ void mp_obj_list_init(mp_obj_list_t *o, size_t n) {
mp_seq_clear(o->items, n, o->alloc, sizeof(*o->items));
}
-STATIC mp_obj_list_t *list_new(size_t n) {
+static mp_obj_list_t *list_new(size_t n) {
mp_obj_list_t *o = m_new_obj(mp_obj_list_t);
mp_obj_list_init(o, n);
return o;
@@ -519,7 +519,7 @@ typedef struct _mp_obj_list_it_t {
size_t cur;
} mp_obj_list_it_t;
-STATIC mp_obj_t list_it_iternext(mp_obj_t self_in) {
+static mp_obj_t list_it_iternext(mp_obj_t self_in) {
mp_obj_list_it_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *list = MP_OBJ_TO_PTR(self->list);
if (self->cur < list->len) {
diff --git a/py/objmap.c b/py/objmap.c
index 98ff19bb7b..1911a7510a 100644
--- a/py/objmap.c
+++ b/py/objmap.c
@@ -36,7 +36,7 @@ typedef struct _mp_obj_map_t {
mp_obj_t iters[];
} mp_obj_map_t;
-STATIC mp_obj_t map_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t map_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, MP_OBJ_FUN_ARGS_MAX, false);
mp_obj_map_t *o = mp_obj_malloc_var(mp_obj_map_t, iters, mp_obj_t, n_args - 1, type);
o->n_iters = n_args - 1;
@@ -47,7 +47,7 @@ STATIC mp_obj_t map_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t map_iternext(mp_obj_t self_in) {
+static mp_obj_t map_iternext(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_map));
mp_obj_map_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t *nextses = m_new(mp_obj_t, self->n_iters);
diff --git a/py/objmodule.c b/py/objmodule.c
index 5266421b79..5ce373b83d 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -34,7 +34,7 @@
#include "py/runtime.h"
#include "py/builtin.h"
-STATIC void module_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void module_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in);
@@ -57,9 +57,9 @@ STATIC void module_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin
mp_printf(print, "<module '%s'>", module_name);
}
-STATIC void module_attr_try_delegation(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
+static void module_attr_try_delegation(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
-STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in);
if (dest[0] == MP_OBJ_NULL) {
// load attribute
@@ -146,13 +146,13 @@ mp_obj_t mp_obj_new_module(qstr module_name) {
/******************************************************************************/
// Global module table and related functions
-STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
+static const mp_rom_map_elem_t mp_builtin_module_table[] = {
// built-in modules declared with MP_REGISTER_MODULE()
MICROPY_REGISTERED_MODULES
};
MP_DEFINE_CONST_MAP(mp_builtin_module_map, mp_builtin_module_table);
-STATIC const mp_rom_map_elem_t mp_builtin_extensible_module_table[] = {
+static const mp_rom_map_elem_t mp_builtin_extensible_module_table[] = {
// built-in modules declared with MP_REGISTER_EXTENSIBLE_MODULE()
MICROPY_REGISTERED_EXTENSIBLE_MODULES
};
@@ -164,7 +164,7 @@ typedef struct _mp_module_delegation_entry_t {
mp_attr_fun_t fun;
} mp_module_delegation_entry_t;
-STATIC const mp_module_delegation_entry_t mp_builtin_module_delegation_table[] = {
+static const mp_module_delegation_entry_t mp_builtin_module_delegation_table[] = {
// delegation entries declared with MP_REGISTER_MODULE_DELEGATION()
MICROPY_MODULE_DELEGATIONS
};
@@ -223,7 +223,7 @@ mp_obj_t mp_module_get_builtin(qstr module_name, bool extensible) {
return elem->value;
}
-STATIC void module_attr_try_delegation(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void module_attr_try_delegation(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
#if MICROPY_MODULE_ATTR_DELEGATION && defined(MICROPY_MODULE_DELEGATIONS)
// Delegate lookup to a module's custom attr method.
size_t n = MP_ARRAY_SIZE(mp_builtin_module_delegation_table);
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index 0adf83fe96..f019604d52 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -44,7 +44,7 @@ size_t mp_obj_namedtuple_find_field(const mp_obj_namedtuple_type_t *type, qstr n
}
#if MICROPY_PY_COLLECTIONS_NAMEDTUPLE__ASDICT
-STATIC mp_obj_t namedtuple_asdict(mp_obj_t self_in) {
+static mp_obj_t namedtuple_asdict(mp_obj_t self_in) {
mp_obj_namedtuple_t *self = MP_OBJ_TO_PTR(self_in);
const qstr *fields = ((mp_obj_namedtuple_type_t *)self->tuple.base.type)->fields;
mp_obj_t dict = mp_obj_new_dict(self->tuple.len);
@@ -60,7 +60,7 @@ STATIC mp_obj_t namedtuple_asdict(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(namedtuple_asdict_obj, namedtuple_asdict);
#endif
-STATIC void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_namedtuple_t *o = MP_OBJ_TO_PTR(o_in);
mp_printf(print, "%q", o->tuple.base.type->name);
@@ -68,7 +68,7 @@ STATIC void namedtuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_ki
mp_obj_attrtuple_print_helper(print, fields, &o->tuple);
}
-STATIC void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] == MP_OBJ_NULL) {
// load attribute
mp_obj_namedtuple_t *self = MP_OBJ_TO_PTR(self_in);
@@ -91,7 +91,7 @@ STATIC void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
}
-STATIC mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
const mp_obj_namedtuple_type_t *type = (const mp_obj_namedtuple_type_t *)type_in;
size_t num_fields = type->n_fields;
if (n_args + n_kw != num_fields) {
@@ -151,7 +151,7 @@ mp_obj_namedtuple_type_t *mp_obj_new_namedtuple_base(size_t n_fields, mp_obj_t *
return o;
}
-STATIC mp_obj_t mp_obj_new_namedtuple_type(qstr name, size_t n_fields, mp_obj_t *fields) {
+static mp_obj_t mp_obj_new_namedtuple_type(qstr name, size_t n_fields, mp_obj_t *fields) {
mp_obj_namedtuple_type_t *o = mp_obj_new_namedtuple_base(n_fields, fields);
mp_obj_type_t *type = (mp_obj_type_t *)&o->base;
type->base.type = &mp_type_type;
@@ -168,7 +168,7 @@ STATIC mp_obj_t mp_obj_new_namedtuple_type(qstr name, size_t n_fields, mp_obj_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t new_namedtuple_type(mp_obj_t name_in, mp_obj_t fields_in) {
+static mp_obj_t new_namedtuple_type(mp_obj_t name_in, mp_obj_t fields_in) {
qstr name = mp_obj_str_get_qstr(name_in);
size_t n_fields;
mp_obj_t *fields;
diff --git a/py/objnone.c b/py/objnone.c
index 5b25cd38c4..a8ce8ebfed 100644
--- a/py/objnone.c
+++ b/py/objnone.c
@@ -34,7 +34,7 @@ typedef struct _mp_obj_none_t {
} mp_obj_none_t;
#endif
-STATIC void none_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void none_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)self_in;
if (MICROPY_PY_JSON && kind == PRINT_JSON) {
mp_print_str(print, "null");
diff --git a/py/objobject.c b/py/objobject.c
index 1acae6d00b..ff93fd0827 100644
--- a/py/objobject.c
+++ b/py/objobject.c
@@ -33,7 +33,7 @@ typedef struct _mp_obj_object_t {
mp_obj_base_t base;
} mp_obj_object_t;
-STATIC mp_obj_t object_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t object_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)args;
mp_arg_check_num(n_args, n_kw, 0, 0, false);
mp_obj_object_t *o = mp_obj_malloc(mp_obj_object_t, type);
@@ -41,13 +41,13 @@ STATIC mp_obj_t object_make_new(const mp_obj_type_t *type, size_t n_args, size_t
}
#if MICROPY_CPYTHON_COMPAT
-STATIC mp_obj_t object___init__(mp_obj_t self) {
+static mp_obj_t object___init__(mp_obj_t self) {
(void)self;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___init___obj, object___init__);
+static MP_DEFINE_CONST_FUN_OBJ_1(object___init___obj, object___init__);
-STATIC mp_obj_t object___new__(mp_obj_t cls) {
+static mp_obj_t object___new__(mp_obj_t cls) {
if (!mp_obj_is_type(cls, &mp_type_type) || !mp_obj_is_instance_type((mp_obj_type_t *)MP_OBJ_TO_PTR(cls))) {
mp_raise_TypeError(MP_ERROR_TEXT("arg must be user-type"));
}
@@ -58,11 +58,11 @@ STATIC mp_obj_t object___new__(mp_obj_t cls) {
const mp_obj_type_t *native_base;
return MP_OBJ_FROM_PTR(mp_obj_new_instance(MP_OBJ_TO_PTR(cls), &native_base));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___new___fun_obj, object___new__);
-STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(object___new___obj, MP_ROM_PTR(&object___new___fun_obj));
+static MP_DEFINE_CONST_FUN_OBJ_1(object___new___fun_obj, object___new__);
+static MP_DEFINE_CONST_STATICMETHOD_OBJ(object___new___obj, MP_ROM_PTR(&object___new___fun_obj));
#if MICROPY_PY_DELATTR_SETATTR
-STATIC mp_obj_t object___setattr__(mp_obj_t self_in, mp_obj_t attr, mp_obj_t value) {
+static mp_obj_t object___setattr__(mp_obj_t self_in, mp_obj_t attr, mp_obj_t value) {
if (!mp_obj_is_instance_type(mp_obj_get_type(self_in))) {
mp_raise_TypeError(MP_ERROR_TEXT("arg must be user-type"));
}
@@ -75,9 +75,9 @@ STATIC mp_obj_t object___setattr__(mp_obj_t self_in, mp_obj_t attr, mp_obj_t val
mp_map_lookup(&self->members, attr, MP_MAP_LOOKUP_ADD_IF_NOT_FOUND)->value = value;
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_3(object___setattr___obj, object___setattr__);
+static MP_DEFINE_CONST_FUN_OBJ_3(object___setattr___obj, object___setattr__);
-STATIC mp_obj_t object___delattr__(mp_obj_t self_in, mp_obj_t attr) {
+static mp_obj_t object___delattr__(mp_obj_t self_in, mp_obj_t attr) {
if (!mp_obj_is_instance_type(mp_obj_get_type(self_in))) {
mp_raise_TypeError(MP_ERROR_TEXT("arg must be user-type"));
}
@@ -92,10 +92,10 @@ STATIC mp_obj_t object___delattr__(mp_obj_t self_in, mp_obj_t attr) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(object___delattr___obj, object___delattr__);
+static MP_DEFINE_CONST_FUN_OBJ_2(object___delattr___obj, object___delattr__);
#endif
-STATIC const mp_rom_map_elem_t object_locals_dict_table[] = {
+static const mp_rom_map_elem_t object_locals_dict_table[] = {
#if MICROPY_CPYTHON_COMPAT
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&object___init___obj) },
#endif
@@ -108,7 +108,7 @@ STATIC const mp_rom_map_elem_t object_locals_dict_table[] = {
#endif
};
-STATIC MP_DEFINE_CONST_DICT(object_locals_dict, object_locals_dict_table);
+static MP_DEFINE_CONST_DICT(object_locals_dict, object_locals_dict_table);
#endif
#if MICROPY_CPYTHON_COMPAT
diff --git a/py/objpolyiter.c b/py/objpolyiter.c
index 78b600abac..65c1f182ec 100644
--- a/py/objpolyiter.c
+++ b/py/objpolyiter.c
@@ -39,7 +39,7 @@ typedef struct _mp_obj_polymorph_iter_t {
mp_fun_1_t iternext;
} mp_obj_polymorph_iter_t;
-STATIC mp_obj_t polymorph_it_iternext(mp_obj_t self_in) {
+static mp_obj_t polymorph_it_iternext(mp_obj_t self_in) {
mp_obj_polymorph_iter_t *self = MP_OBJ_TO_PTR(self_in);
// Redirect call to object instance's iternext method
return self->iternext(self_in);
@@ -64,17 +64,17 @@ typedef struct _mp_obj_polymorph_iter_with_finaliser_t {
mp_fun_1_t finaliser;
} mp_obj_polymorph_with_finaliser_iter_t;
-STATIC mp_obj_t mp_obj_polymorph_iter_del(mp_obj_t self_in) {
+static mp_obj_t mp_obj_polymorph_iter_del(mp_obj_t self_in) {
mp_obj_polymorph_with_finaliser_iter_t *self = MP_OBJ_TO_PTR(self_in);
// Redirect call to object instance's finaliser method
return self->finaliser(self_in);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_obj_polymorph_iter_del_obj, mp_obj_polymorph_iter_del);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_obj_polymorph_iter_del_obj, mp_obj_polymorph_iter_del);
-STATIC const mp_rom_map_elem_t mp_obj_polymorph_iter_locals_dict_table[] = {
+static const mp_rom_map_elem_t mp_obj_polymorph_iter_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_obj_polymorph_iter_del_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_obj_polymorph_iter_locals_dict, mp_obj_polymorph_iter_locals_dict_table);
+static MP_DEFINE_CONST_DICT(mp_obj_polymorph_iter_locals_dict, mp_obj_polymorph_iter_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_polymorph_iter_with_finaliser,
diff --git a/py/objproperty.c b/py/objproperty.c
index 2d3af10e8c..155ffb16b5 100644
--- a/py/objproperty.c
+++ b/py/objproperty.c
@@ -36,7 +36,7 @@ typedef struct _mp_obj_property_t {
mp_obj_t proxy[3]; // getter, setter, deleter
} mp_obj_property_t;
-STATIC mp_obj_t property_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t property_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
enum { ARG_fget, ARG_fset, ARG_fdel, ARG_doc };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
@@ -55,40 +55,40 @@ STATIC mp_obj_t property_make_new(const mp_obj_type_t *type, size_t n_args, size
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t property_getter(mp_obj_t self_in, mp_obj_t getter) {
+static mp_obj_t property_getter(mp_obj_t self_in, mp_obj_t getter) {
mp_obj_property_t *p2 = m_new_obj(mp_obj_property_t);
*p2 = *(mp_obj_property_t *)MP_OBJ_TO_PTR(self_in);
p2->proxy[0] = getter;
return MP_OBJ_FROM_PTR(p2);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(property_getter_obj, property_getter);
+static MP_DEFINE_CONST_FUN_OBJ_2(property_getter_obj, property_getter);
-STATIC mp_obj_t property_setter(mp_obj_t self_in, mp_obj_t setter) {
+static mp_obj_t property_setter(mp_obj_t self_in, mp_obj_t setter) {
mp_obj_property_t *p2 = m_new_obj(mp_obj_property_t);
*p2 = *(mp_obj_property_t *)MP_OBJ_TO_PTR(self_in);
p2->proxy[1] = setter;
return MP_OBJ_FROM_PTR(p2);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(property_setter_obj, property_setter);
+static MP_DEFINE_CONST_FUN_OBJ_2(property_setter_obj, property_setter);
-STATIC mp_obj_t property_deleter(mp_obj_t self_in, mp_obj_t deleter) {
+static mp_obj_t property_deleter(mp_obj_t self_in, mp_obj_t deleter) {
mp_obj_property_t *p2 = m_new_obj(mp_obj_property_t);
*p2 = *(mp_obj_property_t *)MP_OBJ_TO_PTR(self_in);
p2->proxy[2] = deleter;
return MP_OBJ_FROM_PTR(p2);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(property_deleter_obj, property_deleter);
+static MP_DEFINE_CONST_FUN_OBJ_2(property_deleter_obj, property_deleter);
-STATIC const mp_rom_map_elem_t property_locals_dict_table[] = {
+static const mp_rom_map_elem_t property_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_getter), MP_ROM_PTR(&property_getter_obj) },
{ MP_ROM_QSTR(MP_QSTR_setter), MP_ROM_PTR(&property_setter_obj) },
{ MP_ROM_QSTR(MP_QSTR_deleter), MP_ROM_PTR(&property_deleter_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(property_locals_dict, property_locals_dict_table);
+static MP_DEFINE_CONST_DICT(property_locals_dict, property_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_property,
diff --git a/py/objrange.c b/py/objrange.c
index f0fe56d9db..9a4ecd3fcd 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -39,7 +39,7 @@ typedef struct _mp_obj_range_it_t {
mp_int_t step;
} mp_obj_range_it_t;
-STATIC mp_obj_t range_it_iternext(mp_obj_t o_in) {
+static mp_obj_t range_it_iternext(mp_obj_t o_in) {
mp_obj_range_it_t *o = MP_OBJ_TO_PTR(o_in);
if ((o->step > 0 && o->cur < o->stop) || (o->step < 0 && o->cur > o->stop)) {
mp_obj_t o_out = MP_OBJ_NEW_SMALL_INT(o->cur);
@@ -50,14 +50,14 @@ STATIC mp_obj_t range_it_iternext(mp_obj_t o_in) {
}
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_range_it,
MP_QSTR_iterator,
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
iter, range_it_iternext
);
-STATIC mp_obj_t mp_obj_new_range_iterator(mp_int_t cur, mp_int_t stop, mp_int_t step, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t mp_obj_new_range_iterator(mp_int_t cur, mp_int_t stop, mp_int_t step, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_range_it_t) <= sizeof(mp_obj_iter_buf_t));
mp_obj_range_it_t *o = (mp_obj_range_it_t *)iter_buf;
o->base.type = &mp_type_range_it;
@@ -78,7 +78,7 @@ typedef struct _mp_obj_range_t {
mp_int_t step;
} mp_obj_range_t;
-STATIC void range_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void range_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_range_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "range(" INT_FMT ", " INT_FMT "", self->start, self->stop);
@@ -89,7 +89,7 @@ STATIC void range_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind
}
}
-STATIC mp_obj_t range_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t range_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 3, false);
mp_obj_range_t *o = mp_obj_malloc(mp_obj_range_t, type);
@@ -112,7 +112,7 @@ STATIC mp_obj_t range_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_int_t range_len(mp_obj_range_t *self) {
+static mp_int_t range_len(mp_obj_range_t *self) {
// When computing length, need to take into account step!=1 and step<0.
mp_int_t len = self->stop - self->start + self->step;
if (self->step > 0) {
@@ -127,7 +127,7 @@ STATIC mp_int_t range_len(mp_obj_range_t *self) {
return len;
}
-STATIC mp_obj_t range_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t range_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_range_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t len = range_len(self);
switch (op) {
@@ -141,7 +141,7 @@ STATIC mp_obj_t range_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
#if MICROPY_PY_BUILTINS_RANGE_BINOP
-STATIC mp_obj_t range_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t range_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
if (!mp_obj_is_type(rhs_in, &mp_type_range) || op != MP_BINARY_OP_EQUAL) {
return MP_OBJ_NULL; // op not supported
}
@@ -158,7 +158,7 @@ STATIC mp_obj_t range_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
}
#endif
-STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (value == MP_OBJ_SENTINEL) {
// load
mp_obj_range_t *self = MP_OBJ_TO_PTR(self_in);
@@ -185,14 +185,14 @@ STATIC mp_obj_t range_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
}
}
-STATIC mp_obj_t range_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t range_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
mp_obj_range_t *o = MP_OBJ_TO_PTR(o_in);
return mp_obj_new_range_iterator(o->start, o->stop, o->step, iter_buf);
}
#if MICROPY_PY_BUILTINS_RANGE_ATTRS
-STATIC void range_attr(mp_obj_t o_in, qstr attr, mp_obj_t *dest) {
+static void range_attr(mp_obj_t o_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// not load attribute
return;
diff --git a/py/objreversed.c b/py/objreversed.c
index c66698f028..c580ee286b 100644
--- a/py/objreversed.c
+++ b/py/objreversed.c
@@ -37,7 +37,7 @@ typedef struct _mp_obj_reversed_t {
mp_uint_t cur_index; // current index, plus 1; 0=no more, 1=last one (index 0)
} mp_obj_reversed_t;
-STATIC mp_obj_t reversed_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t reversed_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// check if __reversed__ exists, and if so delegate to it
@@ -54,7 +54,7 @@ STATIC mp_obj_t reversed_make_new(const mp_obj_type_t *type, size_t n_args, size
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t reversed_iternext(mp_obj_t self_in) {
+static mp_obj_t reversed_iternext(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_reversed));
mp_obj_reversed_t *self = MP_OBJ_TO_PTR(self_in);
diff --git a/py/objset.c b/py/objset.c
index 906807889a..c8fa12a7ec 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -45,7 +45,7 @@ typedef struct _mp_obj_set_it_t {
size_t cur;
} mp_obj_set_it_t;
-STATIC bool is_set_or_frozenset(mp_obj_t o) {
+static bool is_set_or_frozenset(mp_obj_t o) {
return mp_obj_is_type(o, &mp_type_set)
#if MICROPY_PY_BUILTINS_FROZENSET
|| mp_obj_is_type(o, &mp_type_frozenset)
@@ -60,7 +60,7 @@ STATIC bool is_set_or_frozenset(mp_obj_t o) {
// set or frozenset for methods that operate on both of these types.
#define check_set_or_frozenset(o) mp_check_self(is_set_or_frozenset(o))
-STATIC void set_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void set_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
#if MICROPY_PY_BUILTINS_FROZENSET
@@ -99,7 +99,7 @@ STATIC void set_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
#endif
}
-STATIC mp_obj_t set_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t set_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
switch (n_args) {
@@ -127,7 +127,7 @@ STATIC mp_obj_t set_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
}
}
-STATIC mp_obj_t set_it_iternext(mp_obj_t self_in) {
+static mp_obj_t set_it_iternext(mp_obj_t self_in) {
mp_obj_set_it_t *self = MP_OBJ_TO_PTR(self_in);
size_t max = self->set->set.alloc;
mp_set_t *set = &self->set->set;
@@ -142,7 +142,7 @@ STATIC mp_obj_t set_it_iternext(mp_obj_t self_in) {
return MP_OBJ_STOP_ITERATION;
}
-STATIC mp_obj_t set_getiter(mp_obj_t set_in, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t set_getiter(mp_obj_t set_in, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_set_it_t) <= sizeof(mp_obj_iter_buf_t));
mp_obj_set_it_t *o = (mp_obj_set_it_t *)iter_buf;
o->base.type = &mp_type_polymorph_iter;
@@ -155,23 +155,23 @@ STATIC mp_obj_t set_getiter(mp_obj_t set_in, mp_obj_iter_buf_t *iter_buf) {
/******************************************************************************/
/* set methods */
-STATIC mp_obj_t set_add(mp_obj_t self_in, mp_obj_t item) {
+static mp_obj_t set_add(mp_obj_t self_in, mp_obj_t item) {
check_set(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
mp_set_lookup(&self->set, item, MP_MAP_LOOKUP_ADD_IF_NOT_FOUND);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_add_obj, set_add);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_add_obj, set_add);
-STATIC mp_obj_t set_clear(mp_obj_t self_in) {
+static mp_obj_t set_clear(mp_obj_t self_in) {
check_set(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
mp_set_clear(&self->set);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(set_clear_obj, set_clear);
+static MP_DEFINE_CONST_FUN_OBJ_1(set_clear_obj, set_clear);
-STATIC mp_obj_t set_copy(mp_obj_t self_in) {
+static mp_obj_t set_copy(mp_obj_t self_in) {
check_set_or_frozenset(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_set_t *other = mp_obj_malloc(mp_obj_set_t, self->base.type);
@@ -180,17 +180,17 @@ STATIC mp_obj_t set_copy(mp_obj_t self_in) {
memcpy(other->set.table, self->set.table, self->set.alloc * sizeof(mp_obj_t));
return MP_OBJ_FROM_PTR(other);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(set_copy_obj, set_copy);
+static MP_DEFINE_CONST_FUN_OBJ_1(set_copy_obj, set_copy);
-STATIC mp_obj_t set_discard(mp_obj_t self_in, mp_obj_t item) {
+static mp_obj_t set_discard(mp_obj_t self_in, mp_obj_t item) {
check_set(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
mp_set_lookup(&self->set, item, MP_MAP_LOOKUP_REMOVE_IF_FOUND);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_discard_obj, set_discard);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_discard_obj, set_discard);
-STATIC mp_obj_t set_diff_int(size_t n_args, const mp_obj_t *args, bool update) {
+static mp_obj_t set_diff_int(size_t n_args, const mp_obj_t *args, bool update) {
mp_obj_t self;
if (update) {
check_set(args[0]);
@@ -216,18 +216,18 @@ STATIC mp_obj_t set_diff_int(size_t n_args, const mp_obj_t *args, bool update) {
return self;
}
-STATIC mp_obj_t set_diff(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t set_diff(size_t n_args, const mp_obj_t *args) {
return set_diff_int(n_args, args, false);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_obj, 1, set_diff);
+static MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_obj, 1, set_diff);
-STATIC mp_obj_t set_diff_update(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t set_diff_update(size_t n_args, const mp_obj_t *args) {
set_diff_int(n_args, args, true);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_update_obj, 1, set_diff_update);
+static MP_DEFINE_CONST_FUN_OBJ_VAR(set_diff_update_obj, 1, set_diff_update);
-STATIC mp_obj_t set_intersect_int(mp_obj_t self_in, mp_obj_t other, bool update) {
+static mp_obj_t set_intersect_int(mp_obj_t self_in, mp_obj_t other, bool update) {
if (update) {
check_set(self_in);
} else {
@@ -259,17 +259,17 @@ STATIC mp_obj_t set_intersect_int(mp_obj_t self_in, mp_obj_t other, bool update)
return update ? mp_const_none : MP_OBJ_FROM_PTR(out);
}
-STATIC mp_obj_t set_intersect(mp_obj_t self_in, mp_obj_t other) {
+static mp_obj_t set_intersect(mp_obj_t self_in, mp_obj_t other) {
return set_intersect_int(self_in, other, false);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_intersect_obj, set_intersect);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_intersect_obj, set_intersect);
-STATIC mp_obj_t set_intersect_update(mp_obj_t self_in, mp_obj_t other) {
+static mp_obj_t set_intersect_update(mp_obj_t self_in, mp_obj_t other) {
return set_intersect_int(self_in, other, true);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_intersect_update_obj, set_intersect_update);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_intersect_update_obj, set_intersect_update);
-STATIC mp_obj_t set_isdisjoint(mp_obj_t self_in, mp_obj_t other) {
+static mp_obj_t set_isdisjoint(mp_obj_t self_in, mp_obj_t other) {
check_set_or_frozenset(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
@@ -283,9 +283,9 @@ STATIC mp_obj_t set_isdisjoint(mp_obj_t self_in, mp_obj_t other) {
}
return mp_const_true;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_isdisjoint_obj, set_isdisjoint);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_isdisjoint_obj, set_isdisjoint);
-STATIC mp_obj_t set_issubset_internal(mp_obj_t self_in, mp_obj_t other_in, bool proper) {
+static mp_obj_t set_issubset_internal(mp_obj_t self_in, mp_obj_t other_in, bool proper) {
mp_obj_set_t *self;
bool cleanup_self = false;
if (is_set_or_frozenset(self_in)) {
@@ -327,25 +327,25 @@ STATIC mp_obj_t set_issubset_internal(mp_obj_t self_in, mp_obj_t other_in, bool
return out;
}
-STATIC mp_obj_t set_issubset(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_issubset(mp_obj_t self_in, mp_obj_t other_in) {
return set_issubset_internal(self_in, other_in, false);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_issubset_obj, set_issubset);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_issubset_obj, set_issubset);
-STATIC mp_obj_t set_issubset_proper(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_issubset_proper(mp_obj_t self_in, mp_obj_t other_in) {
return set_issubset_internal(self_in, other_in, true);
}
-STATIC mp_obj_t set_issuperset(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_issuperset(mp_obj_t self_in, mp_obj_t other_in) {
return set_issubset_internal(other_in, self_in, false);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_issuperset_obj, set_issuperset);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_issuperset_obj, set_issuperset);
-STATIC mp_obj_t set_issuperset_proper(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_issuperset_proper(mp_obj_t self_in, mp_obj_t other_in) {
return set_issubset_internal(other_in, self_in, true);
}
-STATIC mp_obj_t set_equal(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_equal(mp_obj_t self_in, mp_obj_t other_in) {
assert(is_set_or_frozenset(other_in));
check_set_or_frozenset(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
@@ -356,7 +356,7 @@ STATIC mp_obj_t set_equal(mp_obj_t self_in, mp_obj_t other_in) {
return set_issubset(self_in, other_in);
}
-STATIC mp_obj_t set_pop(mp_obj_t self_in) {
+static mp_obj_t set_pop(mp_obj_t self_in) {
check_set(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t obj = mp_set_remove_first(&self->set);
@@ -365,9 +365,9 @@ STATIC mp_obj_t set_pop(mp_obj_t self_in) {
}
return obj;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(set_pop_obj, set_pop);
+static MP_DEFINE_CONST_FUN_OBJ_1(set_pop_obj, set_pop);
-STATIC mp_obj_t set_remove(mp_obj_t self_in, mp_obj_t item) {
+static mp_obj_t set_remove(mp_obj_t self_in, mp_obj_t item) {
check_set(self_in);
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
if (mp_set_lookup(&self->set, item, MP_MAP_LOOKUP_REMOVE_IF_FOUND) == MP_OBJ_NULL) {
@@ -375,9 +375,9 @@ STATIC mp_obj_t set_remove(mp_obj_t self_in, mp_obj_t item) {
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_remove_obj, set_remove);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_remove_obj, set_remove);
-STATIC mp_obj_t set_symmetric_difference_update(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_symmetric_difference_update(mp_obj_t self_in, mp_obj_t other_in) {
check_set_or_frozenset(self_in); // can be frozenset due to call from set_symmetric_difference
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t iter = mp_getiter(other_in, NULL);
@@ -387,16 +387,16 @@ STATIC mp_obj_t set_symmetric_difference_update(mp_obj_t self_in, mp_obj_t other
}
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_symmetric_difference_update_obj, set_symmetric_difference_update);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_symmetric_difference_update_obj, set_symmetric_difference_update);
-STATIC mp_obj_t set_symmetric_difference(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_symmetric_difference(mp_obj_t self_in, mp_obj_t other_in) {
mp_obj_t self_out = set_copy(self_in);
set_symmetric_difference_update(self_out, other_in);
return self_out;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_symmetric_difference_obj, set_symmetric_difference);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_symmetric_difference_obj, set_symmetric_difference);
-STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
+static void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
mp_obj_t iter = mp_getiter(other_in, NULL);
mp_obj_t next;
while ((next = mp_iternext(iter)) != MP_OBJ_STOP_ITERATION) {
@@ -404,7 +404,7 @@ STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
}
}
-STATIC mp_obj_t set_update(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t set_update(size_t n_args, const mp_obj_t *args) {
check_set(args[0]);
for (size_t i = 1; i < n_args; i++) {
set_update_int(MP_OBJ_TO_PTR(args[0]), args[i]);
@@ -412,17 +412,17 @@ STATIC mp_obj_t set_update(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(set_update_obj, 1, set_update);
+static MP_DEFINE_CONST_FUN_OBJ_VAR(set_update_obj, 1, set_update);
-STATIC mp_obj_t set_union(mp_obj_t self_in, mp_obj_t other_in) {
+static mp_obj_t set_union(mp_obj_t self_in, mp_obj_t other_in) {
check_set_or_frozenset(self_in);
mp_obj_t self = set_copy(self_in);
set_update_int(MP_OBJ_TO_PTR(self), other_in);
return self;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_union_obj, set_union);
+static MP_DEFINE_CONST_FUN_OBJ_2(set_union_obj, set_union);
-STATIC mp_obj_t set_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t set_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -451,7 +451,7 @@ STATIC mp_obj_t set_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_obj_t set_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
+static mp_obj_t set_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
mp_obj_t args[] = {lhs, rhs};
#if MICROPY_PY_BUILTINS_FROZENSET
bool update = mp_obj_is_type(lhs, &mp_type_set);
@@ -517,7 +517,7 @@ STATIC mp_obj_t set_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
/******************************************************************************/
/* set constructors & public C API */
-STATIC const mp_rom_map_elem_t set_locals_dict_table[] = {
+static const mp_rom_map_elem_t set_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_add), MP_ROM_PTR(&set_add_obj) },
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&set_clear_obj) },
{ MP_ROM_QSTR(MP_QSTR_copy), MP_ROM_PTR(&set_copy_obj) },
@@ -537,7 +537,7 @@ STATIC const mp_rom_map_elem_t set_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&set_update_obj) },
{ MP_ROM_QSTR(MP_QSTR___contains__), MP_ROM_PTR(&mp_op_contains_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(set_locals_dict, set_locals_dict_table);
+static MP_DEFINE_CONST_DICT(set_locals_dict, set_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_set,
@@ -552,7 +552,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
);
#if MICROPY_PY_BUILTINS_FROZENSET
-STATIC const mp_rom_map_elem_t frozenset_locals_dict_table[] = {
+static const mp_rom_map_elem_t frozenset_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_copy), MP_ROM_PTR(&set_copy_obj) },
{ MP_ROM_QSTR(MP_QSTR_difference), MP_ROM_PTR(&set_diff_obj) },
{ MP_ROM_QSTR(MP_QSTR_intersection), MP_ROM_PTR(&set_intersect_obj) },
@@ -563,7 +563,7 @@ STATIC const mp_rom_map_elem_t frozenset_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_union), MP_ROM_PTR(&set_union_obj) },
{ MP_ROM_QSTR(MP_QSTR___contains__), MP_ROM_PTR(&mp_op_contains_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(frozenset_locals_dict, frozenset_locals_dict_table);
+static MP_DEFINE_CONST_DICT(frozenset_locals_dict, frozenset_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_frozenset,
diff --git a/py/objsingleton.c b/py/objsingleton.c
index 6537676c52..c1f102c94c 100644
--- a/py/objsingleton.c
+++ b/py/objsingleton.c
@@ -37,7 +37,7 @@ typedef struct _mp_obj_singleton_t {
qstr name;
} mp_obj_singleton_t;
-STATIC void singleton_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void singleton_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_singleton_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "%q", self->name);
diff --git a/py/objslice.c b/py/objslice.c
index dcd6af8b28..3e7575522b 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -34,7 +34,7 @@
#if MICROPY_PY_BUILTINS_SLICE
-STATIC void slice_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void slice_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_slice_t *o = MP_OBJ_TO_PTR(o_in);
mp_print_str(print, "slice(");
@@ -46,14 +46,14 @@ STATIC void slice_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
mp_print_str(print, ")");
}
-STATIC mp_obj_t slice_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
+static mp_obj_t slice_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
// Needed to explicitly opt out of default __hash__.
// REVISIT: CPython implements comparison operators for slice.
return MP_OBJ_NULL;
}
#if MICROPY_PY_BUILTINS_SLICE_INDICES
-STATIC mp_obj_t slice_indices(mp_obj_t self_in, mp_obj_t length_obj) {
+static mp_obj_t slice_indices(mp_obj_t self_in, mp_obj_t length_obj) {
mp_int_t length = mp_obj_get_int(length_obj);
mp_bound_slice_t bound_indices;
mp_obj_slice_indices(self_in, length, &bound_indices);
@@ -65,11 +65,11 @@ STATIC mp_obj_t slice_indices(mp_obj_t self_in, mp_obj_t length_obj) {
};
return mp_obj_new_tuple(3, results);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(slice_indices_obj, slice_indices);
+static MP_DEFINE_CONST_FUN_OBJ_2(slice_indices_obj, slice_indices);
#endif
#if MICROPY_PY_BUILTINS_SLICE_ATTRS
-STATIC void slice_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void slice_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// not load attribute
return;
@@ -92,10 +92,10 @@ STATIC void slice_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
#endif
#if MICROPY_PY_BUILTINS_SLICE_INDICES && !MICROPY_PY_BUILTINS_SLICE_ATTRS
-STATIC const mp_rom_map_elem_t slice_locals_dict_table[] = {
+static const mp_rom_map_elem_t slice_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_indices), MP_ROM_PTR(&slice_indices_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(slice_locals_dict, slice_locals_dict_table);
+static MP_DEFINE_CONST_DICT(slice_locals_dict, slice_locals_dict_table);
#endif
#if MICROPY_PY_BUILTINS_SLICE_ATTRS
diff --git a/py/objstr.c b/py/objstr.c
index 5dfe94ac4f..c7e4ebf53b 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -35,15 +35,15 @@
#include "py/stackctrl.h"
#if MICROPY_PY_BUILTINS_STR_OP_MODULO
-STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_t *args, mp_obj_t dict);
+static mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_t *args, mp_obj_t dict);
#endif
-STATIC mp_obj_t mp_obj_new_bytes_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf);
-STATIC NORETURN void bad_implicit_conversion(mp_obj_t self_in);
+static mp_obj_t mp_obj_new_bytes_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf);
+static NORETURN void bad_implicit_conversion(mp_obj_t self_in);
-STATIC mp_obj_t mp_obj_new_str_type_from_vstr(const mp_obj_type_t *type, vstr_t *vstr);
+static mp_obj_t mp_obj_new_str_type_from_vstr(const mp_obj_type_t *type, vstr_t *vstr);
-STATIC void str_check_arg_type(const mp_obj_type_t *self_type, const mp_obj_t arg) {
+static void str_check_arg_type(const mp_obj_type_t *self_type, const mp_obj_t arg) {
// String operations generally need the args type to match the object they're called on,
// e.g. str.find(str), byte.startswith(byte)
// with the exception that bytes may be used for bytearray and vice versa.
@@ -63,7 +63,7 @@ STATIC void str_check_arg_type(const mp_obj_type_t *self_type, const mp_obj_t ar
}
}
-STATIC void check_is_str_or_bytes(mp_obj_t self_in) {
+static void check_is_str_or_bytes(mp_obj_t self_in) {
mp_check_self(mp_obj_is_str_or_bytes(self_in));
}
@@ -135,7 +135,7 @@ void mp_str_print_json(const mp_print_t *print, const byte *str_data, size_t str
}
#endif
-STATIC void str_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void str_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
GET_STR_DATA_LEN(self_in, str_data, str_len);
#if MICROPY_PY_JSON
if (kind == PRINT_JSON) {
@@ -212,7 +212,7 @@ mp_obj_t mp_obj_str_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
}
}
-STATIC mp_obj_t bytes_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t bytes_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
#if MICROPY_CPYTHON_COMPAT
@@ -458,7 +458,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
#endif
// This is used for both bytes and 8-bit strings. This is not used for unicode strings.
-STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
const mp_obj_type_t *type = mp_obj_get_type(self_in);
GET_STR_DATA_LEN(self_in, self_data, self_len);
if (value == MP_OBJ_SENTINEL) {
@@ -484,7 +484,7 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
}
}
-STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
check_is_str_or_bytes(self_in);
const mp_obj_type_t *self_type = mp_obj_get_type(self_in);
const mp_obj_type_t *ret_type = self_type;
@@ -628,7 +628,7 @@ mp_obj_t mp_obj_str_split(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_split_obj, 1, 3, mp_obj_str_split);
#if MICROPY_PY_BUILTINS_STR_SPLITLINES
-STATIC mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+static mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_keepends };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_keepends, MP_ARG_BOOL, {.u_bool = false} },
@@ -674,7 +674,7 @@ STATIC mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t
MP_DEFINE_CONST_FUN_OBJ_KW(str_splitlines_obj, 1, str_splitlines);
#endif
-STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
if (n_args < 3) {
// If we don't have split limit, it doesn't matter from which side
// we split.
@@ -739,7 +739,7 @@ STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rsplit_obj, 1, 3, str_rsplit);
-STATIC mp_obj_t str_finder(size_t n_args, const mp_obj_t *args, int direction, bool is_index) {
+static mp_obj_t str_finder(size_t n_args, const mp_obj_t *args, int direction, bool is_index) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
check_is_str_or_bytes(args[0]);
@@ -782,28 +782,28 @@ STATIC mp_obj_t str_finder(size_t n_args, const mp_obj_t *args, int direction, b
}
}
-STATIC mp_obj_t str_find(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_find(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, false);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj, 2, 4, str_find);
-STATIC mp_obj_t str_rfind(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_rfind(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, false);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rfind_obj, 2, 4, str_rfind);
-STATIC mp_obj_t str_index(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_index(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, true);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_index_obj, 2, 4, str_index);
-STATIC mp_obj_t str_rindex(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_rindex(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, true);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rindex_obj, 2, 4, str_rindex);
// TODO: (Much) more variety in args
-STATIC mp_obj_t str_startswith(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_startswith(size_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
GET_STR_DATA_LEN(args[0], str, str_len);
size_t prefix_len;
@@ -819,7 +819,7 @@ STATIC mp_obj_t str_startswith(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_startswith_obj, 2, 3, str_startswith);
-STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], str, str_len);
size_t suffix_len;
const char *suffix = mp_obj_str_get_data(args[1], &suffix_len);
@@ -836,7 +836,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_endswith_obj, 2, 3, str_endswith);
enum { LSTRIP, RSTRIP, STRIP };
-STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) {
check_is_str_or_bytes(args[0]);
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
@@ -905,23 +905,23 @@ STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) {
return mp_obj_new_str_of_type(self_type, orig_str + first_good_char_pos, stripped_len);
}
-STATIC mp_obj_t str_strip(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_strip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(STRIP, n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_strip_obj, 1, 2, str_strip);
-STATIC mp_obj_t str_lstrip(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_lstrip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(LSTRIP, n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_lstrip_obj, 1, 2, str_lstrip);
-STATIC mp_obj_t str_rstrip(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_rstrip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(RSTRIP, n_args, args);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rstrip_obj, 1, 2, str_rstrip);
#if MICROPY_PY_BUILTINS_STR_CENTER
-STATIC mp_obj_t str_center(mp_obj_t str_in, mp_obj_t width_in) {
+static mp_obj_t str_center(mp_obj_t str_in, mp_obj_t width_in) {
GET_STR_DATA_LEN(str_in, str, str_len);
mp_uint_t width = mp_obj_get_int(width_in);
if (str_len >= width) {
@@ -940,7 +940,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(str_center_obj, str_center);
// Takes an int arg, but only parses unsigned numbers, and only changes
// *num if at least one digit was parsed.
-STATIC const char *str_to_int(const char *str, const char *top, int *num) {
+static const char *str_to_int(const char *str, const char *top, int *num) {
if (str < top && '0' <= *str && *str <= '9') {
*num = 0;
do {
@@ -952,19 +952,19 @@ STATIC const char *str_to_int(const char *str, const char *top, int *num) {
return str;
}
-STATIC bool isalignment(char ch) {
+static bool isalignment(char ch) {
return ch && strchr("<>=^", ch) != NULL;
}
-STATIC bool istype(char ch) {
+static bool istype(char ch) {
return ch && strchr("bcdeEfFgGnosxX%", ch) != NULL;
}
-STATIC bool arg_looks_integer(mp_obj_t arg) {
+static bool arg_looks_integer(mp_obj_t arg) {
return mp_obj_is_bool(arg) || mp_obj_is_int(arg);
}
-STATIC bool arg_looks_numeric(mp_obj_t arg) {
+static bool arg_looks_numeric(mp_obj_t arg) {
return arg_looks_integer(arg)
#if MICROPY_PY_BUILTINS_FLOAT
|| mp_obj_is_float(arg)
@@ -973,7 +973,7 @@ STATIC bool arg_looks_numeric(mp_obj_t arg) {
}
#if MICROPY_PY_BUILTINS_STR_OP_MODULO
-STATIC mp_obj_t arg_as_int(mp_obj_t arg) {
+static mp_obj_t arg_as_int(mp_obj_t arg) {
#if MICROPY_PY_BUILTINS_FLOAT
if (mp_obj_is_float(arg)) {
return mp_obj_new_int_from_float(mp_obj_float_get(arg));
@@ -984,7 +984,7 @@ STATIC mp_obj_t arg_as_int(mp_obj_t arg) {
#endif
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
-STATIC NORETURN void terse_str_format_value_error(void) {
+static NORETURN void terse_str_format_value_error(void) {
mp_raise_ValueError(MP_ERROR_TEXT("bad format string"));
}
#else
@@ -992,7 +992,7 @@ STATIC NORETURN void terse_str_format_value_error(void) {
#define terse_str_format_value_error()
#endif
-STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *arg_i, size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
+static vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *arg_i, size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
vstr_t vstr;
mp_print_t print;
vstr_init_print(&vstr, 16, &print);
@@ -1449,7 +1449,7 @@ mp_obj_t mp_obj_str_format(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
MP_DEFINE_CONST_FUN_OBJ_KW(str_format_obj, 1, mp_obj_str_format);
#if MICROPY_PY_BUILTINS_STR_OP_MODULO
-STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_t *args, mp_obj_t dict) {
+static mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_t *args, mp_obj_t dict) {
check_is_str_or_bytes(pattern);
GET_STR_DATA_LEN(pattern, str, len);
@@ -1657,7 +1657,7 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_
// The implementation is optimized, returning the original string if there's
// nothing to replace.
-STATIC mp_obj_t str_replace(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_replace(size_t n_args, const mp_obj_t *args) {
check_is_str_or_bytes(args[0]);
mp_int_t max_rep = -1;
@@ -1759,7 +1759,7 @@ STATIC mp_obj_t str_replace(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_replace_obj, 3, 4, str_replace);
#if MICROPY_PY_BUILTINS_STR_COUNT
-STATIC mp_obj_t str_count(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_count(size_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
check_is_str_or_bytes(args[0]);
@@ -1802,7 +1802,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_count_obj, 2, 4, str_count);
#endif
#if MICROPY_PY_BUILTINS_STR_PARTITION
-STATIC mp_obj_t str_partitioner(mp_obj_t self_in, mp_obj_t arg, int direction) {
+static mp_obj_t str_partitioner(mp_obj_t self_in, mp_obj_t arg, int direction) {
check_is_str_or_bytes(self_in);
const mp_obj_type_t *self_type = mp_obj_get_type(self_in);
str_check_arg_type(self_type, arg);
@@ -1848,19 +1848,19 @@ STATIC mp_obj_t str_partitioner(mp_obj_t self_in, mp_obj_t arg, int direction) {
return mp_obj_new_tuple(3, result);
}
-STATIC mp_obj_t str_partition(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t str_partition(mp_obj_t self_in, mp_obj_t arg) {
return str_partitioner(self_in, arg, 1);
}
MP_DEFINE_CONST_FUN_OBJ_2(str_partition_obj, str_partition);
-STATIC mp_obj_t str_rpartition(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t str_rpartition(mp_obj_t self_in, mp_obj_t arg) {
return str_partitioner(self_in, arg, -1);
}
MP_DEFINE_CONST_FUN_OBJ_2(str_rpartition_obj, str_rpartition);
#endif
// Supposedly not too critical operations, so optimize for code size
-STATIC mp_obj_t str_caseconv(unichar (*op)(unichar), mp_obj_t self_in) {
+static mp_obj_t str_caseconv(unichar (*op)(unichar), mp_obj_t self_in) {
GET_STR_DATA_LEN(self_in, self_data, self_len);
vstr_t vstr;
vstr_init_len(&vstr, self_len);
@@ -1871,17 +1871,17 @@ STATIC mp_obj_t str_caseconv(unichar (*op)(unichar), mp_obj_t self_in) {
return mp_obj_new_str_type_from_vstr(mp_obj_get_type(self_in), &vstr);
}
-STATIC mp_obj_t str_lower(mp_obj_t self_in) {
+static mp_obj_t str_lower(mp_obj_t self_in) {
return str_caseconv(unichar_tolower, self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(str_lower_obj, str_lower);
-STATIC mp_obj_t str_upper(mp_obj_t self_in) {
+static mp_obj_t str_upper(mp_obj_t self_in) {
return str_caseconv(unichar_toupper, self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(str_upper_obj, str_upper);
-STATIC mp_obj_t str_uni_istype(bool (*f)(unichar), mp_obj_t self_in) {
+static mp_obj_t str_uni_istype(bool (*f)(unichar), mp_obj_t self_in) {
GET_STR_DATA_LEN(self_in, self_data, self_len);
if (self_len == 0) {
@@ -1914,27 +1914,27 @@ STATIC mp_obj_t str_uni_istype(bool (*f)(unichar), mp_obj_t self_in) {
return mp_const_true;
}
-STATIC mp_obj_t str_isspace(mp_obj_t self_in) {
+static mp_obj_t str_isspace(mp_obj_t self_in) {
return str_uni_istype(unichar_isspace, self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(str_isspace_obj, str_isspace);
-STATIC mp_obj_t str_isalpha(mp_obj_t self_in) {
+static mp_obj_t str_isalpha(mp_obj_t self_in) {
return str_uni_istype(unichar_isalpha, self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(str_isalpha_obj, str_isalpha);
-STATIC mp_obj_t str_isdigit(mp_obj_t self_in) {
+static mp_obj_t str_isdigit(mp_obj_t self_in) {
return str_uni_istype(unichar_isdigit, self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(str_isdigit_obj, str_isdigit);
-STATIC mp_obj_t str_isupper(mp_obj_t self_in) {
+static mp_obj_t str_isupper(mp_obj_t self_in) {
return str_uni_istype(unichar_isupper, self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(str_isupper_obj, str_isupper);
-STATIC mp_obj_t str_islower(mp_obj_t self_in) {
+static mp_obj_t str_islower(mp_obj_t self_in) {
return str_uni_istype(unichar_islower, self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(str_islower_obj, str_islower);
@@ -1943,7 +1943,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(str_islower_obj, str_islower);
// These methods are superfluous in the presence of str() and bytes()
// constructors.
// TODO: should accept kwargs too
-STATIC mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) {
mp_obj_t new_args[2];
if (n_args == 1) {
new_args[0] = args[0];
@@ -1956,7 +1956,7 @@ STATIC mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_decode_obj, 1, 3, bytes_decode);
// TODO: should accept kwargs too
-STATIC mp_obj_t str_encode(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t str_encode(size_t n_args, const mp_obj_t *args) {
mp_obj_t new_args[2];
if (n_args == 1) {
new_args[0] = args[0];
@@ -2038,13 +2038,13 @@ mp_obj_t mp_obj_bytes_fromhex(mp_obj_t type_in, mp_obj_t data) {
return mp_obj_new_str_type_from_vstr(MP_OBJ_TO_PTR(type_in), &vstr);
}
-STATIC mp_obj_t bytes_hex_as_str(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t bytes_hex_as_str(size_t n_args, const mp_obj_t *args) {
return mp_obj_bytes_hex(n_args, args, &mp_type_str);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_hex_as_str_obj, 1, 2, bytes_hex_as_str);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_hex_as_str_obj, 1, 2, bytes_hex_as_str);
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(bytes_fromhex_obj, mp_obj_bytes_fromhex);
-STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bytes_fromhex_classmethod_obj, MP_ROM_PTR(&bytes_fromhex_obj));
+static MP_DEFINE_CONST_FUN_OBJ_2(bytes_fromhex_obj, mp_obj_bytes_fromhex);
+static MP_DEFINE_CONST_CLASSMETHOD_OBJ(bytes_fromhex_classmethod_obj, MP_ROM_PTR(&bytes_fromhex_obj));
#endif // MICROPY_PY_BUILTINS_BYTES_HEX
mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
@@ -2068,7 +2068,7 @@ void mp_obj_str_set_data(mp_obj_str_t *str, const byte *data, size_t len) {
// This locals table is used for the following types: str, bytes, bytearray, array.array.
// Each type takes a different section (start to end offset) of this table.
-STATIC const mp_rom_map_elem_t array_bytearray_str_bytes_locals_table[] = {
+static const mp_rom_map_elem_t array_bytearray_str_bytes_locals_table[] = {
#if MICROPY_PY_ARRAY || MICROPY_PY_BUILTINS_BYTEARRAY
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&mp_obj_array_append_obj) },
{ MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&mp_obj_array_extend_obj) },
@@ -2168,7 +2168,7 @@ MP_DEFINE_CONST_DICT_WITH_SIZE(mp_obj_memoryview_locals_dict,
#endif
#if !MICROPY_PY_BUILTINS_STR_UNICODE
-STATIC mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf);
+static mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_str,
@@ -2240,7 +2240,7 @@ mp_obj_t mp_obj_new_str_via_qstr(const char *data, size_t len) {
// Create a str/bytes object from the given vstr. The vstr buffer is resized to
// the exact length required and then reused for the str/bytes object. The vstr
// is cleared and can safely be passed to vstr_free if it was heap allocated.
-STATIC mp_obj_t mp_obj_new_str_type_from_vstr(const mp_obj_type_t *type, vstr_t *vstr) {
+static mp_obj_t mp_obj_new_str_type_from_vstr(const mp_obj_type_t *type, vstr_t *vstr) {
// if not a bytes object, look if a qstr with this data already exists
if (type == &mp_type_str) {
qstr q = qstr_find_strn(vstr->buf, vstr->len);
@@ -2342,7 +2342,7 @@ bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2) {
}
}
-STATIC NORETURN void bad_implicit_conversion(mp_obj_t self_in) {
+static NORETURN void bad_implicit_conversion(mp_obj_t self_in) {
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE
mp_raise_TypeError(MP_ERROR_TEXT("can't convert to str implicitly"));
#else
@@ -2411,7 +2411,7 @@ typedef struct _mp_obj_str8_it_t {
} mp_obj_str8_it_t;
#if !MICROPY_PY_BUILTINS_STR_UNICODE
-STATIC mp_obj_t str_it_iternext(mp_obj_t self_in) {
+static mp_obj_t str_it_iternext(mp_obj_t self_in) {
mp_obj_str8_it_t *self = MP_OBJ_TO_PTR(self_in);
GET_STR_DATA_LEN(self->str, str, len);
if (self->cur < len) {
@@ -2423,7 +2423,7 @@ STATIC mp_obj_t str_it_iternext(mp_obj_t self_in) {
}
}
-STATIC mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_str8_it_t) <= sizeof(mp_obj_iter_buf_t));
mp_obj_str8_it_t *o = (mp_obj_str8_it_t *)iter_buf;
o->base.type = &mp_type_polymorph_iter;
@@ -2434,7 +2434,7 @@ STATIC mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_bu
}
#endif
-STATIC mp_obj_t bytes_it_iternext(mp_obj_t self_in) {
+static mp_obj_t bytes_it_iternext(mp_obj_t self_in) {
mp_obj_str8_it_t *self = MP_OBJ_TO_PTR(self_in);
GET_STR_DATA_LEN(self->str, str, len);
if (self->cur < len) {
diff --git a/py/objstringio.c b/py/objstringio.c
index a3c66ed010..a4dc8cfc91 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -36,7 +36,7 @@
#if MICROPY_PY_IO
#if MICROPY_CPYTHON_COMPAT
-STATIC void check_stringio_is_open(const mp_obj_stringio_t *o) {
+static void check_stringio_is_open(const mp_obj_stringio_t *o) {
if (o->vstr == NULL) {
mp_raise_ValueError(MP_ERROR_TEXT("I/O operation on closed file"));
}
@@ -45,13 +45,13 @@ STATIC void check_stringio_is_open(const mp_obj_stringio_t *o) {
#define check_stringio_is_open(o)
#endif
-STATIC void stringio_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void stringio_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_stringio_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, self->base.type == &mp_type_stringio ? "<io.StringIO 0x%x>" : "<io.BytesIO 0x%x>", self);
}
-STATIC mp_uint_t stringio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stringio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
(void)errcode;
mp_obj_stringio_t *o = MP_OBJ_TO_PTR(o_in);
check_stringio_is_open(o);
@@ -67,7 +67,7 @@ STATIC mp_uint_t stringio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *er
return size;
}
-STATIC void stringio_copy_on_write(mp_obj_stringio_t *o) {
+static void stringio_copy_on_write(mp_obj_stringio_t *o) {
const void *buf = o->vstr->buf;
o->vstr->buf = m_new(char, o->vstr->len);
o->vstr->fixed_buf = false;
@@ -75,7 +75,7 @@ STATIC void stringio_copy_on_write(mp_obj_stringio_t *o) {
memcpy(o->vstr->buf, buf, o->vstr->len);
}
-STATIC mp_uint_t stringio_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stringio_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
(void)errcode;
mp_obj_stringio_t *o = MP_OBJ_TO_PTR(o_in);
check_stringio_is_open(o);
@@ -109,7 +109,7 @@ STATIC mp_uint_t stringio_write(mp_obj_t o_in, const void *buf, mp_uint_t size,
return size;
}
-STATIC mp_uint_t stringio_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t stringio_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode;
mp_obj_stringio_t *o = MP_OBJ_TO_PTR(o_in);
switch (request) {
@@ -162,22 +162,22 @@ STATIC mp_uint_t stringio_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
#define STREAM_TO_CONTENT_TYPE(o) (((o)->base.type == &mp_type_stringio) ? &mp_type_str : &mp_type_bytes)
-STATIC mp_obj_t stringio_getvalue(mp_obj_t self_in) {
+static mp_obj_t stringio_getvalue(mp_obj_t self_in) {
mp_obj_stringio_t *self = MP_OBJ_TO_PTR(self_in);
check_stringio_is_open(self);
// TODO: Try to avoid copying string
return mp_obj_new_str_of_type(STREAM_TO_CONTENT_TYPE(self), (byte *)self->vstr->buf, self->vstr->len);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_getvalue_obj, stringio_getvalue);
+static MP_DEFINE_CONST_FUN_OBJ_1(stringio_getvalue_obj, stringio_getvalue);
-STATIC mp_obj_stringio_t *stringio_new(const mp_obj_type_t *type) {
+static mp_obj_stringio_t *stringio_new(const mp_obj_type_t *type) {
mp_obj_stringio_t *o = mp_obj_malloc(mp_obj_stringio_t, type);
o->pos = 0;
o->ref_obj = MP_OBJ_NULL;
return o;
}
-STATIC mp_obj_t stringio_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t stringio_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)n_kw; // TODO check n_kw==0
mp_uint_t sz = 16;
@@ -215,7 +215,7 @@ STATIC mp_obj_t stringio_make_new(const mp_obj_type_t *type_in, size_t n_args, s
return MP_OBJ_FROM_PTR(o);
}
-STATIC const mp_rom_map_elem_t stringio_locals_dict_table[] = {
+static const mp_rom_map_elem_t stringio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
@@ -229,9 +229,9 @@ STATIC const mp_rom_map_elem_t stringio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&mp_stream___exit___obj) },
};
-STATIC MP_DEFINE_CONST_DICT(stringio_locals_dict, stringio_locals_dict_table);
+static MP_DEFINE_CONST_DICT(stringio_locals_dict, stringio_locals_dict_table);
-STATIC const mp_stream_p_t stringio_stream_p = {
+static const mp_stream_p_t stringio_stream_p = {
.read = stringio_read,
.write = stringio_write,
.ioctl = stringio_ioctl,
@@ -249,7 +249,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
);
#if MICROPY_PY_IO_BYTESIO
-STATIC const mp_stream_p_t bytesio_stream_p = {
+static const mp_stream_p_t bytesio_stream_p = {
.read = stringio_read,
.write = stringio_write,
.ioctl = stringio_ioctl,
diff --git a/py/objstrunicode.c b/py/objstrunicode.c
index cbc797de29..d7ce4fca0e 100644
--- a/py/objstrunicode.c
+++ b/py/objstrunicode.c
@@ -34,12 +34,12 @@
#if MICROPY_PY_BUILTINS_STR_UNICODE
-STATIC mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf);
+static mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf);
/******************************************************************************/
/* str */
-STATIC void uni_print_quoted(const mp_print_t *print, const byte *str_data, uint str_len) {
+static void uni_print_quoted(const mp_print_t *print, const byte *str_data, uint str_len) {
// this escapes characters, but it will be very slow to print (calling print many times)
bool has_single_quote = false;
bool has_double_quote = false;
@@ -83,7 +83,7 @@ STATIC void uni_print_quoted(const mp_print_t *print, const byte *str_data, uint
mp_printf(print, "%c", quote_char);
}
-STATIC void uni_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void uni_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
GET_STR_DATA_LEN(self_in, str_data, str_len);
#if MICROPY_PY_JSON
if (kind == PRINT_JSON) {
@@ -98,7 +98,7 @@ STATIC void uni_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
}
}
-STATIC mp_obj_t uni_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t uni_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
GET_STR_DATA_LEN(self_in, str_data, str_len);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -178,7 +178,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
return s;
}
-STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
const mp_obj_type_t *type = mp_obj_get_type(self_in);
assert(type == &mp_type_str);
GET_STR_DATA_LEN(self_in, self_data, self_len);
@@ -253,7 +253,7 @@ typedef struct _mp_obj_str_it_t {
size_t cur;
} mp_obj_str_it_t;
-STATIC mp_obj_t str_it_iternext(mp_obj_t self_in) {
+static mp_obj_t str_it_iternext(mp_obj_t self_in) {
mp_obj_str_it_t *self = MP_OBJ_TO_PTR(self_in);
GET_STR_DATA_LEN(self->str, str, len);
if (self->cur < len) {
@@ -267,7 +267,7 @@ STATIC mp_obj_t str_it_iternext(mp_obj_t self_in) {
}
}
-STATIC mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf) {
+static mp_obj_t mp_obj_new_str_iterator(mp_obj_t str, mp_obj_iter_buf_t *iter_buf) {
assert(sizeof(mp_obj_str_it_t) <= sizeof(mp_obj_iter_buf_t));
mp_obj_str_it_t *o = (mp_obj_str_it_t *)iter_buf;
o->base.type = &mp_type_polymorph_iter;
diff --git a/py/objtuple.c b/py/objtuple.c
index cb1d7cd388..2cbcc0e502 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -65,7 +65,7 @@ void mp_obj_tuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
}
}
-STATIC mp_obj_t mp_obj_tuple_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_obj_tuple_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 0, 1, false);
@@ -107,7 +107,7 @@ STATIC mp_obj_t mp_obj_tuple_make_new(const mp_obj_type_t *type_in, size_t n_arg
}
// Don't pass MP_BINARY_OP_NOT_EQUAL here
-STATIC mp_obj_t tuple_cmp_helper(mp_uint_t op, mp_obj_t self_in, mp_obj_t another_in) {
+static mp_obj_t tuple_cmp_helper(mp_uint_t op, mp_obj_t self_in, mp_obj_t another_in) {
mp_check_self(mp_obj_is_tuple_compatible(self_in));
const mp_obj_type_t *another_type = mp_obj_get_type(another_in);
mp_obj_tuple_t *self = MP_OBJ_TO_PTR(self_in);
@@ -203,26 +203,26 @@ mp_obj_t mp_obj_tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
}
}
-STATIC mp_obj_t tuple_count(mp_obj_t self_in, mp_obj_t value) {
+static mp_obj_t tuple_count(mp_obj_t self_in, mp_obj_t value) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_tuple));
mp_obj_tuple_t *self = MP_OBJ_TO_PTR(self_in);
return mp_seq_count_obj(self->items, self->len, value);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(tuple_count_obj, tuple_count);
+static MP_DEFINE_CONST_FUN_OBJ_2(tuple_count_obj, tuple_count);
-STATIC mp_obj_t tuple_index(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t tuple_index(size_t n_args, const mp_obj_t *args) {
mp_check_self(mp_obj_is_type(args[0], &mp_type_tuple));
mp_obj_tuple_t *self = MP_OBJ_TO_PTR(args[0]);
return mp_seq_index_obj(self->items, self->len, n_args, args);
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(tuple_index_obj, 2, 4, tuple_index);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(tuple_index_obj, 2, 4, tuple_index);
-STATIC const mp_rom_map_elem_t tuple_locals_dict_table[] = {
+static const mp_rom_map_elem_t tuple_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&tuple_count_obj) },
{ MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&tuple_index_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(tuple_locals_dict, tuple_locals_dict_table);
+static MP_DEFINE_CONST_DICT(tuple_locals_dict, tuple_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_tuple,
@@ -277,7 +277,7 @@ typedef struct _mp_obj_tuple_it_t {
size_t cur;
} mp_obj_tuple_it_t;
-STATIC mp_obj_t tuple_it_iternext(mp_obj_t self_in) {
+static mp_obj_t tuple_it_iternext(mp_obj_t self_in) {
mp_obj_tuple_it_t *self = MP_OBJ_TO_PTR(self_in);
if (self->cur < self->tuple->len) {
mp_obj_t o_out = self->tuple->items[self->cur];
diff --git a/py/objtype.c b/py/objtype.c
index 694db3008f..8b2eb6de04 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -44,12 +44,12 @@
#define ENABLE_SPECIAL_ACCESSORS \
(MICROPY_PY_DESCRIPTORS || MICROPY_PY_DELATTR_SETATTR || MICROPY_PY_BUILTINS_PROPERTY)
-STATIC mp_obj_t static_class_method_make_new(const mp_obj_type_t *self_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
+static mp_obj_t static_class_method_make_new(const mp_obj_type_t *self_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
/******************************************************************************/
// instance object
-STATIC int instance_count_native_bases(const mp_obj_type_t *type, const mp_obj_type_t **last_native_base) {
+static int instance_count_native_bases(const mp_obj_type_t *type, const mp_obj_type_t **last_native_base) {
int count = 0;
for (;;) {
if (type == &mp_type_object) {
@@ -84,17 +84,17 @@ STATIC int instance_count_native_bases(const mp_obj_type_t *type, const mp_obj_t
// This wrapper function is allows a subclass of a native type to call the
// __init__() method (corresponding to type->make_new) of the native type.
-STATIC mp_obj_t native_base_init_wrapper(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t native_base_init_wrapper(size_t n_args, const mp_obj_t *args) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(args[0]);
const mp_obj_type_t *native_base = NULL;
instance_count_native_bases(self->base.type, &native_base);
self->subobj[0] = MP_OBJ_TYPE_GET_SLOT(native_base, make_new)(native_base, n_args - 1, 0, args + 1);
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(native_base_init_wrapper_obj, 1, MP_OBJ_FUN_ARGS_MAX, native_base_init_wrapper);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(native_base_init_wrapper_obj, 1, MP_OBJ_FUN_ARGS_MAX, native_base_init_wrapper);
#if !MICROPY_CPYTHON_COMPAT
-STATIC
+static
#endif
mp_obj_instance_t *mp_obj_new_instance(const mp_obj_type_t *class, const mp_obj_type_t **native_base) {
size_t num_native_bases = instance_count_native_bases(class, native_base);
@@ -132,7 +132,7 @@ struct class_lookup_data {
bool is_type;
};
-STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_type_t *type) {
+static void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_type_t *type) {
assert(lookup->dest[0] == MP_OBJ_NULL);
assert(lookup->dest[1] == MP_OBJ_NULL);
for (;;) {
@@ -235,7 +235,7 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_t
}
}
-STATIC void instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
qstr meth = (kind == PRINT_STR) ? MP_QSTR___str__ : MP_QSTR___repr__;
mp_obj_t member[2] = {MP_OBJ_NULL};
@@ -277,7 +277,7 @@ STATIC void instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_k
mp_printf(print, "<%s object at %p>", mp_obj_get_type_str(self_in), self);
}
-STATIC mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, size_t n_kw, const mp_obj_t *args) {
assert(mp_obj_is_instance_type(self));
// look for __new__ function
@@ -392,7 +392,7 @@ const byte mp_unary_op_method_name[MP_UNARY_OP_NUM_RUNTIME] = {
#endif
};
-STATIC mp_obj_t instance_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t instance_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
#if MICROPY_PY_SYS_GETSIZEOF
@@ -530,7 +530,7 @@ const byte mp_binary_op_method_name[MP_BINARY_OP_NUM_RUNTIME] = {
#endif
};
-STATIC mp_obj_t instance_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t instance_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
// Note: For ducktyping, CPython does not look in the instance members or use
// __getattr__ or __getattribute__. It only looks in the class dictionary.
mp_obj_instance_t *lhs = MP_OBJ_TO_PTR(lhs_in);
@@ -572,7 +572,7 @@ STATIC mp_obj_t instance_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t
return res;
}
-STATIC void mp_obj_instance_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void mp_obj_instance_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
// logic: look in instance members then class locals
assert(mp_obj_is_instance_type(mp_obj_get_type(self_in)));
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
@@ -669,7 +669,7 @@ STATIC void mp_obj_instance_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *des
}
}
-STATIC bool mp_obj_instance_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
+static bool mp_obj_instance_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
if (!(self->base.type->flags & MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS)) {
@@ -792,7 +792,7 @@ skip_special_accessors:
}
}
-STATIC void mp_obj_instance_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void mp_obj_instance_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] == MP_OBJ_NULL) {
mp_obj_instance_load_attr(self_in, attr, dest);
} else {
@@ -802,7 +802,7 @@ STATIC void mp_obj_instance_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
}
-STATIC mp_obj_t instance_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
+static mp_obj_t instance_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t member[4] = {MP_OBJ_NULL, MP_OBJ_NULL, index, value};
struct class_lookup_data lookup = {
@@ -837,7 +837,7 @@ STATIC mp_obj_t instance_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value
}
}
-STATIC mp_obj_t mp_obj_instance_get_call(mp_obj_t self_in, mp_obj_t *member) {
+static mp_obj_t mp_obj_instance_get_call(mp_obj_t self_in, mp_obj_t *member) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
struct class_lookup_data lookup = {
.obj = self,
@@ -903,7 +903,7 @@ mp_obj_t mp_obj_instance_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf)
}
}
-STATIC mp_int_t instance_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
+static mp_int_t instance_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t member[2] = {MP_OBJ_NULL};
struct class_lookup_data lookup = {
@@ -929,7 +929,7 @@ STATIC mp_int_t instance_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo,
// - creating a new class (a new type) creates a new mp_obj_type_t
#if ENABLE_SPECIAL_ACCESSORS
-STATIC bool check_for_special_accessors(mp_obj_t key, mp_obj_t value) {
+static bool check_for_special_accessors(mp_obj_t key, mp_obj_t value) {
#if MICROPY_PY_DELATTR_SETATTR
if (key == MP_OBJ_NEW_QSTR(MP_QSTR___setattr__) || key == MP_OBJ_NEW_QSTR(MP_QSTR___delattr__)) {
return true;
@@ -956,13 +956,13 @@ STATIC bool check_for_special_accessors(mp_obj_t key, mp_obj_t value) {
}
#endif
-STATIC void type_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void type_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_type_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<class '%q'>", self->name);
}
-STATIC mp_obj_t type_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t type_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
mp_arg_check_num(n_args, n_kw, 1, 3, false);
@@ -982,7 +982,7 @@ STATIC mp_obj_t type_make_new(const mp_obj_type_t *type_in, size_t n_args, size_
}
}
-STATIC mp_obj_t type_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t type_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// instantiate an instance of a class
mp_obj_type_t *self = MP_OBJ_TO_PTR(self_in);
@@ -1002,7 +1002,7 @@ STATIC mp_obj_t type_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp
return o;
}
-STATIC void type_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void type_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
assert(mp_obj_is_type(self_in, &mp_type_type));
mp_obj_type_t *self = MP_OBJ_TO_PTR(self_in);
@@ -1235,7 +1235,7 @@ typedef struct _mp_obj_super_t {
mp_obj_t obj;
} mp_obj_super_t;
-STATIC void super_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void super_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_super_t *self = MP_OBJ_TO_PTR(self_in);
mp_print_str(print, "<super: ");
@@ -1245,7 +1245,7 @@ STATIC void super_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind
mp_print_str(print, ">");
}
-STATIC mp_obj_t super_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t super_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
(void)type_in;
// 0 arguments are turned into 2 in the compiler
// 1 argument is not yet implemented
@@ -1258,7 +1258,7 @@ STATIC mp_obj_t super_make_new(const mp_obj_type_t *type_in, size_t n_args, size
return MP_OBJ_FROM_PTR(o);
}
-STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// not load attribute
return;
@@ -1386,7 +1386,7 @@ bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo) {
}
}
-STATIC mp_obj_t mp_obj_is_subclass(mp_obj_t object, mp_obj_t classinfo) {
+static mp_obj_t mp_obj_is_subclass(mp_obj_t object, mp_obj_t classinfo) {
size_t len;
mp_obj_t *items;
if (mp_obj_is_type(classinfo, &mp_type_type)) {
@@ -1407,7 +1407,7 @@ STATIC mp_obj_t mp_obj_is_subclass(mp_obj_t object, mp_obj_t classinfo) {
return mp_const_false;
}
-STATIC mp_obj_t mp_builtin_issubclass(mp_obj_t object, mp_obj_t classinfo) {
+static mp_obj_t mp_builtin_issubclass(mp_obj_t object, mp_obj_t classinfo) {
if (!mp_obj_is_type(object, &mp_type_type)) {
mp_raise_TypeError(MP_ERROR_TEXT("issubclass() arg 1 must be a class"));
}
@@ -1416,7 +1416,7 @@ STATIC mp_obj_t mp_builtin_issubclass(mp_obj_t object, mp_obj_t classinfo) {
MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_issubclass_obj, mp_builtin_issubclass);
-STATIC mp_obj_t mp_builtin_isinstance(mp_obj_t object, mp_obj_t classinfo) {
+static mp_obj_t mp_builtin_isinstance(mp_obj_t object, mp_obj_t classinfo) {
return mp_obj_is_subclass(MP_OBJ_FROM_PTR(mp_obj_get_type(object)), classinfo);
}
@@ -1438,7 +1438,7 @@ mp_obj_t mp_obj_cast_to_native_base(mp_obj_t self_in, mp_const_obj_t native_type
/******************************************************************************/
// staticmethod and classmethod types (probably should go in a different file)
-STATIC mp_obj_t static_class_method_make_new(const mp_obj_type_t *self, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t static_class_method_make_new(const mp_obj_type_t *self, size_t n_args, size_t n_kw, const mp_obj_t *args) {
assert(self == &mp_type_staticmethod || self == &mp_type_classmethod);
mp_arg_check_num(n_args, n_kw, 1, 1, false);
diff --git a/py/objzip.c b/py/objzip.c
index 7b4ae7548e..dd2b39ee07 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -36,7 +36,7 @@ typedef struct _mp_obj_zip_t {
mp_obj_t iters[];
} mp_obj_zip_t;
-STATIC mp_obj_t zip_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t zip_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, MP_OBJ_FUN_ARGS_MAX, false);
mp_obj_zip_t *o = mp_obj_malloc_var(mp_obj_zip_t, iters, mp_obj_t, n_args, type);
@@ -47,7 +47,7 @@ STATIC mp_obj_t zip_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t zip_iternext(mp_obj_t self_in) {
+static mp_obj_t zip_iternext(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &mp_type_zip));
mp_obj_zip_t *self = MP_OBJ_TO_PTR(self_in);
if (self->n_iters == 0) {
diff --git a/py/opmethods.c b/py/opmethods.c
index c3931fd358..32ab187b05 100644
--- a/py/opmethods.c
+++ b/py/opmethods.c
@@ -27,28 +27,28 @@
#include "py/obj.h"
#include "py/builtin.h"
-STATIC mp_obj_t op_getitem(mp_obj_t self_in, mp_obj_t key_in) {
+static mp_obj_t op_getitem(mp_obj_t self_in, mp_obj_t key_in) {
const mp_obj_type_t *type = mp_obj_get_type(self_in);
// Note: assumes type must have subscr (only used by dict).
return MP_OBJ_TYPE_GET_SLOT(type, subscr)(self_in, key_in, MP_OBJ_SENTINEL);
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_op_getitem_obj, op_getitem);
-STATIC mp_obj_t op_setitem(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
+static mp_obj_t op_setitem(mp_obj_t self_in, mp_obj_t key_in, mp_obj_t value_in) {
const mp_obj_type_t *type = mp_obj_get_type(self_in);
// Note: assumes type must have subscr (only used by dict).
return MP_OBJ_TYPE_GET_SLOT(type, subscr)(self_in, key_in, value_in);
}
MP_DEFINE_CONST_FUN_OBJ_3(mp_op_setitem_obj, op_setitem);
-STATIC mp_obj_t op_delitem(mp_obj_t self_in, mp_obj_t key_in) {
+static mp_obj_t op_delitem(mp_obj_t self_in, mp_obj_t key_in) {
const mp_obj_type_t *type = mp_obj_get_type(self_in);
// Note: assumes type must have subscr (only used by dict).
return MP_OBJ_TYPE_GET_SLOT(type, subscr)(self_in, key_in, MP_OBJ_NULL);
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_op_delitem_obj, op_delitem);
-STATIC mp_obj_t op_contains(mp_obj_t lhs_in, mp_obj_t rhs_in) {
+static mp_obj_t op_contains(mp_obj_t lhs_in, mp_obj_t rhs_in) {
const mp_obj_type_t *type = mp_obj_get_type(lhs_in);
// Note: assumes type must have binary_op (only used by set/frozenset).
return MP_OBJ_TYPE_GET_SLOT(type, binary_op)(MP_BINARY_OP_CONTAINS, lhs_in, rhs_in);
diff --git a/py/parse.c b/py/parse.c
index e86103ed8e..54be8b97d0 100644
--- a/py/parse.c
+++ b/py/parse.c
@@ -75,7 +75,7 @@ enum {
};
// Define an array of actions corresponding to each rule
-STATIC const uint8_t rule_act_table[] = {
+static const uint8_t rule_act_table[] = {
#define or(n) (RULE_ACT_OR | n)
#define and(n) (RULE_ACT_AND | n)
#define and_ident(n) (RULE_ACT_AND | n | RULE_ACT_ALLOW_IDENT)
@@ -108,7 +108,7 @@ STATIC const uint8_t rule_act_table[] = {
};
// Define the argument data for each rule, as a combined array
-STATIC const uint16_t rule_arg_combined_table[] = {
+static const uint16_t rule_arg_combined_table[] = {
#define tok(t) (RULE_ARG_TOK | MP_TOKEN_##t)
#define rule(r) (RULE_ARG_RULE | RULE_##r)
#define opt_rule(r) (RULE_ARG_OPT_RULE | RULE_##r)
@@ -161,7 +161,7 @@ enum {
// data, which indexes rule_arg_combined_table. The offsets require 9 bits of
// storage but only the lower 8 bits are stored here. The 9th bit is computed
// in get_rule_arg using the FIRST_RULE_WITH_OFFSET_ABOVE_255 constant.
-STATIC const uint8_t rule_arg_offset_table[] = {
+static const uint8_t rule_arg_offset_table[] = {
#define DEF_RULE(rule, comp, kind, ...) RULE_ARG_OFFSET(rule, __VA_ARGS__) & 0xff,
#define DEF_RULE_NC(rule, kind, ...)
#include "py/grammar.h"
@@ -191,7 +191,7 @@ static const size_t FIRST_RULE_WITH_OFFSET_ABOVE_255 =
#if MICROPY_DEBUG_PARSE_RULE_NAME
// Define an array of rule names corresponding to each rule
-STATIC const char *const rule_name_table[] = {
+static const char *const rule_name_table[] = {
#define DEF_RULE(rule, comp, kind, ...) #rule,
#define DEF_RULE_NC(rule, kind, ...)
#include "py/grammar.h"
@@ -242,9 +242,9 @@ typedef struct _parser_t {
#endif
} parser_t;
-STATIC void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args);
+static void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args);
-STATIC const uint16_t *get_rule_arg(uint8_t r_id) {
+static const uint16_t *get_rule_arg(uint8_t r_id) {
size_t off = rule_arg_offset_table[r_id];
if (r_id >= FIRST_RULE_WITH_OFFSET_ABOVE_255) {
off |= 0x100;
@@ -252,7 +252,7 @@ STATIC const uint16_t *get_rule_arg(uint8_t r_id) {
return &rule_arg_combined_table[off];
}
-STATIC void *parser_alloc(parser_t *parser, size_t num_bytes) {
+static void *parser_alloc(parser_t *parser, size_t num_bytes) {
// use a custom memory allocator to store parse nodes sequentially in large chunks
mp_parse_chunk_t *chunk = parser->cur_chunk;
@@ -294,7 +294,7 @@ STATIC void *parser_alloc(parser_t *parser, size_t num_bytes) {
}
#if MICROPY_COMP_CONST_TUPLE
-STATIC void parser_free_parse_node_struct(parser_t *parser, mp_parse_node_struct_t *pns) {
+static void parser_free_parse_node_struct(parser_t *parser, mp_parse_node_struct_t *pns) {
mp_parse_chunk_t *chunk = parser->cur_chunk;
if (chunk->data <= (byte *)pns && (byte *)pns < chunk->data + chunk->union_.used) {
size_t num_bytes = sizeof(mp_parse_node_struct_t) + sizeof(mp_parse_node_t) * MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
@@ -303,7 +303,7 @@ STATIC void parser_free_parse_node_struct(parser_t *parser, mp_parse_node_struct
}
#endif
-STATIC void push_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t arg_i) {
+static void push_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t arg_i) {
if (parser->rule_stack_top >= parser->rule_stack_alloc) {
rule_stack_t *rs = m_renew(rule_stack_t, parser->rule_stack, parser->rule_stack_alloc, parser->rule_stack_alloc + MICROPY_ALLOC_PARSE_RULE_INC);
parser->rule_stack = rs;
@@ -315,13 +315,13 @@ STATIC void push_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t
rs->arg_i = arg_i;
}
-STATIC void push_rule_from_arg(parser_t *parser, size_t arg) {
+static void push_rule_from_arg(parser_t *parser, size_t arg) {
assert((arg & RULE_ARG_KIND_MASK) == RULE_ARG_RULE || (arg & RULE_ARG_KIND_MASK) == RULE_ARG_OPT_RULE);
size_t rule_id = arg & RULE_ARG_ARG_MASK;
push_rule(parser, parser->lexer->tok_line, rule_id, 0);
}
-STATIC uint8_t pop_rule(parser_t *parser, size_t *arg_i, size_t *src_line) {
+static uint8_t pop_rule(parser_t *parser, size_t *arg_i, size_t *src_line) {
parser->rule_stack_top -= 1;
uint8_t rule_id = parser->rule_stack[parser->rule_stack_top].rule_id;
*arg_i = parser->rule_stack[parser->rule_stack_top].arg_i;
@@ -330,7 +330,7 @@ STATIC uint8_t pop_rule(parser_t *parser, size_t *arg_i, size_t *src_line) {
}
#if MICROPY_COMP_CONST_TUPLE
-STATIC uint8_t peek_rule(parser_t *parser, size_t n) {
+static uint8_t peek_rule(parser_t *parser, size_t n) {
assert(parser->rule_stack_top > n);
return parser->rule_stack[parser->rule_stack_top - 1 - n].rule_id;
}
@@ -350,7 +350,7 @@ bool mp_parse_node_get_int_maybe(mp_parse_node_t pn, mp_obj_t *o) {
}
#if MICROPY_COMP_CONST_TUPLE || MICROPY_COMP_CONST
-STATIC bool mp_parse_node_is_const(mp_parse_node_t pn) {
+static bool mp_parse_node_is_const(mp_parse_node_t pn) {
if (MP_PARSE_NODE_IS_SMALL_INT(pn)) {
// Small integer.
return true;
@@ -377,7 +377,7 @@ STATIC bool mp_parse_node_is_const(mp_parse_node_t pn) {
return false;
}
-STATIC mp_obj_t mp_parse_node_convert_to_obj(mp_parse_node_t pn) {
+static mp_obj_t mp_parse_node_convert_to_obj(mp_parse_node_t pn) {
assert(mp_parse_node_is_const(pn));
if (MP_PARSE_NODE_IS_SMALL_INT(pn)) {
mp_int_t arg = MP_PARSE_NODE_LEAF_SMALL_INT(pn);
@@ -419,7 +419,7 @@ STATIC mp_obj_t mp_parse_node_convert_to_obj(mp_parse_node_t pn) {
}
#endif
-STATIC bool parse_node_is_const_bool(mp_parse_node_t pn, bool value) {
+static bool parse_node_is_const_bool(mp_parse_node_t pn, bool value) {
// Returns true if 'pn' is a constant whose boolean value is equivalent to 'value'
#if MICROPY_COMP_CONST_TUPLE || MICROPY_COMP_CONST
return mp_parse_node_is_const(pn) && mp_obj_is_true(mp_parse_node_convert_to_obj(pn)) == value;
@@ -513,7 +513,7 @@ void mp_parse_node_print(const mp_print_t *print, mp_parse_node_t pn, size_t ind
#endif // MICROPY_DEBUG_PRINTERS
/*
-STATIC void result_stack_show(const mp_print_t *print, parser_t *parser) {
+static void result_stack_show(const mp_print_t *print, parser_t *parser) {
mp_printf(print, "result stack, most recent first\n");
for (ssize_t i = parser->result_stack_top - 1; i >= 0; i--) {
mp_parse_node_print(print, parser->result_stack[i], 0);
@@ -521,17 +521,17 @@ STATIC void result_stack_show(const mp_print_t *print, parser_t *parser) {
}
*/
-STATIC mp_parse_node_t pop_result(parser_t *parser) {
+static mp_parse_node_t pop_result(parser_t *parser) {
assert(parser->result_stack_top > 0);
return parser->result_stack[--parser->result_stack_top];
}
-STATIC mp_parse_node_t peek_result(parser_t *parser, size_t pos) {
+static mp_parse_node_t peek_result(parser_t *parser, size_t pos) {
assert(parser->result_stack_top > pos);
return parser->result_stack[parser->result_stack_top - 1 - pos];
}
-STATIC void push_result_node(parser_t *parser, mp_parse_node_t pn) {
+static void push_result_node(parser_t *parser, mp_parse_node_t pn) {
if (parser->result_stack_top >= parser->result_stack_alloc) {
mp_parse_node_t *stack = m_renew(mp_parse_node_t, parser->result_stack, parser->result_stack_alloc, parser->result_stack_alloc + MICROPY_ALLOC_PARSE_RESULT_INC);
parser->result_stack = stack;
@@ -540,7 +540,7 @@ STATIC void push_result_node(parser_t *parser, mp_parse_node_t pn) {
parser->result_stack[parser->result_stack_top++] = pn;
}
-STATIC mp_parse_node_t make_node_const_object(parser_t *parser, size_t src_line, mp_obj_t obj) {
+static mp_parse_node_t make_node_const_object(parser_t *parser, size_t src_line, mp_obj_t obj) {
mp_parse_node_struct_t *pn = parser_alloc(parser, sizeof(mp_parse_node_struct_t) + sizeof(mp_obj_t));
pn->source_line = src_line;
#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D
@@ -557,7 +557,7 @@ STATIC mp_parse_node_t make_node_const_object(parser_t *parser, size_t src_line,
// Create a parse node representing a constant object, possibly optimising the case of
// an integer, by putting the (small) integer value directly in the parse node itself.
-STATIC mp_parse_node_t make_node_const_object_optimised(parser_t *parser, size_t src_line, mp_obj_t obj) {
+static mp_parse_node_t make_node_const_object_optimised(parser_t *parser, size_t src_line, mp_obj_t obj) {
if (mp_obj_is_small_int(obj)) {
mp_int_t val = MP_OBJ_SMALL_INT_VALUE(obj);
#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D
@@ -579,7 +579,7 @@ STATIC mp_parse_node_t make_node_const_object_optimised(parser_t *parser, size_t
}
}
-STATIC void push_result_token(parser_t *parser, uint8_t rule_id) {
+static void push_result_token(parser_t *parser, uint8_t rule_id) {
mp_parse_node_t pn;
mp_lexer_t *lex = parser->lexer;
if (lex->tok_kind == MP_TOKEN_NAME) {
@@ -635,7 +635,7 @@ STATIC void push_result_token(parser_t *parser, uint8_t rule_id) {
#if MICROPY_COMP_CONST_FOLDING
#if MICROPY_COMP_MODULE_CONST
-STATIC const mp_rom_map_elem_t mp_constants_table[] = {
+static const mp_rom_map_elem_t mp_constants_table[] = {
#if MICROPY_PY_ERRNO
{ MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_errno) },
#endif
@@ -645,7 +645,7 @@ STATIC const mp_rom_map_elem_t mp_constants_table[] = {
// Extra constants as defined by a port
MICROPY_PORT_CONSTANTS
};
-STATIC MP_DEFINE_CONST_MAP(mp_constants_map, mp_constants_table);
+static MP_DEFINE_CONST_MAP(mp_constants_map, mp_constants_table);
#endif
#if MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND
@@ -653,7 +653,7 @@ STATIC MP_DEFINE_CONST_MAP(mp_constants_map, mp_constants_table);
// function is static, so provide a hook for them to work around this problem.
MP_NOINLINE
#endif
-STATIC bool fold_logical_constants(parser_t *parser, uint8_t rule_id, size_t *num_args) {
+static bool fold_logical_constants(parser_t *parser, uint8_t rule_id, size_t *num_args) {
if (rule_id == RULE_or_test
|| rule_id == RULE_and_test) {
// folding for binary logical ops: or and
@@ -710,7 +710,7 @@ STATIC bool fold_logical_constants(parser_t *parser, uint8_t rule_id, size_t *nu
return false;
}
-STATIC bool fold_constants(parser_t *parser, uint8_t rule_id, size_t num_args) {
+static bool fold_constants(parser_t *parser, uint8_t rule_id, size_t num_args) {
// this code does folding of arbitrary integer expressions, eg 1 + 2 * 3 + 4
// it does not do partial folding, eg 1 + 2 + x -> 3 + x
@@ -894,7 +894,7 @@ STATIC bool fold_constants(parser_t *parser, uint8_t rule_id, size_t num_args) {
#endif // MICROPY_COMP_CONST_FOLDING
#if MICROPY_COMP_CONST_TUPLE
-STATIC bool build_tuple_from_stack(parser_t *parser, size_t src_line, size_t num_args) {
+static bool build_tuple_from_stack(parser_t *parser, size_t src_line, size_t num_args) {
for (size_t i = num_args; i > 0;) {
mp_parse_node_t pn = peek_result(parser, --i);
if (!mp_parse_node_is_const(pn)) {
@@ -913,7 +913,7 @@ STATIC bool build_tuple_from_stack(parser_t *parser, size_t src_line, size_t num
return true;
}
-STATIC bool build_tuple(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args) {
+static bool build_tuple(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args) {
if (rule_id == RULE_testlist_comp) {
if (peek_rule(parser, 0) == RULE_atom_paren) {
// Tuple of the form "(a,)".
@@ -946,7 +946,7 @@ STATIC bool build_tuple(parser_t *parser, size_t src_line, uint8_t rule_id, size
}
#endif
-STATIC void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args) {
+static void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args) {
// Simplify and optimise certain rules, to reduce memory usage and simplify the compiler.
if (rule_id == RULE_atom_paren) {
// Remove parenthesis around a single expression if possible.
diff --git a/py/parsenum.c b/py/parsenum.c
index e3ad8070c6..b33ffb6ff2 100644
--- a/py/parsenum.c
+++ b/py/parsenum.c
@@ -36,7 +36,7 @@
#include <math.h>
#endif
-STATIC NORETURN void raise_exc(mp_obj_t exc, mp_lexer_t *lex) {
+static NORETURN void raise_exc(mp_obj_t exc, mp_lexer_t *lex) {
// if lex!=NULL then the parser called us and we need to convert the
// exception's type from ValueError to SyntaxError and add traceback info
if (lex != NULL) {
diff --git a/py/persistentcode.c b/py/persistentcode.c
index 1fe9a9a23f..5088c05f03 100644
--- a/py/persistentcode.c
+++ b/py/persistentcode.c
@@ -69,8 +69,8 @@ typedef struct _bytecode_prelude_t {
#include "py/parsenum.h"
-STATIC int read_byte(mp_reader_t *reader);
-STATIC size_t read_uint(mp_reader_t *reader);
+static int read_byte(mp_reader_t *reader);
+static size_t read_uint(mp_reader_t *reader);
#if MICROPY_EMIT_MACHINE_CODE
@@ -138,17 +138,17 @@ void mp_native_relocate(void *ri_in, uint8_t *text, uintptr_t reloc_text) {
#endif
-STATIC int read_byte(mp_reader_t *reader) {
+static int read_byte(mp_reader_t *reader) {
return reader->readbyte(reader->data);
}
-STATIC void read_bytes(mp_reader_t *reader, byte *buf, size_t len) {
+static void read_bytes(mp_reader_t *reader, byte *buf, size_t len) {
while (len-- > 0) {
*buf++ = reader->readbyte(reader->data);
}
}
-STATIC size_t read_uint(mp_reader_t *reader) {
+static size_t read_uint(mp_reader_t *reader) {
size_t unum = 0;
for (;;) {
byte b = reader->readbyte(reader->data);
@@ -160,7 +160,7 @@ STATIC size_t read_uint(mp_reader_t *reader) {
return unum;
}
-STATIC qstr load_qstr(mp_reader_t *reader) {
+static qstr load_qstr(mp_reader_t *reader) {
size_t len = read_uint(reader);
if (len & 1) {
// static qstr
@@ -175,7 +175,7 @@ STATIC qstr load_qstr(mp_reader_t *reader) {
return qst;
}
-STATIC mp_obj_t load_obj(mp_reader_t *reader) {
+static mp_obj_t load_obj(mp_reader_t *reader) {
byte obj_type = read_byte(reader);
#if MICROPY_EMIT_MACHINE_CODE
if (obj_type == MP_PERSISTENT_OBJ_FUN_TABLE) {
@@ -221,7 +221,7 @@ STATIC mp_obj_t load_obj(mp_reader_t *reader) {
}
}
-STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader, mp_module_context_t *context) {
+static mp_raw_code_t *load_raw_code(mp_reader_t *reader, mp_module_context_t *context) {
// Load function kind and data length
size_t kind_len = read_uint(reader);
int kind = (kind_len & 3) + MP_CODE_BYTECODE;
@@ -468,12 +468,12 @@ void mp_raw_code_load_file(qstr filename, mp_compiled_module_t *context) {
#include "py/objstr.h"
-STATIC void mp_print_bytes(mp_print_t *print, const byte *data, size_t len) {
+static void mp_print_bytes(mp_print_t *print, const byte *data, size_t len) {
print->print_strn(print->data, (const char *)data, len);
}
#define BYTES_FOR_INT ((MP_BYTES_PER_OBJ_WORD * 8 + 6) / 7)
-STATIC void mp_print_uint(mp_print_t *print, size_t n) {
+static void mp_print_uint(mp_print_t *print, size_t n) {
byte buf[BYTES_FOR_INT];
byte *p = buf + sizeof(buf);
*--p = n & 0x7f;
@@ -484,7 +484,7 @@ STATIC void mp_print_uint(mp_print_t *print, size_t n) {
print->print_strn(print->data, (char *)p, buf + sizeof(buf) - p);
}
-STATIC void save_qstr(mp_print_t *print, qstr qst) {
+static void save_qstr(mp_print_t *print, qstr qst) {
if (qst <= QSTR_LAST_STATIC) {
// encode static qstr
mp_print_uint(print, qst << 1 | 1);
@@ -496,7 +496,7 @@ STATIC void save_qstr(mp_print_t *print, qstr qst) {
mp_print_bytes(print, str, len + 1); // +1 to store null terminator
}
-STATIC void save_obj(mp_print_t *print, mp_obj_t o) {
+static void save_obj(mp_print_t *print, mp_obj_t o) {
#if MICROPY_EMIT_MACHINE_CODE
if (o == MP_OBJ_FROM_PTR(&mp_fun_table)) {
byte obj_type = MP_PERSISTENT_OBJ_FUN_TABLE;
@@ -562,7 +562,7 @@ STATIC void save_obj(mp_print_t *print, mp_obj_t o) {
}
}
-STATIC void save_raw_code(mp_print_t *print, const mp_raw_code_t *rc) {
+static void save_raw_code(mp_print_t *print, const mp_raw_code_t *rc) {
// Save function kind and data length
mp_print_uint(print, (rc->fun_data_len << 3) | ((rc->n_children != 0) << 2) | (rc->kind - MP_CODE_BYTECODE));
@@ -637,7 +637,7 @@ void mp_raw_code_save(mp_compiled_module_t *cm, mp_print_t *print) {
#include <sys/stat.h>
#include <fcntl.h>
-STATIC void fd_print_strn(void *env, const char *str, size_t len) {
+static void fd_print_strn(void *env, const char *str, size_t len) {
int fd = (intptr_t)env;
MP_THREAD_GIL_EXIT();
ssize_t ret = write(fd, str, len);
diff --git a/py/profile.c b/py/profile.c
index 274089d702..92f414ace7 100644
--- a/py/profile.c
+++ b/py/profile.c
@@ -40,7 +40,7 @@
#define prof_trace_cb MP_STATE_THREAD(prof_trace_callback)
#define QSTR_MAP(context, idx) (context->constants.qstr_table[idx])
-STATIC uint mp_prof_bytecode_lineno(const mp_raw_code_t *rc, size_t bc) {
+static uint mp_prof_bytecode_lineno(const mp_raw_code_t *rc, size_t bc) {
const mp_bytecode_prelude_t *prelude = &rc->prelude;
return mp_bytecode_get_source_line(prelude->line_info, prelude->line_info_top, bc);
}
@@ -71,7 +71,7 @@ void mp_prof_extract_prelude(const byte *bytecode, mp_bytecode_prelude_t *prelud
/******************************************************************************/
// code object
-STATIC void code_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void code_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_code_t *o = MP_OBJ_TO_PTR(o_in);
const mp_raw_code_t *rc = o->rc;
@@ -85,7 +85,7 @@ STATIC void code_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t k
);
}
-STATIC mp_obj_tuple_t *code_consts(const mp_module_context_t *context, const mp_raw_code_t *rc) {
+static mp_obj_tuple_t *code_consts(const mp_module_context_t *context, const mp_raw_code_t *rc) {
mp_obj_tuple_t *consts = MP_OBJ_TO_PTR(mp_obj_new_tuple(rc->n_children + 1, NULL));
size_t const_no = 0;
@@ -101,7 +101,7 @@ STATIC mp_obj_tuple_t *code_consts(const mp_module_context_t *context, const mp_
return consts;
}
-STATIC mp_obj_t raw_code_lnotab(const mp_raw_code_t *rc) {
+static mp_obj_t raw_code_lnotab(const mp_raw_code_t *rc) {
// const mp_bytecode_prelude_t *prelude = &rc->prelude;
uint start = 0;
uint stop = rc->fun_data_len - start;
@@ -139,7 +139,7 @@ STATIC mp_obj_t raw_code_lnotab(const mp_raw_code_t *rc) {
return o;
}
-STATIC void code_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void code_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// not load attribute
return;
@@ -202,7 +202,7 @@ mp_obj_t mp_obj_new_code(const mp_module_context_t *context, const mp_raw_code_t
/******************************************************************************/
// frame object
-STATIC void frame_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
+static void frame_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_frame_t *frame = MP_OBJ_TO_PTR(o_in);
mp_obj_code_t *code = frame->code;
@@ -217,7 +217,7 @@ STATIC void frame_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
);
}
-STATIC void frame_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
+static void frame_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
if (dest[0] != MP_OBJ_NULL) {
// not load attribute
return;
@@ -294,7 +294,7 @@ typedef struct {
mp_obj_t arg;
} prof_callback_args_t;
-STATIC mp_obj_t mp_prof_callback_invoke(mp_obj_t callback, prof_callback_args_t *args) {
+static mp_obj_t mp_prof_callback_invoke(mp_obj_t callback, prof_callback_args_t *args) {
assert(mp_obj_is_callable(callback));
mp_prof_is_executing = true;
@@ -474,7 +474,7 @@ typedef struct _mp_dis_instruction_t {
mp_obj_t argobjex_cache;
} mp_dis_instruction_t;
-STATIC const byte *mp_prof_opcode_decode(const byte *ip, const mp_uint_t *const_table, mp_dis_instruction_t *instruction) {
+static const byte *mp_prof_opcode_decode(const byte *ip, const mp_uint_t *const_table, mp_dis_instruction_t *instruction) {
mp_uint_t unum;
const byte *ptr;
mp_obj_t obj;
diff --git a/py/qstr.c b/py/qstr.c
index 204becd213..3720932250 100644
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -187,7 +187,7 @@ void qstr_init(void) {
#endif
}
-STATIC const qstr_pool_t *find_qstr(qstr *q) {
+static const qstr_pool_t *find_qstr(qstr *q) {
// search pool for this qstr
// total_prev_len==0 in the final pool, so the loop will always terminate
const qstr_pool_t *pool = MP_STATE_VM(last_pool);
@@ -200,7 +200,7 @@ STATIC const qstr_pool_t *find_qstr(qstr *q) {
}
// qstr_mutex must be taken while in this function
-STATIC qstr qstr_add(mp_uint_t len, const char *q_ptr) {
+static qstr qstr_add(mp_uint_t len, const char *q_ptr) {
#if MICROPY_QSTR_BYTES_IN_HASH
mp_uint_t hash = qstr_compute_hash((const byte *)q_ptr, len);
DEBUG_printf("QSTR: add hash=%d len=%d data=%.*s\n", hash, len, len, q_ptr);
@@ -444,7 +444,7 @@ void qstr_dump_data(void) {
#else
// Emit the compressed_string_data string.
-#define MP_COMPRESSED_DATA(x) STATIC const char *compressed_string_data = x;
+#define MP_COMPRESSED_DATA(x) static const char *compressed_string_data = x;
#define MP_MATCH_COMPRESSED(a, b)
#include "genhdr/compressed.data.h"
#undef MP_COMPRESSED_DATA
@@ -458,7 +458,7 @@ void qstr_dump_data(void) {
// The compressed string data is delimited by setting high bit in the final char of each word.
// e.g. aaaa<0x80|a>bbbbbb<0x80|b>....
// This method finds the n'th string.
-STATIC const byte *find_uncompressed_string(uint8_t n) {
+static const byte *find_uncompressed_string(uint8_t n) {
const byte *c = (byte *)compressed_string_data;
while (n > 0) {
while ((*c & 0x80) == 0) {
diff --git a/py/reader.c b/py/reader.c
index d2af62cfb3..151e04cac2 100644
--- a/py/reader.c
+++ b/py/reader.c
@@ -39,7 +39,7 @@ typedef struct _mp_reader_mem_t {
const byte *end;
} mp_reader_mem_t;
-STATIC mp_uint_t mp_reader_mem_readbyte(void *data) {
+static mp_uint_t mp_reader_mem_readbyte(void *data) {
mp_reader_mem_t *reader = (mp_reader_mem_t *)data;
if (reader->cur < reader->end) {
return *reader->cur++;
@@ -48,7 +48,7 @@ STATIC mp_uint_t mp_reader_mem_readbyte(void *data) {
}
}
-STATIC void mp_reader_mem_close(void *data) {
+static void mp_reader_mem_close(void *data) {
mp_reader_mem_t *reader = (mp_reader_mem_t *)data;
if (reader->free_len > 0) {
m_del(char, (char *)reader->beg, reader->free_len);
@@ -81,7 +81,7 @@ typedef struct _mp_reader_posix_t {
byte buf[20];
} mp_reader_posix_t;
-STATIC mp_uint_t mp_reader_posix_readbyte(void *data) {
+static mp_uint_t mp_reader_posix_readbyte(void *data) {
mp_reader_posix_t *reader = (mp_reader_posix_t *)data;
if (reader->pos >= reader->len) {
if (reader->len == 0) {
@@ -101,7 +101,7 @@ STATIC mp_uint_t mp_reader_posix_readbyte(void *data) {
return reader->buf[reader->pos++];
}
-STATIC void mp_reader_posix_close(void *data) {
+static void mp_reader_posix_close(void *data) {
mp_reader_posix_t *reader = (mp_reader_posix_t *)data;
if (reader->close_fd) {
MP_THREAD_GIL_EXIT();
diff --git a/py/repl.c b/py/repl.c
index cf69d3d899..b79a2d3c42 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -43,7 +43,7 @@ const char *mp_repl_get_psx(unsigned int entry) {
}
#endif
-STATIC bool str_startswith_word(const char *str, const char *head) {
+static bool str_startswith_word(const char *str, const char *head) {
size_t i;
for (i = 0; str[i] && head[i]; i++) {
if (str[i] != head[i]) {
@@ -154,7 +154,7 @@ bool mp_repl_continue_with_input(const char *input) {
return false;
}
-STATIC bool test_qstr(mp_obj_t obj, qstr name) {
+static bool test_qstr(mp_obj_t obj, qstr name) {
if (obj) {
// try object member
mp_obj_t dest[2];
@@ -167,7 +167,7 @@ STATIC bool test_qstr(mp_obj_t obj, qstr name) {
}
}
-STATIC const char *find_completions(const char *s_start, size_t s_len,
+static const char *find_completions(const char *s_start, size_t s_len,
mp_obj_t obj, size_t *match_len, qstr *q_first, qstr *q_last) {
const char *match_str = NULL;
@@ -207,7 +207,7 @@ STATIC const char *find_completions(const char *s_start, size_t s_len,
return match_str;
}
-STATIC void print_completions(const mp_print_t *print,
+static void print_completions(const mp_print_t *print,
const char *s_start, size_t s_len,
mp_obj_t obj, qstr q_first, qstr q_last) {
diff --git a/py/runtime.c b/py/runtime.c
index 6d8eddedc8..f7e0abdb46 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -731,7 +731,7 @@ mp_obj_t mp_call_method_n_kw(size_t n_args, size_t n_kw, const mp_obj_t *args) {
// This function only needs to be exposed externally when in stackless mode.
#if !MICROPY_STACKLESS
-STATIC
+static
#endif
void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_obj_t *args, mp_call_args_t *out_args) {
mp_obj_t fun = *args++;
@@ -1074,7 +1074,7 @@ typedef struct _mp_obj_checked_fun_t {
mp_obj_t fun;
} mp_obj_checked_fun_t;
-STATIC mp_obj_t checked_fun_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t checked_fun_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_obj_checked_fun_t *self = MP_OBJ_TO_PTR(self_in);
if (n_args > 0) {
const mp_obj_type_t *arg0_type = mp_obj_get_type(args[0]);
@@ -1090,14 +1090,14 @@ STATIC mp_obj_t checked_fun_call(mp_obj_t self_in, size_t n_args, size_t n_kw, c
return mp_call_function_n_kw(self->fun, n_args, n_kw, args);
}
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
mp_type_checked_fun,
MP_QSTR_function,
MP_TYPE_FLAG_BINDS_SELF,
call, checked_fun_call
);
-STATIC mp_obj_t mp_obj_new_checked_fun(const mp_obj_type_t *type, mp_obj_t fun) {
+static mp_obj_t mp_obj_new_checked_fun(const mp_obj_type_t *type, mp_obj_t fun) {
mp_obj_checked_fun_t *o = mp_obj_malloc(mp_obj_checked_fun_t, &mp_type_checked_fun);
o->type = type;
o->fun = fun;
@@ -1326,7 +1326,7 @@ mp_obj_t mp_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
}
-STATIC mp_fun_1_t type_get_iternext(const mp_obj_type_t *type) {
+static mp_fun_1_t type_get_iternext(const mp_obj_type_t *type) {
if ((type->flags & MP_TYPE_FLAG_ITER_IS_STREAM) == MP_TYPE_FLAG_ITER_IS_STREAM) {
return mp_stream_unbuffered_iter;
} else if (type->flags & MP_TYPE_FLAG_ITER_IS_ITERNEXT) {
diff --git a/py/scope.c b/py/scope.c
index 8fc0943289..1a4c6cc77f 100644
--- a/py/scope.c
+++ b/py/scope.c
@@ -31,7 +31,7 @@
#if MICROPY_ENABLE_COMPILER
// These low numbered qstrs should fit in 8 bits. See assertions below.
-STATIC const uint8_t scope_simple_name_table[] = {
+static const uint8_t scope_simple_name_table[] = {
[SCOPE_MODULE] = MP_QSTR__lt_module_gt_,
[SCOPE_LAMBDA] = MP_QSTR__lt_lambda_gt_,
[SCOPE_LIST_COMP] = MP_QSTR__lt_listcomp_gt_,
@@ -111,7 +111,7 @@ id_info_t *scope_find_global(scope_t *scope, qstr qst) {
return scope_find(scope, qst);
}
-STATIC void scope_close_over_in_parents(scope_t *scope, qstr qst) {
+static void scope_close_over_in_parents(scope_t *scope, qstr qst) {
assert(scope->parent != NULL); // we should have at least 1 parent
for (scope_t *s = scope->parent;; s = s->parent) {
assert(s->parent != NULL); // we should not get to the outer scope
diff --git a/py/stream.c b/py/stream.c
index ac0234ac13..aa905ca8cc 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -38,7 +38,7 @@
// TODO: should be in mpconfig.h
#define DEFAULT_BUFFER_SIZE 256
-STATIC mp_obj_t stream_readall(mp_obj_t self_in);
+static mp_obj_t stream_readall(mp_obj_t self_in);
// Returns error condition in *errcode, if non-zero, return value is number of bytes written
// before error condition occurred. If *errcode == 0, returns total bytes written (which will
@@ -96,7 +96,7 @@ const mp_stream_p_t *mp_get_stream_raise(mp_obj_t self_in, int flags) {
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("stream operation not supported"));
}
-STATIC mp_obj_t stream_read_generic(size_t n_args, const mp_obj_t *args, byte flags) {
+static mp_obj_t stream_read_generic(size_t n_args, const mp_obj_t *args, byte flags) {
// What to do if sz < -1? Python docs don't specify this case.
// CPython does a readall, but here we silently let negatives through,
// and they will cause a MemoryError.
@@ -218,12 +218,12 @@ STATIC mp_obj_t stream_read_generic(size_t n_args, const mp_obj_t *args, byte fl
}
}
-STATIC mp_obj_t stream_read(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t stream_read(size_t n_args, const mp_obj_t *args) {
return stream_read_generic(n_args, args, MP_STREAM_RW_READ);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read_obj, 1, 2, stream_read);
-STATIC mp_obj_t stream_read1(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t stream_read1(size_t n_args, const mp_obj_t *args) {
return stream_read_generic(n_args, args, MP_STREAM_RW_READ | MP_STREAM_RW_ONCE);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read1_obj, 1, 2, stream_read1);
@@ -249,7 +249,7 @@ void mp_stream_write_adaptor(void *self, const char *buf, size_t len) {
mp_stream_write(MP_OBJ_FROM_PTR(self), buf, len, MP_STREAM_RW_WRITE);
}
-STATIC mp_obj_t stream_write_method(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t stream_write_method(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_READ);
size_t max_len = (size_t)-1;
@@ -268,14 +268,14 @@ STATIC mp_obj_t stream_write_method(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_write_obj, 2, 4, stream_write_method);
-STATIC mp_obj_t stream_write1_method(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t stream_write1_method(mp_obj_t self_in, mp_obj_t arg) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
return mp_stream_write(self_in, bufinfo.buf, bufinfo.len, MP_STREAM_RW_WRITE | MP_STREAM_RW_ONCE);
}
MP_DEFINE_CONST_FUN_OBJ_2(mp_stream_write1_obj, stream_write1_method);
-STATIC mp_obj_t stream_readinto(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t stream_readinto(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_WRITE);
@@ -303,7 +303,7 @@ STATIC mp_obj_t stream_readinto(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_readinto_obj, 2, 3, stream_readinto);
-STATIC mp_obj_t stream_readall(mp_obj_t self_in) {
+static mp_obj_t stream_readall(mp_obj_t self_in) {
const mp_stream_p_t *stream_p = mp_get_stream(self_in);
mp_uint_t total_size = 0;
@@ -348,7 +348,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) {
}
// Unbuffered, inefficient implementation of readline() for raw I/O files.
-STATIC mp_obj_t stream_unbuffered_readline(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t stream_unbuffered_readline(size_t n_args, const mp_obj_t *args) {
const mp_stream_p_t *stream_p = mp_get_stream(args[0]);
mp_int_t max_size = -1;
@@ -406,7 +406,7 @@ STATIC mp_obj_t stream_unbuffered_readline(size_t n_args, const mp_obj_t *args)
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_unbuffered_readline_obj, 1, 2, stream_unbuffered_readline);
// TODO take an optional extra argument (what does it do exactly?)
-STATIC mp_obj_t stream_unbuffered_readlines(mp_obj_t self) {
+static mp_obj_t stream_unbuffered_readlines(mp_obj_t self) {
mp_obj_t lines = mp_obj_new_list(0, NULL);
for (;;) {
mp_obj_t line = stream_unbuffered_readline(1, &self);
@@ -438,13 +438,13 @@ mp_obj_t mp_stream_close(mp_obj_t stream) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_stream_close_obj, mp_stream_close);
-STATIC mp_obj_t mp_stream___exit__(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_stream___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
return mp_stream_close(args[0]);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream___exit___obj, 4, 4, mp_stream___exit__);
-STATIC mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) {
struct mp_stream_seek_t seek_s;
// TODO: Could be uint64
seek_s.offset = mp_obj_get_int(args[1]);
@@ -470,7 +470,7 @@ STATIC mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_seek_obj, 2, 3, stream_seek);
-STATIC mp_obj_t stream_tell(mp_obj_t self) {
+static mp_obj_t stream_tell(mp_obj_t self) {
mp_obj_t offset = MP_OBJ_NEW_SMALL_INT(0);
mp_obj_t whence = MP_OBJ_NEW_SMALL_INT(SEEK_CUR);
const mp_obj_t args[3] = {self, offset, whence};
@@ -478,7 +478,7 @@ STATIC mp_obj_t stream_tell(mp_obj_t self) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_stream_tell_obj, stream_tell);
-STATIC mp_obj_t stream_flush(mp_obj_t self) {
+static mp_obj_t stream_flush(mp_obj_t self) {
const mp_stream_p_t *stream_p = mp_get_stream(self);
int error;
mp_uint_t res = stream_p->ioctl(self, MP_STREAM_FLUSH, 0, &error);
@@ -489,7 +489,7 @@ STATIC mp_obj_t stream_flush(mp_obj_t self) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_stream_flush_obj, stream_flush);
-STATIC mp_obj_t stream_ioctl(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t stream_ioctl(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo;
uintptr_t val = 0;
if (n_args > 2) {
diff --git a/py/unicode.c b/py/unicode.c
index 5acaad3788..81a37880f3 100644
--- a/py/unicode.c
+++ b/py/unicode.c
@@ -48,7 +48,7 @@
#define AT_LX (FL_LOWER | FL_ALPHA | FL_PRINT | FL_XDIGIT)
// table of attributes for ascii characters
-STATIC const uint8_t attr[] = {
+static const uint8_t attr[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, AT_SP, AT_SP, AT_SP, AT_SP, AT_SP, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/py/vstr.c b/py/vstr.c
index 56327b5f7a..fc55d6948c 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -104,7 +104,7 @@ char *vstr_extend(vstr_t *vstr, size_t size) {
return p;
}
-STATIC void vstr_ensure_extra(vstr_t *vstr, size_t size) {
+static void vstr_ensure_extra(vstr_t *vstr, size_t size) {
if (vstr->len + size > vstr->alloc) {
if (vstr->fixed_buf) {
// We can't reallocate, and the caller is expecting the space to
@@ -183,7 +183,7 @@ void vstr_add_strn(vstr_t *vstr, const char *str, size_t len) {
vstr->len += len;
}
-STATIC char *vstr_ins_blank_bytes(vstr_t *vstr, size_t byte_pos, size_t byte_len) {
+static char *vstr_ins_blank_bytes(vstr_t *vstr, size_t byte_pos, size_t byte_len) {
size_t l = vstr->len;
if (byte_pos > l) {
byte_pos = l;
diff --git a/shared/libc/printf.c b/shared/libc/printf.c
index 715181229e..50b04ce9be 100644
--- a/shared/libc/printf.c
+++ b/shared/libc/printf.c
@@ -87,7 +87,7 @@ typedef struct _strn_print_env_t {
size_t remain;
} strn_print_env_t;
-STATIC void strn_print_strn(void *data, const char *str, size_t len) {
+static void strn_print_strn(void *data, const char *str, size_t len) {
strn_print_env_t *strn_print_env = data;
if (len > strn_print_env->remain) {
len = strn_print_env->remain;
diff --git a/shared/readline/readline.c b/shared/readline/readline.c
index b85bbd5bea..c9386f16b5 100644
--- a/shared/readline/readline.c
+++ b/shared/readline/readline.c
@@ -55,7 +55,7 @@ void readline_init0(void) {
memset(MP_STATE_PORT(readline_hist), 0, MICROPY_READLINE_HISTORY_SIZE * sizeof(const char*));
}
-STATIC char *str_dup_maybe(const char *str) {
+static char *str_dup_maybe(const char *str) {
uint32_t len = strlen(str);
char *s2 = m_new_maybe(char, len + 1);
if (s2 == NULL) {
@@ -72,7 +72,7 @@ STATIC char *str_dup_maybe(const char *str) {
// ...and provide the implementation using them
#if MICROPY_HAL_HAS_VT100
-STATIC void mp_hal_move_cursor_back(uint pos) {
+static void mp_hal_move_cursor_back(uint pos) {
if (pos <= 4) {
// fast path for most common case of 1 step back
mp_hal_stdout_tx_strn("\b\b\b\b", pos);
@@ -88,7 +88,7 @@ STATIC void mp_hal_move_cursor_back(uint pos) {
}
}
-STATIC void mp_hal_erase_line_from_cursor(uint n_chars_to_erase) {
+static void mp_hal_erase_line_from_cursor(uint n_chars_to_erase) {
(void)n_chars_to_erase;
mp_hal_stdout_tx_strn("\x1b[K", 3);
}
@@ -107,10 +107,10 @@ typedef struct _readline_t {
const char *prompt;
} readline_t;
-STATIC readline_t rl;
+static readline_t rl;
#if MICROPY_REPL_EMACS_WORDS_MOVE
-STATIC size_t cursor_count_word(int forward) {
+static size_t cursor_count_word(int forward) {
const char *line_buf = vstr_str(rl.line);
size_t pos = rl.cursor_pos;
bool in_word = false;
@@ -481,7 +481,7 @@ redraw:
}
#if MICROPY_REPL_AUTO_INDENT
-STATIC void readline_auto_indent(void) {
+static void readline_auto_indent(void) {
if (!(rl.auto_indent_state & AUTO_INDENT_ENABLED)) {
return;
}
diff --git a/shared/runtime/gchelper_generic.c b/shared/runtime/gchelper_generic.c
index 272e37056a..4ef2e73f7a 100644
--- a/shared/runtime/gchelper_generic.c
+++ b/shared/runtime/gchelper_generic.c
@@ -42,7 +42,7 @@
// stack already by the caller.
#if defined(__x86_64__)
-STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
+static void gc_helper_get_regs(gc_helper_regs_t arr) {
register long rbx asm ("rbx");
register long rbp asm ("rbp");
register long r12 asm ("r12");
@@ -73,7 +73,7 @@ STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
#elif defined(__i386__)
-STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
+static void gc_helper_get_regs(gc_helper_regs_t arr) {
register long ebx asm ("ebx");
register long esi asm ("esi");
register long edi asm ("edi");
@@ -100,7 +100,7 @@ STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
// Fallback implementation, prefer gchelper_thumb1.s or gchelper_thumb2.s
-STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
+static void gc_helper_get_regs(gc_helper_regs_t arr) {
register long r4 asm ("r4");
register long r5 asm ("r5");
register long r6 asm ("r6");
@@ -125,7 +125,7 @@ STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
#elif defined(__aarch64__)
-STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
+static void gc_helper_get_regs(gc_helper_regs_t arr) {
const register long x19 asm ("x19");
const register long x20 asm ("x20");
const register long x21 asm ("x21");
@@ -161,7 +161,7 @@ STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
// Even if we have specific support for an architecture, it is
// possible to force use of setjmp-based implementation.
-STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
+static void gc_helper_get_regs(gc_helper_regs_t arr) {
setjmp(arr);
}
diff --git a/shared/runtime/mpirq.c b/shared/runtime/mpirq.c
index acd727403b..6111b9b10c 100644
--- a/shared/runtime/mpirq.c
+++ b/shared/runtime/mpirq.c
@@ -96,13 +96,13 @@ void mp_irq_handler(mp_irq_obj_t *self) {
/******************************************************************************/
// MicroPython bindings
-STATIC mp_obj_t mp_irq_flags(mp_obj_t self_in) {
+static mp_obj_t mp_irq_flags(mp_obj_t self_in) {
mp_irq_obj_t *self = MP_OBJ_TO_PTR(self_in);
return mp_obj_new_int(self->methods->info(self->parent, MP_IRQ_INFO_FLAGS));
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_flags_obj, mp_irq_flags);
+static MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_flags_obj, mp_irq_flags);
-STATIC mp_obj_t mp_irq_trigger(size_t n_args, const mp_obj_t *args) {
+static mp_obj_t mp_irq_trigger(size_t n_args, const mp_obj_t *args) {
mp_irq_obj_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_t ret_obj = mp_obj_new_int(self->methods->info(self->parent, MP_IRQ_INFO_TRIGGERS));
if (n_args == 2) {
@@ -111,19 +111,19 @@ STATIC mp_obj_t mp_irq_trigger(size_t n_args, const mp_obj_t *args) {
}
return ret_obj;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_irq_trigger_obj, 1, 2, mp_irq_trigger);
+static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_irq_trigger_obj, 1, 2, mp_irq_trigger);
-STATIC mp_obj_t mp_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t mp_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
mp_irq_handler(MP_OBJ_TO_PTR(self_in));
return mp_const_none;
}
-STATIC const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
+static const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_flags), MP_ROM_PTR(&mp_irq_flags_obj) },
{ MP_ROM_QSTR(MP_QSTR_trigger), MP_ROM_PTR(&mp_irq_trigger_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
+static MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_irq_type,
diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c
index cc2aa53504..a305e6a5df 100644
--- a/shared/runtime/pyexec.c
+++ b/shared/runtime/pyexec.c
@@ -47,7 +47,7 @@ pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL;
int pyexec_system_exit = 0;
#if MICROPY_REPL_INFO
-STATIC bool repl_display_debugging_info = 0;
+static bool repl_display_debugging_info = 0;
#endif
#define EXEC_FLAG_PRINT_EOF (1 << 0)
@@ -64,7 +64,7 @@ STATIC bool repl_display_debugging_info = 0;
// EXEC_FLAG_PRINT_EOF prints 2 EOF chars: 1 after normal output, 1 after exception output
// EXEC_FLAG_ALLOW_DEBUGGING allows debugging info to be printed after executing the code
// EXEC_FLAG_IS_REPL is used for REPL inputs (flag passed on to mp_compile)
-STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input_kind, mp_uint_t exec_flags) {
+static int parse_compile_execute(const void *source, mp_parse_input_kind_t input_kind, mp_uint_t exec_flags) {
int ret = 0;
#if MICROPY_REPL_INFO
uint32_t start = 0;
@@ -201,7 +201,7 @@ typedef struct _mp_reader_stdin_t {
uint16_t window_remain;
} mp_reader_stdin_t;
-STATIC mp_uint_t mp_reader_stdin_readbyte(void *data) {
+static mp_uint_t mp_reader_stdin_readbyte(void *data) {
mp_reader_stdin_t *reader = (mp_reader_stdin_t *)data;
if (reader->eof) {
@@ -233,7 +233,7 @@ STATIC mp_uint_t mp_reader_stdin_readbyte(void *data) {
return c;
}
-STATIC void mp_reader_stdin_close(void *data) {
+static void mp_reader_stdin_close(void *data) {
mp_reader_stdin_t *reader = (mp_reader_stdin_t *)data;
if (!reader->eof) {
reader->eof = true;
@@ -247,7 +247,7 @@ STATIC void mp_reader_stdin_close(void *data) {
}
}
-STATIC void mp_reader_new_stdin(mp_reader_t *reader, mp_reader_stdin_t *reader_stdin, uint16_t buf_max) {
+static void mp_reader_new_stdin(mp_reader_t *reader, mp_reader_stdin_t *reader_stdin, uint16_t buf_max) {
// Make flow-control window half the buffer size, and indicate to the host that 2x windows are
// free (sending the window size implicitly indicates that a window is free, and then the 0x01
// indicates that another window is free).
@@ -263,7 +263,7 @@ STATIC void mp_reader_new_stdin(mp_reader_t *reader, mp_reader_stdin_t *reader_s
reader->close = mp_reader_stdin_close;
}
-STATIC int do_reader_stdin(int c) {
+static int do_reader_stdin(int c) {
if (c != 'A') {
// Unsupported command.
mp_hal_stdout_tx_strn("R\x00", 2);
@@ -294,8 +294,8 @@ typedef struct _repl_t {
repl_t repl;
-STATIC int pyexec_raw_repl_process_char(int c);
-STATIC int pyexec_friendly_repl_process_char(int c);
+static int pyexec_raw_repl_process_char(int c);
+static int pyexec_friendly_repl_process_char(int c);
void pyexec_event_repl_init(void) {
MP_STATE_VM(repl_line) = vstr_new(32);
@@ -310,7 +310,7 @@ void pyexec_event_repl_init(void) {
}
}
-STATIC int pyexec_raw_repl_process_char(int c) {
+static int pyexec_raw_repl_process_char(int c) {
if (c == CHAR_CTRL_A) {
// reset raw REPL
if (vstr_len(MP_STATE_VM(repl_line)) == 2 && vstr_str(MP_STATE_VM(repl_line))[0] == CHAR_CTRL_E) {
@@ -364,7 +364,7 @@ reset:
return 0;
}
-STATIC int pyexec_friendly_repl_process_char(int c) {
+static int pyexec_friendly_repl_process_char(int c) {
if (repl.paste_mode) {
if (c == CHAR_CTRL_C) {
// cancel everything
diff --git a/shared/runtime/softtimer.c b/shared/runtime/softtimer.c
index 468fa95b72..13a6e78777 100644
--- a/shared/runtime/softtimer.c
+++ b/shared/runtime/softtimer.c
@@ -56,9 +56,9 @@ static void soft_timer_schedule_at_ms(uint32_t ticks_ms) {
// Pointer to the pairheap of soft timer objects.
// This may contain bss/data pointers as well as GC-heap pointers,
// and is explicitly GC traced by soft_timer_gc_mark_all().
-STATIC soft_timer_entry_t *soft_timer_heap;
+static soft_timer_entry_t *soft_timer_heap;
-STATIC int soft_timer_lt(mp_pairheap_t *n1, mp_pairheap_t *n2) {
+static int soft_timer_lt(mp_pairheap_t *n1, mp_pairheap_t *n2) {
soft_timer_entry_t *e1 = (soft_timer_entry_t *)n1;
soft_timer_entry_t *e2 = (soft_timer_entry_t *)n2;
return soft_timer_ticks_diff(e1->expiry_ms, e2->expiry_ms) < 0;
diff --git a/shared/runtime/sys_stdio_mphal.c b/shared/runtime/sys_stdio_mphal.c
index b7a35a5cba..ad045fb3a9 100644
--- a/shared/runtime/sys_stdio_mphal.c
+++ b/shared/runtime/sys_stdio_mphal.c
@@ -49,15 +49,15 @@ typedef struct _sys_stdio_obj_t {
} sys_stdio_obj_t;
#if MICROPY_PY_SYS_STDIO_BUFFER
-STATIC const sys_stdio_obj_t stdio_buffer_obj;
+static const sys_stdio_obj_t stdio_buffer_obj;
#endif
-STATIC void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
+static void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<io.FileIO %d>", self->fd);
}
-STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->fd == STDIO_FD_IN) {
for (uint i = 0; i < size; i++) {
@@ -74,7 +74,7 @@ STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *er
}
}
-STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->fd == STDIO_FD_OUT || self->fd == STDIO_FD_ERR) {
mp_hal_stdout_tx_strn_cooked(buf, size);
@@ -85,7 +85,7 @@ STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size,
}
}
-STATIC mp_uint_t stdio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+static mp_uint_t stdio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)self_in;
if (request == MP_STREAM_POLL) {
return mp_hal_stdio_poll(arg);
@@ -97,7 +97,7 @@ STATIC mp_uint_t stdio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg,
}
}
-STATIC const mp_rom_map_elem_t stdio_locals_dict_table[] = {
+static const mp_rom_map_elem_t stdio_locals_dict_table[] = {
#if MICROPY_PY_SYS_STDIO_BUFFER
{ MP_ROM_QSTR(MP_QSTR_buffer), MP_ROM_PTR(&stdio_buffer_obj) },
#endif
@@ -111,9 +111,9 @@ STATIC const mp_rom_map_elem_t stdio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&mp_stream___exit___obj) },
};
-STATIC MP_DEFINE_CONST_DICT(stdio_locals_dict, stdio_locals_dict_table);
+static MP_DEFINE_CONST_DICT(stdio_locals_dict, stdio_locals_dict_table);
-STATIC const mp_stream_p_t stdio_obj_stream_p = {
+static const mp_stream_p_t stdio_obj_stream_p = {
.read = stdio_read,
.write = stdio_write,
.ioctl = stdio_ioctl,
@@ -134,25 +134,25 @@ const sys_stdio_obj_t mp_sys_stdout_obj = {{&stdio_obj_type}, .fd = STDIO_FD_OUT
const sys_stdio_obj_t mp_sys_stderr_obj = {{&stdio_obj_type}, .fd = STDIO_FD_ERR};
#if MICROPY_PY_SYS_STDIO_BUFFER
-STATIC mp_uint_t stdio_buffer_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stdio_buffer_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
for (uint i = 0; i < size; i++) {
((byte *)buf)[i] = mp_hal_stdin_rx_chr();
}
return size;
}
-STATIC mp_uint_t stdio_buffer_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
+static mp_uint_t stdio_buffer_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
return mp_hal_stdout_tx_strn(buf, size);
}
-STATIC const mp_stream_p_t stdio_buffer_obj_stream_p = {
+static const mp_stream_p_t stdio_buffer_obj_stream_p = {
.read = stdio_buffer_read,
.write = stdio_buffer_write,
.ioctl = stdio_ioctl,
.is_text = false,
};
-STATIC MP_DEFINE_CONST_OBJ_TYPE(
+static MP_DEFINE_CONST_OBJ_TYPE(
stdio_buffer_obj_type,
MP_QSTR_FileIO,
MP_TYPE_FLAG_ITER_IS_STREAM,
@@ -161,5 +161,5 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
locals_dict, &stdio_locals_dict
);
-STATIC const sys_stdio_obj_t stdio_buffer_obj = {{&stdio_buffer_obj_type}, .fd = 0}; // fd unused
+static const sys_stdio_obj_t stdio_buffer_obj = {{&stdio_buffer_obj_type}, .fd = 0}; // fd unused
#endif
diff --git a/shared/timeutils/timeutils.c b/shared/timeutils/timeutils.c
index 6bf3eca84a..4282a0178d 100644
--- a/shared/timeutils/timeutils.c
+++ b/shared/timeutils/timeutils.c
@@ -40,7 +40,7 @@
#define DAYS_PER_100Y (365 * 100 + 24)
#define DAYS_PER_4Y (365 * 4 + 1)
-STATIC const uint16_t days_since_jan1[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
+static const uint16_t days_since_jan1[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
bool timeutils_is_leap_year(mp_uint_t year) {
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
@@ -125,7 +125,7 @@ void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t, timeutils_struct_t
tm->tm_year = 2000 + years + 4 * q_cycles + 100 * c_cycles + 400 * qc_cycles;
// Note: days_in_month[0] corresponds to March
- STATIC const int8_t days_in_month[] = {31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 29};
+ static const int8_t days_in_month[] = {31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 29};
mp_int_t month;
for (month = 0; days_in_month[month] <= days; month++) {
diff --git a/shared/tinyusb/mp_cdc_common.c b/shared/tinyusb/mp_cdc_common.c
index 8278685262..e790646f4f 100644
--- a/shared/tinyusb/mp_cdc_common.c
+++ b/shared/tinyusb/mp_cdc_common.c
@@ -34,7 +34,7 @@
static mp_sched_node_t mp_bootloader_sched_node;
-STATIC void usbd_cdc_run_bootloader_task(mp_sched_node_t *node) {
+static void usbd_cdc_run_bootloader_task(mp_sched_node_t *node) {
mp_hal_delay_ms(250);
machine_bootloader(0, NULL);
}
diff --git a/tools/boardgen.py b/tools/boardgen.py
index caa9fe851c..41a8e9f2e5 100644
--- a/tools/boardgen.py
+++ b/tools/boardgen.py
@@ -289,7 +289,7 @@ class PinGenerator:
def print_board_locals_dict(self, out_source):
print(file=out_source)
print(
- "STATIC const mp_rom_map_elem_t machine_pin_board_pins_locals_dict_table[] = {",
+ "static const mp_rom_map_elem_t machine_pin_board_pins_locals_dict_table[] = {",
file=out_source,
)
for pin in self.available_pins():
@@ -318,7 +318,7 @@ class PinGenerator:
def print_cpu_locals_dict(self, out_source):
print(file=out_source)
print(
- "STATIC const mp_rom_map_elem_t machine_pin_cpu_pins_locals_dict_table[] = {",
+ "static const mp_rom_map_elem_t machine_pin_cpu_pins_locals_dict_table[] = {",
file=out_source,
)
for pin in self.available_pins(exclude_hidden=True):