|
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;
};
|
|