mirror of
https://github.com/nasa/fprime.git
synced 2025-12-12 18:31:06 -06:00
91 lines
2.4 KiB
Fortran
91 lines
2.4 KiB
Fortran
module Ref {
|
|
|
|
@ Component for sending a math operation
|
|
active component MathSender {
|
|
|
|
# ----------------------------------------------------------------------
|
|
# General ports
|
|
# ----------------------------------------------------------------------
|
|
|
|
@ Port for sending the operation request
|
|
output port mathOpOut: MathOp
|
|
|
|
@ Port for receiving the result
|
|
async input port mathResultIn: MathResult
|
|
|
|
# ----------------------------------------------------------------------
|
|
# Special ports
|
|
# ----------------------------------------------------------------------
|
|
|
|
@ Command receive port
|
|
command recv port cmdIn
|
|
|
|
@ Command registration port
|
|
command reg port cmdRegOut
|
|
|
|
@ Command response port
|
|
command resp port cmdResponseOut
|
|
|
|
@ Event port
|
|
event port eventOut
|
|
|
|
@ Telemetry port
|
|
telemetry port tlmOut
|
|
|
|
@ Text event port
|
|
text event port textEventOut
|
|
|
|
@ Time get port
|
|
time get port timeGetOut
|
|
|
|
# ----------------------------------------------------------------------
|
|
# Commands
|
|
# ----------------------------------------------------------------------
|
|
|
|
@ Do a math operation
|
|
async command DO_MATH(
|
|
val1: F32 @< The first operand
|
|
op: MathOp @< The operation
|
|
val2: F32 @< The second operand
|
|
)
|
|
|
|
# ----------------------------------------------------------------------
|
|
# Events
|
|
# ----------------------------------------------------------------------
|
|
|
|
@ Math command received
|
|
event COMMAND_RECV(
|
|
val1: F32 @< The first operand
|
|
op: MathOp @< The operation
|
|
val2: F32 @< The second operand
|
|
) \
|
|
severity activity low \
|
|
format "Math command received: {f} {} {f}"
|
|
|
|
@ Received math result
|
|
event RESULT(
|
|
result: F32 @< The math result
|
|
) \
|
|
severity activity high \
|
|
format "Math result is {f}"
|
|
|
|
# ----------------------------------------------------------------------
|
|
# Telemetry
|
|
# ----------------------------------------------------------------------
|
|
|
|
@ The first value
|
|
telemetry VAL1: F32
|
|
|
|
@ The operation
|
|
telemetry OP: MathOp
|
|
|
|
@ The second value
|
|
telemetry VAL2: F32
|
|
|
|
@ The result
|
|
telemetry RESULT: F32
|
|
|
|
}
|
|
|
|
}
|