Commit 280e3fa9 authored by Henrik Brix Andersen's avatar Henrik Brix Andersen Committed by Maureen Helm
Browse files

samples: drivers: dac: add support for twr_ke18f board



Add support for the NXP TWR-KE18F development board to the DAC driver
sample.

Signed-off-by: default avatarHenrik Brix Andersen <henrik@brixandersen.dk>
parent e53ae4d4
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -13,7 +13,30 @@ Building and Running

The DAC output is defined in the board's devicetree and pinmux file.

Only board nucleo_l073rz is supported for now.
Building and Running for ST Nucleo L073RZ
=========================================
The sample can be built and executed for the
:ref:`nucleo_l073rz_board` as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/dac
   :board: nucleo_l073rz
   :goals: build flash
   :compact:

Building and Running for NXP TWR-KE18F
======================================
The sample can be built and executed for the :ref:`twr_ke18f` as
follows:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/dac
   :board: twr_ke18f
   :goals: build flash
   :compact:

DAC output is available on pin A32 of the primary TWR elevator
connector.

Sample output
=============
@@ -26,7 +49,6 @@ The following output is printed:

.. code-block:: console

   DAC internal reference voltage: 3300 mV
   Generating sawtooth signal at DAC channel 1.

.. note:: If the DAC is not supported, the output will be an error message.
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ sample:
tests:
  sample.drivers.dac:
    tags: DAC
    platform_whitelist: nucleo_l073rz twr_ke18f
    depends_on: dac
    harness: console
    harness_config:
+8 −0
Original line number Diff line number Diff line
@@ -8,9 +8,17 @@
#include <sys/printk.h>
#include <drivers/dac.h>

#if defined(CONFIG_BOARD_NUCLEO_L073RZ)
#define DAC_DEVICE_NAME		DT_LABEL(DT_ALIAS(dac1))
#define DAC_CHANNEL_ID		1
#define DAC_RESOLUTION		12
#elif defined(CONFIG_BOARD_TWR_KE18F)
#define DAC_DEVICE_NAME		DT_LABEL(DT_NODELABEL(dac0))
#define DAC_CHANNEL_ID		0
#define DAC_RESOLUTION		12
#else
#error "Unsupported board."
#endif

static const struct dac_channel_cfg dac_ch_cfg = {
	.channel_id  = DAC_CHANNEL_ID,