![]() |
no-OS
|
Source file for the TMC7300 driver. More...
#include <stdlib.h>#include <stdint.h>#include <stdbool.h>#include "no_os_uart.h"#include "no_os_alloc.h"#include "no_os_error.h"#include "no_os_util.h"#include "tmc7300.h"Functions | |
| int | tmc7300_reg_write (struct tmc7300_desc *desc, uint32_t addr, uint32_t val) |
| Write a register. | |
| int | tmc7300_reg_read (struct tmc7300_desc *desc, uint32_t addr, uint32_t *val) |
| Read a register. | |
| int | tmc7300_reg_update (struct tmc7300_desc *desc, uint32_t addr, uint32_t mask, uint32_t val) |
| Update a register. | |
| int | tmc7300_get_load_indicator (struct tmc7300_desc *desc, enum tmc7300_bridge bridge, uint32_t *val) |
| Get the load indicator. | |
| int | tmc7300_drv_enable (struct tmc7300_desc *desc, bool enable) |
| Enable the bridge driver. | |
| int | tmc7300_set_pwm_duty (struct tmc7300_desc *desc, enum tmc7300_bridge bridge, int32_t duty) |
| Set the PWM duty cycle. | |
| int | tmc7300_set_current_limit (struct tmc7300_desc *desc, uint32_t val) |
| Set the current limit. | |
| int | tmc7300_set_send_delay (struct tmc7300_desc *desc, uint8_t delay) |
| Set the UART response delay. | |
| int | tmc7300_get_ifcnt (struct tmc7300_desc *desc, uint8_t *ifcnt) |
| Get the number of UART valid write accesses. Wraps around at 255. | |
| int | tmc7300_get_drv_status (struct tmc7300_desc *desc, union tmc7300_drv_status *status) |
| Read the driver status register. | |
| int | tmc7300_get_ioin (struct tmc7300_desc *desc, union tmc7300_ioin *ioin) |
| Read the IOIN register. | |
| int | tmc7300_set_standstill_mode (struct tmc7300_desc *desc, enum tmc7300_standstill_mode mode) |
| Set the standstill mode. The motorrun bit will be set to 0. | |
| int | tmc7300_set_pwm_freq (struct tmc7300_desc *desc, enum tmc7300_pwm_freq freq) |
| Set the frequency of the PWM signal. | |
| int | tmc7300_get_pwm_freq (struct tmc7300_desc *desc, enum tmc7300_pwm_freq *freq) |
| Get the frequency of the PWM signal. | |
| int | tmc7300_set_blank_time (struct tmc7300_desc *desc, enum tmc7300_blank_time time) |
| Set the comparator blank time register. | |
| int | tmc7300_get_blank_time (struct tmc7300_desc *desc, enum tmc7300_blank_time *time) |
| Get the comparator blank time register. | |
| int | tmc7300_set_pwm_duty_dir (struct tmc7300_desc *desc, enum tmc7300_bridge bridge, uint8_t duty, enum tmc7300_motor_dir dir) |
| Set the PWM duty cycle and direction. | |
| int | tmc7300_init (struct tmc7300_desc **desc, struct tmc7300_init_param *param) |
| Initialize the TMC7300 driver. | |
| int | tmc7300_remove (struct tmc7300_desc *desc) |
| Free the resources allocated by tmc7300_init(). | |
Source file for the TMC7300 driver.
Copyright 2024(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| int tmc7300_drv_enable | ( | struct tmc7300_desc * | desc, |
| bool | enable ) |
Enable the bridge driver.
| desc | - The TMC7300 descriptor. |
| enable | - Enable or disable the driver. |
| int tmc7300_get_blank_time | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_blank_time * | time ) |
Get the comparator blank time register.
| desc | - The TMC7300 descriptor. |
| time | - The blank time setting. |
| int tmc7300_get_drv_status | ( | struct tmc7300_desc * | desc, |
| union tmc7300_drv_status * | status ) |
Read the driver status register.
| desc | - The TMC7300 descriptor. |
| status | - The driver status. |
| int tmc7300_get_ifcnt | ( | struct tmc7300_desc * | desc, |
| uint8_t * | ifcnt ) |
Get the number of UART valid write accesses. Wraps around at 255.
| desc | - The TMC7300 descriptor. |
| ifcnt | - The number of valid write accesses. |
| int tmc7300_get_ioin | ( | struct tmc7300_desc * | desc, |
| union tmc7300_ioin * | ioin ) |
Read the IOIN register.
| desc | - The TMC7300 descriptor. |
| ioin | - The IOIN register value. |
| int tmc7300_get_load_indicator | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_bridge | bridge, | ||
| uint32_t * | val ) |
Get the load indicator.
| desc | - The TMC7300 descriptor. |
| bridge | - The bridge to get the load indicator for. |
| val | - The load indicator value. |
| int tmc7300_get_pwm_freq | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_pwm_freq * | freq ) |
Get the frequency of the PWM signal.
| desc | - The TMC7300 descriptor. |
| freq | - Division factor for the internal clock oscillator (12 MHz). |
| int tmc7300_init | ( | struct tmc7300_desc ** | desc, |
| struct tmc7300_init_param * | param ) |
Initialize the TMC7300 driver.
| desc | - The TMC7300 descriptor. |
| param | - The initialization parameters. |
| int tmc7300_reg_read | ( | struct tmc7300_desc * | desc, |
| uint32_t | addr, | ||
| uint32_t * | val ) |
Read a register.
| desc | - The TMC7300 descriptor. |
| addr | - The register address. |
| val | - The value to read. |
| int tmc7300_reg_update | ( | struct tmc7300_desc * | desc, |
| uint32_t | addr, | ||
| uint32_t | mask, | ||
| uint32_t | val ) |
Update a register.
| desc | - The TMC7300 descriptor. |
| addr | - The register address. |
| mask | - The mask to apply. |
| val | - The value of the field specified by the mask. Will be shifted to the correct position. |
| int tmc7300_reg_write | ( | struct tmc7300_desc * | desc, |
| uint32_t | addr, | ||
| uint32_t | val ) |
Write a register.
| desc | - The TMC7300 descriptor. |
| addr | - The register address. |
| val | - The value to write. |
| int tmc7300_remove | ( | struct tmc7300_desc * | desc | ) |
Free the resources allocated by tmc7300_init().
| desc | - The TMC7300 descriptor. |
| int tmc7300_set_blank_time | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_blank_time | time ) |
Set the comparator blank time register.
| desc | - The TMC7300 descriptor. |
| time | - The blank time setting. |
| int tmc7300_set_current_limit | ( | struct tmc7300_desc * | desc, |
| uint32_t | val ) |
Set the current limit.
| desc | - The TMC7300 descriptor. |
| val | - The current limit value. |
| int tmc7300_set_pwm_duty | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_bridge | bridge, | ||
| int32_t | duty ) |
Set the PWM duty cycle.
| desc | - The TMC7300 descriptor. |
| bridge | - The bridge to set the PWM duty cycle for. |
| duty | - The duty cycle value. |
| int tmc7300_set_pwm_duty_dir | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_bridge | bridge, | ||
| uint8_t | duty, | ||
| enum tmc7300_motor_dir | dir ) |
Set the PWM duty cycle and direction.
| desc | - The TMC7300 descriptor. |
| bridge | - The bridge to set the PWM duty cycle for. |
| duty | - The duty cycle value. |
| dir | - The direction of the motor. |
| int tmc7300_set_pwm_freq | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_pwm_freq | freq ) |
Set the frequency of the PWM signal.
| desc | - The TMC7300 descriptor. |
| freq | - Division factor for the internal clock oscillator (12 MHz). |
| int tmc7300_set_send_delay | ( | struct tmc7300_desc * | desc, |
| uint8_t | delay ) |
Set the UART response delay.
| desc | - The TMC7300 descriptor. |
| delay | - The delay value. |
| int tmc7300_set_standstill_mode | ( | struct tmc7300_desc * | desc, |
| enum tmc7300_standstill_mode | mode ) |
Set the standstill mode. The motorrun bit will be set to 0.
| desc | - The TMC7300 descriptor. |
| mode | - The standstill mode setting (freewheeling or break). |