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

Revision:
24:8868101d01d0
Parent:
23:f9e7e64784be
--- a/chipNumbers.h	Sat Nov 29 16:32:57 2014 +0000
+++ b/chipNumbers.h	Wed Dec 03 17:49:41 2014 +0000
@@ -1,34 +1,49 @@
 #include "mbed.h"
-
+//Define the integers to store the number of chips in each dispensor tube.
 int redAmount;          //The amount of chips curs
 int greenAmount;
 int blueAmount;
 int recycleAmount;
-int dispensorSize = 24; //The maximum number of chips that can fit in one of the dispensor tubes.
 
+/*  readChipNumbers()
+ *  Read the number of chips in each tube form the txt file on the MBED.
+ *  
+ *  The txt file provides non-volatile memory to store the keep track of
+ *  the chips een if the device loses power.
+*/
 void readChipNumbers(){
     redAmount = readFile(0);
     greenAmount = readFile(1);
     blueAmount = readFile(2);
     recycleAmount = readFile(3);
     }
-    
-void decrementRed(){
+
+//Decrement the amount of red chips in the storage tube by one.
+void decrementRed(){    
     redAmount--;
     }
+    
+//Decrement the amount of green chips in the storage tube by one.
 void decrementGreen(){
     greenAmount--;
     }
+    
+//Decrement the amount of blue chips in the storage tube by one.
 void decrementBlue(){
     blueAmount--;
     }
     
+//Increment the amount of red chips in the storage tube by one.
 void incrementRed(){
     redAmount++;
     }
+    
+//Increment the amount of green chips in the storage tube by one.
 void incrementGreen(){
     greenAmount++;
     }
+    
+//Increment the amount of blue chips in the storage tube by one.
 void incrementBlue(){
     blueAmount++;
     }