maix::ext_dev::tmc2209
maix.ext_dev.tmc2209 module
This is
maix::ext_dev::tmc2209
module of MaixCDK.
All of these elements are in namespacemaix::ext_dev::tmc2209
.For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!
1. Module#
No module
2. Enum#
3. Variable#
4. Function#
4.1. slide_scan#
Scan and initialize the slide with the given parameters
item | description |
---|---|
param | port: UART port, string type. addr: TMC2209 UART address, range 0x00~0x03, integer type. baud: UART baud rate, integer type. step_angle: Motor step angle, float type. micro_step: Motor micro step, options: 1/2/4/8/16/32/64/128/256, integer type. round_mm: Round distance in mm, float type. speed_mm_s: Speed of the slide in mm/s, float type. dir: Direction of movement, boolean type. Default is true. use_internal_sense_resistors: Enable internal sense resistors if true, disable if false, boolean type. Default is true. run_current_per: Motor run current percentage, range 0~100(%), integer type. Default is 100%. hold_current_per: Motor hold current percentage, range 0~100(%), integer type. Default is 100%. conf_save_path: Configuration save path, string type. Default is "./slide_conf.bin". force_update: Force update the configuration if true, boolean type. Default is true. |
C++ defination code:
4.2. slide_test#
Test the slide with the given parameters\nThis function tests the slide by moving it in the specified direction until a stall condition is detected, as defined in the configuration file.
item | description |
---|---|
param | port: UART port, string type. addr: TMC2209 UART address, range 0x00~0x03, integer type. baud: UART baud rate, integer type. step_angle: Motor step angle, float type. micro_step: Motor micro step, options: 1/2/4/8/16/32/64/128/256, integer type. round_mm: Round distance in mm, float type. speed_mm_s: Speed of the slide in mm/s, float type. dir: Direction of movement, boolean type. Default is true. use_internal_sense_resistors: Enable internal sense resistors if true, disable if false, boolean type. Default is true. run_current_per: Motor run current percentage, range 0~100(%), integer type. Default is 100%. hold_current_per: Motor hold current percentage, range 0~100(%), integer type. Default is 100%. conf_save_path: Configuration save path, string type. Default is "./slide_conf.bin". |
C++ defination code:
5. Class#
5.1. Slide#
Slide Class
C++ defination code:
5.1.1. __init__#
Constructor for Slide\nInitializes the Slide object with the specified parameters.
item | description |
---|---|
type | func |
param | port: UART port, string type. addr: TMC2209 UART address, range 0x00~0x03, integer type. baud: UART baud rate, integer type. step_angle: Motor step angle, float type. micro_step: Motor micro step, options: 1/2/4/8/16/32/64/128/256, integer type. round_mm: Round distance in mm, float type. speed_mm_s: Speed of the slide in mm/s, float type. Default is -1, indicating the use of a default speed factor. use_internal_sense_resistors: Enable internal sense resistors if TRUE, disable if FALSE, boolean type. Default is TRUE. run_current_per: Motor run current percentage, range 0~100(%), integer type. Default is 100%. hold_current_per: Motor hold current percentage, range 0~100(%), integer type. Default is 100%. cfg_file_path: Configuration file path, string type. Default is an empty string, indicating no configuration file. |
static | False |
C++ defination code:
5.1.2. load_conf#
Load configuration from a file\nLoads the configuration settings for the slide from the specified file path.
item | description |
---|---|
type | func |
param | path: Path to the configuration file, string type. |
static | False |
C++ defination code:
5.1.3. move#
Move the slide by a specified length\nMoves the slide by the specified length at the given speed. Optionally checks for stall conditions.
item | description |
---|---|
type | func |
param | oft: Length to move, float type. speed_mm_s: Speed in mm/s. Default is -1, indicating the use of the default speed set during initialization. check: Enable movement check if true, boolean type. Default is true. |
static | False |
C++ defination code:
5.1.4. reset#
Reset the slide position\nResets the slide position in the specified direction at the given speed.
item | description |
---|---|
type | func |
param | dir: Direction of reset, boolean type. Default is false. speed_mm_s: Speed in mm/s. Default is -1, indicating the use of the speed set during initialization. |
static | False |
C++ defination code:
5.1.5. stop_default_per#
Get or set the stop default percentage\nRetrieves or sets the stop default percentage. If the parameter is -1, it returns the current setting.
item | description |
---|---|
type | func |
param | per: Stop default percentage, range 0~100(%), integer type. Default is -1, indicating no change. |
return | int Current stop default percentage if per is -1, otherwise the new set percentage. |
static | False |
C++ defination code:
5.1.6. run_current_per#
Get or set the run current percentage\nRetrieves or sets the run current percentage. If the parameter is -1, it returns the current setting.
item | description |
---|---|
type | func |
param | per: Run current percentage, range 0~100(%), integer type. Default is -1, indicating no change. |
return | int Current run current percentage if per is -1, otherwise the new set percentage. |
static | False |
C++ defination code:
5.1.7. hold_current_per#
Get or set the hold current percentage\nRetrieves or sets the hold current percentage. If the parameter is -1, it returns the current setting.
item | description |
---|---|
type | func |
param | per: Hold current percentage, range 0~100(%), integer type. Default is -1, indicating no change. |
return | int Current hold current percentage if per is -1, otherwise the new set percentage. |
static | False |
C++ defination code:
5.1.8. use_internal_sense_resistors#
Enable or disable internal sense resistors\nEnables or disables the internal sense resistors based on the provided boolean value.
item | description |
---|---|
type | func |
param | b: Boolean value to enable (true) or disable (false) internal sense resistors. Default is true. |
static | False |
C++ defination code:
5.2. ScrewSlide#
ScrewSlide Class
C++ defination code:
5.2.1. __init__#
Constructor for ScrewSlide
item | description |
---|---|
type | func |
param | port: UART port, string type. addr: TMC2209 UART address, range 0x00~0x03, integer type. baud: UART baud rate, integer type. step_angle: Motor step angle, float type. micro_step: Motor micro step, options: 1/2/4/8/16/32/64/128/256, integer type. screw_pitch: Screw pitch of the slide, integer type. speed_mm_s: Speed of the slide in mm/s, 10 means 10mm/s, float type. Default is -1, indicating the use of a default speed factor. use_internal_sense_resistors: Enable internal sense resistors if TRUE, disable if FALSE, boolean type. Default is TRUE. run_current_per: Motor run current percentage, range 0~100(%), integer type. Default is 100%. hold_current_per: Motor hold current percentage, range 0~100(%), integer type. Default is 100%. |
static | False |
C++ defination code:
5.2.2. move#
Move the slide by a specified length
item | description |
---|---|
type | func |
param | oft: Length to move, 10 means 10mm, float type. Positive values move the slide in the positive direction, negative values move it in the opposite direction. speed_mm_s: Speed in mm/s. Default is -1, indicating the use of the default speed set during initialization. callback: Callback function to be called during movement. The callback function receives the current progress percentage (0~100%) of the movement. If the callback returns true, the move operation will be terminated immediately. Default is nullptr. |
static | False |
C++ defination code:
5.2.3. reset#
Reset the slide position
item | description |
---|---|
type | func |
param | callback: Callback function to be called during the reset loop. The reset operation will only terminate if the callback returns true. dir: Direction of reset. Default is false. speed_mm_s: Speed in mm/s. Default is -1, indicating the use of the speed set during initialization. |
static | False |
C++ defination code:
5.2.4. run_current_per#
Get or set the run current percentage
item | description |
---|---|
type | func |
param | per: Run current percentage, range 0~100(%). Default is -1, indicating no change and returning the current run current percentage. |
return | int Current run current percentage if per is -1, otherwise the new set percentage. |
static | False |
C++ defination code:
5.2.5. hold_current_per#
Get or set the hold current percentage
item | description |
---|---|
type | func |
param | per: Hold current percentage, range 0~100(%). Default is -1, indicating no change and returning the current hold current percentage. |
return | int Current hold current percentage if per is -1, otherwise the new set percentage. |
static | False |
C++ defination code:
5.2.6. use_internal_sense_resistors#
Enable or disable internal sense resistors
item | description |
---|---|
type | func |
param | b: Boolean value to enable (true) or disable (false) internal sense resistors. Default is true. |
static | False |
C++ defination code: