The MBED firmware used on the Chipin sorter, developed over 12 weeks for a 3rd year university systems project. Chipin is a token sorter, it sorts tokens by colours and dispenses them to order through an online booking system and card reader. This program interfaces with an FPGA, PC and LCD screen to control the sorter. The sorter has an operation mode where it can process orders when a card is entered into the machine. There is also a maintenance mode where the device responds to maintenance instructions such as 'dispense all'. More information at http://www.ionsystems.uk/

Dependencies:   MCP23017 TCS3472_I2C WattBob_TextLCD mbed-rtos mbed

stateMachine.h

Committer:
IonSystems
Date:
2014-11-25
Revision:
22:8f11d1c178ab
Parent:
12:814a8fdbb6f7
Child:
27:47a7bc902587

File content as of revision 22:8f11d1c178ab:


enum StateMachine{
    
    //Initializing state
    INITIALISING,
    
    //Stored value states
    READING_RGB_VALUES,     //read stored values from MBED datafile
    WRITING_RGB_VALUES,     //write stored values to MBED datafile
    INCREMENT_RED,
    INCREMENT_GREEN,
    INCREMENT_BLUE,
    DECREMENT_RED,
    DECREMENT_GREEN,
    DECREMENT_BLUE,
    
    
    //Dispensing states
    DISPENSE_RED,
    DISPENSE_GREEN,
    DISPENSE_BLUE,
    DISPENSE_ALL,
    //Sorting states
    SORT_RED,
    SORT_GREEN,
    SORT_BLUE,
    SORT_BIN,
    SORT_RECYCLE,
    
    //Card reader states
    READ_CARD,
    WAITING_FOR_CARD,
    WAITING_FOR_DATABASE,
    RECIEVING_AMOUNTS,      //The MBED is recieving the number of each colour of token to dispense.
    
    //MBED LCD states
    DISPLAY_WELCOME,        //Display a welcome message.
    DISPLAY_AMOUNTS,        //Display the amount of tokens requested.
    DISPLAY_LEVELS,         //Display the current sorted chip levels.
    DISPLAY_LANGUAGE,       //Display the current language.
    DISPLAY_COMPLETED,      //Display an 'order completed' message.
    DISPLAY_SORTING,        //Display a 'currently sorting' message.
    DISPLAY_DISPENSING,     //Display a 'dispensing' message.
    
    //PC States
    WAITING_FOR_ACK,
    WAITING_FOR_CHAR,
    //External LCD States
    
    //Maintenance mode states
    RB_LEFT,
    RB_CENTRE,
    RB_RIGHT,
    GO_UP,
    GO_CENTRE,
    GO_DOWN,
    BR_LEFT,
    BR_RIGHT,
    R_PUSH,
    R_HOME,
    GB_LEFT,
    GB_CENTRE,
    GB_RIGHT,
    maintenanceEND
    };