impure functionPartialPyRuntimeSync

Interface of the sync point PyRuntime_sync: passes the pin states, wakes the worker thread up to its next blocking point, returns the driven state and the next requested wake-up

Inputs

TypeNameDefaultDescription
PyRuntimehandle
RealcurrentTime
Integer[:]pinBoolInlogic level read on each pin (0/1), in the order of the pin table given to PyRuntime (MCU: indices 1-8 = GP0-GP7, 9 = on-board LED)
Real[size(pinBoolIn, 1)]pinAnalogInraw voltage (V) measured on each pin, aligned with pinBoolIn - read by machine.ADC on the ADC-capable pins
BooleanpowerGoodthe board is supplied: the program starts at the first supplied sync point and stops for good at the first supply loss
RealadcRefreference voltage of the ADC (V): read_u16() = 65535 at this voltage

Outputs

TypeNameDefaultDescription
Integer[size(pinBoolIn, 1)]pinBoolOutlevel driven on each pin (0/1)
Integer[size(pinBoolIn, 1)]pinIsOutputdirection of each pin (1 = output)
Integer[size(pinBoolIn, 1)]pinPullinternal pull resistor of each pin (0 = none, 1 = Pin.PULL_UP, 2 = Pin.PULL_DOWN)
Real[size(pinBoolIn, 1)]pwmFreqPWM frequency of each pin (Hz), 0 = not in PWM mode - see machine.PWM
Real[size(pinBoolIn, 1)]pwmDutyPWM duty cycle of each pin (0-1), relevant only if pwmFreq > 0
IntegerdisplaySeqincremented at each machine.Display.write() on the single logical link MCU.Display0 - see machine.Display
StringdisplayPayloadlast text sent by write() (sample-and-hold)
Integer[2]uartTxPinpins assigned to serial transmission, one per UART slot (0 = none, otherwise its index, aligned with pinBoolOut) - slot 1: machine.UART of the script, slot 2: internal radio of the micro:bit - see machine.UART
Integer[2]uartTxLevellevel to hold on each transmit pin until the next sync point (0/1, idle = high): nextWakeTime falls on the next level CHANGE of a frame, the frame format stays entirely on the C side - Integer for the same reason as uartTxPin
RealnextWakeTime