|
| 1 | +/* |
| 2 | + * Copyright (c) 2023, ComLab, Jozef Stefan Institute - https://e6.ijs.si/ |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * Redistribution and use in source and binary forms, with or without |
| 6 | + * modification, are permitted provided that the following conditions |
| 7 | + * are met: |
| 8 | + * 1. Redistributions of source code must retain the above copyright |
| 9 | + * notice, this list of conditions and the following disclaimer. |
| 10 | + * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | + * notice, this list of conditions and the following disclaimer in the |
| 12 | + * documentation and/or other materials provided with the distribution. |
| 13 | + * 3. Neither the name of the copyright holder nor the names of its |
| 14 | + * contributors may be used to endorse or promote products derived |
| 15 | + * from this software without specific prior written permission. |
| 16 | + * |
| 17 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 20 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 21 | + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 25 | + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 26 | + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 28 | + * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | + */ |
| 30 | +/*---------------------------------------------------------------------------*/ |
| 31 | +/** |
| 32 | + * \file |
| 33 | + * Header file for the at86rf215-arch.c - architecture dependent code. |
| 34 | + * \author |
| 35 | + * Grega Morano <grega.morano@ijs.si> |
| 36 | + */ |
| 37 | +/*---------------------------------------------------------------------------*/ |
| 38 | +#ifndef AT86RF215_ARCH_H_ |
| 39 | +#define AT86RF215_ARCH_H_ |
| 40 | + |
| 41 | +#include <stdint.h> |
| 42 | + |
| 43 | +/** |
| 44 | + * \brief Initialize the radio's I/O periphery |
| 45 | + * |
| 46 | + * The function has to accomplish the following tasks: |
| 47 | + * - Configure RST pin |
| 48 | + * - Configure IRQ pin and setup the interrupt |
| 49 | + * - Configure CSn pin |
| 50 | + * - Enable and configure SPI |
| 51 | + */ |
| 52 | +void at86rf215_arch_init(void); |
| 53 | + |
| 54 | +/** |
| 55 | + * \brief Reset the radio |
| 56 | + * |
| 57 | + * The radio Reset is triggered by pulling the pin RSTN to low, keeping it |
| 58 | + * low for 625ns and than release it to high. |
| 59 | + */ |
| 60 | +void at86rf215_arch_set_RSTN(void); |
| 61 | + |
| 62 | +/** |
| 63 | + * \brief Release the radio from the reset mode |
| 64 | + */ |
| 65 | +void at86rf215_arch_clear_RSTN(void); |
| 66 | + |
| 67 | +/** |
| 68 | + * \brief Enable the radio's IRQ line |
| 69 | + */ |
| 70 | +void at86rf215_arch_enable_EXTI(void); |
| 71 | + |
| 72 | +/** |
| 73 | + * \brief Disable the radio's IRQ line |
| 74 | + */ |
| 75 | +void at86rf215_arch_disable_EXTI(void); |
| 76 | + |
| 77 | +/** |
| 78 | + * \brief Select the radio's SPI chip select |
| 79 | + */ |
| 80 | +void at86rf215_arch_spi_select(void); |
| 81 | + |
| 82 | +/** |
| 83 | + * \brief Deselect the radio's SPI chip select |
| 84 | + */ |
| 85 | +void at86rf215_arch_spi_deselect(void); |
| 86 | + |
| 87 | +/** |
| 88 | + * \brief Transfer and receive a single byte over SPI |
| 89 | + * \param b Byte to be sent |
| 90 | + * \return Byte received |
| 91 | + */ |
| 92 | +uint8_t at86rf215_arch_spi_txrx(uint8_t b); |
| 93 | + |
| 94 | +/** |
| 95 | + * \brief Interrupt routine |
| 96 | + * |
| 97 | + * To be called by the hardware interrupt handler - part of at86rf215-arch.c |
| 98 | + */ |
| 99 | +void at86rf215_isr(void); |
| 100 | + |
| 101 | +#endif /* AT86RF215_ARCH_H */ |
0 commit comments