how to determine which processor module i'm using?
-
hi all,
i'm writing code to execute on either a WiPy or a GPy.
i need to determine at run time which module the code is running on so i can initialise LTE (GPy) or not (WiPy)
aside from using the try...except method to check for LTE modem presence is there an object i can query for a device idi can't seem to find anything in the documentation.
any help will be appreciated
-
Dear @cYc,
@cYc said in how to determine which processor module i'm using?:
I need to determine at run time which module the code is running on so i can initialise LTE (GPy) or not (WiPy) aside from using the
try/except
method.@robert-hh said in how to determine which processor module i'm using?:
import sys
print(sys.platform)If you will need a more extensive platform switch, you are welcome to take our implementation [1] from the Universal MicroPython Application Loader.
More or less, it just wraps
sys.platform
andsys.implementation
.We are using it to run the Terkin-Datalogger on both ESP32 and STM32 plaforms and to decide whether it is running on Pycom MicroPython or Genuine MicroPython.
platform_info = PlatformInfo() if platform_info.mcu == platform_info.MCU.ESP32: print('Running on ESP32') elif platform_info.mcu == platform_info.MCU.STM32: print('Running on STM32') if platform_info.vendor == platform_info.MICROPYTHON.Pycom: print('Running on Pycom MicroPython') elif platform_info.vendor == platform_info.MICROPYTHON.Vanilla: print('Running on Genuine MicroPython')
With kind regards,
Andreas.
-
@robert-hh
many thanks for the speedy reply
exactly what i needed
-
@cYc sys.platform will tell you.
import sys
print (sys.platform)