Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4835

MicroPython • Re: Detecting USB serial connection ?

$
0
0
Found a solution for 'USB Connected" which is useful in its own right, is partway there -

https://forum.micropython.org/viewtopic ... 814#p59545

Code:

SIE_STATUS_REG = 0x50110000 + 0x50SIE_CONNECTED  = 1 << 16SIE_SUSPENDED  = 1 << 4usbConnected   = (machine.mem32[SIE_STATUS_REG] & (SIE_CONNECTED | SIE_SUSPENDED)) == SIE_CONNECTED             if usbConnected:  print('USB connected')

Statistics: Posted by hippy — Fri Jan 19, 2024 3:41 pm



Viewing all articles
Browse latest Browse all 4835

Trending Articles