Skip to content

Example Zephyr application for micro:bit v2.

License

Notifications You must be signed in to change notification settings

lingyuan-he/zephyr-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zephyr Example Application

This repository contains an example Zephyr application that is modified from the Zephyr example application. The main purpose of this repository is to illustrate a typical structure of a Zephyr-based application that uses a custom module.

This example application runs on the micro:bit v2 board. When flashed onto the board without change, it detects changes in the direction of gravity and illuminate a column/row of LED of the 5x5 LED matrix that corresponds with the change:

  • When the board is placed flat or not directly on one of its sides (looking from the side of the LED matrix), no LED is illuminated.
  • When the board is placed perpendicularly on one of its sides (left, right, top, or bottom), the column/row closest to the down side of the board is illuminated. For example, if the board has its top side (looking from the side of the LED matrix) straight up, the bottow row of LED will illuminate.

This example demonstrates several functionalities of the Zephyr OS:

  • A basic custom libarary (accel) that can be enabled/disabled with Kconfig. The library provides support of using the 3-axis sensor.
  • A custom device tree binding and a custom ledmatrix driver that provides support of lighting up the top row, bottom row, left column, or right column LEDs, as well as to turn the LED matrix off. In combination they illustrate the connection from the device tree to the driver API, then to the driver API implementation.
  • Layered Kconfig configurations for the custom lib and driver, including config to enable/disable them.
  • Logging of modules that are individually configurable.

This application is tested with the 4.0.99 development version of Zephyr OS as of December 2024.

How to Use this Repository

First, the Zephyr main repository and Zephyr SDK should be set up. The simplest way to achieve this is to follow the Zephyr Getting Started Guide and complete the blinky example on the micro:bit V2 board.

Next, this repository should be cloned into a sub-directory within the zephyrproject folder (~/zephyrproject if you have followed the guide), such as inside ~/zephyrproject/applications. In other words, it is intended to be used as a "workspace" type of application as mentioned in the Zephyr Application Developement documentation.

Then, the default configurations should allow for a seemless compilation:

cd ~zephyrproject/applications
west build -b bbc_microbit_v2 app -p

Flash to the board with command:

west flash

Debugging on the board with command:

west debug

Helpful Links

About

Example Zephyr application for micro:bit v2.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published