Access to EV3 servo motors. More...
Data Structures | |
struct | EV3_SERVO |
Structure of a servo motor descriptor. More... | |
Macros | |
#define | SERVO_DIR "/sys/class/servo-motor" |
#define | SERVO_DESC__LIMIT_ DESC_LIMIT |
#define | SERVO__NONE_ SERVO_DESC__LIMIT_ |
Enumerations | |
enum | { SERVO_TYPE__NONE_ = 0, SERVO_MOTOR, SERVO_TYPE__COUNT_, SERVO_TYPE__UNKNOWN_ = SERVO_TYPE__COUNT_ } |
Identifiers of servo motor types. More... | |
enum | { SERVO_COMMAND__NONE_ = 0, SERVO_RUN, SERVO_FLOAT, SERVO_COMMAND__COUNT_, SERVO_COMMAND__UNKNOWN_ = SERVO_COMMAND__COUNT_ } |
Common identifiers of servo motor "command" attribute. More... | |
enum | { SERVO_POLARITY__NONE_ = 0, SERVO_NORMAL, SERVO_INVERSED, SERVO_POLARITY__COUNT_, SERVO_POLARITY__UNKNOWN_ = SERVO_POLARITY__COUNT_ } |
Common identifiers of servo motor "polarity" attribute. More... | |
enum | { SERVO_STATE__NONE_ = 0, SERVO_RUNNING = 0x1L } |
Common identifiers of servo motor "state" attribute. | |
Functions | |
EV3_SERVO_VAR (EV3_SERVO ev3_servo[SERVO_DESC__LIMIT_]) | |
Vector of servo motor descriptors (filled by ev3_servo_init). | |
size_t | get_servo_address (uint8_t sn, char *buf, size_t sz) |
Read "address" attribute of the servo motor. More... | |
size_t | get_servo_command (uint8_t sn, char *buf, size_t sz) |
Read "command" attribute of the servo motor. More... | |
size_t | set_servo_command (uint8_t sn, char *value) |
Write "command" attribute of the servo motor. More... | |
size_t | multi_set_servo_command (uint8_t *sn, char *value) |
Write "command" attribute of several servo motors. More... | |
size_t | get_servo_driver_name (uint8_t sn, char *buf, size_t sz) |
Read "driver_name" attribute of the servo motor. More... | |
size_t | get_servo_max_pulse_sp (uint8_t sn, int *buf) |
Read "max_pulse_sp" attribute of the servo motor. More... | |
size_t | set_servo_max_pulse_sp (uint8_t sn, int value) |
Write "max_pulse_sp" attribute of the servo motor. More... | |
size_t | multi_set_servo_max_pulse_sp (uint8_t *sn, int value) |
Write "max_pulse_sp" attribute of several servo motors. More... | |
size_t | get_servo_mid_pulse_sp (uint8_t sn, int *buf) |
Read "mid_pulse_sp" attribute of the servo motor. More... | |
size_t | set_servo_mid_pulse_sp (uint8_t sn, int value) |
Write "mid_pulse_sp" attribute of the servo motor. More... | |
size_t | multi_set_servo_mid_pulse_sp (uint8_t *sn, int value) |
Write "mid_pulse_sp" attribute of several servo motors. More... | |
size_t | get_servo_min_pulse_sp (uint8_t sn, int *buf) |
Read "min_pulse_sp" attribute of the servo motor. More... | |
size_t | set_servo_min_pulse_sp (uint8_t sn, int value) |
Write "min_pulse_sp" attribute of the servo motor. More... | |
size_t | multi_set_servo_min_pulse_sp (uint8_t *sn, int value) |
Write "min_pulse_sp" attribute of several servo motors. More... | |
size_t | get_servo_polarity (uint8_t sn, char *buf, size_t sz) |
Read "polarity" attribute of the servo motor. More... | |
size_t | set_servo_polarity (uint8_t sn, char *value) |
Write "polarity" attribute of the servo motor. More... | |
size_t | multi_set_servo_polarity (uint8_t *sn, char *value) |
Write "polarity" attribute of several servo motors. More... | |
size_t | get_servo_position_sp (uint8_t sn, int *buf) |
Read "position_sp" attribute of the servo motor. More... | |
size_t | set_servo_position_sp (uint8_t sn, int value) |
Write "position_sp" attribute of the servo motor. More... | |
size_t | multi_set_servo_position_sp (uint8_t *sn, int value) |
Write "position_sp" attribute of several servo motors. More... | |
size_t | get_servo_rate_sp (uint8_t sn, int *buf) |
Read "rate_sp" attribute of the servo motor. More... | |
size_t | set_servo_rate_sp (uint8_t sn, int value) |
Write "rate_sp" attribute of the servo motor. More... | |
size_t | multi_set_servo_rate_sp (uint8_t *sn, int value) |
Write "rate_sp" attribute of several servo motors. More... | |
size_t | get_servo_state (uint8_t sn, char *buf, size_t sz) |
Read "state" attribute of the servo motor. More... | |
const char * | ev3_servo_type (INX_T type_inx) |
Get name of the specified servo motor type. More... | |
INX_T | get_servo_type_inx (uint8_t sn) |
Read "driver_name" attribute and get index of the servo motor type. More... | |
size_t | get_servo_desc (uint8_t sn, EV3_SERVO *desc) |
Read servo motor attributes that are required for filling the descriptor. More... | |
EV3_SERVO * | ev3_servo_desc (uint8_t sn) |
Get descriptor of the servo motor. More... | |
INX_T | ev3_servo_desc_type_inx (uint8_t sn) |
Get type from the servo motor descriptor. More... | |
uint8_t | ev3_servo_desc_port (uint8_t sn) |
Get EV3 port from the servo motor descriptor. More... | |
uint8_t | ev3_servo_desc_extport (uint8_t sn) |
Get extended port from the servo motor descriptor. More... | |
uint8_t | ev3_servo_desc_addr (uint8_t sn) |
Get I2C address from the servo motor descriptor. More... | |
char * | ev3_servo_port_name (uint8_t sn, char *buf) |
Assemble EV3 port name from the servo motor descriptor. More... | |
bool | ev3_search_servo (INX_T type_inx, uint8_t *sn, uint8_t from) |
Search of a sequence number of the specified servo motor type. More... | |
bool | ev3_search_servo_plugged_in (uint8_t port, uint8_t extport, uint8_t *sn, uint8_t from) |
Search of a sequence number the servo motor by plug-in attributes. More... | |
const char * | ev3_servo_command (INX_T command_inx) |
Get name of the specified servo motor command. More... | |
INX_T | get_servo_command_inx (uint8_t sn) |
Read "command" attribute of the servo motor and get the index. More... | |
size_t | set_servo_command_inx (uint8_t sn, INX_T command_inx) |
Write "command" attribute of the servo motor by the index. More... | |
size_t | multi_set_servo_command_inx (uint8_t *sn, INX_T command_inx) |
Write "command" attribute of several servo motors by the index. More... | |
const char * | ev3_servo_polarity (INX_T polarity_inx) |
Get name of the specified servo motor polarity. More... | |
INX_T | get_servo_polarity_inx (uint8_t sn) |
Read "polarity" attribute of the servo motor and get the index. More... | |
size_t | set_servo_polarity_inx (uint8_t sn, INX_T polarity_inx) |
Write "polarity" attribute of the servo motor by the index. More... | |
size_t | multi_set_servo_polarity_inx (uint8_t *sn, INX_T polarity_inx) |
Write "polarity" attribute of several servo motors by the index. More... | |
size_t | get_servo_state_flags (uint8_t sn, FLAGS_T *flags) |
Read "state" attribute of the servo motor and get the flags. More... | |
int | ev3_servo_init (void) |
Detect connected servo motors. More... | |
Access to EV3 servo motors.
#define SERVO__NONE_ SERVO_DESC__LIMIT_ |
Servo motor is not found.
#define SERVO_DESC__LIMIT_ DESC_LIMIT |
Limit of servo motor descriptors.
#define SERVO_DIR "/sys/class/servo-motor" |
Directory of servo motors.
anonymous enum |
anonymous enum |
anonymous enum |
bool ev3_search_servo | ( | INX_T | type_inx, |
uint8_t * | sn, | ||
uint8_t | from | ||
) |
Search of a sequence number of the specified servo motor type.
type_inx | Servo motor type. | |
[out] | sn | Buffer for the sequence number. |
from | Search initial value. |
bool ev3_search_servo_plugged_in | ( | uint8_t | port, |
uint8_t | extport, | ||
uint8_t * | sn, | ||
uint8_t | from | ||
) |
Search of a sequence number the servo motor by plug-in attributes.
port | EV3 port. | |
extport | Extended port. | |
[out] | sn | Buffer for the sequence number. |
from | Search initial value. |
const char* ev3_servo_command | ( | INX_T | command_inx | ) |
Get name of the specified servo motor command.
command_inx | Index of the servo motor command. |
EV3_SERVO* ev3_servo_desc | ( | uint8_t | sn | ) |
Get descriptor of the servo motor.
sn | Sequence number. |
uint8_t ev3_servo_desc_addr | ( | uint8_t | sn | ) |
Get I2C address from the servo motor descriptor.
sn | Sequence number. |
uint8_t ev3_servo_desc_extport | ( | uint8_t | sn | ) |
Get extended port from the servo motor descriptor.
sn | Sequence number. |
uint8_t ev3_servo_desc_port | ( | uint8_t | sn | ) |
Get EV3 port from the servo motor descriptor.
sn | Sequence number. |
INX_T ev3_servo_desc_type_inx | ( | uint8_t | sn | ) |
Get type from the servo motor descriptor.
sn | Sequence number. |
int ev3_servo_init | ( | void | ) |
Detect connected servo motors.
const char* ev3_servo_polarity | ( | INX_T | polarity_inx | ) |
Get name of the specified servo motor polarity.
polarity_inx | Index of the servo motor polarity. |
char* ev3_servo_port_name | ( | uint8_t | sn, |
char * | buf | ||
) |
Assemble EV3 port name from the servo motor descriptor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
const char* ev3_servo_type | ( | INX_T | type_inx | ) |
Get name of the specified servo motor type.
type_inx | Index of the servo motor type. |
size_t get_servo_address | ( | uint8_t | sn, |
char * | buf, | ||
size_t | sz | ||
) |
Read "address" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
sz | Buffer size. |
size_t get_servo_command | ( | uint8_t | sn, |
char * | buf, | ||
size_t | sz | ||
) |
Read "command" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
sz | Buffer size. |
INX_T get_servo_command_inx | ( | uint8_t | sn | ) |
Read "command" attribute of the servo motor and get the index.
sn | Sequence number. |
size_t get_servo_desc | ( | uint8_t | sn, |
EV3_SERVO * | desc | ||
) |
Read servo motor attributes that are required for filling the descriptor.
sn | Sequence number. |
desc | Buffer for the descriptor. |
size_t get_servo_driver_name | ( | uint8_t | sn, |
char * | buf, | ||
size_t | sz | ||
) |
Read "driver_name" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
sz | Buffer size. |
size_t get_servo_max_pulse_sp | ( | uint8_t | sn, |
int * | buf | ||
) |
Read "max_pulse_sp" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
size_t get_servo_mid_pulse_sp | ( | uint8_t | sn, |
int * | buf | ||
) |
Read "mid_pulse_sp" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
size_t get_servo_min_pulse_sp | ( | uint8_t | sn, |
int * | buf | ||
) |
Read "min_pulse_sp" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
size_t get_servo_polarity | ( | uint8_t | sn, |
char * | buf, | ||
size_t | sz | ||
) |
Read "polarity" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
sz | Buffer size. |
INX_T get_servo_polarity_inx | ( | uint8_t | sn | ) |
Read "polarity" attribute of the servo motor and get the index.
sn | Sequence number. |
size_t get_servo_position_sp | ( | uint8_t | sn, |
int * | buf | ||
) |
Read "position_sp" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
size_t get_servo_rate_sp | ( | uint8_t | sn, |
int * | buf | ||
) |
Read "rate_sp" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
size_t get_servo_state | ( | uint8_t | sn, |
char * | buf, | ||
size_t | sz | ||
) |
Read "state" attribute of the servo motor.
sn | Sequence number. | |
[out] | buf | Buffer for result. |
sz | Buffer size. |
size_t get_servo_state_flags | ( | uint8_t | sn, |
FLAGS_T * | flags | ||
) |
Read "state" attribute of the servo motor and get the flags.
sn | Sequence number. |
flags | Buffer for the flags. |
INX_T get_servo_type_inx | ( | uint8_t | sn | ) |
Read "driver_name" attribute and get index of the servo motor type.
sn | Sequence number. |
size_t multi_set_servo_command | ( | uint8_t * | sn, |
char * | value | ||
) |
Write "command" attribute of several servo motors.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
value | Attribute value. |
size_t multi_set_servo_command_inx | ( | uint8_t * | sn, |
INX_T | command_inx | ||
) |
Write "command" attribute of several servo motors by the index.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
command_inx | Index of the servo motor command. |
size_t multi_set_servo_max_pulse_sp | ( | uint8_t * | sn, |
int | value | ||
) |
Write "max_pulse_sp" attribute of several servo motors.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
value | Attribute value. |
size_t multi_set_servo_mid_pulse_sp | ( | uint8_t * | sn, |
int | value | ||
) |
Write "mid_pulse_sp" attribute of several servo motors.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
value | Attribute value. |
size_t multi_set_servo_min_pulse_sp | ( | uint8_t * | sn, |
int | value | ||
) |
Write "min_pulse_sp" attribute of several servo motors.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
value | Attribute value. |
size_t multi_set_servo_polarity | ( | uint8_t * | sn, |
char * | value | ||
) |
Write "polarity" attribute of several servo motors.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
value | Attribute value. |
size_t multi_set_servo_polarity_inx | ( | uint8_t * | sn, |
INX_T | polarity_inx | ||
) |
Write "polarity" attribute of several servo motors by the index.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
polarity_inx | Index of the servo motor polarity. |
size_t multi_set_servo_position_sp | ( | uint8_t * | sn, |
int | value | ||
) |
Write "position_sp" attribute of several servo motors.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
value | Attribute value. |
size_t multi_set_servo_rate_sp | ( | uint8_t * | sn, |
int | value | ||
) |
Write "rate_sp" attribute of several servo motors.
sn | Vector of sequence numbers ending with DESC_LIMIT. |
value | Attribute value. |
size_t set_servo_command | ( | uint8_t | sn, |
char * | value | ||
) |
Write "command" attribute of the servo motor.
sn | Sequence number. |
value | Attribute value. |
size_t set_servo_command_inx | ( | uint8_t | sn, |
INX_T | command_inx | ||
) |
Write "command" attribute of the servo motor by the index.
sn | Sequence number. |
command_inx | Index of the servo motor command. |
size_t set_servo_max_pulse_sp | ( | uint8_t | sn, |
int | value | ||
) |
Write "max_pulse_sp" attribute of the servo motor.
sn | Sequence number. |
value | Attribute value. |
size_t set_servo_mid_pulse_sp | ( | uint8_t | sn, |
int | value | ||
) |
Write "mid_pulse_sp" attribute of the servo motor.
sn | Sequence number. |
value | Attribute value. |
size_t set_servo_min_pulse_sp | ( | uint8_t | sn, |
int | value | ||
) |
Write "min_pulse_sp" attribute of the servo motor.
sn | Sequence number. |
value | Attribute value. |
size_t set_servo_polarity | ( | uint8_t | sn, |
char * | value | ||
) |
Write "polarity" attribute of the servo motor.
sn | Sequence number. |
value | Attribute value. |
size_t set_servo_polarity_inx | ( | uint8_t | sn, |
INX_T | polarity_inx | ||
) |
Write "polarity" attribute of the servo motor by the index.
sn | Sequence number. |
polarity_inx | Index of the servo motor polarity. |
size_t set_servo_position_sp | ( | uint8_t | sn, |
int | value | ||
) |
Write "position_sp" attribute of the servo motor.
sn | Sequence number. |
value | Attribute value. |
size_t set_servo_rate_sp | ( | uint8_t | sn, |
int | value | ||
) |
Write "rate_sp" attribute of the servo motor.
sn | Sequence number. |
value | Attribute value. |