14 #ifdef BRICK_IMPLEMENT 15 #define BRICK_VAR( decl ) \ 17 #define BRICK_VAR_INIT( decl, ... ) \ 23 #define BRICK_VAR( decl ) \ 25 #define BRICK_VAR_INIT( decl, ... ) \ 28 #if __GNUC__ && !__GNUC_STDC_INLINE__ 1005 extern char *
dc_get_address( POOL_T sock,
char *buf,
size_t sz );
1174 extern bool dc_stop( POOL_T pool );
1209 extern POOL_T
dc_search( INX_T type_inx );
1230 extern void sleep_ms( uint32_t ms );
1239 #undef BRICK_VAR_INIT bool tacho_set_polarity_inversed(POOL_T pool)
Set "inversed" polarity for tachos.
Definition: brick.c:1077
bool tacho_set_stop_action_hold(POOL_T pool)
Set "hold" stop_action for tachos.
Definition: brick.c:1092
bool us_set_mode_us_si_cm(POOL_T pool)
Set "US_SI_CM" mode for lego_ev3_us sensors.
Definition: brick.c:431
bool dc_run_timed(POOL_T pool)
Set "run_timed" command for DC motors.
Definition: brick.c:1362
INX_T tacho_get_polarity(POOL_T sock)
Get value (index) of "polarity" attribute of the tacho.
Definition: brick.c:776
float sensor_get_value4(POOL_T sock, float defval)
Get value of "value4" attribute of the sensor.
Definition: brick.c:351
FLAGS_T dc_get_state(POOL_T sock)
Get value (flags) of "state" attribute of the DC motor.
Definition: brick.c:1263
float sensor_get_value0(POOL_T sock, float defval)
Get value of "value0" attribute of the sensor.
Definition: brick.c:307
POOL_T sensor_search(INX_T type_inx)
Search of the specified sensor type.
Definition: brick.c:541
bool dc_set_command(POOL_T pool, INX_T command_inx)
Set value of "command" attribute of DC motors.
Definition: brick.c:1181
bool ir_set_mode_ir_rem_a(POOL_T pool)
Set "IR_REM_A" mode for lego_ev3_ir sensors.
Definition: brick.c:526
bool tacho_set_stop_action_coast(POOL_T pool)
Set "coast" stop_action for tachos.
Definition: brick.c:1082
bool tacho_run_to_rel_pos(POOL_T pool)
Set "run_to_rel_pos" command for tachos.
Definition: brick.c:1047
int tacho_get_count_per_rot(POOL_T sock, int defval)
Get value of "count_per_rot" attribute of the tacho.
Definition: brick.c:627
bool tacho_set_time_sp(POOL_T pool, int value)
Set value of "time_sp" attribute of tachos.
Definition: brick.c:1027
bool gyro_set_mode_gyro_rate(POOL_T pool)
Set "GYRO_RATE" mode for lego_ev3_gyro sensors.
Definition: brick.c:456
float sensor_get_value1(POOL_T sock, float defval)
Get value of "value1" attribute of the sensor.
Definition: brick.c:318
POOL_T tacho_search(INX_T type_inx)
Search of the specified tacho type.
Definition: brick.c:1097
uint8_t POOL_T
Type of a pool of input or output sockets.
Definition: brick.h:63
int tacho_get_hold_pid_Kd(POOL_T sock, int defval)
Get value of "hold_pid/Kd" attribute of the tacho.
Definition: brick.c:702
int tacho_get_full_travel_count(POOL_T sock, int defval)
Get value of "full_travel_count" attribute of the tacho.
Definition: brick.c:649
bool tacho_set_stop_action_brake(POOL_T pool)
Set "brake" stop_action for tachos.
Definition: brick.c:1087
bool tacho_is_plugged(POOL_T pool, INX_T type_inx)
Check that tachos of the specified type are plugged into specified sockets.
Definition: brick.c:1108
FLAGS_T tacho_get_state(POOL_T sock)
Get value (flags) of "state" attribute of the tacho.
Definition: brick.c:975
bool ir_set_mode_ir_remote(POOL_T pool)
Set "IR_REMOTE" mode for lego_ev3_ir sensors.
Definition: brick.c:521
bool dc_stop(POOL_T pool)
Set "stop" command for DC motors.
Definition: brick.c:1372
bool us_set_mode_us_dist_in(POOL_T pool)
Set "US_DIST_IN" mode for lego_ev3_us sensors.
Definition: brick.c:421
int tacho_get_position_sp(POOL_T sock, int defval)
Get value of "position_sp" attribute of the tacho.
Definition: brick.c:817
int tacho_get_hold_pid_Kp(POOL_T sock, int defval)
Get value of "hold_pid/Kp" attribute of the tacho.
Definition: brick.c:744
bool tacho_set_hold_pid_Ki(POOL_T pool, int value)
Set value of "hold_pid/Ki" attribute of tachos.
Definition: brick.c:734
bool dc_set_stop_action(POOL_T pool, INX_T stop_action_inx)
Set value of "stop_action" attribute of DC motors.
Definition: brick.c:1274
bool sensor_set_direct(POOL_T pool, char *value)
Set value of "direct" attribute of sensors.
Definition: brick.c:194
bool ir_set_mode_ir_seek(POOL_T pool)
Set "IR_SEEK" mode for lego_ev3_ir sensors.
Definition: brick.c:516
int dc_get_ramp_up_sp(POOL_T sock, int defval)
Get value of "ramp_up_sp" attribute of the DC motor.
Definition: brick.c:1315
bool sensor_set_poll_ms(POOL_T pool, dword value)
Set value of "poll_ms" attribute of sensors.
Definition: brick.c:287
bool dc_run_direct(POOL_T pool)
Set "run_direct" command for DC motors.
Definition: brick.c:1367
bool dc_set_polarity_normal(POOL_T pool)
Set "normal" polarity for DC motors.
Definition: brick.c:1377
bool tacho_set_speed_pid_Kp(POOL_T pool, int value)
Set value of "speed_pid/Kp" attribute of tachos.
Definition: brick.c:944
bool dc_set_stop_action_brake(POOL_T pool)
Set "brake" stop_action for DC motors.
Definition: brick.c:1392
char * sensor_get_fw_version(POOL_T sock, char *buf, size_t sz)
Get value of "fw_version" attribute of the sensor.
Definition: brick.c:225
bool dc_set_stop_action_coast(POOL_T pool)
Set "coast" stop_action for DC motors.
Definition: brick.c:1387
char * dc_get_address(POOL_T sock, char *buf, size_t sz)
Get value of "address" attribute of the DC motor.
Definition: brick.c:1171
bool color_set_mode_col_reflect(POOL_T pool)
Set "COL_REFLECT" mode for lego_ev3_color sensors.
Definition: brick.c:476
void brick_uninit(void)
Uninitialize the EV3 brick.
Definition: brick.c:92
uint8_t socket_to_port(POOL_T sock)
Get EV3 port of the socket.
Definition: brick.c:59
bool tacho_run_direct(POOL_T pool)
Set "run_direct" command for tachos.
Definition: brick.c:1057
bool gyro_set_mode_gyro_fas(POOL_T pool)
Set "GYRO_FAS" mode for lego_ev3_gyro sensors.
Definition: brick.c:461
void sleep_ms(uint32_t ms)
Delay in milliseconds.
Definition: brick.c:1452
dword sensor_get_poll_ms(POOL_T sock, dword defval)
Get value of "poll_ms" attribute of the sensor.
Definition: brick.c:276
char * tacho_get_commands(POOL_T sock, char *buf, size_t sz)
Get value of "commands" attribute of the tacho.
Definition: brick.c:617
bool ir_set_mode_ir_prox(POOL_T pool)
Set "IR_PROX" mode for lego_ev3_ir sensors.
Definition: brick.c:511
int tacho_get_ramp_up_sp(POOL_T sock, int defval)
Get value of "ramp_up_sp" attribute of the tacho.
Definition: brick.c:859
dword sensor_get_decimals(POOL_T sock, dword defval)
Get value of "decimals" attribute of the sensor.
Definition: brick.c:204
int tacho_get_position(POOL_T sock, int defval)
Get value of "position" attribute of the tacho.
Definition: brick.c:796
int tacho_get_max_speed(POOL_T sock, int defval)
Get value of "max_speed" attribute of the tacho.
Definition: brick.c:765
char * dc_get_commands(POOL_T sock, char *buf, size_t sz)
Get value of "commands" attribute of the DC motor.
Definition: brick.c:1191
bool tacho_run_to_abs_pos(POOL_T pool)
Set "run_to_abs_pos" command for tachos.
Definition: brick.c:1042
bool dc_is_running(POOL_T pool)
Check that DC motors are running.
Definition: brick.c:1434
dword sensor_get_num_values(POOL_T sock, dword defval)
Get value of "num_values" attribute of the sensor.
Definition: brick.c:265
bool tacho_set_polarity_normal(POOL_T pool)
Set "normal" polarity for tachos.
Definition: brick.c:1072
INX_T tacho_get_stop_action(POOL_T sock)
Get value (index) of "stop_action" attribute of the tacho.
Definition: brick.c:986
char * sensor_get_driver_name(POOL_T sock, char *buf, size_t sz)
Get value of "driver_name" attribute of the sensor.
Definition: brick.c:215
bool color_set_mode_rgb_raw(POOL_T pool)
Set "RGB_RAW" mode for lego_ev3_color sensors.
Definition: brick.c:496
bool us_set_mode_us_si_in(POOL_T pool)
Set "US_SI_IN" mode for lego_ev3_us sensors.
Definition: brick.c:436
bool tacho_set_hold_pid_Kp(POOL_T pool, int value)
Set value of "hold_pid/Kp" attribute of tachos.
Definition: brick.c:755
int tacho_get_speed_pid_Kp(POOL_T sock, int defval)
Get value of "speed_pid/Kp" attribute of the tacho.
Definition: brick.c:933
bool tacho_set_command(POOL_T pool, INX_T command_inx)
Set value of "command" attribute of tachos.
Definition: brick.c:607
bool dc_set_duty_cycle_sp(POOL_T pool, int value)
Set value of "duty_cycle_sp" attribute of DC motors.
Definition: brick.c:1233
bool gyro_set_mode_gyro_g_and_a(POOL_T pool)
Set "GYRO_G_AND_A" mode for lego_ev3_gyro sensors.
Definition: brick.c:466
int tacho_get_speed_pid_Kd(POOL_T sock, int defval)
Get value of "speed_pid/Kd" attribute of the tacho.
Definition: brick.c:891
bool tacho_run_timed(POOL_T pool)
Set "run_timed" command for tachos.
Definition: brick.c:1052
bool gyro_set_mode_gyro_cal(POOL_T pool)
Set "GYRO_CAL" mode for lego_ev3_gyro sensors.
Definition: brick.c:471
int dc_get_ramp_down_sp(POOL_T sock, int defval)
Get value of "ramp_down_sp" attribute of the DC motor.
Definition: brick.c:1294
int tacho_get_ramp_down_sp(POOL_T sock, int defval)
Get value of "ramp_down_sp" attribute of the tacho.
Definition: brick.c:838
int tacho_get_hold_pid_Ki(POOL_T sock, int defval)
Get value of "hold_pid/Ki" attribute of the tacho.
Definition: brick.c:723
int tacho_get_count_per_m(POOL_T sock, int defval)
Get value of "count_per_m" attribute of the tacho.
Definition: brick.c:638
bool sensor_set_command(POOL_T pool, INX_T command_inx)
Set value of "command" attribute of sensors.
Definition: brick.c:164
bool touch_set_mode_touch(POOL_T pool)
Set "TOUCH" mode for lego_ev3_touch sensors.
Definition: brick.c:506
float sensor_get_value2(POOL_T sock, float defval)
Get value of "value2" attribute of the sensor.
Definition: brick.c:329
bool gyro_set_mode_gyro_ang(POOL_T pool)
Set "GYRO_ANG" mode for lego_ev3_gyro sensors.
Definition: brick.c:451
bool tacho_set_ramp_down_sp(POOL_T pool, int value)
Set value of "ramp_down_sp" attribute of tachos.
Definition: brick.c:849
bool tacho_set_hold_pid_Kd(POOL_T pool, int value)
Set value of "hold_pid/Kd" attribute of tachos.
Definition: brick.c:713
bool color_set_mode_ref_raw(POOL_T pool)
Set "REF_RAW" mode for lego_ev3_color sensors.
Definition: brick.c:491
int dc_get_duty_cycle_sp(POOL_T sock, int defval)
Get value of "duty_cycle_sp" attribute of the DC motor.
Definition: brick.c:1222
bool tacho_stop(POOL_T pool)
Set "stop" command for tachos.
Definition: brick.c:1062
bool dc_set_ramp_down_sp(POOL_T pool, int value)
Set value of "ramp_down_sp" attribute of DC motors.
Definition: brick.c:1305
bool dc_is_plugged(POOL_T pool, INX_T type_inx)
Check that DC motors of the specified type are plugged into specified sockets.
Definition: brick.c:1408
int tacho_get_duty_cycle(POOL_T sock, int defval)
Get value of "duty_cycle" attribute of the tacho.
Definition: brick.c:670
bool dc_set_polarity(POOL_T pool, INX_T polarity_inx)
Set value of "polarity" attribute of DC motors.
Definition: brick.c:1253
char * sensor_get_address(POOL_T sock, char *buf, size_t sz)
Get value of "address" attribute of the sensor.
Definition: brick.c:124
float sensor_get_value3(POOL_T sock, float defval)
Get value of "value3" attribute of the sensor.
Definition: brick.c:340
char * dc_get_stop_actions(POOL_T sock, char *buf, size_t sz)
Get value of "stop_actions" attribute of the DC motor.
Definition: brick.c:1284
bool brick_init(void)
Initialize the EV3 brick.
Definition: brick.c:83
bool tacho_set_position(POOL_T pool, int value)
Set value of "position" attribute of tachos.
Definition: brick.c:807
bool color_set_mode_col_ambient(POOL_T pool)
Set "COL_AMBIENT" mode for lego_ev3_color sensors.
Definition: brick.c:481
uint8_t brick_keys(void)
Read state of the EV3 brick's keys.
Definition: brick.c:97
char * sensor_get_modes(POOL_T sock, char *buf, size_t sz)
Get value of "modes" attribute of the sensor.
Definition: brick.c:255
int tacho_get_speed_sp(POOL_T sock, int defval)
Get value of "speed_sp" attribute of the tacho.
Definition: brick.c:954
char * tacho_get_driver_name(POOL_T sock, char *buf, size_t sz)
Get value of "driver_name" attribute of the tacho.
Definition: brick.c:660
bool tacho_run_forever(POOL_T pool)
Set "run_forever" command for tachos.
Definition: brick.c:1037
bool tacho_set_speed_pid_Kd(POOL_T pool, int value)
Set value of "speed_pid/Kd" attribute of tachos.
Definition: brick.c:902
byte * sensor_get_bin_data(POOL_T sock, byte *buf, size_t sz)
Get value of "bin_data" attribute of the sensor.
Definition: brick.c:134
bool tacho_reset(POOL_T pool)
Set "reset" command for tachos.
Definition: brick.c:1067
char * tacho_get_address(POOL_T sock, char *buf, size_t sz)
Get value of "address" attribute of the tacho.
Definition: brick.c:597
float sensor_get_value5(POOL_T sock, float defval)
Get value of "value5" attribute of the sensor.
Definition: brick.c:362
int sensor_get_value(uint8_t inx, POOL_T sock, int defval)
Get value of "value" attribute of the sensor.
Definition: brick.c:405
bool color_set_mode_col_color(POOL_T pool)
Set "COL_COLOR" mode for lego_ev3_color sensors.
Definition: brick.c:486
bool us_set_mode_us_dc_in(POOL_T pool)
Set "US_DC_IN" mode for lego_ev3_us sensors.
Definition: brick.c:446
float sensor_get_value7(POOL_T sock, float defval)
Get value of "value7" attribute of the sensor.
Definition: brick.c:384
POOL_T port_to_socket(uint8_t port)
Get socket of the EV3 port.
Definition: brick.c:35
float sensor_get_value6(POOL_T sock, float defval)
Get value of "value6" attribute of the sensor.
Definition: brick.c:373
bool dc_set_time_sp(POOL_T pool, int value)
Set value of "time_sp" attribute of DC motors.
Definition: brick.c:1347
bool tacho_set_ramp_up_sp(POOL_T pool, int value)
Set value of "ramp_up_sp" attribute of tachos.
Definition: brick.c:870
bool dc_set_polarity_inversed(POOL_T pool)
Set "inversed" polarity for DC motors.
Definition: brick.c:1382
int tacho_get_speed(POOL_T sock, int defval)
Get value of "speed" attribute of the tacho.
Definition: brick.c:880
bool sensor_set_mode(POOL_T pool, INX_T mode_inx)
Set value of "mode" attribute of sensors.
Definition: brick.c:245
bool tacho_is_running(POOL_T pool)
Check that tachos are running.
Definition: brick.c:1134
bool tacho_set_position_sp(POOL_T pool, int value)
Set value of "position_sp" attribute of tachos.
Definition: brick.c:828
bool us_set_mode_us_dc_cm(POOL_T pool)
Set "US_DC_CM" mode for lego_ev3_us sensors.
Definition: brick.c:441
INX_T dc_get_polarity(POOL_T sock)
Get value (index) of "polarity" attribute of the DC motor.
Definition: brick.c:1243
char * sensor_get_text_value(POOL_T sock, char *buf, size_t sz)
Get value of "text_value" attribute of the sensor.
Definition: brick.c:395
bool sensor_set_bin_data(POOL_T pool, byte *value, size_t sz)
Set value of "bin_data" attribute of sensors.
Definition: brick.c:144
bool tacho_set_duty_cycle_sp(POOL_T pool, int value)
Set value of "duty_cycle_sp" attribute of tachos.
Definition: brick.c:692
int tacho_get_duty_cycle_sp(POOL_T sock, int defval)
Get value of "duty_cycle_sp" attribute of the tacho.
Definition: brick.c:681
char * tacho_get_stop_actions(POOL_T sock, char *buf, size_t sz)
Get value of "stop_actions" attribute of the tacho.
Definition: brick.c:1006
int dc_get_duty_cycle(POOL_T sock, int defval)
Get value of "duty_cycle" attribute of the DC motor.
Definition: brick.c:1211
bool color_set_mode_col_cal(POOL_T pool)
Set "COL_CAL" mode for lego_ev3_color sensors.
Definition: brick.c:501
INX_T sensor_get_mode(POOL_T sock)
Get value (index) of "mode" attribute of the sensor.
Definition: brick.c:235
char * sensor_get_commands(POOL_T sock, char *buf, size_t sz)
Get value of "commands" attribute of the sensor.
Definition: brick.c:174
bool us_set_mode_us_listen(POOL_T pool)
Set "US_LISTEN" mode for lego_ev3_us sensors.
Definition: brick.c:426
char * sensor_get_direct(POOL_T sock, char *buf, size_t sz)
Get value of "direct" attribute of the sensor.
Definition: brick.c:184
POOL_T dc_search(INX_T type_inx)
Search of the specified DC motor type.
Definition: brick.c:1397
bool sensor_is_plugged(POOL_T pool, INX_T type_inx)
Check that sensors of the specified type are plugged into specified sockets.
Definition: brick.c:552
bool tacho_set_polarity(POOL_T pool, INX_T polarity_inx)
Set value of "polarity" attribute of tachos.
Definition: brick.c:786
bool tacho_set_speed_pid_Ki(POOL_T pool, int value)
Set value of "speed_pid/Ki" attribute of tachos.
Definition: brick.c:923
bool tacho_set_stop_action(POOL_T pool, INX_T stop_action_inx)
Set value of "stop_action" attribute of tachos.
Definition: brick.c:996
bool dc_set_ramp_up_sp(POOL_T pool, int value)
Set value of "ramp_up_sp" attribute of DC motors.
Definition: brick.c:1326
char * sensor_get_bin_data_format(POOL_T sock, char *buf, size_t sz)
Get value of "bin_data_format" attribute of the sensor.
Definition: brick.c:154
bool tacho_set_speed_sp(POOL_T pool, int value)
Set value of "speed_sp" attribute of tachos.
Definition: brick.c:965
int dc_get_time_sp(POOL_T sock, int defval)
Get value of "time_sp" attribute of the DC motor.
Definition: brick.c:1336
bool ir_set_mode_ir_cal(POOL_T pool)
Set "IR_CAL" mode for lego_ev3_ir sensors.
Definition: brick.c:536
char * dc_get_driver_name(POOL_T sock, char *buf, size_t sz)
Get value of "driver_name" attribute of the DC motor.
Definition: brick.c:1201
bool dc_run_forever(POOL_T pool)
Set "run_forever" command for DC motors.
Definition: brick.c:1357
bool ir_set_mode_ir_s_alt(POOL_T pool)
Set "IR_S_ALT" mode for lego_ev3_ir sensors.
Definition: brick.c:531
char * sensor_get_units(POOL_T sock, char *buf, size_t sz)
Get value of "units" attribute of the sensor.
Definition: brick.c:297
bool us_set_mode_us_dist_cm(POOL_T pool)
Set "US_DIST_CM" mode for lego_ev3_us sensors.
Definition: brick.c:416
int tacho_get_speed_pid_Ki(POOL_T sock, int defval)
Get value of "speed_pid/Ki" attribute of the tacho.
Definition: brick.c:912
int tacho_get_time_sp(POOL_T sock, int defval)
Get value of "time_sp" attribute of the tacho.
Definition: brick.c:1016