mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
e3824a6d78
To the outside world, the AHRS can be in one of only a few primary states: Not present - AHRS is absent or non-responsive via SPI Inactive - Only link-level status messages are processed Ready - Ready to receive the next application level message Busy - Application level message is being processed Internal to the AHRS, there are many more states that need to be managed. This FSM provides the necessary decoupling between the ISR (which is being driven by the SPI link) and the AHRS main processing loop which must continue to run its filters independently of the SPI messaging rate. With this structure, SPI messages can be received at any time but processed at only specific points within the filter chains. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1005 ebee16cc-31ac-478f-84a7-5cbb03baadba
91 lines
2.6 KiB
Plaintext
91 lines
2.6 KiB
Plaintext
// Regenerate using graphviz/dotty with this command
|
|
// dot -Tjpg ./flight/Doc/Architecture/ahrs_spi_link_fsm.dot > ./flight/Doc/Architecture/ahrs_spi_link_fsm.jpg
|
|
|
|
digraph ahrs_spi_protocol {
|
|
label="AHRS SPI Link State Machine"
|
|
labelloc=t
|
|
labeljust = l
|
|
|
|
// Stopped -- Undefined Wire State
|
|
{
|
|
node [ style=filled,color=lightgray ]
|
|
|
|
stopped [ shape="doublecircle" ]
|
|
stopping
|
|
}
|
|
|
|
// Wire State Inactive
|
|
{
|
|
node [ style=filled,color=lightblue ]
|
|
|
|
inactive
|
|
}
|
|
|
|
// Wire State Busy
|
|
{
|
|
node [ style=filled,color=red ]
|
|
|
|
user_busy
|
|
user_busy_tx_pending
|
|
user_busy_rx_pending
|
|
user_busy_rxtx_pending
|
|
}
|
|
{
|
|
node [ style=filled,color=yellow ]
|
|
|
|
user_tx_pending
|
|
user_rx_pending
|
|
user_rxtx_pending
|
|
}
|
|
|
|
// Wire State Ready
|
|
{
|
|
node [ style=filled,color=green ]
|
|
|
|
user_rx_active
|
|
user_tx_active
|
|
user_rxtx_active
|
|
}
|
|
|
|
//
|
|
// State transitions driven by the user
|
|
//
|
|
stopped -> inactive [ label="init link" ]
|
|
|
|
inactive -> stopping [ label="stop" ]
|
|
inactive -> user_busy_rx_pending [ label="user set rx" ]
|
|
inactive -> user_busy_tx_pending [ label="user set tx" ]
|
|
|
|
user_busy -> user_busy_tx_pending [ label="user set tx" ]
|
|
user_busy -> user_busy_rx_pending [ label="user set rx" ]
|
|
user_busy -> inactive [ label="user done" ]
|
|
user_busy -> stopping [ label="stop" ]
|
|
|
|
user_busy_tx_pending -> user_busy_rxtx_pending [ label="user set rx" ]
|
|
user_busy_tx_pending -> user_tx_pending [ label="user done" ]
|
|
|
|
user_busy_rx_pending -> user_busy_rxtx_pending [ label="user set tx" ]
|
|
user_busy_rx_pending -> user_rx_pending [ label="user done" ]
|
|
|
|
user_busy_rxtx_pending -> user_rxtx_pending [ label="user done" ]
|
|
|
|
//
|
|
// State transitions driven by messaging from the OP board
|
|
//
|
|
stopping -> stopped [ label="rx any" ]
|
|
|
|
user_tx_pending -> user_tx_active [ label="rx any" ]
|
|
user_rx_pending -> user_rx_active [ label="rx any" ]
|
|
|
|
user_rxtx_pending -> user_rxtx_active [ label="rx any" ]
|
|
|
|
// Active -> Busy
|
|
user_rx_active -> user_busy [ label="rx user" ]
|
|
|
|
user_tx_active -> inactive [ label="rx any" ]
|
|
|
|
user_rxtx_active -> user_busy [ label="rx user" ]
|
|
user_rxtx_active -> user_rx_active [ label="rx link" ]
|
|
user_rxtx_active -> user_rx_active [ label="rx unknown" ]
|
|
}
|