Top level class for the TMC7300 library. This class controls a TMC7300 chip. https://www.analog.com/media/en/technical-documentation/data-sheets/TMC7300_datasheet_rev1.08.pdf.
More...
#include <TMC7300.h>
|
| | TMC7300IC (uint8_t _pin, uint8_t _chipAddress, uint32_t _baudrate=100000) |
| | constructor for class that controls a TMC7300 chip.
|
| |
| void | begin (boolean _extcap=true, uint8_t _irun=31) |
| | begin communication with the TMC7300
|
| |
| int | checkDriver () |
| | check if the TMC7300's settings match the settings they should have and reset them if they don't
|
| |
| void | writeField (TMCField field, uint32_t fieldValue, boolean write=true) |
| | write data to a field of a register in the TMC7300 (see TMC7300_Map.h and the TMC7300 datasheet for more information)
|
| |
| uint32_t | readField (TMCField field, boolean read=true) |
| | read data from a field of a register in the TMC7300 (see TMC7300_Map.h and the TMC7300 datasheet for more information)
|
| |
| void | writeRegister (uint8_t address, uint32_t value) |
| | write data to a register in the TMC7300
|
| |
| boolean | readRegister (uint8_t address, uint32_t &value) |
| | read data from a register in the TMC7300
|
| |
| uint8_t | getChipAddress () |
| | get the chipAddress of the TMC7300
|
| |
◆ TMC7300IC()
| TMC7300IC::TMC7300IC |
( |
uint8_t |
_pin, |
|
|
uint8_t |
_chipAddress, |
|
|
uint32_t |
_baudrate = 100000 |
|
) |
| |
|
inline |
constructor for class that controls a TMC7300 chip.
- Parameters
-
| _pin | pin to send uart signals through |
| _chipAddress | The address is selected by AD0 (bit 0, LSB) and AD1 (bit 1, MSB) in the range 0 to 3 |
| _baudrate | approximate bits per second to communicate with, default 10000, must be between 10000 and 100000 |
◆ begin()
| void TMC7300IC::begin |
( |
boolean |
_extcap = true, |
|
|
uint8_t |
_irun = 31 |
|
) |
| |
|
inline |
begin communication with the TMC7300
- Parameters
-
| _extcap | (boolean) whether to enable the external capacitor on the vcp pin, default true |
- Return values
-
◆ checkDriver()
| int TMC7300IC::checkDriver |
( |
| ) |
|
|
inline |
check if the TMC7300's settings match the settings they should have and reset them if they don't
- Note
- This function is useful for recovering from power cycling the driver but not the microcontroller
- Return values
-
| not | 0 if settings had to be reset (bit 0: drv_error, bit 2: pwm_direct, bit 3: enabledrv) |
◆ getChipAddress()
| uint8_t TMC7300IC::getChipAddress |
( |
| ) |
|
|
inline |
get the chipAddress of the TMC7300
- Return values
-
◆ readField()
| uint32_t TMC7300IC::readField |
( |
TMCField |
field, |
|
|
boolean |
read = true |
|
) |
| |
|
inline |
read data from a field of a register in the TMC7300 (see TMC7300_Map.h and the TMC7300 datasheet for more information)
- Note
- if the read failed, the value will be the last value read from the register
- Parameters
-
| field | TMCField to read from (ensure the field allows reading) |
| read | (boolen) whether to read immediately or recall the value from the last time the register was read |
- Return values
-
◆ readRegister()
| boolean TMC7300IC::readRegister |
( |
uint8_t |
address, |
|
|
uint32_t & |
value |
|
) |
| |
|
inline |
read data from a register in the TMC7300
- Note
- You should usually use readField instead of this function, because most registers contain multiple fields.
- Parameters
-
| address | address of the register to read from |
| value | (reference to uint32_t variable) gets set to the value read from the register |
- Return values
-
| true | if the read was successful, false if the read failed and value was not changed |
◆ writeField()
| void TMC7300IC::writeField |
( |
TMCField |
field, |
|
|
uint32_t |
fieldValue, |
|
|
boolean |
write = true |
|
) |
| |
|
inline |
write data to a field of a register in the TMC7300 (see TMC7300_Map.h and the TMC7300 datasheet for more information)
- Parameters
-
| field | TMCField to write to |
| fieldValue | value to write to the field, it will be masked to fit in the field |
| write | (boolen) whether to write immediately or just save the value to be written by the next writeField that accesses the same register |
- Return values
-
◆ writeRegister()
| void TMC7300IC::writeRegister |
( |
uint8_t |
address, |
|
|
uint32_t |
value |
|
) |
| |
|
inline |
write data to a register in the TMC7300
- Note
- You should usually use writeField instead of this function, because this function doesn't keep track of other fields sharing the register.
- Parameters
-
| address | address of the register to write to |
| value | value to write to the register |
- Return values
-
◆ chipAddress
| uint8_t TMC7300IC::chipAddress |
|
protected |
◆ extcap
| boolean TMC7300IC::extcap |
|
protected |
◆ pin
◆ registers
| uint32_t TMC7300IC::registers[10] |
|
protected |
Initial value:= {
0, 0, 0, 0, 0, (uint32_t)0b1111100000001, 0, (uint32_t)0x13008001, 0, (uint32_t)0xC40D1024}
◆ uartDelay
| uint32_t TMC7300IC::uartDelay |
|
protected |
The documentation for this class was generated from the following file: