4 errors

Dependencies:   KS0108_PCF8574 mbed

Revision:
2:66e4ebaba5df
Parent:
1:4f46d81502aa
--- a/main.cpp	Wed Sep 05 07:22:44 2012 +0000
+++ b/main.cpp	Mon Sep 10 16:33:46 2012 +0000
@@ -1,11 +1,18 @@
 #include "mbed.h"
 #include "menbed.h"
+#include "PCF8574_DataBus.h"
+
+
+
 
 AnalogIn photocell(p15);
 PwmOut led1(LED1);
 PwmOut led2(LED2);
 DigitalOut led3(LED3);
 DigitalOut led4(LED4);
+I2C i2c(p9, p10);
+PCF8574_DataBus    DB = PCF8574_DataBus(i2c, 0x40);
+
 
 float photocellVoltage(void) {return 3.3 * photocell;}
 void setLed1Pwm (float d) {led1 = d / 100.0;}
@@ -17,73 +24,39 @@
 void extinguishLed4 () {led4 = 0;}
 
 int main() {
-
+/*
     // Declare all the submenus so that they can be referenced in the
     // definitions of other menus
     MenbedMenu *rootMenu;
-    MenbedMenu *measurementMenu;
-    MenbedMenu *controlMenu;
-    MenbedMenu *aboutMenu;
+    //MenbedMenu *measurementMenu;
+    //MenbedMenu *controlMenu;
+    //MenbedMenu *aboutMenu;
 
-    // Root menu--to create a menu, we first create an array of pointers to 
-    // all the menu items that will populate the menu.  The MenbedMenuItem
-    // constructor take five arguments: the function to be executed when the
-    // item is selected; the child menu to open when the item is selected;
-    // a boolean indicating whether the child menu is actually this menu's
-    // ancestor, (useful when creating "go to root menu" items); a parameter
-    // object that holds a value to be viewed or modified; and a text string
-    // indicating what the menu item should say.  The text string may contain
-    // a printf-style specifier for a float that is bracketed by \t characters
-    // to offset it from the surrounding text.  If the float specified is
-    // found, it will be replaced by the value of the parameter.
-    MenbedMenuItem *rootMenuItems[3] = {
-        new MenbedMenuItem (NULL, &measurementMenu, false, NULL, "Measurements"),
-        new MenbedMenuItem (NULL, &controlMenu, false, NULL, "Controls"),
-        new MenbedMenuItem (NULL, &aboutMenu, false, NULL, "About"),
-    };
-    // After we have the array of pointers to menu items, we pass the number of
-    // elements in the arry and the array itself to the MenbedMenu constructor.
-    rootMenu = new MenbedMenu (3, rootMenuItems);
+    
+    MenbedMenuItem *rootMenuItems[2] = {
+        new MenbedMenuItem (NULL, NULL, false, NULL, " Test"),
+        new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") };
+        //new MenbedMenuItem (NULL, &measurementMenu, false, NULL, "Measurements"),
+        //new MenbedMenuItem (NULL, &controlMenu, false, NULL, "Controls"),
+        //new MenbedMenuItem (NULL, &aboutMenu, false, NULL, "About"),
+    
+    
+    rootMenu = new MenbedMenu (2, rootMenuItems);
 
-    // Measurements menu--the first item of the measurement menu displays the
-    // voltage and the resistor divider junction formed between a photocell and
-    // a fixed resistor.  To print this voltage as part of a menu item, we
-    // create a MenbedMenuParam object that takes as arguments to its
-    // constructor: a pointer to a function that returns a float containing the
-    // value of the parameter; a pointer to a function that we would call to 
-    // change the value of the parameter; a boolean (irrevelant here)
-    // indicating whether the parameter, if it were modifiable by the user, 
-    // should be updated as the user is changing its value or whether its
-    // should only be updated after the user has confirmed the new value; a 
-    // minimum value for the parameter; a maximum value; and a step size.
-    MenbedMenuParam photocellParam (photocellVoltage, NULL, false, 0.0, 0.0, 0.0);
+    */
+    //MenbedMenuParam photocellParam (photocellVoltage, NULL, false, 0.0, 0.0, 0.0);
     // Having created the parameter, we pass it as the 4th argument of the 
     // MenbedMenuItem constructor.  Note the \t-offset %.2f format specified
     // in the menu item text.  The menu system will call the photocellVoltage
     // function specified in the parameter constructor above and then print the
     // float that it returns in place of the %.2f in the menu text.
-    MenbedMenuItem *measurementMenuItems[2] = {
+   /* MenbedMenuItem *measurementMenuItems[2] = {
         new MenbedMenuItem (NULL, NULL, false, &photocellParam, "Photocell: \t%.2f\tV"),
         new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") };
-    measurementMenu = new MenbedMenu (2, measurementMenuItems);
+    measurementMenu = new MenbedMenu (2, measurementMenuItems);*/
 
-    // Controls menu--We have modifiable parameters in the first and second
-    // meu items of the controls menu.  Walking through the first parameter
-    // constructor, the getLed1Pwm function pointer points to a function that
-    // returns the current value of the PWM duty cycle.  The setLed1Pwm 
-    // function pointer points to a function which sets the PWM duty cycle.
-    // The boolean set to true indicates that as soon as the user makes a 
-    // change to the parameter, the setLed1Pwm function will be called.  The
-    // menu system will not wait for the user to confirm his change before
-    // making the call.  The 0.0 and 100.0 represent the minimum and 
-    // maximum PWM values.  The final 1.0 paramter is the step size when
-    // changing the PWM duty cycle.
-    MenbedMenuParam pwmParam1 (getLed1Pwm, setLed1Pwm, true, 0.0, 100.0, 1.0);
-    // The only different in this parameter from the one above is that the PWM
-    // duty cycle is not updated (setLed2Pwm is not called) until the user
-    // confirms the new duty cycle.  If the user cancels his modifications
-    // (either by pushing the cancel button or pushing and holding the select
-    // button) setLed2PWM is never called.
+     /*MenbedMenuParam pwmParam1 (getLed1Pwm, setLed1Pwm, true, 0.0, 100.0, 1.0);
+    
     MenbedMenuParam pwmParam2 (getLed2Pwm, setLed2Pwm, false, 0.0, 100.0, 1.0);
     // The third, fourth, and fifth items of the control menu demonstrate
     // functions when a menu item is selected.  The ability to call a function
@@ -105,43 +78,33 @@
         new MenbedMenuItem (NULL, NULL, false, NULL, "  Copyright 2011"),
         new MenbedMenuItem (NULL, NULL, false, NULL, " xxxxxxxx@xxx.xxx") };
     aboutMenu = new MenbedMenu (3, aboutMenuItems);
-            
+         */   
     // Having created the menus, menu items, and item parameters, we are ready
     // to instantiate the display.  MenbedDisplayHD44780 extends MenbedDisplay
     // and implements the all-important writeLine function allong with some
     // other less important functions.  The pins we pass to the constructor
     // specify the physical interface connection to the LCD.
-    MenbedDisplayHD44780 *hd44780Lcd = new MenbedDisplayHD44780 
-        (p25, p26, p27, p28, p29, p30, MenbedDisplayHD44780::LCD20x4);
-
-    // Now, we have the menu objects and the display object.  All we have to do
-    // is create the menbed menu system.  The number of buttons used by the
-    // menu system is specified by the number of pins passed to the Menbed 
-    // constructor.  The pin order is select, down, up, cancel.  With 
-    // constructor overloading, we can opt out of using the cancel and up
-    // buttons.
-
-    /* Four buttons (select, down, up, cancel ) */    
-    Menbed menbed(p22, p24, p23, p21,
-        rootMenu,
-        hd44780Lcd);
+    
+    //MenbedDisplay *LCD = new MenbedDisplay;
+  /*  
+    KS0108 *LCD = new KS0108  
+        (
+    p21,//_RST
+    p5,//_DI
+    p30,//_RW
+    p29,//_E
+    p25,//_CS2
+    p6,//_CS1
+    DB
+);
     
 
-    /* Three buttons (select, down, up) */
-    /*
-    Menbed menbed(p22, p24, p23,
-        &rootMenu,
-        hd44780Lcd);
-    */
+ */
+   
+    //Menbed (PinName select, PinName down, PinName up, PinName cancel,MenbedMenu *rootMenu,MenbedDisplay *display);
+    //Four buttons (select, down, up, cancel )     
+  //  Menbed menbed(p8, p11, p12, p13, rootMenu, LCD);
     
-    /* Two buttons (select, down) */
-    /*  
-    Menbed menbed(p22, p24,
-        &rootMenu,
-        hd44780Lcd);        
-    */
 
-    // The menu system runs in the background using Ticker objects.  The user
-    // can now run whatever application code he pleases.
     while(1) {}
 }