This example demonstrates how to work with I2C (Inter-Integrated Circuit) to control a real-time clock module based on the DS1307Z chip in KasperskyOS.
This example is intended to run only on Raspberry Pi.
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/i2c_ds1307_rtc
List of programs
I2cClient – application that uses the I2C driver interface.I2C – I2C driver.DCM – system program that lets you dynamically create IPC channels.When you build an example for the target hardware platform, drivers are automatically included in the solution.
BSP – Board Support Package that provides cross-platform peripheral configuration for the Raspberry Pi 4 B.Bcm2711MboxArmToVc – driver for working with the VideoCore (VC6) coprocessor via mailbox technology for Raspberry Pi 4 B.To ensure the correct operation of I2C and BSP drivers, the following conditions must be met:
I2cClient program to the client libraries named i2c::client and bsp::client.I2cClient and I2C programs and between the I2cClient and BSP programs.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 policy description files for a KasperskyOS-based solution are located in the ./einit/src directory.
The security.psl file contains description of the solution security policy. This file is a top-level file into which a portion of the solution security policy description in the form of the PSL file dynld.psl is included via the use declaration. (The declarations in the PSL file are annotated to explain the purpose of these declarations.) The dynld.psl file contains the part of the security policy that is used when dynamically linking the solution components.
Resources
The ./resources/xdl/i2c_ds1307_rtc directory contains the I2cClient.edl file, which is the EDL description for the I2cClient program.
Operating scenario
The I2cClient program performs the following actions:
EXIT_SUCCESS code if the data matches, 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.
For the example to work correctly, you must connect a DS1307Z chip-based real-time clock module to the I2C port. Diagram for connecting the DS1307Z to Raspberry Pi:
See Building and running examples section.
Page top