Revision 2008

View differences:

trunk/code/projects/forklift_demo/Forklift.h
10 10
  int get_serial_number(); // unique to each forklift
11 11
  int get_height();
12 12
  int get_height_setpoint();
13
  int set_height_setpoint(int setpoint);
13
  int set_height_setpoint(char setpoint);
14 14
};
15 15

  
16 16
#endif
trunk/code/projects/forklift_demo/Makefile
103 103
#     gnu89 = c89 plus GCC extensions
104 104
#     c99   = ISO C99 standard (not yet fully implemented)
105 105
#     gnu99 = c99 plus GCC extensions
106
CSTANDARD = -std=gnu99
106
CSTANDARD = -std=c++0x
107 107

  
108 108
# Place -D or -U options here
109 109
CDEFS += -DF_CPU=$(F_CPU)UL
......
132 132
CFLAGS += $(CDEFS) $(CINCS)
133 133
CFLAGS += -O$(OPT)
134 134
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
135
CFLAGS += -Wall -Wstrict-prototypes
135
CFLAGS += -Wall
136 136
CFLAGS += -Wa,-adhlns=$(<:.cpp=.lst)
137 137
CFLAGS += $(CSTANDARD)
138 138

  
trunk/code/projects/forklift_demo/Forklift.cpp
25 25
char volatile response;
26 26
char volatile received;
27 27

  
28
int mrecv(char data)
28
static int mrecv(char data)
29 29
{
30 30
  response = data;
31 31
  received = 1;
32
  return 0;
32 33
}
33 34

  
34
void srecv(char) {}
35
char ssend() {}
35
static void srecv(char) {}
36
static char ssend() {return 0;}
36 37

  
37
int read_addr(char addr)
38
static int read_addr(char addr)
38 39
{
39 40
  if (i2c_send(FORKLIFT_ADDR, &addr, 1))
40 41
    return FORKLIFT_ERROR;
......
50 51
  return FORKLIFT_ERROR;
51 52
}
52 53

  
53
int write_addr(char addr, char data)
54
static int write_addr(char addr, char data)
54 55
{
55 56
  char buf[2];
56 57
  buf[0] = addr;
......
61 62
    return 0;
62 63
}
63 64

  
64
void forklift_init()
65
void Forklift::forklift_init()
65 66
{
66 67
  i2c_init(SCOUT_AVR_ADDR, mrecv, srecv, ssend);
67 68
}
68 69

  
69
int get_tracking_id()
70
int Forklift::get_tracking_id()
70 71
{
71 72
  return read_addr(FORKLIFT_TRACKING_ID);
72 73
}
73 74

  
74
int get_serial_number()
75
int Forklift::get_serial_number()
75 76
{
76 77
  return read_addr(FORKLIFT_SERIAL_NUMBER);
77 78
}
78 79

  
79
int get_height()
80
int Forklift::get_height()
80 81
{
81 82
  return read_addr(FORKLIFT_HEIGHT);
82 83
}
83 84

  
84
int get_height_setpoint()
85
int Forklift::get_height_setpoint()
85 86
{
86 87
  return read_addr(FORKLIFT_HEIGHT_SETPOINT);
87 88
}
88 89

  
89
int set_height_setpoint(char setpoint)
90
int Forklift::set_height_setpoint(char setpoint)
90 91
{
91 92
  return write_addr(FORKLIFT_HEIGHT_SETPOINT, setpoint);
92 93
}

Also available in: Unified diff