The example demonstrates the use of a pulse-width modulation (PWM) driver to control the LED in a KasperskyOS-based solution.
Example directory in the SDK
The code of the example and build scripts are available at the following path:
/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/pwm_led
List of programs
PwmLed – application that uses the PWM driver interface to control the brightness of an LED.PWM – driver that provides low-level access to the hardware registers of the PWM controller and controls the output signal parameters (frequency, duty cycle, polarity).DCM – system program that provides functionality for dynamically creating IPC channels.When building an example for a target hardware platform, a platform-specific BSP driver is automatically included in the solution. BSP is a Board Support Package that provides cross-platform configuration of peripherals.
For the PWM driver to work correctly, you need to link the PwmLed program to the client library named pwm::client.
Initialization description
The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in template. Macros in @INIT_*@ format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.
Security policy description
The security.psl file contains a description of a security policy for a KasperskyOS-based solution and is located in the ./einit/src directory. The declarations in the PSL file are provided with comments that explain the purpose of these declarations.
Resources
The ./resources/xdl/pwm_led directory contains the PwmLed.edl file, which is the EDL description for the PwmLed program.
Operating scenario
The PwmLed program performs the following actions:
pwm0 PWM channel for operation.EXIT_SUCCESS code if there are no errors, otherwise it shows the EXIT_FAILURE code.Building and running the example
The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.
This example is intended to run only on Radxa ROCK 3A.
For the example to work correctly, apply the DTBO overlay rk3568-pwm0-m0.dtbo to the hardware configuration description binary file rk3568-rock-3a.dtb according to the instructions on applying overlays provided in the section titled Building drivers for the Radxa ROCK 3A hardware platform.
See Building and running examples section.
Page top