Appiko
spi_rf_nrf52.h
1 /*
2  * spi_rf_nrf52.h : <Write brief>
3  * Copyright (C) 2019 Appiko
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
19 
20 #include "hal_spim.h"
21 
22 #ifndef SPI_RF_NRF52_H
23 #define SPI_RF_NRF52_H
24 
25 #define USE_CC112X /* use the CC112x transciever commands */
26 #define RF_XTAL 32000 /* default is 26000 for CC1101 */
27 
28 
29 #define RF_MISO_PIN 3
30 #define RF_MOSI_PIN 4
31 #define RF_SCK_PIN 22
32 #define RF_CS_PIN 23
33 #define RF_RESET_PIN 24
34 
35 #define LED1
36 #define LED2
37 #define LED3
38 #define LED4
39 
40 #define RADIO_BURST_ACCESS 0x40
41 #define RADIO_SINGLE_ACCESS 0x00
42 #define RADIO_READ_ACCESS 0x80
43 #define RADIO_WRITE_ACCESS 0x00
44 
45 #define RF_SPI_BEGIN()
46 #define RF_SPI_TX(x)
47 #define RF_SPI_WAIT_DONE()
48 #define RF_SPI_WAIT_TX_DONE()
49 #define RF_SPI_RX()
50 #define RF_SPI_WAIT_MISO_LOW(x)
51 #define RF_SPI_END()
52 
53 
54 typedef struct
55 {
56  uint16_t addr;
57  uint8_t data;
58 }registerSetting_t;
59 
60 typedef uint8_t rfStatus_t;
61 
62 void trxRfSpiInterfaceInit(void);
63 rfStatus_t trx8BitRegAccess(uint8_t accessType, uint8_t addrByte, uint8_t *pData, uint16_t len);
64 rfStatus_t trxSpiCmdStrobe(uint8_t cmd);
65 
66 /* CC112X specific prototype function */
67 rfStatus_t trx16BitRegAccess(uint8_t accessType, uint8_t extAddr, uint8_t regAddr, uint8_t *pData, uint8_t len);
68 
69 
70 #endif /* SPI_RF_NRF52_H */
71