|
| 1 | +/***************************************************************************//** |
| 2 | + * @file basic_example.c |
| 3 | + * @brief Implementation of the basic example for RTC. |
| 4 | + * @author Francis Roi Manabat ([email protected]) |
| 5 | +******************************************************************************** |
| 6 | + * Copyright 2023(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 "maxim_gpio.h" |
| 36 | +#include "maxim_spi.h" |
| 37 | +#include "maxim_uart.h" |
| 38 | +#include "maxim_irq.h" |
| 39 | +#include "no_os_rtc.h" |
| 40 | +#include "no_os_uart.h" |
| 41 | +#include "no_os_util.h" |
| 42 | +#include "no_os_error.h" |
| 43 | +#include "no_os_alloc.h" |
| 44 | +#include "no_os_gpio.h" |
| 45 | +#include "no_os_irq.h" |
| 46 | +#include "maxim_rtc.h" |
| 47 | + |
| 48 | +struct max_uart_init_param uart_extra_ip = { |
| 49 | + .flow = MAX_UART_FLOW_DIS |
| 50 | +}; |
| 51 | + |
| 52 | +struct no_os_uart_init_param uart_ip = { |
| 53 | + .device_id = 2, |
| 54 | + .asynchronous_rx = false, |
| 55 | + .baud_rate = 115200, |
| 56 | + .size = NO_OS_UART_CS_8, |
| 57 | + .parity = NO_OS_UART_PAR_NO, |
| 58 | + .stop = NO_OS_UART_STOP_1_BIT, |
| 59 | + .extra = &uart_extra_ip, |
| 60 | + .platform_ops = &max_uart_ops, |
| 61 | +}; |
| 62 | + |
| 63 | +struct no_os_rtc_init_param rtc_ip = { |
| 64 | + .freq = 1, |
| 65 | + .load = 0, |
| 66 | + .platform_ops = &max_rtc_ops, |
| 67 | + .extra = NULL |
| 68 | +}; |
| 69 | + |
| 70 | +struct no_os_gpio_init_param led_ip = { |
| 71 | + .port = 0, |
| 72 | + .number = 14, |
| 73 | + .pull = NO_OS_PULL_UP, |
| 74 | + .platform_ops = &max_gpio_ops, |
| 75 | + .extra = &gpio_extra_ip, |
| 76 | +}; |
| 77 | +struct no_os_gpio_init_param button_ip = { |
| 78 | + .port = 4, |
| 79 | + .number = 0, |
| 80 | + .pull = NO_OS_PULL_UP, |
| 81 | + .platform_ops = &max_gpio_ops, |
| 82 | + .extra = &gpio_extra_ip, |
| 83 | +}; |
| 84 | + |
| 85 | +struct max_gpio_init_param gpio_extra_ip = { |
| 86 | + .vssel = 1, |
| 87 | +}; |
| 88 | + |
| 89 | +struct no_os_irq_init_param rtc_irq_ip = { |
| 90 | + .irq_ctrl_id = 19, |
| 91 | + .platform_ops = &max_irq_ops, |
| 92 | + .extra = NULL, |
| 93 | +}; |
0 commit comments