Page 1 of 1

Improvements

Posted: Fri Jun 17, 2016 9:26 am
by RoccoMarco
Dear all,
I have started my work on MEMS drivers. I am going to commit some enhancements of L3GD20.

I have enriched APIs, added place holder for advanced features (Still to implement) and improved STM32F3xx-SPI-L3GD20 demo (by adding a shell with specific commands) in order to make better tests on driver.

Code is not at its definitive stage but I prefer to commit since changes are significant.

Feedbacks are highly appreciated.

PS: STM32F4xx-SPI-L3GD20 demo will not compile. I will update it as soon as improvement on L3GD20 are completed.

Re: Improvements

Posted: Fri Jun 17, 2016 7:52 pm
by tfAteba
Hi RM,

Good news :) , I will take a look to your improuvment and give a feedback if I found some thing. But I don't have a board to make a real test :( .

After that, I will improve the bmp085 driver too.

Regards,

Theo

Re: Improvements

Posted: Tue Jun 21, 2016 10:01 pm
by RoccoMarco
So I have commited some changes on L3GD20.

Now configuration structures appears like this:

Code: Select all

/**
 * @brief   L3GD20 configuration structure.
 */
typedef struct {

#if L3GD20_USE_SPI || defined(__DOXYGEN__)
  /**
   * @brief SPI driver associated to this L3GD20.
   */
  SPIDriver                 *spip;
  /**
   * @brief SPI configuration associated to this L3GD20.
   */
  const SPIConfig           *spicfg;
#endif /* L3GD20_USE_SPI */
#if L3GD20_USE_I2C || defined(__DOXYGEN__)
  /**
   * @brief I2C driver associated to this L3GD20.
   */
  I2CDriver                 *i2cp;
  /**
   * @brief I2C configuration associated to this L3GD20.
   */
  const I2CConfig           *i2ccfg;
#endif /* L3GD20_USE_I2C */
  /**
   * @brief L3GD20 initial sensitivity.
   */
  float                     sensitivity[L3GD20_NUMBER_OF_AXES];
  /**
   * @brief L3GD20 initial bias.
   */
  float                     bias[L3GD20_NUMBER_OF_AXES];
  /**
   * @brief   L3GD20 initial measurement unit.
   */
  l3gd20_unit_t             unit;
  /**
   * @brief L3GD20 initial full scale value.
   */
  l3gd20_fs_t               fullscale;
  /**
   * @brief L3GD20 output data rate selection.
   */
  l3gd20_odr_t              outputdatarate;
#if L3GD20_USE_ADVANCED || defined(__DOXYGEN__)
  /**
   * @brief L3GD20 block data update.
   */
  l3gd20_bdu_t              blockdataupdate;
  /**
   * @brief L3GD20 endianness.
   */
  l3gd20_end_t              endianness;
  /**
   * @brief   L3GD20 LP1 filter bandwidth.
   */
  l3gd20_bw_t               bandwidth;
  /**
   * @brief   L3GD20 HP filter mode.
   */
  l3gd20_hpm_t              hpmode;
  /**
   * @brief   L3GD20 HP configuration.
   */
  l3gd20_hpcf_t             hpconfiguration;
  /**
   * @brief   L3GD20 LP2 filter mode.
   * @detail  To activate LP2 HP should be active
   */
  l3gd20_lp2m_t             lp2mode;
#endif
} L3GD20Config;


The basic mode support only a basilar set of fields required to use the MEMS, advanced mode (disabled by default) adds filters, endianness, low power and blockdata update settings.

Currently there aren't fields for interrupts and FIFO since I am not sure about how to abstract them (most likely they could not be abstracted). The most suitable solution seems to be adding 2 new APIs to access MEMS registers in order to setup these features from application. I am not convinced about this, so at the moment I prefer to optimize and update all device driver developed so far since release date is very close. EX is still fresh there will be room for manoeuvre in the near future.

By the way demo as been upgrade in form of a shell in order to better test driver features.

I will update other device drivers and demos in the next days.
Ciao,
RM