gusimplewhiteboard
wb_nxt_interface.h
Go to the documentation of this file.
1
9#ifndef wb_nxt_interface_h
10#define wb_nxt_interface_h
11
12#include <gu_util.h>
13
16{
17 Port1 = 0,
25};
26
29{
37};
38
40 //Doxy is warning about undocumented functions as a result of our macros and the fact that they're used in this union. This will disable doxy from parsing this section, which means no warnings but also no generated documentation for this section. The other option is to redefine the macros locally to fix the naming problem. - Carl.
41
45union nxt_port_object_data
46{
47 struct {
49 PROPERTY(uint8_t, distance)
50 } sonar_sensor;
51
52 struct {
54 PROPERTY(bool, pressed)
55 } touch_sensor;
56
57 struct {
59 PROPERTY(int32_t, value)
60 } passive_light_sensor;
61
62 struct {
64 PROPERTY(int32_t, value)
65 } active_light_sensor;
66
67 struct {
69 CONTROLLED_PROPERTY(uint32_t, enc_ticks)
70
71 CONTROLLED_PROPERTY(int16_t, speed)
72
73 CONTROL_BIT(enc_ticks)
75 CONTROL_BIT(speed)
76
77
78 unsigned int _padding : 14;
79 } motor;
80};
82
85{
89 PROPERTY(union nxt_port_object_data, data)
90};
91
96{
99
100#ifdef __cplusplus
105 {
106 memset(this, 0, sizeof(*this));
107 }
108#endif
109};
110
111#endif //wb_nxt_interface_h
An object that contains the type and data of an nxt sensor.
PROPERTY(enum nxt_port_object_type, type) PROPERTY(union nxt_port_object_data
what type of sensor / motor
Interface for talking with an NXT.
ARRAY_PROPERTY(struct nxt_port_object, objects, NUMBER_OF_NXT_PORTS) wb_nxt_interface()
An array of sensors and motors plugged into the nxt ports.
nxt_ports
/file wb_nxt_interface.h
@ MotorA
@ Port2
@ Port4
@ MotorB
@ Port1
@ Port3
@ NUMBER_OF_NXT_PORTS
@ MotorC
nxt_port_object_type
Used to determine what type of object is plugged into each port on the nxt currently.
@ Motor
@ NUMBER_OF_NXT_OBJECT_TYPES
@ Passive_Light_Sensor
@ Active_Light_Sensor
@ Sonar_Sensor
@ Empty_Port
@ Touch_Sensor