Create release.yml
[betaflight.git] / src / main / pg / rx_spi.c
blob0f18b8ae48c79776801299ba9cd922ca457e62d0
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #include "platform.h"
23 #ifdef USE_RX_SPI
25 #include "drivers/io.h"
26 #include "drivers/bus_spi.h"
28 #include "pg/pg.h"
29 #include "pg/pg_ids.h"
30 #include "pg/rx_spi.h"
32 #include "rx/rx_spi.h"
34 PG_REGISTER_WITH_RESET_FN(rxSpiConfig_t, rxSpiConfig, PG_RX_SPI_CONFIG, 0);
36 void pgResetFn_rxSpiConfig(rxSpiConfig_t *rxSpiConfig)
38 rxSpiConfig->rx_spi_protocol = RX_SPI_DEFAULT_PROTOCOL;
40 // Basic SPI
41 rxSpiConfig->csnTag = IO_TAG(RX_NSS_PIN);
42 rxSpiConfig->spibus = SPI_DEV_TO_CFG(spiDeviceByInstance(RX_SPI_INSTANCE));
44 rxSpiConfig->extiIoTag = IO_TAG(RX_SPI_EXTI_PIN);
46 rxSpiConfig->bindIoTag = IO_TAG(RX_SPI_BIND_PIN);
47 rxSpiConfig->ledIoTag = IO_TAG(RX_SPI_LED_PIN);
48 #ifdef RX_SPI_LED_INVERTED
49 rxSpiConfig->ledInversion = true;
50 #else
51 rxSpiConfig->ledInversion = false;
52 #endif
54 #endif