examples/foc: move setpoint and vbus configuration from foc_adc.h to foc_cfg.h
This commit is contained in:
parent
edeaacedb0
commit
3fda1294d7
@ -31,55 +31,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* VBUS source must be specified */
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_FOC_VBUS_CONST) && \
|
||||
defined(CONFIG_EXAMPLES_FOC_VBUS_ADC)
|
||||
# error
|
||||
#endif
|
||||
|
||||
/* Velocity source must be specified */
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_FOC_SETPOINT_CONST) && \
|
||||
defined(CONFIG_EXAMPLES_FOC_SETPOINT_ADC)
|
||||
# error
|
||||
#endif
|
||||
|
||||
/* VBUS ADC scale factor */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_VBUS_ADC
|
||||
# define VBUS_ADC_SCALE (CONFIG_EXAMPLES_FOC_ADC_VREF * \
|
||||
CONFIG_EXAMPLES_FOC_VBUS_SCALE / \
|
||||
CONFIG_EXAMPLES_FOC_ADC_MAX / \
|
||||
1000.0f / \
|
||||
1000.0f)
|
||||
#endif
|
||||
|
||||
/* Velocity ADC scale factor */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_SETPOINT_ADC
|
||||
# define SETPOINT_ADC_SCALE (1.0f / CONFIG_EXAMPLES_FOC_ADC_MAX)
|
||||
#endif
|
||||
|
||||
/* If constant velocity is selected, velocity value must be provided */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_SETPOINT_CONST
|
||||
# define SETPOINT_ADC_SCALE (1)
|
||||
# if CONFIG_EXAMPLES_FOC_SETPOINT_CONST_VALUE == 0
|
||||
# error
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If constant VBUS is selected, VBUS value must be provided */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_VBUS_CONST
|
||||
# define VBUS_ADC_SCALE (1)
|
||||
# define VBUS_CONST_VALUE (CONFIG_EXAMPLES_FOC_VBUS_CONST_VALUE / 1000.0f)
|
||||
# if CONFIG_EXAMPLES_FOC_VBUS_CONST_VALUE == 0
|
||||
# error
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Additional configuration if ADC support is required */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_HAVE_ADC
|
||||
|
@ -128,4 +128,53 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Setpoint source must be specified */
|
||||
|
||||
#if !defined(CONFIG_EXAMPLES_FOC_SETPOINT_CONST) && \
|
||||
!defined(CONFIG_EXAMPLES_FOC_SETPOINT_ADC)
|
||||
# error
|
||||
#endif
|
||||
|
||||
/* Setpoint ADC scale factor */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_SETPOINT_ADC
|
||||
# define SETPOINT_ADC_SCALE (1.0f / CONFIG_EXAMPLES_FOC_ADC_MAX)
|
||||
#endif
|
||||
|
||||
/* If constant setpoint is selected, setpoint value must be provided */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_SETPOINT_CONST
|
||||
# define SETPOINT_ADC_SCALE (1)
|
||||
# if CONFIG_EXAMPLES_FOC_SETPOINT_CONST_VALUE == 0
|
||||
# error
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* VBUS source must be specified */
|
||||
|
||||
#if !defined(CONFIG_EXAMPLES_FOC_VBUS_CONST) && \
|
||||
!defined(CONFIG_EXAMPLES_FOC_VBUS_ADC)
|
||||
# error
|
||||
#endif
|
||||
|
||||
/* VBUS ADC scale factor */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_VBUS_ADC
|
||||
# define VBUS_ADC_SCALE (CONFIG_EXAMPLES_FOC_ADC_VREF * \
|
||||
CONFIG_EXAMPLES_FOC_VBUS_SCALE / \
|
||||
CONFIG_EXAMPLES_FOC_ADC_MAX / \
|
||||
1000.0f / \
|
||||
1000.0f)
|
||||
#endif
|
||||
|
||||
/* If constant VBUS is selected, VBUS value must be provided */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_FOC_VBUS_CONST
|
||||
# define VBUS_ADC_SCALE (1)
|
||||
# define VBUS_CONST_VALUE (CONFIG_EXAMPLES_FOC_VBUS_CONST_VALUE / 1000.0f)
|
||||
# if CONFIG_EXAMPLES_FOC_VBUS_CONST_VALUE == 0
|
||||
# error
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* __EXAMPLES_FOC_FOC_CFG_H */
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include "foc_mq.h"
|
||||
#include "foc_thr.h"
|
||||
#include "foc_adc.h"
|
||||
#include "foc_cfg.h"
|
||||
#include "foc_debug.h"
|
||||
#include "foc_device.h"
|
||||
#include "foc_parseargs.h"
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "foc_motor_b16.h"
|
||||
|
||||
#include "foc_cfg.h"
|
||||
#include "foc_adc.h"
|
||||
#include "foc_debug.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "foc_motor_f32.h"
|
||||
|
||||
#include "foc_cfg.h"
|
||||
#include "foc_adc.h"
|
||||
#include "foc_debug.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user