I was a newbie some days ago to the Riot-os. I started with some of the getting started guides Riot has. I found that Riot is something where I could make progress compared to my past experience with other Rtos famous in the open-source community.
The Riot-os is indeed a lightweight operating system with all standard tools like gdb, gcc, and Posix api. I have had only one supported board the time when I started and that was the Nordic nRF52840 microcontroller-based dongle.
It is a tiny USB-like development board with connectivity like BLE 5 support. It also has major peripheral interface protocol support like the I2C, SPI, UART etc. There are two onboard leds and one button.
I thought of interfacing a BLE280 sensor to the board and sending the data over BLE protocol so that other BLE devices can read the GATT server Characteristic values.(BLE devices have services and characteristics values that can be read through other BLE devices. Both services and Characteristics have unique UUIDs.) Fortunately, there was already an implementation of the I2C library for interfacing the BME280 sensor and some examples for the Nimble BLE library. Nimble is a fully open-source BLE stack for tiny microcontroller devices with BLE support.
The first thing to do was to install the Riot correctly as explained in the following guide.
At this point, a good idea is to check whether the board can be flashed from the command. Navigate to RIOT’s root directory and type the following command. The command will build the /saul application in /examples and flash the binary to the board.
make BOARD=nrf52840dongle -C examples/saul flash PORT=/dev/ttyACM1
Once the step is done one can create a separate application in the folder with the source file with a makefile in it. The Makefile contains the information which tells the build system how to build the application.
The following is the Makefile settings required for the BLE application with sends I2C sensor data over a BLE.
The Makefile contains the information which tells the build system how to build the application.
# Set the name of your application: APPLICATION = foobar BOARD ?= nrf52840dongle USEMODULE += fmt USEMODULE +=periph_i2c USEMODULE += bme280_i2c FEATURES_PROVIDED += periph_i2c FEATURES_REQUIRED += periph_i2c FEATURES_REQUIRED += periph_uart USEMODULE += dht CFLAGS += -DBMX280_PARAM_I2C_DEV=I2C_DEV\(0\) CFLAGS += -DBMX280_PARAM_I2C_ADDR=0x76 # This has to be the absolute path to the RIOT base directory: RIOTBASE ?= $(CURDIR)/../../ # Include NimBLE USEPKG += nimble USEMODULE += nimble_svc_gap USEMODULE += nimble_svc_gatt # Use automated advertising USEMODULE += nimble_autoadv CFLAGS += -DNIMBLE_AUTOADV_DEVICE_NAME='"Antica247"' CFLAGS += -DNIMBLE_AUTOADV_START_MANUALLY=1 DEVELHELP ?= 1 # Change this to 0 to show compiler invocation lines by default: QUIET ?= 1 include $(RIOTBASE)/Makefile.include
Then create a file with main.c and paste the following code in it.