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
-
@cYc sys.platform will tell you.
import sys
print (sys.platform) -
@robert-hh
many thanks for the speedy reply
exactly what i needed -
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/exceptmethod.@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.platformandsys.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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login