Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of bertl14 by
Revision 5:066936e2c097, committed 2016-04-04
- Comitter:
- heinrich_kevin
- Date:
- Mon Apr 04 12:17:24 2016 +0000
- Parent:
- 3:4326e2654adb
- Commit message:
- NEW VERSION
Changed in this revision
bertl14.cpp | Show annotated file Show diff for this revision Revisions of this file |
bertl14.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4326e2654adb -r 066936e2c097 bertl14.cpp --- a/bertl14.cpp Mon Feb 01 10:48:40 2016 +0000 +++ b/bertl14.cpp Mon Apr 04 12:17:24 2016 +0000 @@ -42,17 +42,17 @@ unsigned char bertl_PC9555_switches() { - int taster; + char taster[1]; pc9555.start(); // Start PC9555 to write the Adress pc9555.write(PC9555_ADDR_W); // Write the WRITE-Adress pc9555.write(0x01); // To define the Switches => 0x02: LEDs pc9555.start(); // Start PC9555 again to read the Values pc9555.write(PC9555_ADDR_R); // Set the READ_bit - taster = pc9555.read(0); // Read the Value of the Switches + taster[0] = pc9555.read(0); // Read the Value of the Switches (HEX_MASK) pc9555.stop(); // Stop the I2C - return (taster); // Return the value + return (taster[0]); // Return the value } // END PC9555 Routines
diff -r 4326e2654adb -r 066936e2c097 bertl14.h --- a/bertl14.h Mon Feb 01 10:48:40 2016 +0000 +++ b/bertl14.h Mon Apr 04 12:17:24 2016 +0000 @@ -13,6 +13,7 @@ #define LED_R_YELLOW (LED_FR_YELLOW|LED_BR_YELLOW) // 0b1000 1000, BERTL Right Side, YELLOW-LEDs are on #define LED_L_YELLOW (LED_FL_YELLOW|LED_BL_YELLOW) // 0b0010 0010, BERTL Left Side, YELLOW-LEDs are on +#define LED_YELLOW (LED_L_YELLOW|LED_R_YELLOW) // 0b1010 1010, BERTL, all YELLOW-LEDs are on #define LED_F_WHITE (LED_FL_WHITE|LED_FR_WHITE) // 0b0000 0101, BERTL Forward, WHITE-LEDs are on #define LED_B_RED (LED_BL_RED|LED_BR_RED) // 0b0101 0000, BERTL Backward, RED LEDs are on #define LED_B_ALL (LED_B_RED|LED_BL_YELLOW|LED_BR_YELLOW) // 0b1111 0000, BERTL Backward, All LEDs are on @@ -20,13 +21,24 @@ //-------------------------------------- // Switches: // Switch TA1: DEZ = 1 +#define TA_FM 0x01 // front middle switch // Switch TA2: DEZ = 2 +#define TA_BM 0x02 // back middle switch // Switch TA3: DEZ = 4 +#define TA_FL 0x04 // front left switch // Switch TA4: DEZ = 8 +#define TA_FR 0x08 // front right switch // Switch TA5: DEZ = 16 +#define TA_BL 0x10 // back left switch // Switch TA6: DEZ = 32 +#define TA_BR 0x20 // back right switch // Switch TA7: DEZ = 64 +#define TA_BF_L 0x40 // bottom front left switch // Switch TA8: DEZ = 128 +#define TA_BF_R 0x80 // bottom front right switch + +#define TA_F (TA_FL|TA_FM|TA_FR) // All front switches +#define TA_B (TA_BL|TA_BM|TA_BR) // All back switches //-------------------------------------- // Define PC9555 Routines #define PC9555_ADDR_W 0x40 //A2 = A1 = A0 = 0, WRITE-ADRESS