Basic I2C Example

Communicate with a peripheral using the I2C API.

API Features Demonstrated

Platforms

This app works on:

Requirements and Prerequisites

This app requires a ZentriOS device, such as an AMW106 Moray evaluation board, connected to an ST LIS3DH three axes linear accelerometer, such as supplied with the ASG001 Zentri Backpack.

Description

The app uses the I2C API to read from and write to the registers of the accelerometer sensor.

Usage Instructions

This app requires no interaction.

On building, downloading and running, it displays:

> I2C Example starting...
Reading 'Who Am I' register
   Response valid: 0x33
Writing CTRL_REG 1-4 (0x20 - 0x23)
Reading CTRL_REG 1-4 (0x20 - 0x23)
Verifying registers
   Success, read back data valid

After displaying the above results the app exits and the device reboots.

Implementation

zn_app_init

Source

See: