LCOV - code coverage report
Current view: top level - zephyr/drivers/dac - dac161s997.h Coverage Total Hit
Test: new.info Lines: 66.7 % 12 8
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2025 Prevas A/S
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #ifndef ZEPHYR_INCLUDE_DRIVERS_DAC_DAC161S997_H_
       8              : #define ZEPHYR_INCLUDE_DRIVERS_DAC_DAC161S997_H_
       9              : 
      10              : #include <stdint.h>
      11              : #include <zephyr/device.h>
      12              : 
      13              : #ifdef __cplusplus
      14              : extern "C" {
      15              : #endif
      16              : 
      17            0 : union dac161s997_status {
      18            0 :         uint8_t raw;
      19              :         struct {
      20              :                 /**
      21              :                  * True if the DAC161S997 is unable to maintain the output current.
      22              :                  */
      23            1 :                 bool current_loop_status: 1;
      24              :                 /**
      25              :                  * Identical to current_loop_status except this bit is sticky.
      26              :                  */
      27            1 :                 bool loop_status: 1;
      28              :                 /**
      29              :                  * True if a SPI command has not been received within SPI timeout period (default
      30              :                  * 100 ms). If this error occurs, it is cleared with a properly formatted write
      31              :                  * command to a valid address.
      32              :                  */
      33            1 :                 bool spi_timeout_error: 1;
      34              :                 /**
      35              :                  * A frame error is caused by an incorrect number of clocks during a register write.
      36              :                  * A register write without an integer multiple of 24 clock cycles will cause a
      37              :                  * Frame error.
      38              :                  */
      39            1 :                 bool frame_status: 1;
      40              :                 /**
      41              :                  * Returns the state of the ERR_LVL pin.
      42              :                  */
      43            1 :                 bool error_level_pin_state: 1;
      44              :                 /**
      45              :                  * DAC resolution register. Always returns 0x7.
      46              :                  */
      47            1 :                 uint8_t dac_resolution: 3;
      48            0 :         } __packed;
      49              : };
      50              : 
      51              : /**
      52              :  * @typedef dac161s997_error_callback_t
      53              :  * @brief Callback to invoke when an error is triggered
      54              :  *
      55              :  * @param dev Pointer to the device
      56              :  * @param status NULL if read was not possible otherwise pointer to status.
      57              :  */
      58            1 : typedef void (*dac161s997_error_callback_t)(const struct device *dev,
      59              :                                             const union dac161s997_status *status);
      60              : 
      61              : /**
      62              :  * @brief Set callback to invoke when an error is triggered
      63              :  *
      64              :  * The callback runs in a work queue context and the device is locked while it runs.
      65              :  *
      66              :  * @param dev Pointer to the device
      67              :  * @param cb Callback to invoke when an error is triggered
      68              :  *
      69              :  * @returns 0 on success and -errno otherwise.
      70              :  */
      71            1 : int dac161s997_set_error_callback(const struct device *dev, dac161s997_error_callback_t cb);
      72              : 
      73              : #ifdef __cplusplus
      74              : }
      75              : #endif
      76              : 
      77              : #endif /* ZEPHYR_INCLUDE_DRIVERS_DAC_DAC161S997_H_ */
        

Generated by: LCOV version 2.0-1