impure functionPyRuntime_sync
Sync point between the Python script and the simulation: passes the pin states, wakes the worker thread up to its next blocking point, returns the driven state and the next requested wake-up
Extends from PartialPyRuntimeSync (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
| Type | Name | Default | Description |
|---|---|---|---|
| PyRuntime | handle (from PartialPyRuntimeSync) | ||
| Real | currentTime (from PartialPyRuntimeSync) | ||
| Integer[:] | pinBoolIn (from PartialPyRuntimeSync) | logic 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)] | pinAnalogIn (from PartialPyRuntimeSync) | raw voltage (V) measured on each pin, aligned with pinBoolIn - read by machine.ADC on the ADC-capable pins | |
| Boolean | powerGood (from PartialPyRuntimeSync) | the board is supplied: the program starts at the first supplied sync point and stops for good at the first supply loss | |
| Real | adcRef (from PartialPyRuntimeSync) | reference voltage of the ADC (V): read_u16() = 65535 at this voltage |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer[size(pinBoolIn, 1)] | pinBoolOut (from PartialPyRuntimeSync) | level driven on each pin (0/1) | |
| Integer[size(pinBoolIn, 1)] | pinIsOutput (from PartialPyRuntimeSync) | direction of each pin (1 = output) | |
| Integer[size(pinBoolIn, 1)] | pinPull (from PartialPyRuntimeSync) | internal pull resistor of each pin (0 = none, 1 = Pin.PULL_UP, 2 = Pin.PULL_DOWN) | |
| Real[size(pinBoolIn, 1)] | pwmFreq (from PartialPyRuntimeSync) | PWM frequency of each pin (Hz), 0 = not in PWM mode - see machine.PWM | |
| Real[size(pinBoolIn, 1)] | pwmDuty (from PartialPyRuntimeSync) | PWM duty cycle of each pin (0-1), relevant only if pwmFreq > 0 | |
| Integer | displaySeq (from PartialPyRuntimeSync) | incremented at each machine.Display.write() on the single logical link MCU.Display0 - see machine.Display | |
| String | displayPayload (from PartialPyRuntimeSync) | last text sent by write() (sample-and-hold) | |
| Integer[2] | uartTxPin (from PartialPyRuntimeSync) | pins 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] | uartTxLevel (from PartialPyRuntimeSync) | level 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 | |
| Real | nextWakeTime (from PartialPyRuntimeSync) |