Commit d697d26b authored by Piotr Mienkowski's avatar Piotr Mienkowski Committed by Carles Cufi
Browse files

samples: sensor: Add simple quadrature decoder demo



Add simple application to demonstrate quadrature decoder sensor.

Tested on Atmel SMART SAM E70 Xplained board.

Signed-off-by: default avatarPiotr Mienkowski <piotr.mienkowski@gmail.com>
parent f5163e2c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(thermometer)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
+37 −0
Original line number Diff line number Diff line
.. _qdec:

QDEC: Quadrature Decoder
###########################

Overview
********
A simple quadrature decoder example

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

This project writes the quadrature decoder position to the console once every
2 seconds.

Building on SAM E70 Xplained board
==================================

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/qdec
   :host-os: unix
   :board: sam_e70_xplained
   :goals: build
   :compact:

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

.. code-block:: console

    Quadrature Decoder sample application

    Position is 6
    Position is 12
    Position is -45

    <repeats endlessly every 2 seconds>
+1 −0
Original line number Diff line number Diff line
CONFIG_QDEC_SAM=y
+11 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2021, Piotr Mienkowski
 *
 * SPDX-License-Identifier: Apache-2.0
 */

&tc0 {
	status = "okay";
	pinctrl-0 = <&pa0b_tc0_tioa0 &pa1b_tc0_tiob0>;
	label = "QDEC_0";
};
+2 −0
Original line number Diff line number Diff line
CONFIG_SENSOR=y
CONFIG_STDOUT_CONSOLE=y
Loading