industry/foc/*/foc_angle.c: add methods to set the zero angle and direction of the angle

This commit is contained in:
raiden00pl 2021-10-29 12:06:26 +02:00 committed by Xiang Xiao
parent 2e61b3e310
commit 6cafdae44a
4 changed files with 112 additions and 0 deletions

View File

@ -74,6 +74,14 @@ struct foc_angle_ops_b16_s
CODE int (*cfg)(FAR foc_angle_b16_t *h, FAR void *cfg);
/* Zero */
CODE int (*zero)(FAR foc_angle_b16_t *h);
/* Direction */
CODE int (*dir)(FAR foc_angle_b16_t *h, b16_t dir);
/* Run */
CODE int (*run)(FAR foc_angle_b16_t *h,
@ -131,6 +139,18 @@ int foc_angle_deinit_b16(FAR foc_angle_b16_t *h);
int foc_angle_cfg_b16(FAR foc_angle_b16_t *h, FAR void *cfg);
/****************************************************************************
* Name: foc_angle_zero_b16
****************************************************************************/
int foc_angle_zero_b16(FAR foc_angle_b16_t *h);
/****************************************************************************
* Name: foc_angle_dir_b16
****************************************************************************/
int foc_angle_dir_b16(FAR foc_angle_b16_t *h, b16_t dir);
/****************************************************************************
* Name: foc_angle_run_b16
****************************************************************************/

View File

@ -74,6 +74,14 @@ struct foc_angle_ops_f32_s
CODE int (*cfg)(FAR foc_angle_f32_t *h, FAR void *cfg);
/* Zero */
CODE int (*zero)(FAR foc_angle_f32_t *h);
/* Direction */
CODE int (*dir)(FAR foc_angle_f32_t *h, float dir);
/* Run angle handler */
CODE int (*run)(FAR foc_angle_f32_t *h,
@ -131,6 +139,18 @@ int foc_angle_deinit_f32(FAR foc_angle_f32_t *h);
int foc_angle_cfg_f32(FAR foc_angle_f32_t *h, FAR void *cfg);
/****************************************************************************
* Name: foc_angle_zero_f32
****************************************************************************/
int foc_angle_zero_f32(FAR foc_angle_f32_t *h);
/****************************************************************************
* Name: foc_angle_dir_f32
****************************************************************************/
int foc_angle_dir_f32(FAR foc_angle_f32_t *h, float dir);
/****************************************************************************
* Name: foc_angle_run_f32
****************************************************************************/

View File

@ -130,6 +130,42 @@ int foc_angle_cfg_b16(FAR foc_angle_b16_t *h, FAR void *cfg)
return h->ops->cfg(h, cfg);
}
/****************************************************************************
* Name: foc_angle_zero_b16
*
* Description:
* Reset the FOC angle handler (fixed16)
*
* Input Parameter:
* h - pointer to FOC angle handler
*
****************************************************************************/
int foc_angle_zero_b16(FAR foc_angle_b16_t *h)
{
DEBUGASSERT(h);
return h->ops->zero(h);
}
/****************************************************************************
* Name: foc_angle_dir_b16
*
* Description:
* Set the FOC angle handler direction (fixed16)
*
* Input Parameter:
* h - pointer to FOC angle handler
*
****************************************************************************/
int foc_angle_dir_b16(FAR foc_angle_b16_t *h, b16_t dir)
{
DEBUGASSERT(h);
return h->ops->dir(h, dir);
}
/****************************************************************************
* Name: foc_angle_run_b16
*

View File

@ -130,6 +130,42 @@ int foc_angle_cfg_f32(FAR foc_angle_f32_t *h, FAR void *cfg)
return h->ops->cfg(h, cfg);
}
/****************************************************************************
* Name: foc_angle_zero_f32
*
* Description:
* Reset the FOC angle handler (float32)
*
* Input Parameter:
* h - pointer to FOC angle handler
*
****************************************************************************/
int foc_angle_zero_f32(FAR foc_angle_f32_t *h)
{
DEBUGASSERT(h);
return h->ops->zero(h);
}
/****************************************************************************
* Name: foc_angle_dir_f32
*
* Description:
* Set the FOC angle handler direction (float32)
*
* Input Parameter:
* h - pointer to FOC angle handler
*
****************************************************************************/
int foc_angle_dir_f32(FAR foc_angle_f32_t *h, float dir)
{
DEBUGASSERT(h);
return h->ops->dir(h, dir);
}
/****************************************************************************
* Name: foc_angle_run_f32
*