SPI implementation for gd32vf RISCV on mecrisp-quintus for accessing the BME280 humidity sensor

user-images.githubusercontent.com_64471355_128324729-9aef0436-ee0f-4c95-b3f0-04b9e3c55c77.jpg

I use this little breakout board. Be aware that it comes with seven pads. There are others with 5 or 6 pads. The sensor itself is the tiny silver square with a very tiny hole in the middle of the upper half of the board.
The BME280 is a sensor that measures air humidity, air pressure and temperature. It can be configured to measure in variant speeds and resolutions. The higher the speed the lower the resolution.
The example code shown in BME280.fs was made for an application drawing a carnot diagram of a stirling engine, so it had to be fast. The data was send to a PC where the time consuming calculations were made. If you use it you are able to read out the ID code of the BME280 to test the connection it should be #96 or $60. You will have the calibration data and the ability to read out raw data (pressure, temperature and humidity).
There are other sensor ICs in the world that will show the real values for temperature and pressure without extra calculations but they are somewhat more expensive.

Workflow

Datasheet of the BME280

mb