a command line interface that can dynamically assign pins
Dependencies: TextLCD mbed PS2
Interface.cpp@0:4b04cc4cccb4, 2011-10-20 (annotated)
- Committer:
- gsulc
- Date:
- Thu Oct 20 20:27:04 2011 +0000
- Revision:
- 0:4b04cc4cccb4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gsulc | 0:4b04cc4cccb4 | 1 | /**************************************************************/ |
gsulc | 0:4b04cc4cccb4 | 2 | // Name: Interface.h |
gsulc | 0:4b04cc4cccb4 | 3 | // |
gsulc | 0:4b04cc4cccb4 | 4 | // Description: defines an interface object for assigning |
gsulc | 0:4b04cc4cccb4 | 5 | // interfaces on the fly |
gsulc | 0:4b04cc4cccb4 | 6 | // |
gsulc | 0:4b04cc4cccb4 | 7 | /**************************************************************/ |
gsulc | 0:4b04cc4cccb4 | 8 | |
gsulc | 0:4b04cc4cccb4 | 9 | #include "Interface.h" |
gsulc | 0:4b04cc4cccb4 | 10 | #include <string.h> |
gsulc | 0:4b04cc4cccb4 | 11 | |
gsulc | 0:4b04cc4cccb4 | 12 | /*Interface::Interface(char type_str[], char pins_str[]), void* interface) |
gsulc | 0:4b04cc4cccb4 | 13 | { |
gsulc | 0:4b04cc4cccb4 | 14 | // read string to find out the type, check the pins against an |
gsulc | 0:4b04cc4cccb4 | 15 | // appropriate mask, and create an interface of that type |
gsulc | 0:4b04cc4cccb4 | 16 | if(strcmp()) |
gsulc | 0:4b04cc4cccb4 | 17 | type = |
gsulc | 0:4b04cc4cccb4 | 18 | }*/ |
gsulc | 0:4b04cc4cccb4 | 19 | |
gsulc | 0:4b04cc4cccb4 | 20 | PinName getPin(int pin) { |
gsulc | 0:4b04cc4cccb4 | 21 | switch(pin){ |
gsulc | 0:4b04cc4cccb4 | 22 | case 5: |
gsulc | 0:4b04cc4cccb4 | 23 | return p5; |
gsulc | 0:4b04cc4cccb4 | 24 | case 6: |
gsulc | 0:4b04cc4cccb4 | 25 | return p6; |
gsulc | 0:4b04cc4cccb4 | 26 | case 7: |
gsulc | 0:4b04cc4cccb4 | 27 | return p7; |
gsulc | 0:4b04cc4cccb4 | 28 | case 8: |
gsulc | 0:4b04cc4cccb4 | 29 | return p8; |
gsulc | 0:4b04cc4cccb4 | 30 | case 9: |
gsulc | 0:4b04cc4cccb4 | 31 | return p9; |
gsulc | 0:4b04cc4cccb4 | 32 | case 10: |
gsulc | 0:4b04cc4cccb4 | 33 | return p10; |
gsulc | 0:4b04cc4cccb4 | 34 | case 11: |
gsulc | 0:4b04cc4cccb4 | 35 | return p11; |
gsulc | 0:4b04cc4cccb4 | 36 | case 12: |
gsulc | 0:4b04cc4cccb4 | 37 | return p12; |
gsulc | 0:4b04cc4cccb4 | 38 | case 13: |
gsulc | 0:4b04cc4cccb4 | 39 | return p13; |
gsulc | 0:4b04cc4cccb4 | 40 | case 14: |
gsulc | 0:4b04cc4cccb4 | 41 | return p14; |
gsulc | 0:4b04cc4cccb4 | 42 | case 15: |
gsulc | 0:4b04cc4cccb4 | 43 | return p15; |
gsulc | 0:4b04cc4cccb4 | 44 | case 16: |
gsulc | 0:4b04cc4cccb4 | 45 | return p16; |
gsulc | 0:4b04cc4cccb4 | 46 | case 17: |
gsulc | 0:4b04cc4cccb4 | 47 | return p17; |
gsulc | 0:4b04cc4cccb4 | 48 | case 18: |
gsulc | 0:4b04cc4cccb4 | 49 | return p18; |
gsulc | 0:4b04cc4cccb4 | 50 | case 19: |
gsulc | 0:4b04cc4cccb4 | 51 | return p19; |
gsulc | 0:4b04cc4cccb4 | 52 | case 20: |
gsulc | 0:4b04cc4cccb4 | 53 | return p20; |
gsulc | 0:4b04cc4cccb4 | 54 | case 21: |
gsulc | 0:4b04cc4cccb4 | 55 | return p21; |
gsulc | 0:4b04cc4cccb4 | 56 | case 22: |
gsulc | 0:4b04cc4cccb4 | 57 | return p22; |
gsulc | 0:4b04cc4cccb4 | 58 | case 23: |
gsulc | 0:4b04cc4cccb4 | 59 | return p23; |
gsulc | 0:4b04cc4cccb4 | 60 | case 24: |
gsulc | 0:4b04cc4cccb4 | 61 | return p24; |
gsulc | 0:4b04cc4cccb4 | 62 | case 25: |
gsulc | 0:4b04cc4cccb4 | 63 | return p25; |
gsulc | 0:4b04cc4cccb4 | 64 | case 26: |
gsulc | 0:4b04cc4cccb4 | 65 | return p26; |
gsulc | 0:4b04cc4cccb4 | 66 | case 27: |
gsulc | 0:4b04cc4cccb4 | 67 | return p27; |
gsulc | 0:4b04cc4cccb4 | 68 | case 28: |
gsulc | 0:4b04cc4cccb4 | 69 | return p28; |
gsulc | 0:4b04cc4cccb4 | 70 | case 29: |
gsulc | 0:4b04cc4cccb4 | 71 | return p29; |
gsulc | 0:4b04cc4cccb4 | 72 | case 30: |
gsulc | 0:4b04cc4cccb4 | 73 | return p30; |
gsulc | 0:4b04cc4cccb4 | 74 | default: |
gsulc | 0:4b04cc4cccb4 | 75 | //return NULL; |
gsulc | 0:4b04cc4cccb4 | 76 | printf("Error: Not a valid pin"); |
gsulc | 0:4b04cc4cccb4 | 77 | } |
gsulc | 0:4b04cc4cccb4 | 78 | } |