|
| 1 | +/******************************************************************************* |
| 2 | + * @file common_data.c |
| 3 | + * @brief Defines common data to be used by ltc2378 examples. |
| 4 | + * @author Cherrence Sarip (cherrence.sarip@analog.com) |
| 5 | + ******************************************************************************** |
| 6 | + * Copyright 2025(c) Analog Devices, Inc. |
| 7 | + * |
| 8 | + * Redistribution and use in source and binary forms, with or without |
| 9 | + * modification, are permitted provided that the following conditions are met: |
| 10 | + * |
| 11 | + * 1. Redistributions of source code must retain the above copyright notice, |
| 12 | + * this list of conditions and the following disclaimer. |
| 13 | + * |
| 14 | + * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 15 | + * this list of conditions and the following disclaimer in the documentation |
| 16 | + * and/or other materials provided with the distribution. |
| 17 | + * |
| 18 | + * 3. Neither the name of Analog Devices, Inc. nor the names of its |
| 19 | + * contributors may be used to endorse or promote products derived from this |
| 20 | + * software without specific prior written permission. |
| 21 | + * |
| 22 | + * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR |
| 23 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 24 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 25 | + * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 26 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 27 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
| 28 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 29 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 30 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 31 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | + *******************************************************************************/ |
| 33 | + |
| 34 | +#include "common_data.h" |
| 35 | +#include <stdbool.h> |
| 36 | + |
| 37 | +struct no_os_uart_init_param uip = { |
| 38 | + .device_id = UART_DEVICE_ID, |
| 39 | + .irq_id = UART_IRQ_ID, |
| 40 | + .asynchronous_rx = true, |
| 41 | + .baud_rate = UART_BAUDRATE, |
| 42 | + .size = NO_OS_UART_CS_8, |
| 43 | + .parity = NO_OS_UART_PAR_NO, |
| 44 | + .stop = NO_OS_UART_STOP_1_BIT, |
| 45 | + .platform_ops = UART_OPS, |
| 46 | + .extra = UART_EXTRA, |
| 47 | +}; |
| 48 | + |
| 49 | +const struct no_os_spi_init_param ltc2378_spi_ip = { |
| 50 | + .device_id = SPI_DEVICE_ID, |
| 51 | + .max_speed_hz = SPI_MAX_SPEED, |
| 52 | + .chip_select = SPI_CS, |
| 53 | + .mode = NO_OS_SPI_MODE_0, |
| 54 | + .bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST, |
| 55 | + .platform_ops = SPI_OPS, |
| 56 | + .extra = SPI_EXTRA, |
| 57 | + .parent = NULL, |
| 58 | +}; |
| 59 | + |
| 60 | +const struct no_os_gpio_init_param ltc2378_gpio_cnv = { |
| 61 | + .port = GPIO_CNV_PORT_NUM, |
| 62 | + .number = GPIO_CNV_PIN_NUM, |
| 63 | + .platform_ops = GPIO_OPS, |
| 64 | + .extra = GPIO_EXTRA |
| 65 | +}; |
| 66 | + |
| 67 | +const struct no_os_gpio_init_param ltc2378_gpio_busy = { |
| 68 | + .port = GPIO_BUSY_PORT_NUM, |
| 69 | + .number = GPIO_BUSY_PIN_NUM, |
| 70 | + .platform_ops = GPIO_OPS, |
| 71 | + .extra = GPIO_EXTRA |
| 72 | +}; |
| 73 | + |
| 74 | +struct ltc2378_init_param ltc2378_ip = { |
| 75 | + .spi_init = <c2378_spi_ip, |
| 76 | + .gpio_cnv_init = <c2378_gpio_cnv, |
| 77 | + .gpio_busy_init = <c2378_gpio_busy, |
| 78 | + .vref_uv = 2500000, |
| 79 | + .input_mode = LTC2378_UNIPOLAR |
| 80 | +}; |
0 commit comments