drivers/foc: get hardware information via lower-half interface

This commit is contained in:
raiden00pl
2023-11-13 12:18:48 +01:00
committed by Xiang Xiao
parent 5f15c73219
commit 7d99f01cf7
13 changed files with 182 additions and 85 deletions
+3 -3
View File
@@ -98,9 +98,9 @@ struct foc_params_s
foc_duty_t duty[CONFIG_MOTOR_FOC_PHASES]; /* PWM duty cycle for phases */
};
/* Hardware specific configuration */
/* Hardware specific informations */
struct foc_hw_config_s
struct foc_info_hw_s
{
uint32_t pwm_dt_ns; /* PWM dead-time in nano seconds */
foc_duty_t pwm_max; /* Maximum PWM duty cycle */
@@ -110,7 +110,7 @@ struct foc_hw_config_s
struct foc_info_s
{
struct foc_hw_config_s hw_cfg; /* Hardware specific configuration */
struct foc_info_hw_s hw_cfg; /* Hardware specific informations */
};
/* FOC device upper-half */
+6
View File
@@ -48,6 +48,7 @@
#define FOC_OPS_PWMOFF(d, o) (d)->lower->ops->pwm_off(d, o)
#define FOC_OPS_DUTY(d, x) (d)->lower->ops->pwm_duty_set(d, x)
#define FOC_OPS_IOCTL(d, c, a) (d)->lower->ops->ioctl(d, c, a)
#define FOC_OPS_INFOGET(d, i) (d)->lower->ops->info_get(d, i)
#define FOC_OPS_BIND(d, c) (d)->lower->ops->bind(d, c)
#define FOC_OPS_FAULT_CLEAR(d) (d)->lower->ops->fault_clear(d)
#ifdef CONFIG_MOTOR_FOC_TRACE
@@ -119,6 +120,11 @@ struct foc_lower_ops_s
CODE int (*start)(FAR struct foc_dev_s *dev, bool state);
/* Get all hardware information */
CODE int (*info_get)(FAR struct foc_dev_s *dev,
FAR struct foc_info_s *info);
/* Lower-half IOCTL */
CODE int (*ioctl)(FAR struct foc_dev_s *dev, int cmd,