1 /** 2 * @file drivers/stepper/adi/stepper.h 3 * 4 * @brief Private API for Trinamic SPI bus 5 * 6 */ 7 8 /* 9 * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG 10 * SPDX-License-Identifier: Apache-2.0 11 */ 12 13 #ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_SPI_H_ 14 #define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_SPI_H_ 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 /** 21 * @brief TMC SPI INTERFACE 22 * @ingroup io_priv_interfaces 23 * @{ 24 * 25 */ 26 27 #include <zephyr/drivers/spi.h> 28 29 /** 30 * @brief Read a register from the TMC module using the SPI Bus. 31 * 32 * @param bus SPI DT information of the bus. 33 * @param read_address_mask Address Mask for read operation. 34 * @param register_address Register. 35 * @param data Pointer to read value. 36 * 37 * @return a value from spi_transceive(). 38 */ 39 int tmc_spi_read_register(const struct spi_dt_spec *bus, const uint8_t read_address_mask, 40 const uint8_t register_address, uint32_t *data); 41 42 /** 43 * @brief Write into a register in the TMC module using the SPI Bus. 44 * 45 * @param bus SPI DT information of the bus. 46 * @param write_bit Write bit for write operation. 47 * @param register_address Register. 48 * @param data Value to be written in the register. 49 * 50 * @return a value from spi_transceive(). 51 */ 52 int tmc_spi_write_register(const struct spi_dt_spec *bus, const uint8_t write_bit, 53 const uint8_t register_address, const uint32_t data); 54 55 /** 56 * @} 57 */ 58 59 #ifdef __cplusplus 60 } 61 #endif 62 63 #endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_SPI_H_ */ 64