Revision 1254
Changed rbom->ibom
trunk/code/projects/diagnostic_station/station/hardware_rbom.h | ||
---|---|---|
1 |
#ifndef _hardware_rbom_h |
|
2 |
#define _hardware_rbom_h |
|
3 |
|
|
4 |
#include <dragonfly_lib.h> |
|
5 |
#include "global.h" |
|
6 |
|
|
7 |
/* |
|
8 |
* Inverse BOM sensor macros for (N)orth, |
|
9 |
* (S)outh, (E)ast, and (W)est positions. |
|
10 |
*/ |
|
11 |
// FIXME do it right |
|
12 |
#define RBOM_SENSOR_LEFT AN3 |
|
13 |
#define RBOM_SENSOR_RIGHT AN4 |
|
14 |
#define RBOM_SENSOR_TOP AN5 |
|
15 |
//#define RBOM_SENSOR_ AN6 |
|
16 |
|
|
17 |
void rbom_init (void); |
|
18 |
|
|
19 |
void rbom_set (bool on); |
|
20 |
void rbom_read (uint16_t *top, uint16_t *left, uint16_t *right); |
|
21 |
void rbom_update (void); |
|
22 |
void rbom_debug (void); |
|
23 |
|
|
24 |
#endif |
trunk/code/projects/diagnostic_station/station/hardware_rbom.c | ||
---|---|---|
1 |
#include "hardware_rbom.h" |
|
2 |
|
|
3 |
static void pDataDump(int startPort, int stopPort, unsigned int delay); |
|
4 |
static void pUsr(int startPort, int stopPort, unsigned int delay); |
|
5 |
|
|
6 |
void rbom_init (void) |
|
7 |
{ |
|
8 |
// FIXME implement |
|
9 |
} |
|
10 |
|
|
11 |
void rbom_set (bool on) |
|
12 |
{ |
|
13 |
if (on) |
|
14 |
{ |
|
15 |
usb_puts ("# Turning RBOM light on" NL); |
|
16 |
// FIXME implement |
|
17 |
} |
|
18 |
else |
|
19 |
{ |
|
20 |
usb_puts ("# Turning RBOM light off" NL); |
|
21 |
// FIXME implement |
|
22 |
} |
|
23 |
} |
|
24 |
|
|
25 |
void rbom_read (uint16_t *top, uint16_t *left, uint16_t *right) |
|
26 |
{ |
|
27 |
usb_puts ("# Reading RBOM" NL); |
|
28 |
// FIXME implement |
|
29 |
|
|
30 |
*top=0; |
|
31 |
*left=0; |
|
32 |
*right=0; |
|
33 |
} |
|
34 |
|
|
35 |
void rbom_update (void) |
|
36 |
{ |
|
37 |
// FIXME implement |
|
38 |
} |
|
39 |
|
|
40 |
void rbom_debug (void) |
|
41 |
{ |
|
42 |
usb_puts("# Debugging RBOM\n"); |
|
43 |
|
|
44 |
while(1) { |
|
45 |
pUsr(0x0, 0x10, 500); |
|
46 |
} |
|
47 |
|
|
48 |
exit(1); /* Control should never reach here */ |
|
49 |
} |
|
50 |
|
|
51 |
static void pDataDump(int startPort, int stopPort, unsigned int delay) { |
|
52 |
|
|
53 |
char buf[16]; |
|
54 |
int i; |
|
55 |
|
|
56 |
usb_puts("# port:\t\tval:\n\n"); |
|
57 |
|
|
58 |
for (i = startPort; i <= stopPort; i++) { |
|
59 |
|
|
60 |
usb_puts(itoa(analog10(i), buf, 10)); |
|
61 |
usb_puts("\n"); |
|
62 |
} |
|
63 |
|
|
64 |
delay_ms(delay); |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
|
|
69 |
static void pUsr(int startPort, int stopPort, unsigned int delay) { |
|
70 |
|
|
71 |
char buf[16]; |
|
72 |
int i; |
|
73 |
|
|
74 |
usb_puts("# port:\t\tval:\n\n"); |
|
75 |
|
|
76 |
for (i = startPort; i <= stopPort; i++) { |
|
77 |
|
|
78 |
usb_puts(itoa(i, buf, 10)); |
|
79 |
usb_puts("\t\t"); |
|
80 |
usb_puts(itoa(analog10(i), buf, 10)); |
|
81 |
usb_puts("\n"); |
|
82 |
|
|
83 |
} |
|
84 |
|
|
85 |
delay_ms(delay); |
|
86 |
|
|
87 |
} |
trunk/code/projects/diagnostic_station/station/hardware.h | ||
---|---|---|
6 | 6 |
#include "global.h" |
7 | 7 |
|
8 | 8 |
#include "hardware_dynamos.h" |
9 |
#include "hardware_rbom.h"
|
|
9 |
#include "hardware_ibom.h"
|
|
10 | 10 |
#include "hardware_wall.h" |
11 | 11 |
#include "hardware_turntable.h" |
12 | 12 |
|
trunk/code/projects/diagnostic_station/station/hardware_ibom.c | ||
---|---|---|
1 |
#include "hardware_ibom.h" |
|
2 |
|
|
3 |
static void pDataDump(int startPort, int stopPort, unsigned int delay); |
|
4 |
static void pUsr(int startPort, int stopPort, unsigned int delay); |
|
5 |
|
|
6 |
void ibom_init (void) |
|
7 |
{ |
|
8 |
// FIXME implement |
|
9 |
} |
|
10 |
|
|
11 |
void ibom_set (bool on) |
|
12 |
{ |
|
13 |
if (on) |
|
14 |
{ |
|
15 |
usb_puts ("# Turning RBOM light on" NL); |
|
16 |
// FIXME implement |
|
17 |
} |
|
18 |
else |
|
19 |
{ |
|
20 |
usb_puts ("# Turning RBOM light off" NL); |
|
21 |
// FIXME implement |
|
22 |
} |
|
23 |
} |
|
24 |
|
|
25 |
void ibom_read (uint16_t *top, uint16_t *left, uint16_t *right) |
|
26 |
{ |
|
27 |
usb_puts ("# Reading RBOM" NL); |
|
28 |
// FIXME implement |
|
29 |
|
|
30 |
*top=0; |
|
31 |
*left=0; |
|
32 |
*right=0; |
|
33 |
} |
|
34 |
|
|
35 |
void ibom_update (void) |
|
36 |
{ |
|
37 |
// FIXME implement |
|
38 |
} |
|
39 |
|
|
40 |
void ibom_debug (void) |
|
41 |
{ |
|
42 |
usb_puts("# Debugging RBOM\n"); |
|
43 |
|
|
44 |
while(1) { |
|
45 |
pUsr(0x0, 0x10, 500); |
|
46 |
} |
|
47 |
|
|
48 |
exit(1); /* Control should never reach here */ |
|
49 |
} |
|
50 |
|
|
51 |
static void pDataDump(int startPort, int stopPort, unsigned int delay) { |
|
52 |
|
|
53 |
char buf[16]; |
|
54 |
int i; |
|
55 |
|
|
56 |
usb_puts("# port:\t\tval:\n\n"); |
|
57 |
|
|
58 |
for (i = startPort; i <= stopPort; i++) { |
|
59 |
|
|
60 |
usb_puts(itoa(analog10(i), buf, 10)); |
|
61 |
usb_puts("\n"); |
|
62 |
} |
|
63 |
|
|
64 |
delay_ms(delay); |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
|
|
69 |
static void pUsr(int startPort, int stopPort, unsigned int delay) { |
|
70 |
|
|
71 |
char buf[16]; |
|
72 |
int i; |
|
73 |
|
|
74 |
usb_puts("# port:\t\tval:\n\n"); |
|
75 |
|
|
76 |
for (i = startPort; i <= stopPort; i++) { |
|
77 |
|
|
78 |
usb_puts(itoa(i, buf, 10)); |
|
79 |
usb_puts("\t\t"); |
|
80 |
usb_puts(itoa(analog10(i), buf, 10)); |
|
81 |
usb_puts("\n"); |
|
82 |
|
|
83 |
} |
|
84 |
|
|
85 |
delay_ms(delay); |
|
86 |
|
|
87 |
} |
trunk/code/projects/diagnostic_station/station/dump_station.c | ||
---|---|---|
44 | 44 |
} |
45 | 45 |
} |
46 | 46 |
|
47 |
void dump_station_rbom (void)
|
|
47 |
void dump_station_ibom (void)
|
|
48 | 48 |
{ |
49 | 49 |
uint16_t top, left, right; |
50 | 50 |
char c; |
51 | 51 |
|
52 | 52 |
while (usb_getc_nb (&c)==-1) |
53 | 53 |
{ |
54 |
rbom_update ();
|
|
55 |
rbom_read (&top, &left, &right);
|
|
54 |
ibom_update ();
|
|
55 |
ibom_read (&top, &left, &right);
|
|
56 | 56 |
usb_puti (top); |
57 | 57 |
usb_puts (" "); |
58 | 58 |
usb_puti (left); |
trunk/code/projects/diagnostic_station/station/hardware_ibom.h | ||
---|---|---|
1 |
#ifndef _hardware_ibom_h |
|
2 |
#define _hardware_ibom_h |
|
3 |
|
|
4 |
#include <dragonfly_lib.h> |
|
5 |
#include "global.h" |
|
6 |
|
|
7 |
/* |
|
8 |
* Inverse BOM sensor macros for (N)orth, |
|
9 |
* (S)outh, (E)ast, and (W)est positions. |
|
10 |
*/ |
|
11 |
// FIXME do it right |
|
12 |
#define RBOM_SENSOR_LEFT AN3 |
|
13 |
#define RBOM_SENSOR_RIGHT AN4 |
|
14 |
#define RBOM_SENSOR_TOP AN5 |
|
15 |
//#define RBOM_SENSOR_ AN6 |
|
16 |
|
|
17 |
void ibom_init (void); |
|
18 |
|
|
19 |
void ibom_set (bool on); |
|
20 |
void ibom_read (uint16_t *top, uint16_t *left, uint16_t *right); |
|
21 |
void ibom_update (void); |
|
22 |
void ibom_debug (void); |
|
23 |
|
|
24 |
#endif |
trunk/code/projects/diagnostic_station/station/dump_station.h | ||
---|---|---|
5 | 5 |
void dump_station_dynamos (void); |
6 | 6 |
void dump_station_turntable (void); |
7 | 7 |
void dump_station_wall (void); |
8 |
void dump_station_rbom (void);
|
|
8 |
void dump_station_ibom (void);
|
|
9 | 9 |
|
10 | 10 |
|
11 | 11 |
|
trunk/code/projects/diagnostic_station/station/test_bom.c | ||
---|---|---|
2 | 2 |
#include "global.h" |
3 | 3 |
|
4 | 4 |
#include "hardware_turntable.h" |
5 |
#include "hardware_rbom.h"
|
|
5 |
#include "hardware_ibom.h"
|
|
6 | 6 |
#include "comm_robot.h" |
7 | 7 |
|
8 | 8 |
static uint16_t bom_emitter_position (uint8_t num) |
... | ... | |
52 | 52 |
turntable_rotate_to_position (bom_emitter_position (n)); |
53 | 53 |
robot_set_bom (1<<n); |
54 | 54 |
|
55 |
rbom_update ();
|
|
55 |
ibom_update ();
|
|
56 | 56 |
#define TOP 0 |
57 | 57 |
#define LEFT 1 |
58 | 58 |
#define RIGHT 2 |
59 |
rbom_read (&values[TOP], &values[LEFT], &values[RIGHT]);
|
|
59 |
ibom_read (&values[TOP], &values[LEFT], &values[RIGHT]);
|
|
60 | 60 |
|
61 | 61 |
robot_set_bom (0); |
62 | 62 |
|
... | ... | |
80 | 80 |
|
81 | 81 |
uint16_t on_value, off_value; |
82 | 82 |
|
83 |
rbom_set (true);
|
|
83 |
ibom_set (true);
|
|
84 | 84 |
robot_read_bom (n, &on_value); |
85 |
rbom_set (false);
|
|
85 |
ibom_set (false);
|
|
86 | 86 |
robot_read_bom (n, &off_value); |
87 | 87 |
|
88 | 88 |
// Send data |
trunk/code/projects/diagnostic_station/station/comm_interactive.c | ||
---|---|---|
22 | 22 |
case 'e': case 'E': dump_station_dynamos (); break; |
23 | 23 |
case 'w': case 'W': dump_station_wall (); break; |
24 | 24 |
case 't': case 'T': dump_station_turntable (); break; |
25 |
case 'r': case 'R': dump_station_rbom (); break;
|
|
25 |
case 'r': case 'R': dump_station_ibom (); break;
|
|
26 | 26 |
case ESC: return; |
27 | 27 |
default: break; |
28 | 28 |
} |
trunk/code/projects/diagnostic_station/station/main.c | ||
---|---|---|
104 | 104 |
|
105 | 105 |
orbs_set(255, 0,255,255,0,255); |
106 | 106 |
|
107 |
rbom_debug();
|
|
107 |
ibom_debug();
|
|
108 | 108 |
|
109 | 109 |
return 0; |
110 | 110 |
} |
trunk/code/projects/diagnostic_station/station/hardware.c | ||
---|---|---|
5 | 5 |
usb_puts ("# Initializing station hardware" NL); |
6 | 6 |
|
7 | 7 |
dynamos_init (); |
8 |
rbom_init ();
|
|
8 |
ibom_init ();
|
|
9 | 9 |
wall_init (); |
10 | 10 |
turntable_init (); |
11 | 11 |
} |
Also available in: Unified diff