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
| Type | Name | Default | Description |
|---|---|---|---|
| UartDevice | dev | ||
| Real | currentTime | ||
| Boolean | rxLevel | Logic level read on the receive pin (voltage thresholded on the Modelica side) | |
| Real[Interfaces.UART_DEV_MAX_VALUES] | valueIn | Quantities coming from the model, substituted by {vN} in the transmitted frames |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[Interfaces.UART_DEV_MAX_VALUES] | valueOut | Quantities captured by {oN} from the received frames (held between two frames) | |
| Boolean | txActive | A frame is being transmitted (icon indicator) | |
| Boolean | txLevel | Level to hold on TX until the next sync point (idle = high): nextWakeTime falls on the next level CHANGE of the frame | |
| Boolean | rxBusy | A frame is being received (icon activity indicator) | |
| Integer | eventSeq | Incremented at each received line and each transmitted payload - trigger for the edge detection change(eventSeq), same pattern as Display0.seq | |
| String | lastRx | Last complete line received (log, display) | |
| String | lastTx | Last payload transmitted (log) | |
| Real | nextWakeTime | Nearest deadline: edge to transmit, end of frame, middle of the stop bit of a received frame, armed reply or periodic tick |