impure functionUartDevice_sync

Sync point of an external serial device: advances transmission and reception, delivers the received lines, arms the transmissions, and returns the next deadline

Information

impure: the function carries the state of the device and does not return the same thing for the same arguments — like PyRuntime_sync. It is only called from a when, never during a trial evaluation of the solver.

Called again several times at the same simulated instant (Modelica iterates over events), it does nothing more: all its steps are driven by deadlines or consume what they process.

Inputs

TypeNameDefaultDescription
UartDevicedev
RealcurrentTime
BooleanrxLevelLogic level read on the receive pin (voltage thresholded on the Modelica side)
Real[Interfaces.UART_DEV_MAX_VALUES]valueInQuantities coming from the model, substituted by {vN} in the transmitted frames

Outputs

TypeNameDefaultDescription
Real[Interfaces.UART_DEV_MAX_VALUES]valueOutQuantities captured by {oN} from the received frames (held between two frames)
BooleantxActiveA frame is being transmitted (icon indicator)
BooleantxLevelLevel to hold on TX until the next sync point (idle = high): nextWakeTime falls on the next level CHANGE of the frame
BooleanrxBusyA frame is being received (icon activity indicator)
IntegereventSeqIncremented at each received line and each transmitted payload - trigger for the edge detection change(eventSeq), same pattern as Display0.seq
StringlastRxLast complete line received (log, display)
StringlastTxLast payload transmitted (log)
RealnextWakeTimeNearest deadline: edge to transmit, end of frame, middle of the stop bit of a received frame, armed reply or periodic tick