前馈科技

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 5009|回复: 0

几个foc_dev数据结构

[复制链接]

97

主题

97

帖子

539

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
539
发表于 2021-12-29 21:32:26 | 显示全部楼层 |阅读模式
struct foc_lower_ops_s
{
  CODE int (*configure)(FAR struct foc_dev_s *dev, FAR struct foc_cfg_s *cfg);
  CODE int (*setup)(FAR struct foc_dev_s *dev);
  CODE int (*shutdown)(FAR struct foc_dev_s *dev);
  CODE int (*pwm_duty_set)(FAR struct foc_dev_s *dev,   FAR foc_duty_t *duty);
  CODE int (*start)(FAR struct foc_dev_s *dev, bool state);
  CODE int (*ioctl)(FAR struct foc_dev_s *dev, int cmd,   unsigned long arg);
  CODE int (*bind)(FAR struct foc_dev_s *dev,  FAR struct foc_callbacks_s *cb)
  CODE int (*fault_clear)(FAR struct foc_dev_s *dev);
};

struct stm32_foc_dev_s
{
  uint8_t                      pwm_inst;
  uint8_t                      adc_inst;
  uint32_t                    pwm_base;
  uint32_t                    adc_irq;
  uint32_t                    jextval;
  FAR struct stm32_pwm_dev_s *pwm;
  FAR struct adc_dev_s              *adc_dev;
  FAR struct stm32_adc_dev_s  *adc;
  CODE int (*adc_isr)(FAR struct foc_dev_s *dev);
};

struct stm32_foc_board_s
{
  FAR struct stm32_foc_board_ops_s *ops;
  FAR struct stm32_foc_board_data_s *data;
};

struct stm32_foc_board_ops_s
{
  CODE int (*setup)(FAR struct foc_dev_s *dev);
  CODE int (*shutdown)(FAR struct foc_dev_s *dev);
  CODE int (*calibration)(FAR struct foc_dev_s *dev, bool state);
  CODE int (*fault_clear)(FAR struct foc_dev_s *dev);
  CODE int (*pwm_start)(FAR struct foc_dev_s *dev, bool state);
  CODE int (*current_get)(FAR struct foc_dev_s *dev, FAR int16_t *curr_raw,   FAR foc_current_t *curr);
#ifdef CONFIG_MOTOR_FOC_TRACE
  CODE int (*trace_init)(FAR struct foc_dev_s *dev);
  CODE void (*trace)(FAR struct foc_dev_s *dev, int type, bool state);
#endif
};


struct stm32_foc_board_data_s
{
  FAR struct stm32_foc_adc_s *adc_cfg;
  uint8_t pwm_dt;
  uint16_t pwm_dt_ns;
  foc_duty_t duty_max;
};

struct adc_dev_s
{
#ifdef CONFIG_ADC
  uint8_t                      ad_ocount;  
  uint8_t                      ad_nrxwaiters;
  sem_t                       ad_closesem;
  sem_t                       ad_recvsem;
  struct adc_fifo_s       ad_recv;
  bool                          ad_isovr;
  struct pollfd *fds[CONFIG_ADC_NPOLLWAITERS];
#endif /* CONFIG_ADC */
  FAR const struct adc_ops_s *ad_ops;
  FAR void                   *ad_priv;
};







回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|计算机控制

GMT+8, 2024-4-25 09:02 , Processed in 0.049891 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表