Events List

This page describes all of the events associated with the services run by SpiceX. These events are triggered in response to changes in input pins (i.e. rising or falling edge) for various sensory inputs.

System Events

ES_INIT

Parameter: void

Description: used to transition from initial psuedo-state to state


ES_TIMER

Parameter: index of the timer

Description: triggered when timer expires

Cap Sensor Service

DBButtonDown

Triggered when the button is currently being pressed.

DBButtonUp

Triggered when the button is released.

Door Sensor Service

ES_DOOR_OPEN

Triggered when the hall effect sensor detects a rising edge, indicating the door is open.

ES_DOOR_CLOSE

Triggered when the hall effect sensor detects a falling edge, indicating the door is closed.

LED Display Service

ES_CHAR_PRESS

Triggered during posting of a new message. Displays one character to the LED module at a time, scrolls the display by 4 columns.

ES_UPDATING

Continuously triggered while message updates. Calls DM_TakesDisplayUpdatesStep() until finished.

Message Service

ES_INIT

Triggers the start of a half second timer.

ES_TIMEOUT

Triggered when the timer for half a second expires, at which an event is posted to the LED. Display service scrolls the corresponding character in the message. When the entire message is done updating, post an event ES_FinishedDisplay to the main state machine SpiceRackFSM to indicate completed.

ES_STARTING

Triggered when main FSM enters "rotating" state. Change a static variable, starting_message, to "ROTATING". Posts an event ES_INIT to itself to begin displaying one character at a time.

ES_STOPPING

Triggered when main FSM enters "stopping" state. Change a static variable, starting_message, to "STOPPING". Posts an event ES_INIT to itself to begin displaying one character at a time.

ES_NEW_SPICE

Triggered when Hall sensor detects new spice. Change a static variable, starting_message, to "NEW SPICE DETECTED". Posts an event ES_INIT to itself to begin displaying one character at a time.

ES_ADJUSTED

Triggered when potentiometer changed by user. Change a static variable, starting_message, to "CHANGING SPEED". Posts an event ES_INIT to itself to begin displaying one character at a time.

ES_CLR_SCRN

Triggered when door closed. Change a static variable, starting_message, to "\0", which is an empty string. Clears LED display.

ES_RESTARTING

Triggered when 20s have elapsed w/o user input. Change a static variable, starting_message, to "RESTARTING". Posts an event ES_INIT to itself to begin displaying one character at a time.

ES_BEGIN

Triggered when state machine begins. Posts an event ES_BEGIN to the LED display to starting the begin message.

IR Sensor Service

ES_OptoDown

Triggered when the IR sensor detects a hand-waving gesture.

ES_OptoUp

Triggered when the IR sensor doesn't detect a gesture.

Main Service

ES_DOOR_OPEN

Triggered when the hall effect sensor detects a rising edge, indicating the door is open.

ES_BEGIN

Triggered when state machine begins. Posts an event ES_BEGIN to the LED display to starting the begin message.

ES_DOOR_CLOSE

Triggered when the hall effect sensor detects a falling edge, indicating the door is closed.

DBButtonDown

Triggered when the button is currently being pressed.

ES_OptoDown

Triggered when the IR sensor detects a hand-waving gesture.

ES_SPICE_HIGH

Triggered when a new spice has been detected on the ferris wheel.

ES_TIMEOUT

Triggered when the timer for half a second expires, at which an event is posted to the LED. Display service to scroll the corresponding character in the message. When the entire message is done updating, post an event ES_FinishedDisplay to the main state machine SpiceRackFSM to indicate completed.

ES_FinishedDisplay

Triggered when a message is done printing. Posts to the SpiceRackFSM.

Spice Sensor Service

ES_SPICE_HIGH

Triggered when a new spice has been detected on the ferris wheel.

ES_SPICE_LOW

Triggered when there is no spice detected on the ferris wheel.

Motor Driver Service

ES_NEW_POT_VAL

Triggered when there has been a change in user input for the potentiometer. Adjusts the motor speed accordingly. Posts this event to the motor driver service.

ES_MOTOR_INIT

Triggered when main FSM goes into "rotating" state. Initializes PWM for motor. Called by the main state machine.

ES_MOTOR_STOP

Triggered when main FSM goes into "stopped" state. Stops the motor. Called by the main state machine.