4 errors

Dependencies:   KS0108_PCF8574 mbed

Committer:
GuiTwo
Date:
Tue Sep 11 10:21:10 2012 +0000
Revision:
3:ec80bb6ff5da
Parent:
2:66e4ebaba5df
4 errors on vector .cc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GuiTwo 0:936f1c020120 1 #include "mbed.h"
GuiTwo 0:936f1c020120 2 #include "menbed.h"
GuiTwo 2:66e4ebaba5df 3 #include "PCF8574_DataBus.h"
GuiTwo 2:66e4ebaba5df 4
GuiTwo 2:66e4ebaba5df 5
GuiTwo 2:66e4ebaba5df 6
GuiTwo 0:936f1c020120 7
GuiTwo 0:936f1c020120 8 AnalogIn photocell(p15);
GuiTwo 0:936f1c020120 9 PwmOut led1(LED1);
GuiTwo 0:936f1c020120 10 PwmOut led2(LED2);
GuiTwo 0:936f1c020120 11 DigitalOut led3(LED3);
GuiTwo 0:936f1c020120 12 DigitalOut led4(LED4);
GuiTwo 2:66e4ebaba5df 13 I2C i2c(p9, p10);
GuiTwo 2:66e4ebaba5df 14 PCF8574_DataBus DB = PCF8574_DataBus(i2c, 0x40);
GuiTwo 2:66e4ebaba5df 15
GuiTwo 0:936f1c020120 16
GuiTwo 0:936f1c020120 17 float photocellVoltage(void) {return 3.3 * photocell;}
GuiTwo 0:936f1c020120 18 void setLed1Pwm (float d) {led1 = d / 100.0;}
GuiTwo 0:936f1c020120 19 float getLed1Pwm (void) {return led1 * 100.0;}
GuiTwo 0:936f1c020120 20 void setLed2Pwm (float d) {led2 = d / 100.0;}
GuiTwo 0:936f1c020120 21 float getLed2Pwm (void) {return led2 * 100.0;}
GuiTwo 0:936f1c020120 22 void toggleLed3 () {led3 = led3 ^ 1;}
GuiTwo 0:936f1c020120 23 void lightLed4 () {led4 = 1;}
GuiTwo 0:936f1c020120 24 void extinguishLed4 () {led4 = 0;}
GuiTwo 0:936f1c020120 25
GuiTwo 0:936f1c020120 26 int main() {
GuiTwo 2:66e4ebaba5df 27 /*
GuiTwo 0:936f1c020120 28 // Declare all the submenus so that they can be referenced in the
GuiTwo 0:936f1c020120 29 // definitions of other menus
GuiTwo 0:936f1c020120 30 MenbedMenu *rootMenu;
GuiTwo 2:66e4ebaba5df 31 //MenbedMenu *measurementMenu;
GuiTwo 2:66e4ebaba5df 32 //MenbedMenu *controlMenu;
GuiTwo 2:66e4ebaba5df 33 //MenbedMenu *aboutMenu;
GuiTwo 0:936f1c020120 34
GuiTwo 2:66e4ebaba5df 35
GuiTwo 2:66e4ebaba5df 36 MenbedMenuItem *rootMenuItems[2] = {
GuiTwo 2:66e4ebaba5df 37 new MenbedMenuItem (NULL, NULL, false, NULL, " Test"),
GuiTwo 2:66e4ebaba5df 38 new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") };
GuiTwo 2:66e4ebaba5df 39 //new MenbedMenuItem (NULL, &measurementMenu, false, NULL, "Measurements"),
GuiTwo 2:66e4ebaba5df 40 //new MenbedMenuItem (NULL, &controlMenu, false, NULL, "Controls"),
GuiTwo 2:66e4ebaba5df 41 //new MenbedMenuItem (NULL, &aboutMenu, false, NULL, "About"),
GuiTwo 2:66e4ebaba5df 42
GuiTwo 2:66e4ebaba5df 43
GuiTwo 2:66e4ebaba5df 44 rootMenu = new MenbedMenu (2, rootMenuItems);
GuiTwo 0:936f1c020120 45
GuiTwo 2:66e4ebaba5df 46 */
GuiTwo 2:66e4ebaba5df 47 //MenbedMenuParam photocellParam (photocellVoltage, NULL, false, 0.0, 0.0, 0.0);
GuiTwo 0:936f1c020120 48 // Having created the parameter, we pass it as the 4th argument of the
GuiTwo 0:936f1c020120 49 // MenbedMenuItem constructor. Note the \t-offset %.2f format specified
GuiTwo 0:936f1c020120 50 // in the menu item text. The menu system will call the photocellVoltage
GuiTwo 0:936f1c020120 51 // function specified in the parameter constructor above and then print the
GuiTwo 0:936f1c020120 52 // float that it returns in place of the %.2f in the menu text.
GuiTwo 2:66e4ebaba5df 53 /* MenbedMenuItem *measurementMenuItems[2] = {
GuiTwo 0:936f1c020120 54 new MenbedMenuItem (NULL, NULL, false, &photocellParam, "Photocell: \t%.2f\tV"),
GuiTwo 0:936f1c020120 55 new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") };
GuiTwo 2:66e4ebaba5df 56 measurementMenu = new MenbedMenu (2, measurementMenuItems);*/
GuiTwo 0:936f1c020120 57
GuiTwo 2:66e4ebaba5df 58 /*MenbedMenuParam pwmParam1 (getLed1Pwm, setLed1Pwm, true, 0.0, 100.0, 1.0);
GuiTwo 2:66e4ebaba5df 59
GuiTwo 0:936f1c020120 60 MenbedMenuParam pwmParam2 (getLed2Pwm, setLed2Pwm, false, 0.0, 100.0, 1.0);
GuiTwo 0:936f1c020120 61 // The third, fourth, and fifth items of the control menu demonstrate
GuiTwo 0:936f1c020120 62 // functions when a menu item is selected. The ability to call a function
GuiTwo 0:936f1c020120 63 // can be combined with either displaying a submenu or editing a parameter.
GuiTwo 0:936f1c020120 64 MenbedMenuItem *controlMenuItems[6] = {
GuiTwo 0:936f1c020120 65 new MenbedMenuItem (NULL, NULL, false, &pwmParam1, "LED1 PWM: \t%.0f\t%"),
GuiTwo 0:936f1c020120 66 new MenbedMenuItem (NULL, NULL, false, &pwmParam2, "LED2 PWM: \t%.0f\t%"),
GuiTwo 0:936f1c020120 67 new MenbedMenuItem (toggleLed3, NULL, false, NULL, "Toggle LED3"),
GuiTwo 0:936f1c020120 68 new MenbedMenuItem (lightLed4, NULL, false, NULL, "Light LED4"),
GuiTwo 0:936f1c020120 69 new MenbedMenuItem (extinguishLed4, NULL, false, NULL, "Extinguish LED4"),
GuiTwo 0:936f1c020120 70 new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") };
GuiTwo 0:936f1c020120 71 controlMenu = new MenbedMenu (6, controlMenuItems);
GuiTwo 0:936f1c020120 72
GuiTwo 0:936f1c020120 73 // About menu--there's nothing fancy here, but the lack of a "Home" item
GuiTwo 0:936f1c020120 74 // forces the user to employ the cancel button, either directly or by
GuiTwo 0:936f1c020120 75 // pushing and hold the select button, to return to the root menu.
GuiTwo 0:936f1c020120 76 MenbedMenuItem *aboutMenuItems[3] = {
GuiTwo 0:936f1c020120 77 new MenbedMenuItem (NULL, NULL, false, NULL, " NXP3915"),
GuiTwo 0:936f1c020120 78 new MenbedMenuItem (NULL, NULL, false, NULL, " Copyright 2011"),
GuiTwo 0:936f1c020120 79 new MenbedMenuItem (NULL, NULL, false, NULL, " xxxxxxxx@xxx.xxx") };
GuiTwo 0:936f1c020120 80 aboutMenu = new MenbedMenu (3, aboutMenuItems);
GuiTwo 2:66e4ebaba5df 81 */
GuiTwo 0:936f1c020120 82 // Having created the menus, menu items, and item parameters, we are ready
GuiTwo 0:936f1c020120 83 // to instantiate the display. MenbedDisplayHD44780 extends MenbedDisplay
GuiTwo 0:936f1c020120 84 // and implements the all-important writeLine function allong with some
GuiTwo 0:936f1c020120 85 // other less important functions. The pins we pass to the constructor
GuiTwo 0:936f1c020120 86 // specify the physical interface connection to the LCD.
GuiTwo 2:66e4ebaba5df 87
GuiTwo 2:66e4ebaba5df 88 //MenbedDisplay *LCD = new MenbedDisplay;
GuiTwo 2:66e4ebaba5df 89 /*
GuiTwo 2:66e4ebaba5df 90 KS0108 *LCD = new KS0108
GuiTwo 2:66e4ebaba5df 91 (
GuiTwo 2:66e4ebaba5df 92 p21,//_RST
GuiTwo 2:66e4ebaba5df 93 p5,//_DI
GuiTwo 2:66e4ebaba5df 94 p30,//_RW
GuiTwo 2:66e4ebaba5df 95 p29,//_E
GuiTwo 2:66e4ebaba5df 96 p25,//_CS2
GuiTwo 2:66e4ebaba5df 97 p6,//_CS1
GuiTwo 2:66e4ebaba5df 98 DB
GuiTwo 2:66e4ebaba5df 99 );
GuiTwo 0:936f1c020120 100
GuiTwo 0:936f1c020120 101
GuiTwo 2:66e4ebaba5df 102 */
GuiTwo 2:66e4ebaba5df 103
GuiTwo 2:66e4ebaba5df 104 //Menbed (PinName select, PinName down, PinName up, PinName cancel,MenbedMenu *rootMenu,MenbedDisplay *display);
GuiTwo 2:66e4ebaba5df 105 //Four buttons (select, down, up, cancel )
GuiTwo 2:66e4ebaba5df 106 // Menbed menbed(p8, p11, p12, p13, rootMenu, LCD);
GuiTwo 0:936f1c020120 107
GuiTwo 0:936f1c020120 108
GuiTwo 0:936f1c020120 109 while(1) {}
GuiTwo 0:936f1c020120 110 }