Improved LIS3DSH driver and related demos: improved bias and sensitivity handling.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9830 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
52bdd5d866
commit
638d27eabf
|
@ -107,21 +107,25 @@ static msg_t read_raw(void *ip, int32_t axes[LIS3DSH_NUMBER_OF_AXES]) {
|
||||||
#if LIS3DSH_USE_SPI
|
#if LIS3DSH_USE_SPI
|
||||||
osalDbgAssert((((LIS3DSHDriver *)ip)->config->spip->state == SPI_READY),
|
osalDbgAssert((((LIS3DSHDriver *)ip)->config->spip->state == SPI_READY),
|
||||||
"read_raw(), channel not ready");
|
"read_raw(), channel not ready");
|
||||||
|
|
||||||
#if LIS3DSH_SHARED_SPI
|
#if LIS3DSH_SHARED_SPI
|
||||||
spiAcquireBus(((LIS3DSHDriver *)ip)->config->spip);
|
spiAcquireBus(((LIS3DSHDriver *)ip)->config->spip);
|
||||||
spiStart(((LIS3DSHDriver *)ip)->config->spip,
|
spiStart(((LIS3DSHDriver *)ip)->config->spip,
|
||||||
((LIS3DSHDriver *)ip)->config->spicfg);
|
((LIS3DSHDriver *)ip)->config->spicfg);
|
||||||
#endif /* LIS3DSH_SHARED_SPI */
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
|
||||||
lis3dshSPIReadRegister(((LIS3DSHDriver *)ip)->config->spip, LIS3DSH_AD_OUT_X_L,
|
lis3dshSPIReadRegister(((LIS3DSHDriver *)ip)->config->spip, LIS3DSH_AD_OUT_X_L,
|
||||||
LIS3DSH_NUMBER_OF_AXES * 2, buff);
|
LIS3DSH_NUMBER_OF_AXES * 2, buff);
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++) {
|
|
||||||
tmp = buff[2*i] + (buff[2*i+1] << 8);
|
|
||||||
axes[i] = (int32_t)tmp;
|
|
||||||
}
|
|
||||||
#if LIS3DSH_SHARED_SPI
|
#if LIS3DSH_SHARED_SPI
|
||||||
spiReleaseBus(((LIS3DSHDriver *)ip)->config->spip);
|
spiReleaseBus(((LIS3DSHDriver *)ip)->config->spip);
|
||||||
#endif /* LIS3DSH_SHARED_SPI */
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
#endif /* LIS3DSH_USE_SPI */
|
#endif /* LIS3DSH_USE_SPI */
|
||||||
|
|
||||||
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++) {
|
||||||
|
tmp = buff[2*i] + (buff[2*i+1] << 8);
|
||||||
|
axes[i] = (int32_t)tmp;
|
||||||
|
}
|
||||||
return MSG_OK;
|
return MSG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,13 +248,34 @@ static msg_t set_full_scale(void *ip, lis3dsh_fs_t fs) {
|
||||||
scale = newfs / ((LIS3DSHDriver *)ip)->fullscale;
|
scale = newfs / ((LIS3DSHDriver *)ip)->fullscale;
|
||||||
((LIS3DSHDriver *)ip)->fullscale = newfs;
|
((LIS3DSHDriver *)ip)->fullscale = newfs;
|
||||||
|
|
||||||
/* Updating register.*/
|
#if LIS3DSH_USE_SPI
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiAcquireBus(((LIS3DSHDriver *)ip)->config->spip);
|
||||||
|
spiStart(((LIS3DSHDriver *)ip)->config->spip,
|
||||||
|
((LIS3DSHDriver *)ip)->config->spicfg);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
lis3dshSPIReadRegister(((LIS3DSHDriver *)ip)->config->spip,
|
lis3dshSPIReadRegister(((LIS3DSHDriver *)ip)->config->spip,
|
||||||
LIS3DSH_AD_CTRL_REG5, 1, &cr);
|
LIS3DSH_AD_CTRL_REG5, 1, &cr);
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiReleaseBus(((LIS3DSHDriver *)ip)->config->spip);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
#endif /* LIS3DSH_USE_SPI */
|
||||||
|
|
||||||
cr &= ~(LIS3DSH_CTRL_REG5_FS_MASK);
|
cr &= ~(LIS3DSH_CTRL_REG5_FS_MASK);
|
||||||
cr |= fs;
|
cr |= fs;
|
||||||
|
|
||||||
|
#if LIS3DSH_USE_SPI
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiAcquireBus(((LIS3DSHDriver *)ip)->config->spip);
|
||||||
|
spiStart(((LIS3DSHDriver *)ip)->config->spip,
|
||||||
|
((LIS3DSHDriver *)ip)->config->spicfg);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
lis3dshSPIWriteRegister(((LIS3DSHDriver *)ip)->config->spip,
|
lis3dshSPIWriteRegister(((LIS3DSHDriver *)ip)->config->spip,
|
||||||
LIS3DSH_AD_CTRL_REG5, 1, &cr);
|
LIS3DSH_AD_CTRL_REG5, 1, &cr);
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiReleaseBus(((LIS3DSHDriver *)ip)->config->spip);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
#endif /* LIS3DSH_USE_SPI */
|
||||||
|
|
||||||
/* Scaling sensitivity and bias. Re-calibration is suggested anyway. */
|
/* Scaling sensitivity and bias. Re-calibration is suggested anyway. */
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++) {
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++) {
|
||||||
|
@ -294,7 +319,7 @@ void lis3dshObjectInit(LIS3DSHDriver *devp) {
|
||||||
devp->vmt_lis3dsh = &vmt_lis3dsh;
|
devp->vmt_lis3dsh = &vmt_lis3dsh;
|
||||||
devp->config = NULL;
|
devp->config = NULL;
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
devp->bias[i] = 0;
|
devp->bias[i] = 0.0f;
|
||||||
devp->state = LIS3DSH_STOP;
|
devp->state = LIS3DSH_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,13 +340,6 @@ void lis3dshStart(LIS3DSHDriver *devp, const LIS3DSHConfig *config) {
|
||||||
|
|
||||||
devp->config = config;
|
devp->config = config;
|
||||||
|
|
||||||
#if LIS3DSH_USE_SPI
|
|
||||||
#if LIS3DSH_SHARED_SPI
|
|
||||||
spiAcquireBus((devp)->config->spip);
|
|
||||||
#endif /* LIS3DSH_SHARED_SPI */
|
|
||||||
spiStart((devp)->config->spip,
|
|
||||||
(devp)->config->spicfg);
|
|
||||||
|
|
||||||
/* Control register 4 configuration block.*/
|
/* Control register 4 configuration block.*/
|
||||||
{
|
{
|
||||||
cr = LIS3DSH_CTRL_REG4_XEN | LIS3DSH_CTRL_REG4_YEN | LIS3DSH_CTRL_REG4_ZEN |
|
cr = LIS3DSH_CTRL_REG4_XEN | LIS3DSH_CTRL_REG4_YEN | LIS3DSH_CTRL_REG4_ZEN |
|
||||||
|
@ -330,9 +348,21 @@ void lis3dshStart(LIS3DSHDriver *devp, const LIS3DSHConfig *config) {
|
||||||
cr |= devp->config->blockdataupdate;
|
cr |= devp->config->blockdataupdate;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIS3DSH_USE_SPI
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiAcquireBus((devp)->config->spip);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
spiStart((devp)->config->spip, (devp)->config->spicfg);
|
||||||
|
|
||||||
lis3dshSPIWriteRegister(devp->config->spip, LIS3DSH_AD_CTRL_REG4,
|
lis3dshSPIWriteRegister(devp->config->spip, LIS3DSH_AD_CTRL_REG4,
|
||||||
1, &cr);
|
1, &cr);
|
||||||
|
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiReleaseBus((devp)->config->spip);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
#endif /* LIS3DSH_USE_SPI */
|
||||||
|
|
||||||
/* Control register 5 configuration block.*/
|
/* Control register 5 configuration block.*/
|
||||||
{
|
{
|
||||||
cr = devp->config->fullscale;
|
cr = devp->config->fullscale;
|
||||||
|
@ -340,9 +370,21 @@ void lis3dshStart(LIS3DSHDriver *devp, const LIS3DSHConfig *config) {
|
||||||
cr |= devp->config->antialiasing;
|
cr |= devp->config->antialiasing;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIS3DSH_USE_SPI
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiAcquireBus((devp)->config->spip);
|
||||||
|
spiStart((devp)->config->spip, (devp)->config->spicfg);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
|
||||||
lis3dshSPIWriteRegister(devp->config->spip, LIS3DSH_AD_CTRL_REG5,
|
lis3dshSPIWriteRegister(devp->config->spip, LIS3DSH_AD_CTRL_REG5,
|
||||||
1, &cr);
|
1, &cr);
|
||||||
|
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiReleaseBus((devp)->config->spip);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
#endif /* LIS3DSH_USE_SPI */
|
||||||
|
|
||||||
/* Control register 6 configuration block.*/
|
/* Control register 6 configuration block.*/
|
||||||
{
|
{
|
||||||
cr = LIS3DSH_CTRL_REG6_ADD_INC;
|
cr = LIS3DSH_CTRL_REG6_ADD_INC;
|
||||||
|
@ -350,42 +392,76 @@ void lis3dshStart(LIS3DSHDriver *devp, const LIS3DSHConfig *config) {
|
||||||
cr |= devp->config->blockdataupdate;
|
cr |= devp->config->blockdataupdate;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIS3DSH_USE_SPI
|
||||||
|
#if LIS3DSH_SHARED_SPI
|
||||||
|
spiAcquireBus((devp)->config->spip);
|
||||||
|
spiStart((devp)->config->spip, (devp)->config->spicfg);
|
||||||
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
|
|
||||||
lis3dshSPIWriteRegister(devp->config->spip, LIS3DSH_AD_CTRL_REG6,
|
lis3dshSPIWriteRegister(devp->config->spip, LIS3DSH_AD_CTRL_REG6,
|
||||||
1, &cr);
|
1, &cr);
|
||||||
|
|
||||||
#if LIS3DSH_SHARED_SPI
|
#if LIS3DSH_SHARED_SPI
|
||||||
spiReleaseBus((devp)->config->spip);
|
spiReleaseBus((devp)->config->spip);
|
||||||
#endif /* LIS3DSH_SHARED_SPI */
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
#endif /* LIS3DSH_USE_SPI */
|
#endif /* LIS3DSH_USE_SPI */
|
||||||
|
|
||||||
/* Storing sensitivity information according to full scale value */
|
/* Storing sensitivity information according to user setting */
|
||||||
if(devp->config->fullscale == LIS3DSH_FS_2G) {
|
if(devp->config->fullscale == LIS3DSH_FS_2G) {
|
||||||
devp->fullscale = LIS3DSH_2G;
|
devp->fullscale = LIS3DSH_2G;
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
if(devp->config->sensitivity == NULL)
|
||||||
devp->sensitivity[i] = LIS3DSH_SENS_2G;
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = LIS3DSH_SENS_2G;
|
||||||
|
else
|
||||||
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = devp->config->sensitivity[i];
|
||||||
}
|
}
|
||||||
else if(devp->config->fullscale == LIS3DSH_FS_4G) {
|
else if(devp->config->fullscale == LIS3DSH_FS_4G) {
|
||||||
devp->fullscale = LIS3DSH_4G;
|
devp->fullscale = LIS3DSH_4G;
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
if(devp->config->sensitivity == NULL)
|
||||||
devp->sensitivity[i] = LIS3DSH_SENS_4G;
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = LIS3DSH_SENS_4G;
|
||||||
|
else
|
||||||
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = devp->config->sensitivity[i];
|
||||||
}
|
}
|
||||||
else if(devp->config->fullscale == LIS3DSH_FS_6G) {
|
else if(devp->config->fullscale == LIS3DSH_FS_6G) {
|
||||||
devp->fullscale = LIS3DSH_6G;
|
devp->fullscale = LIS3DSH_6G;
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
if(devp->config->sensitivity == NULL)
|
||||||
devp->sensitivity[i] = LIS3DSH_SENS_6G;
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = LIS3DSH_SENS_6G;
|
||||||
|
else
|
||||||
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = devp->config->sensitivity[i];
|
||||||
}
|
}
|
||||||
else if(devp->config->fullscale == LIS3DSH_FS_8G) {
|
else if(devp->config->fullscale == LIS3DSH_FS_8G) {
|
||||||
devp->fullscale = LIS3DSH_8G;
|
devp->fullscale = LIS3DSH_8G;
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
if(devp->config->sensitivity == NULL)
|
||||||
devp->sensitivity[i] = LIS3DSH_SENS_8G;
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = LIS3DSH_SENS_8G;
|
||||||
|
else
|
||||||
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = devp->config->sensitivity[i];
|
||||||
}
|
}
|
||||||
else if(devp->config->fullscale == LIS3DSH_FS_16G) {
|
else if(devp->config->fullscale == LIS3DSH_FS_16G) {
|
||||||
devp->fullscale = LIS3DSH_16G;
|
devp->fullscale = LIS3DSH_16G;
|
||||||
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
if(devp->config->sensitivity == NULL)
|
||||||
devp->sensitivity[i] = LIS3DSH_SENS_16G;
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = LIS3DSH_SENS_16G;
|
||||||
|
else
|
||||||
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->sensitivity[i] = devp->config->sensitivity[i];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
osalDbgAssert(FALSE, "lis3dshStart(), accelerometer full scale issue");
|
osalDbgAssert(FALSE, "lis3dshStart(), accelerometer full scale issue");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Storing bias information according to user setting */
|
||||||
|
if(devp->config->bias != NULL)
|
||||||
|
for(i = 0; i < LIS3DSH_NUMBER_OF_AXES; i++)
|
||||||
|
devp->bias[i] = devp->config->bias[i];
|
||||||
|
|
||||||
/* This is the Accelerometer transient recovery time */
|
/* This is the Accelerometer transient recovery time */
|
||||||
osalThreadSleepMilliseconds(10);
|
osalThreadSleepMilliseconds(10);
|
||||||
|
|
||||||
|
@ -406,8 +482,8 @@ void lis3dshStop(LIS3DSHDriver *devp) {
|
||||||
osalDbgAssert((devp->state == LIS3DSH_STOP) || (devp->state == LIS3DSH_READY),
|
osalDbgAssert((devp->state == LIS3DSH_STOP) || (devp->state == LIS3DSH_READY),
|
||||||
"lis3dshStop(), invalid state");
|
"lis3dshStop(), invalid state");
|
||||||
|
|
||||||
|
if (devp->state == LIS3DSH_READY) {
|
||||||
#if (LIS3DSH_USE_SPI)
|
#if (LIS3DSH_USE_SPI)
|
||||||
if (devp->state == LIS3DSH_STOP) {
|
|
||||||
#if LIS3DSH_SHARED_SPI
|
#if LIS3DSH_SHARED_SPI
|
||||||
spiAcquireBus((devp)->config->spip);
|
spiAcquireBus((devp)->config->spip);
|
||||||
spiStart((devp)->config->spip,
|
spiStart((devp)->config->spip,
|
||||||
|
@ -420,9 +496,9 @@ void lis3dshStop(LIS3DSHDriver *devp) {
|
||||||
spiStop((devp)->config->spip);
|
spiStop((devp)->config->spip);
|
||||||
#if LIS3DSH_SHARED_SPI
|
#if LIS3DSH_SHARED_SPI
|
||||||
spiReleaseBus((devp)->config->spip);
|
spiReleaseBus((devp)->config->spip);
|
||||||
#endif /* LIS3DSH_SHARED_SPI */
|
#endif /* LIS3DSH_SHARED_SPI */
|
||||||
}
|
|
||||||
#endif /* LIS3DSH_USE_SPI */
|
#endif /* LIS3DSH_USE_SPI */
|
||||||
|
}
|
||||||
devp->state = LIS3DSH_STOP;
|
devp->state = LIS3DSH_STOP;
|
||||||
}
|
}
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH driver version string.
|
* @brief LIS3DSH driver version string.
|
||||||
*/
|
*/
|
||||||
#define EX_LIS3DSH_VERSION "1.0.1"
|
#define EX_LIS3DSH_VERSION "1.0.2"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH driver version major number.
|
* @brief LIS3DSH driver version major number.
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH driver version patch number.
|
* @brief LIS3DSH driver version patch number.
|
||||||
*/
|
*/
|
||||||
#define EX_LIS3DSH_PATCH 1
|
#define EX_LIS3DSH_PATCH 2
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -435,28 +435,28 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH initial sensitivity.
|
* @brief LIS3DSH initial sensitivity.
|
||||||
*/
|
*/
|
||||||
float sensitivity[LIS3DSH_NUMBER_OF_AXES];
|
float *sensitivity;
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH initial bias.
|
* @brief LIS3DSH initial bias.
|
||||||
*/
|
*/
|
||||||
float bias[LIS3DSH_NUMBER_OF_AXES];
|
float *bias;
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH full scale value.
|
* @brief LIS3DSH full scale value.
|
||||||
*/
|
*/
|
||||||
lis3dsh_fs_t fullscale;
|
lis3dsh_fs_t fullscale;
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH output data rate selection.
|
* @brief LIS3DSH output data rate selection.
|
||||||
*/
|
*/
|
||||||
lis3dsh_odr_t outputdatarate;
|
lis3dsh_odr_t outputdatarate;
|
||||||
#if LIS3DSH_USE_ADVANCED || defined(__DOXYGEN__)
|
#if LIS3DSH_USE_ADVANCED || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH anti-aliasing bandwidth.
|
* @brief LIS3DSH anti-aliasing bandwidth.
|
||||||
*/
|
*/
|
||||||
lis3dsh_bw_t antialiasing;
|
lis3dsh_bw_t antialiasing;
|
||||||
/**
|
/**
|
||||||
* @brief LIS3DSH block data update.
|
* @brief LIS3DSH block data update.
|
||||||
*/
|
*/
|
||||||
lis3dsh_bdu_t blockdataupdate;
|
lis3dsh_bdu_t blockdataupdate;
|
||||||
#endif
|
#endif
|
||||||
} LIS3DSHConfig;
|
} LIS3DSHConfig;
|
||||||
|
|
||||||
|
@ -488,9 +488,9 @@ struct LIS3DSHVMT {
|
||||||
#define _lis3dsh_data \
|
#define _lis3dsh_data \
|
||||||
_base_accelerometer_data \
|
_base_accelerometer_data \
|
||||||
/* Driver state.*/ \
|
/* Driver state.*/ \
|
||||||
lis3dsh_state_t state; \
|
lis3dsh_state_t state; \
|
||||||
/* Current configuration data.*/ \
|
/* Current configuration data.*/ \
|
||||||
const LIS3DSHConfig *config; \
|
const LIS3DSHConfig *config; \
|
||||||
/* Current sensitivity.*/ \
|
/* Current sensitivity.*/ \
|
||||||
float sensitivity[LIS3DSH_NUMBER_OF_AXES]; \
|
float sensitivity[LIS3DSH_NUMBER_OF_AXES]; \
|
||||||
/* Bias data.*/ \
|
/* Bias data.*/ \
|
||||||
|
|
|
@ -71,7 +71,7 @@ endif
|
||||||
|
|
||||||
# Enables the use of FPU (no, softfp, hard).
|
# Enables the use of FPU (no, softfp, hard).
|
||||||
ifeq ($(USE_FPU),)
|
ifeq ($(USE_FPU),)
|
||||||
USE_FPU = hard
|
USE_FPU = no
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -114,7 +114,7 @@ CSRC = $(STARTUPSRC) \
|
||||||
$(HALSRC) \
|
$(HALSRC) \
|
||||||
$(PLATFORMSRC) \
|
$(PLATFORMSRC) \
|
||||||
$(BOARDSRC) \
|
$(BOARDSRC) \
|
||||||
$(LIS3DSHSRC) \
|
$(LIS3DSHSRC) \
|
||||||
$(STREAMSSRC) \
|
$(STREAMSSRC) \
|
||||||
$(SHELLSRC) \
|
$(SHELLSRC) \
|
||||||
usbcfg.c main.c
|
usbcfg.c main.c
|
||||||
|
|
|
@ -44,7 +44,11 @@
|
||||||
#define STM32_CLOCK48_REQUIRED TRUE
|
#define STM32_CLOCK48_REQUIRED TRUE
|
||||||
#define STM32_SW STM32_SW_PLL
|
#define STM32_SW STM32_SW_PLL
|
||||||
#define STM32_PLLSRC STM32_PLLSRC_HSE
|
#define STM32_PLLSRC STM32_PLLSRC_HSE
|
||||||
|
#if defined(BOARD_ST_STM32F4_DISCOVERY)
|
||||||
#define STM32_PLLM_VALUE 8
|
#define STM32_PLLM_VALUE 8
|
||||||
|
#else
|
||||||
|
#define STM32_PLLM_VALUE 12
|
||||||
|
#endif
|
||||||
#define STM32_PLLN_VALUE 336
|
#define STM32_PLLN_VALUE 336
|
||||||
#define STM32_PLLP_VALUE 2
|
#define STM32_PLLP_VALUE 2
|
||||||
#define STM32_PLLQ_VALUE 7
|
#define STM32_PLLQ_VALUE 7
|
||||||
|
@ -264,8 +268,8 @@
|
||||||
* SPI driver system settings.
|
* SPI driver system settings.
|
||||||
*/
|
*/
|
||||||
#define STM32_SPI_USE_SPI1 TRUE
|
#define STM32_SPI_USE_SPI1 TRUE
|
||||||
#define STM32_SPI_USE_SPI2 TRUE
|
#define STM32_SPI_USE_SPI2 FALSE
|
||||||
#define STM32_SPI_USE_SPI3 TRUE
|
#define STM32_SPI_USE_SPI3 FALSE
|
||||||
#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
|
#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
|
||||||
#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
|
#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
|
||||||
#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
|
#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** ChibiOS/HAL + ChibiOS/EX - SPI + LIS3DSH demo for STM32F4xx. **
|
** ChibiOS/HAL - USB-CDC driver demo for STM32. **
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
** TARGET **
|
** TARGET **
|
||||||
|
|
||||||
The demo runs on an STM32F407 Discovery board rev MB997C and MB997D.
|
The demo runs on both Olimex STM32-E407 or STM32F4-Discovery boards, just
|
||||||
|
change the board reference in the Makefile.
|
||||||
|
|
||||||
** The Demo **
|
** The Demo **
|
||||||
|
|
||||||
The demo flashes the board LED using a thread, read data from LIS3DSH printing
|
The application demonstrates the use of the STM32 USB (OTG) driver.
|
||||||
it on a BaseSequentialStream (SDU1, mapped on USB virtual COM port).
|
|
||||||
|
|
||||||
** Build Procedure **
|
** Build Procedure **
|
||||||
|
|
||||||
The demo has been tested by using the free Codesourcery GCC-based toolchain
|
The demo has been tested using the free Codesourcery GCC-based toolchain
|
||||||
and YAGARTO.
|
and YAGARTO.
|
||||||
Just modify the TRGT line in the makefile in order to use different GCC ports.
|
Just modify the TRGT line in the makefile in order to use different GCC ports.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue