Revision 1456 branches/colonetmk2/code/projects/libwireless/lib/sensor_matrix.c

View differences:

sensor_matrix.c
32 32
 * @author Brian Coltin, Colony Project, CMU Robotics Club
33 33
 **/
34 34

  
35
#include <stdlib.h>
36
#include <stdio.h>
37
#include <wl_defs.h>
38

  
35
#include "wl_defs.h"
39 36
#include "sensor_matrix.h"
40 37

  
41 38
// the global sensor matrix
......
57 54
		m.joined[i] = 0;
58 55
#ifndef BAYBOARD
59 56
		for (j = 0; j < MAXIMUM_XBEE_ID; j++)
60
			m.matrix[i][j] = READING_UNKNOWN;
57
			m.matrix[i][j].dir = READING_UNKNOWN;
61 58
#endif
62 59
	}
63 60
}
......
69 66
 * @param robot the id of the robot who the reading is for
70 67
 * @param reading the BOM reading from observer to robot
71 68
 */
72
void sensor_matrix_set_reading(int observer, int robot, int reading)
69
void sensor_matrix_set_reading(int observer, int robot, SensorReading reading)
73 70
{
74 71
#ifndef BAYBOARD
75 72
	if (robot >= MAXIMUM_XBEE_ID || observer >= MAXIMUM_XBEE_ID)
......
78 75
		return;
79 76
	}
80 77

  
81
	m.matrix[observer][robot] = (unsigned char)reading;
78
	m.matrix[observer][robot] = reading;
82 79
#endif
83 80
}
84 81

  
......
90 87
 *
91 88
 * @return the observer's BOM reading for robot
92 89
 **/
93
int sensor_matrix_get_reading(int observer, int robot)
90
SensorReading * sensor_matrix_get_reading(int observer, int robot)
94 91
{
95 92
#ifndef BAYBOARD
96 93
	if (observer >= MAXIMUM_XBEE_ID || robot >= MAXIMUM_XBEE_ID)
97
		return -1;
94
		return NULL;
98 95

  
99
	return (int)m.matrix[observer][robot];
96
	return &m.matrix[observer][robot];
100 97
#else
101
	return -1;
98
	return NULL;
102 99
#endif
103 100
}
104 101

  

Also available in: Unified diff