Hello everyone. I welcome you to my third (from five) blogs about VEML3328. I decided to join this competition in this category 6 hours before deadline. In previous blog I described my motivation and my breakout. Now I will briefly describe my own library for VEML3328 sensor which I did in recent 2 hours. Easier is to use library written by someone else, but I like making libraries because it push me to learn everything (or almost everything) possible. In case of VEML3328 it is easy because it is sensor with very simple interface. In datasheet I found that it has only one 16-bit configuration register, other 5 registers are used for retrieving data from sensor and last register is used for retrieving device id (which is 0x28, last digits from it’s name). The only configuration register looks as follows:
This register will be most complicated (but still easy) part of library because I need to define all bits in structures.
For writing library in hurry, I copy pasted structure from my previous library, replaced sensor name, address and rewrite logic for support VEML3328 features.
Library provides to the user following functions.
These functions cover whole functionality of the device. User can configure all parameters (using SetConfiguration), trigger single shoot conversion if he/she configures sensor to this mode and read data from sensor. Read functions are available in several variants differing in provided channels. You can reed all channels by RGBCIR variant but if you need only some channels, you can call function which will read only subset of channel. Reading subset of channels is better because it generates less transactions on I2C bus and it is faster.
Currently I ported library for STM32G0 platform. I will use it with Discovery board which I also ordered as part of Project14 reward. As far I have not tested the library yet. Now I go to test it and read first data form the sensor. I have not found way for visualizing data yet, so I go to work on it.
Thank you for reading this blog. In next blog I will show my project, some data from sensor when experimenting with it. I hope I will not face any strange bug which will prevent me completing project at time (in 3 hours), but as far everything looks seamless.
Next blog: VEML3328 Last-Minute Entry: Blog #4 Program and Experimenting