samples/subsys/zbus/hello_world/README.html · samples/subsys/zbus/hello_world/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Zbus

Zbus Hello World

Acceleration publication을 synchronous listener와 subscriber thread가 함께 받습니다.

Official pathsamples/subsys/zbus/hello_world/README.html
Source filesamples/subsys/zbus/hello_world/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Channel/observer 목록과 acc_data 전달 순서를 설명합니다.

Threads

3

Channel

acc_data

Observers

Listener · Subscriber

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 5E3D28C7B4A426436A37C44468375F74EEA4938AE3C6B3FFD8CED74FE93557CC
.. zephyr:code-sample:: zbus-hello-world
   :name: zbus Hello World
   :relevant-api: zbus_apis

   Make three threads talk to each other using zbus.

Overview
********
This sample implements a simple hello world application using zbus to make the threads talk to each other.

Building and Running
********************

This project outputs to the console.  It can be built and executed
on QEMU as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/zbus/hello_world
   :host-os: unix
   :board: qemu_x86
   :goals: run

Sample Output
=============

.. code-block:: console

    D: Sensor sample started raw reading, version 0.1-2!
    D: Channel list:
    D: 0 - Channel acc_data:
    D:       Message size: 12
    D:       Observers:
    D:       - my_listener
    D:       - my_subscriber
    D: 1 - Channel version:
    D:       Message size: 4
    D:       Observers:
    D: Observers list:
    D: 0 - Listener my_listener
    D: 1 - Subscriber my_subscriber
    D: START processing channel acc_data change
    D: From listener -> Acc x=1, y=1, z=1
    D: FINISH processing channel acc_data change
    D: From subscriber -> Acc x=1, y=1, z=1
    D: START processing channel acc_data change
    D: From listener -> Acc x=2, y=2, z=2
    D: FINISH processing channel acc_data change
    D: From subscriber -> Acc x=2, y=2, z=2

Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.

Part 3

한국어 전문 번역

개요

Zbus를 사용해 세 thread가 서로 통신하는 간단한 Hello World application입니다.

빌드 및 실행

Console로 출력하며 다음 command로 qemu_x86에서 build하고 실행합니다.

# From the root of the zephyr repository
west build -b qemu_x86 samples/subsys/zbus/hello_world
west build -t run

샘플 출력

먼저 sensor sample version과 channel list를 출력합니다. acc_data channel의 message 크기는 12 byte이고 my_listener와 my_subscriber observer가 연결돼 있습니다. version channel의 message 크기는 4 byte입니다.

Acceleration data가 publish될 때 listener는 channel change 처리 구간 안에서 동기적으로 x·y·z 값을 읽고, subscriber thread도 같은 값을 받습니다. Example에서는 값 1과 2가 차례로 전달됩니다.

D: Sensor sample started raw reading, version 0.1-2!
D: Channel list:
D: 0 - Channel acc_data:
D:       Message size: 12
D:       Observers:
D:       - my_listener
D:       - my_subscriber
D: 1 - Channel version:
D:       Message size: 4
D:       Observers:
D: Observers list:
D: 0 - Listener my_listener
D: 1 - Subscriber my_subscriber
D: START processing channel acc_data change
D: From listener -> Acc x=1, y=1, z=1
D: FINISH processing channel acc_data change
D: From subscriber -> Acc x=1, y=1, z=1
D: START processing channel acc_data change
D: From listener -> Acc x=2, y=2, z=2
D: FINISH processing channel acc_data change
D: From subscriber -> Acc x=2, y=2, z=2

QEMU를 종료하려면 CTRL+A를 누른 뒤 x를 누릅니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.