Simplified interface of "ev3dev-c" library. More...
#include <stdint.h>
#include <stdbool.h>
#include "ev3.h"
#include "ev3_port.h"
#include "ev3_sensor.h"
#include "ev3_tacho.h"
#include "ev3_dc.h"
Go to the source code of this file.
Macros | |
#define | BRICK_VAR(decl) extern decl |
#define | BRICK_VAR_INIT(decl, ...) extern decl |
#define | BRICK_INL inline |
Typedefs | |
typedef uint8_t | POOL_T |
Type of a pool of input or output sockets. | |
Enumerations | |
enum | { SOCKET__NONE_ = 0, IN1 = 0x1L, IN2 = 0x2L, IN3 = 0x4L, IN4 = 0x8L, OUTA = 0x10L, OUTB = 0x20L, OUTC = 0x40L, OUTD = 0x80L } |
Identifiers of sockets. | |
Functions | |
POOL_T | port_to_socket (uint8_t port) |
Get socket of the EV3 port. More... | |
uint8_t | socket_to_port (POOL_T sock) |
Get EV3 port of the socket. More... | |
bool | brick_init (void) |
Initialize the EV3 brick. More... | |
void | brick_uninit (void) |
Uninitialize the EV3 brick. | |
uint8_t | brick_keys (void) |
Read state of the EV3 brick's keys. More... | |
char * | sensor_get_address (POOL_T sock, char *buf, size_t sz) |
Get value of "address" attribute of the sensor. More... | |
byte * | sensor_get_bin_data (POOL_T sock, byte *buf, size_t sz) |
Get value of "bin_data" attribute of the sensor. More... | |
bool | sensor_set_bin_data (POOL_T pool, byte *value, size_t sz) |
Set value of "bin_data" attribute of sensors. More... | |
char * | sensor_get_bin_data_format (POOL_T sock, char *buf, size_t sz) |
Get value of "bin_data_format" attribute of the sensor. More... | |
bool | sensor_set_command (POOL_T pool, INX_T command_inx) |
Set value of "command" attribute of sensors. More... | |
char * | sensor_get_commands (POOL_T sock, char *buf, size_t sz) |
Get value of "commands" attribute of the sensor. More... | |
char * | sensor_get_direct (POOL_T sock, char *buf, size_t sz) |
Get value of "direct" attribute of the sensor. More... | |
bool | sensor_set_direct (POOL_T pool, char *value) |
Set value of "direct" attribute of sensors. More... | |
dword | sensor_get_decimals (POOL_T sock, dword defval) |
Get value of "decimals" attribute of the sensor. More... | |
char * | sensor_get_driver_name (POOL_T sock, char *buf, size_t sz) |
Get value of "driver_name" attribute of the sensor. More... | |
char * | sensor_get_fw_version (POOL_T sock, char *buf, size_t sz) |
Get value of "fw_version" attribute of the sensor. More... | |
INX_T | sensor_get_mode (POOL_T sock) |
Get value (index) of "mode" attribute of the sensor. More... | |
bool | sensor_set_mode (POOL_T pool, INX_T mode_inx) |
Set value of "mode" attribute of sensors. More... | |
char * | sensor_get_modes (POOL_T sock, char *buf, size_t sz) |
Get value of "modes" attribute of the sensor. More... | |
dword | sensor_get_num_values (POOL_T sock, dword defval) |
Get value of "num_values" attribute of the sensor. More... | |
dword | sensor_get_poll_ms (POOL_T sock, dword defval) |
Get value of "poll_ms" attribute of the sensor. More... | |
bool | sensor_set_poll_ms (POOL_T pool, dword value) |
Set value of "poll_ms" attribute of sensors. More... | |
char * | sensor_get_units (POOL_T sock, char *buf, size_t sz) |
Get value of "units" attribute of the sensor. More... | |
float | sensor_get_value0 (POOL_T sock, float defval) |
Get value of "value0" attribute of the sensor. More... | |
float | sensor_get_value1 (POOL_T sock, float defval) |
Get value of "value1" attribute of the sensor. More... | |
float | sensor_get_value2 (POOL_T sock, float defval) |
Get value of "value2" attribute of the sensor. More... | |
float | sensor_get_value3 (POOL_T sock, float defval) |
Get value of "value3" attribute of the sensor. More... | |
float | sensor_get_value4 (POOL_T sock, float defval) |
Get value of "value4" attribute of the sensor. More... | |
float | sensor_get_value5 (POOL_T sock, float defval) |
Get value of "value5" attribute of the sensor. More... | |
float | sensor_get_value6 (POOL_T sock, float defval) |
Get value of "value6" attribute of the sensor. More... | |
float | sensor_get_value7 (POOL_T sock, float defval) |
Get value of "value7" attribute of the sensor. More... | |
char * | sensor_get_text_value (POOL_T sock, char *buf, size_t sz) |
Get value of "text_value" attribute of the sensor. More... | |
int | sensor_get_value (uint8_t inx, POOL_T sock, int defval) |
Get value of "value" attribute of the sensor. More... | |
bool | us_set_mode_us_dist_cm (POOL_T pool) |
Set "US_DIST_CM" mode for lego_ev3_us sensors. More... | |
bool | us_set_mode_us_dist_in (POOL_T pool) |
Set "US_DIST_IN" mode for lego_ev3_us sensors. More... | |
bool | us_set_mode_us_listen (POOL_T pool) |
Set "US_LISTEN" mode for lego_ev3_us sensors. More... | |
bool | us_set_mode_us_si_cm (POOL_T pool) |
Set "US_SI_CM" mode for lego_ev3_us sensors. More... | |
bool | us_set_mode_us_si_in (POOL_T pool) |
Set "US_SI_IN" mode for lego_ev3_us sensors. More... | |
bool | us_set_mode_us_dc_cm (POOL_T pool) |
Set "US_DC_CM" mode for lego_ev3_us sensors. More... | |
bool | us_set_mode_us_dc_in (POOL_T pool) |
Set "US_DC_IN" mode for lego_ev3_us sensors. More... | |
bool | gyro_set_mode_gyro_ang (POOL_T pool) |
Set "GYRO_ANG" mode for lego_ev3_gyro sensors. More... | |
bool | gyro_set_mode_gyro_rate (POOL_T pool) |
Set "GYRO_RATE" mode for lego_ev3_gyro sensors. More... | |
bool | gyro_set_mode_gyro_fas (POOL_T pool) |
Set "GYRO_FAS" mode for lego_ev3_gyro sensors. More... | |
bool | gyro_set_mode_gyro_g_and_a (POOL_T pool) |
Set "GYRO_G_AND_A" mode for lego_ev3_gyro sensors. More... | |
bool | gyro_set_mode_gyro_cal (POOL_T pool) |
Set "GYRO_CAL" mode for lego_ev3_gyro sensors. More... | |
bool | color_set_mode_col_reflect (POOL_T pool) |
Set "COL_REFLECT" mode for lego_ev3_color sensors. More... | |
bool | color_set_mode_col_ambient (POOL_T pool) |
Set "COL_AMBIENT" mode for lego_ev3_color sensors. More... | |
bool | color_set_mode_col_color (POOL_T pool) |
Set "COL_COLOR" mode for lego_ev3_color sensors. More... | |
bool | color_set_mode_ref_raw (POOL_T pool) |
Set "REF_RAW" mode for lego_ev3_color sensors. More... | |
bool | color_set_mode_rgb_raw (POOL_T pool) |
Set "RGB_RAW" mode for lego_ev3_color sensors. More... | |
bool | color_set_mode_col_cal (POOL_T pool) |
Set "COL_CAL" mode for lego_ev3_color sensors. More... | |
bool | touch_set_mode_touch (POOL_T pool) |
Set "TOUCH" mode for lego_ev3_touch sensors. More... | |
bool | ir_set_mode_ir_prox (POOL_T pool) |
Set "IR_PROX" mode for lego_ev3_ir sensors. More... | |
bool | ir_set_mode_ir_seek (POOL_T pool) |
Set "IR_SEEK" mode for lego_ev3_ir sensors. More... | |
bool | ir_set_mode_ir_remote (POOL_T pool) |
Set "IR_REMOTE" mode for lego_ev3_ir sensors. More... | |
bool | ir_set_mode_ir_rem_a (POOL_T pool) |
Set "IR_REM_A" mode for lego_ev3_ir sensors. More... | |
bool | ir_set_mode_ir_s_alt (POOL_T pool) |
Set "IR_S_ALT" mode for lego_ev3_ir sensors. More... | |
bool | ir_set_mode_ir_cal (POOL_T pool) |
Set "IR_CAL" mode for lego_ev3_ir sensors. More... | |
POOL_T | sensor_search (INX_T type_inx) |
Search of the specified sensor type. More... | |
bool | sensor_is_plugged (POOL_T pool, INX_T type_inx) |
Check that sensors of the specified type are plugged into specified sockets. More... | |
char * | tacho_get_address (POOL_T sock, char *buf, size_t sz) |
Get value of "address" attribute of the tacho. More... | |
bool | tacho_set_command (POOL_T pool, INX_T command_inx) |
Set value of "command" attribute of tachos. More... | |
char * | tacho_get_commands (POOL_T sock, char *buf, size_t sz) |
Get value of "commands" attribute of the tacho. More... | |
int | tacho_get_count_per_rot (POOL_T sock, int defval) |
Get value of "count_per_rot" attribute of the tacho. More... | |
int | tacho_get_count_per_m (POOL_T sock, int defval) |
Get value of "count_per_m" attribute of the tacho. More... | |
int | tacho_get_full_travel_count (POOL_T sock, int defval) |
Get value of "full_travel_count" attribute of the tacho. More... | |
char * | tacho_get_driver_name (POOL_T sock, char *buf, size_t sz) |
Get value of "driver_name" attribute of the tacho. More... | |
int | tacho_get_duty_cycle (POOL_T sock, int defval) |
Get value of "duty_cycle" attribute of the tacho. More... | |
int | tacho_get_duty_cycle_sp (POOL_T sock, int defval) |
Get value of "duty_cycle_sp" attribute of the tacho. More... | |
bool | tacho_set_duty_cycle_sp (POOL_T pool, int value) |
Set value of "duty_cycle_sp" attribute of tachos. More... | |
int | tacho_get_hold_pid_Kd (POOL_T sock, int defval) |
Get value of "hold_pid/Kd" attribute of the tacho. More... | |
bool | tacho_set_hold_pid_Kd (POOL_T pool, int value) |
Set value of "hold_pid/Kd" attribute of tachos. More... | |
int | tacho_get_hold_pid_Ki (POOL_T sock, int defval) |
Get value of "hold_pid/Ki" attribute of the tacho. More... | |
bool | tacho_set_hold_pid_Ki (POOL_T pool, int value) |
Set value of "hold_pid/Ki" attribute of tachos. More... | |
int | tacho_get_hold_pid_Kp (POOL_T sock, int defval) |
Get value of "hold_pid/Kp" attribute of the tacho. More... | |
bool | tacho_set_hold_pid_Kp (POOL_T pool, int value) |
Set value of "hold_pid/Kp" attribute of tachos. More... | |
int | tacho_get_max_speed (POOL_T sock, int defval) |
Get value of "max_speed" attribute of the tacho. More... | |
INX_T | tacho_get_polarity (POOL_T sock) |
Get value (index) of "polarity" attribute of the tacho. More... | |
bool | tacho_set_polarity (POOL_T pool, INX_T polarity_inx) |
Set value of "polarity" attribute of tachos. More... | |
int | tacho_get_position (POOL_T sock, int defval) |
Get value of "position" attribute of the tacho. More... | |
bool | tacho_set_position (POOL_T pool, int value) |
Set value of "position" attribute of tachos. More... | |
int | tacho_get_position_sp (POOL_T sock, int defval) |
Get value of "position_sp" attribute of the tacho. More... | |
bool | tacho_set_position_sp (POOL_T pool, int value) |
Set value of "position_sp" attribute of tachos. More... | |
int | tacho_get_ramp_down_sp (POOL_T sock, int defval) |
Get value of "ramp_down_sp" attribute of the tacho. More... | |
bool | tacho_set_ramp_down_sp (POOL_T pool, int value) |
Set value of "ramp_down_sp" attribute of tachos. More... | |
int | tacho_get_ramp_up_sp (POOL_T sock, int defval) |
Get value of "ramp_up_sp" attribute of the tacho. More... | |
bool | tacho_set_ramp_up_sp (POOL_T pool, int value) |
Set value of "ramp_up_sp" attribute of tachos. More... | |
int | tacho_get_speed (POOL_T sock, int defval) |
Get value of "speed" attribute of the tacho. More... | |
int | tacho_get_speed_pid_Kd (POOL_T sock, int defval) |
Get value of "speed_pid/Kd" attribute of the tacho. More... | |
bool | tacho_set_speed_pid_Kd (POOL_T pool, int value) |
Set value of "speed_pid/Kd" attribute of tachos. More... | |
int | tacho_get_speed_pid_Ki (POOL_T sock, int defval) |
Get value of "speed_pid/Ki" attribute of the tacho. More... | |
bool | tacho_set_speed_pid_Ki (POOL_T pool, int value) |
Set value of "speed_pid/Ki" attribute of tachos. More... | |
int | tacho_get_speed_pid_Kp (POOL_T sock, int defval) |
Get value of "speed_pid/Kp" attribute of the tacho. More... | |
bool | tacho_set_speed_pid_Kp (POOL_T pool, int value) |
Set value of "speed_pid/Kp" attribute of tachos. More... | |
int | tacho_get_speed_sp (POOL_T sock, int defval) |
Get value of "speed_sp" attribute of the tacho. More... | |
bool | tacho_set_speed_sp (POOL_T pool, int value) |
Set value of "speed_sp" attribute of tachos. More... | |
FLAGS_T | tacho_get_state (POOL_T sock) |
Get value (flags) of "state" attribute of the tacho. More... | |
INX_T | tacho_get_stop_action (POOL_T sock) |
Get value (index) of "stop_action" attribute of the tacho. More... | |
bool | tacho_set_stop_action (POOL_T pool, INX_T stop_action_inx) |
Set value of "stop_action" attribute of tachos. More... | |
char * | tacho_get_stop_actions (POOL_T sock, char *buf, size_t sz) |
Get value of "stop_actions" attribute of the tacho. More... | |
int | tacho_get_time_sp (POOL_T sock, int defval) |
Get value of "time_sp" attribute of the tacho. More... | |
bool | tacho_set_time_sp (POOL_T pool, int value) |
Set value of "time_sp" attribute of tachos. More... | |
bool | tacho_run_forever (POOL_T pool) |
Set "run_forever" command for tachos. More... | |
bool | tacho_run_to_abs_pos (POOL_T pool) |
Set "run_to_abs_pos" command for tachos. More... | |
bool | tacho_run_to_rel_pos (POOL_T pool) |
Set "run_to_rel_pos" command for tachos. More... | |
bool | tacho_run_timed (POOL_T pool) |
Set "run_timed" command for tachos. More... | |
bool | tacho_run_direct (POOL_T pool) |
Set "run_direct" command for tachos. More... | |
bool | tacho_stop (POOL_T pool) |
Set "stop" command for tachos. More... | |
bool | tacho_reset (POOL_T pool) |
Set "reset" command for tachos. More... | |
bool | tacho_set_polarity_normal (POOL_T pool) |
Set "normal" polarity for tachos. More... | |
bool | tacho_set_polarity_inversed (POOL_T pool) |
Set "inversed" polarity for tachos. More... | |
bool | tacho_set_stop_action_coast (POOL_T pool) |
Set "coast" stop_action for tachos. More... | |
bool | tacho_set_stop_action_brake (POOL_T pool) |
Set "brake" stop_action for tachos. More... | |
bool | tacho_set_stop_action_hold (POOL_T pool) |
Set "hold" stop_action for tachos. More... | |
POOL_T | tacho_search (INX_T type_inx) |
Search of the specified tacho type. More... | |
bool | tacho_is_plugged (POOL_T pool, INX_T type_inx) |
Check that tachos of the specified type are plugged into specified sockets. More... | |
bool | tacho_is_running (POOL_T pool) |
Check that tachos are running. More... | |
char * | dc_get_address (POOL_T sock, char *buf, size_t sz) |
Get value of "address" attribute of the DC motor. More... | |
bool | dc_set_command (POOL_T pool, INX_T command_inx) |
Set value of "command" attribute of DC motors. More... | |
char * | dc_get_commands (POOL_T sock, char *buf, size_t sz) |
Get value of "commands" attribute of the DC motor. More... | |
char * | dc_get_driver_name (POOL_T sock, char *buf, size_t sz) |
Get value of "driver_name" attribute of the DC motor. More... | |
int | dc_get_duty_cycle (POOL_T sock, int defval) |
Get value of "duty_cycle" attribute of the DC motor. More... | |
int | dc_get_duty_cycle_sp (POOL_T sock, int defval) |
Get value of "duty_cycle_sp" attribute of the DC motor. More... | |
bool | dc_set_duty_cycle_sp (POOL_T pool, int value) |
Set value of "duty_cycle_sp" attribute of DC motors. More... | |
INX_T | dc_get_polarity (POOL_T sock) |
Get value (index) of "polarity" attribute of the DC motor. More... | |
bool | dc_set_polarity (POOL_T pool, INX_T polarity_inx) |
Set value of "polarity" attribute of DC motors. More... | |
FLAGS_T | dc_get_state (POOL_T sock) |
Get value (flags) of "state" attribute of the DC motor. More... | |
bool | dc_set_stop_action (POOL_T pool, INX_T stop_action_inx) |
Set value of "stop_action" attribute of DC motors. More... | |
char * | dc_get_stop_actions (POOL_T sock, char *buf, size_t sz) |
Get value of "stop_actions" attribute of the DC motor. More... | |
int | dc_get_ramp_down_sp (POOL_T sock, int defval) |
Get value of "ramp_down_sp" attribute of the DC motor. More... | |
bool | dc_set_ramp_down_sp (POOL_T pool, int value) |
Set value of "ramp_down_sp" attribute of DC motors. More... | |
int | dc_get_ramp_up_sp (POOL_T sock, int defval) |
Get value of "ramp_up_sp" attribute of the DC motor. More... | |
bool | dc_set_ramp_up_sp (POOL_T pool, int value) |
Set value of "ramp_up_sp" attribute of DC motors. More... | |
int | dc_get_time_sp (POOL_T sock, int defval) |
Get value of "time_sp" attribute of the DC motor. More... | |
bool | dc_set_time_sp (POOL_T pool, int value) |
Set value of "time_sp" attribute of DC motors. More... | |
bool | dc_run_forever (POOL_T pool) |
Set "run_forever" command for DC motors. More... | |
bool | dc_run_timed (POOL_T pool) |
Set "run_timed" command for DC motors. More... | |
bool | dc_run_direct (POOL_T pool) |
Set "run_direct" command for DC motors. More... | |
bool | dc_stop (POOL_T pool) |
Set "stop" command for DC motors. More... | |
bool | dc_set_polarity_normal (POOL_T pool) |
Set "normal" polarity for DC motors. More... | |
bool | dc_set_polarity_inversed (POOL_T pool) |
Set "inversed" polarity for DC motors. More... | |
bool | dc_set_stop_action_coast (POOL_T pool) |
Set "coast" stop_action for DC motors. More... | |
bool | dc_set_stop_action_brake (POOL_T pool) |
Set "brake" stop_action for DC motors. More... | |
POOL_T | dc_search (INX_T type_inx) |
Search of the specified DC motor type. More... | |
bool | dc_is_plugged (POOL_T pool, INX_T type_inx) |
Check that DC motors of the specified type are plugged into specified sockets. More... | |
bool | dc_is_running (POOL_T pool) |
Check that DC motors are running. More... | |
void | sleep_ms (uint32_t ms) |
Delay in milliseconds. More... | |
Simplified interface of "ev3dev-c" library.
(brick.yu-h)