One of the aspects that sets BeRTOS apart from a bare metal approach to developing small embedded systems is the hardware abtraction layer, HAL, and the available drivers. In addition to providing a real-time kernel, BeRTOS comes with a set of drivers for common functions.
Examples of such functions are file systems, motor control, various buses such as I2C, SPI and USB, etc. The complete list can be found at the official site.
One example of a driver API are the ones for ADC readings. This API provides a standardized interface to the available ADC channels of most supported architectures. The methods provided are adc_init and adc_read. The first initializes the ADC sub-system, the latter makes a reading.
To make the code portable, the type for returning readings, as well as specifying ADC channels are typedefed. A convenient macro for linear conversion from a raw sensor reading to the wanted value range is also provided.
A more complex driver, providing a convenient API is the I2C driver. It provides both hardware supported I2C and a bit banged version through the same API. During the initialization, the type of backend to use is defined. Then it is just a matter of calling i2c_read and i2c_write to speak over the bus.
The PWM driver offers many configuration options. A PWM channel can be polarized, as well as have its duty cycle and frequency set. It can also be enabled or disabled, to turn the signal fully on or off. Again, the API provided works across many of the supported platforms, making the knowledge gained from one platform useful on the next.
By providing drivers for many common areas, BeRTOS makes it easier to interface common elements. For instance, the stepper driver API implements features such as RAMP, which can be complex to implement by yourself. The only area where the drivers are lacking is in the documentation department. Instead of providing clear examples and fuller module introductions and method descriptions, one is forced to study examples, header files, and at times, even source code.