Вы находитесь на странице: 1из 2

/*

LEAF_STATE_MACHINE

This state machine detecs the insertion of the leaf card, during which the game
should run

States:
LeafInserted
LeafNotInserted

*/

Include Dependent Files


Function define module functions
Define port and pin for the LEAF

Specify Module Variables


MyPriority
LastPinState
CurrentState

InitLeafSM

Parameters
uint8_t : the priorty of this service

Returns
bool, false if error in initialization, true otherwise

Description
Saves away the priority, and does any
other required initialization for this service

Function

Initialize the MyPriority module variable with the passed priority


Initialize the leaf pin as a digital input
Initialize the last pin state for the leaf pin
Make current state - PseudoState_Leaf

Likewise, initialise the Leaf LED


Initialize the Leaf LED to start as Off

Post ES_INIT to this state machine. Return true if successful, false in case of
any error.

PostLeafSM

Parameters
ES_Event_t ThisEvent ,the event to post to the queue

Returns
bool false if the Enqueue operation failed, true otherwise

Description
Posts an event to this state machine's queue

Function:

Call ES_PostToService passing the priority through MyPriority and the assigned
event

RunLeafSM
Parameters
ES_Event_t : the event from its service queue to process in this State
Machine
Types of ES_Event_t: LEAF_ACTIVATED, LEAF_NOT_ACTIVATED

Returns
ES_Event_t, ES_NO_EVENT if no error ES_ERROR otherwise

Function

Declare a ReturnEvent and initialise it as ES_NO_EVENT. This would be returned


in case of no error.

Switch CurrentState
If PseudoState_Leaf:
If event is ES_INIT:
Switch on the Leaf LED
Put current state to LeafNotInserted

If LeafNotInserted:
If event is LEAF_VALID:
Post LEAF_ACTIVATED event to the ControlSM
Put current state to LeafInserted
Switch off leaf led

If LeafInserted:
If event LEAF_REMOVED:
Post LEAF_RESET
Put current state to LeafNotInserted
Switch on the Leaf LED

return ReturnEvent

Вам также может понравиться

  • Pseudoleaf
    Pseudoleaf
    Документ3 страницы
    Pseudoleaf
    api-437846864
    Оценок пока нет
  • Leafsm
    Leafsm
    Документ7 страниц
    Leafsm
    api-438010548
    Оценок пока нет
  • Resetsm
    Resetsm
    Документ2 страницы
    Resetsm
    api-438010548
    Оценок пока нет
  • Gamesm
    Gamesm
    Документ3 страницы
    Gamesm
    api-438010548
    Оценок пока нет
  • Controlsm
    Controlsm
    Документ3 страницы
    Controlsm
    api-438010548
    Оценок пока нет
  • Pseudoturntable
    Pseudoturntable
    Документ2 страницы
    Pseudoturntable
    api-437846864
    Оценок пока нет
  • Visualblastsm
    Visualblastsm
    Документ5 страниц
    Visualblastsm
    api-438010548
    Оценок пока нет
  • Gameplay HSM Pseudo Code
    Gameplay HSM Pseudo Code
    Документ4 страницы
    Gameplay HSM Pseudo Code
    api-644185248
    Оценок пока нет
  • Pseudogame
    Pseudogame
    Документ5 страниц
    Pseudogame
    api-437846864
    Оценок пока нет
  • Scoringsm
    Scoringsm
    Документ10 страниц
    Scoringsm
    api-438010548
    Оценок пока нет
  • Spi Leader Pseudocode
    Spi Leader Pseudocode
    Документ5 страниц
    Spi Leader Pseudocode
    api-581263110
    Оценок пока нет
  • Faceoffnav
    Faceoffnav
    Документ7 страниц
    Faceoffnav
    api-398062839
    Оценок пока нет
  • Navtoshootreloadsm
    Navtoshootreloadsm
    Документ4 страницы
    Navtoshootreloadsm
    api-398062839
    Оценок пока нет
  • Pesudo Code
    Pesudo Code
    Документ22 страницы
    Pesudo Code
    api-311007633
    Оценок пока нет
  • Idle
    Idle
    Документ2 страницы
    Idle
    api-385142684
    Оценок пока нет
  • Servo Service Pseudo Code
    Servo Service Pseudo Code
    Документ3 страницы
    Servo Service Pseudo Code
    api-340729449
    Оценок пока нет
  • Playservice
    Playservice
    Документ14 страниц
    Playservice
    api-397509789
    Оценок пока нет
  • Actionmachine C
    Actionmachine C
    Документ6 страниц
    Actionmachine C
    api-272643960
    Оценок пока нет
  • Psuedoeve
    Psuedoeve
    Документ3 страницы
    Psuedoeve
    api-437846864
    Оценок пока нет
  • Software Specification
    Software Specification
    Документ43 страницы
    Software Specification
    Andrew Sack
    Оценок пока нет
  • Psuedo-Code For Ledstripservice Service Initializeledstripservice
    Psuedo-Code For Ledstripservice Service Initializeledstripservice
    Документ4 страницы
    Psuedo-Code For Ledstripservice Service Initializeledstripservice
    api-437846864
    Оценок пока нет
  • Reloading SM
    Reloading SM
    Документ10 страниц
    Reloading SM
    api-397509789
    Оценок пока нет
  • Refcommsm
    Refcommsm
    Документ9 страниц
    Refcommsm
    api-397492879
    Оценок пока нет
  • Linefollowing SM
    Linefollowing SM
    Документ9 страниц
    Linefollowing SM
    api-397509789
    Оценок пока нет
  • Gamehsm
    Gamehsm
    Документ9 страниц
    Gamehsm
    api-438120791
    Оценок пока нет
  • Propellerbot Tophsm Pseudo Code
    Propellerbot Tophsm Pseudo Code
    Документ3 страницы
    Propellerbot Tophsm Pseudo Code
    api-644185248
    Оценок пока нет
  • State Machine Pseudo Code
    State Machine Pseudo Code
    Документ2 страницы
    State Machine Pseudo Code
    api-340729449
    100% (1)
  • Ledfsm Pseudocode
    Ledfsm Pseudocode
    Документ3 страницы
    Ledfsm Pseudocode
    api-581263110
    Оценок пока нет
  • Pseudo-Code For The Eye Clock Module (A Service That Implements A State Machine) Initializeeyeclock
    Pseudo-Code For The Eye Clock Module (A Service That Implements A State Machine) Initializeeyeclock
    Документ5 страниц
    Pseudo-Code For The Eye Clock Module (A Service That Implements A State Machine) Initializeeyeclock
    api-437846864
    Оценок пока нет
  • Eventcheckers
    Eventcheckers
    Документ4 страницы
    Eventcheckers
    api-438010548
    Оценок пока нет
  • Gamemastersm
    Gamemastersm
    Документ12 страниц
    Gamemastersm
    api-397492879
    Оценок пока нет
  • Buttondb
    Buttondb
    Документ5 страниц
    Buttondb
    api-532411015
    Оценок пока нет
  • Unloadrecycling
    Unloadrecycling
    Документ11 страниц
    Unloadrecycling
    api-438120791
    Оценок пока нет
  • Wheel
    Wheel
    Документ1 страница
    Wheel
    api-272563993
    Оценок пока нет
  • Car C
    Car C
    Документ5 страниц
    Car C
    api-385142684
    Оценок пока нет
  • Pseudo Code
    Pseudo Code
    Документ14 страниц
    Pseudo Code
    api-301836448
    Оценок пока нет
  • Shootingc
    Shootingc
    Документ7 страниц
    Shootingc
    api-397509789
    Оценок пока нет
  • Psuedogamebuttons
    Psuedogamebuttons
    Документ3 страницы
    Psuedogamebuttons
    api-437846864
    Оценок пока нет
  • Unloadtrash
    Unloadtrash
    Документ10 страниц
    Unloadtrash
    api-438120791
    Оценок пока нет
  • Buttonledsm Pseudocode
    Buttonledsm Pseudocode
    Документ3 страницы
    Buttonledsm Pseudocode
    api-581263110
    Оценок пока нет
  • Motorservice
    Motorservice
    Документ8 страниц
    Motorservice
    api-397509789
    Оценок пока нет
  • Defense
    Defense
    Документ6 страниц
    Defense
    api-398062839
    Оценок пока нет
  • Gameplayc
    Gameplayc
    Документ5 страниц
    Gameplayc
    api-397509789
    Оценок пока нет
  • Linefollowing Pseudocode
    Linefollowing Pseudocode
    Документ3 страницы
    Linefollowing Pseudocode
    api-581263110
    Оценок пока нет
  • Led Service Pseudocode
    Led Service Pseudocode
    Документ2 страницы
    Led Service Pseudocode
    api-581249153
    Оценок пока нет
  • Gamesm
    Gamesm
    Документ12 страниц
    Gamesm
    api-438010548
    Оценок пока нет
  • Timingmotor Final
    Timingmotor Final
    Документ2 страницы
    Timingmotor Final
    api-340769184
    Оценок пока нет
  • "Es - Configure.H" "Es - Framework.H" "Gameplay.H" "Enemyship.H" "Projectile.H" "Spaceship.H" "Updateoled.H" "Dotstarservice.H"
    "Es - Configure.H" "Es - Framework.H" "Gameplay.H" "Enemyship.H" "Projectile.H" "Spaceship.H" "Updateoled.H" "Dotstarservice.H"
    Документ9 страниц
    "Es - Configure.H" "Es - Framework.H" "Gameplay.H" "Enemyship.H" "Projectile.H" "Spaceship.H" "Updateoled.H" "Dotstarservice.H"
    api-532411015
    Оценок пока нет
  • "ES - Configure.h" "ES - Framework.h" "Car.h" "PWM16Tiva.h" "Inc/hw - Memmap.h" "Inc/hw - Types.h" "Inc/hw - Gpio.h" "Inc/hw - Sysctl.h"
    "ES - Configure.h" "ES - Framework.h" "Car.h" "PWM16Tiva.h" "Inc/hw - Memmap.h" "Inc/hw - Types.h" "Inc/hw - Gpio.h" "Inc/hw - Sysctl.h"
    Документ10 страниц
    "ES - Configure.h" "ES - Framework.h" "Car.h" "PWM16Tiva.h" "Inc/hw - Memmap.h" "Inc/hw - Types.h" "Inc/hw - Gpio.h" "Inc/hw - Sysctl.h"
    api-385142684
    Оценок пока нет
  • Lasercharging
    Lasercharging
    Документ2 страницы
    Lasercharging
    api-272563993
    Оценок пока нет
  • Alignsm
    Alignsm
    Документ3 страницы
    Alignsm
    api-644185248
    Оценок пока нет
  • Faceoffsm
    Faceoffsm
    Документ16 страниц
    Faceoffsm
    api-397492879
    Оценок пока нет
  • Defensesm
    Defensesm
    Документ6 страниц
    Defensesm
    api-397492879
    Оценок пока нет
  • Scoringsm
    Scoringsm
    Документ3 страницы
    Scoringsm
    api-438010548
    Оценок пока нет
  • Startbutton Final
    Startbutton Final
    Документ3 страницы
    Startbutton Final
    api-340769184
    Оценок пока нет
  • Refservice
    Refservice
    Документ10 страниц
    Refservice
    api-397509789
    Оценок пока нет
  • Linefollowingsm
    Linefollowingsm
    Документ8 страниц
    Linefollowingsm
    api-398062839
    Оценок пока нет
  • DOC-56154 - How To Activate Next Page, Last Page Buttons
    DOC-56154 - How To Activate Next Page, Last Page Buttons
    Документ4 страницы
    DOC-56154 - How To Activate Next Page, Last Page Buttons
    ZJ Liu
    Оценок пока нет
  • Blinkingled
    Blinkingled
    Документ2 страницы
    Blinkingled
    api-272563993
    Оценок пока нет
  • States Machines: Mario Bros Water Company
    States Machines: Mario Bros Water Company
    Документ7 страниц
    States Machines: Mario Bros Water Company
    api-438010548
    Оценок пока нет
  • Scoringsm
    Scoringsm
    Документ3 страницы
    Scoringsm
    api-438010548
    Оценок пока нет
  • Visualblastsm
    Visualblastsm
    Документ1 страница
    Visualblastsm
    api-438010548
    Оценок пока нет
  • Eventcheckers
    Eventcheckers
    Документ1 страница
    Eventcheckers
    api-438010548
    Оценок пока нет
  • Es Eventcheckwrapper
    Es Eventcheckwrapper
    Документ1 страница
    Es Eventcheckwrapper
    api-438010548
    Оценок пока нет
  • Controlsm
    Controlsm
    Документ1 страница
    Controlsm
    api-438010548
    Оценок пока нет
  • Resetsm
    Resetsm
    Документ1 страница
    Resetsm
    api-438010548
    Оценок пока нет
  • SR Hillandmotor
    SR Hillandmotor
    Документ1 страница
    SR Hillandmotor
    api-438010548
    Оценок пока нет
  • Mariomovementsm
    Mariomovementsm
    Документ1 страница
    Mariomovementsm
    api-438010548
    Оценок пока нет
  • Soundsm
    Soundsm
    Документ1 страница
    Soundsm
    api-438010548
    Оценок пока нет
  • Scoringsm
    Scoringsm
    Документ1 страница
    Scoringsm
    api-438010548
    Оценок пока нет
  • Gamesm
    Gamesm
    Документ1 страница
    Gamesm
    api-438010548
    Оценок пока нет
  • Leafsm
    Leafsm
    Документ1 страница
    Leafsm
    api-438010548
    Оценок пока нет
  • Visualblastsm
    Visualblastsm
    Документ5 страниц
    Visualblastsm
    api-438010548
    Оценок пока нет
  • Eventcheckers
    Eventcheckers
    Документ4 страницы
    Eventcheckers
    api-438010548
    Оценок пока нет
  • Mariomovementsm
    Mariomovementsm
    Документ4 страницы
    Mariomovementsm
    api-438010548
    Оценок пока нет
  • Scoringsm
    Scoringsm
    Документ10 страниц
    Scoringsm
    api-438010548
    Оценок пока нет
  • Gamesm
    Gamesm
    Документ12 страниц
    Gamesm
    api-438010548
    Оценок пока нет