| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef __MYRADIO_GPIO_H_
- #define __MYRADIO_GPIO_H_
- #include <stdint.h>
- #include "stm32f10x.h"
- #include "stm32f10x_gpio.h"
- #include "stm32f10x_spi.h"
- #include "board.h"
- #ifndef SPI_SOFT_3LINE
- #define SPI_HARD
- #endif
- // #define SPI_SOFT_3LINE
- typedef void (*RADIO_GPIO_CALLBACK)(uint8_t index);
- //-------------射频模块引脚映射到转接板排针---------------
- #define BOARD_PIN_SPI_CLK GPIO_Pin_5 //SPI1_SCK(8)
- #define BOARD_PORT_SPI_CLK GPIOA //DAC_OUT2 ADC12_IN5
- #define BOARD_GPIO_SPI_CLK BOARD_PORT_SPI_CLK, BOARD_PIN_SPI_CLK //
- #define BOARD_PIN_SPI_MISO GPIO_Pin_6 //SPI1_MISO(8)
- #define BOARD_PORT_SPI_MISO GPIOA // TIM8_BKIN/ADC12_IN6
- // TIM3_CH1(8)
- #define BOARD_GPIO_SPI_MISO BOARD_PORT_SPI_MISO, BOARD_PIN_SPI_MISO //
- #define BOARD_PIN_SPI_MOSI GPIO_Pin_7 //SPI1_MOSI(8)/
- #define BOARD_PORT_SPI_MOSI GPIOA // TIM8_CH1N/ADC12_IN7
- // TIM3_CH2(8)
- #define BOARD_GPIO_SPI_MOSI BOARD_PORT_SPI_MOSI, BOARD_PIN_SPI_MOSI //
- #define BOARD_PIN_SPI_CSN GPIO_Pin_4 //SPI1_NSS(8)/
- #define BOARD_PORT_SPI_CSN GPIOA // USART2_CK(8)
- // DAC_OUT1/ADC12_IN4
- #define BOARD_GPIO_SPI_CSN BOARD_PORT_SPI_CSN, BOARD_PIN_SPI_CSN //
- // -> 3 -> E 用于接收灵敏度测试data out输出映射 TIM2_CH3
- #define RF_PAN312x_IO0_PIN GPIO_Pin_10 //
- #define RF_PAN312x_IO0_PORT GPIOB
- #define RF_PAN312x_IO0 RF_PAN312x_IO0_PORT, RF_PAN312x_IO0_PIN //
- // -> 4 -> F
- #define RF_PAN312x_IO1_PIN GPIO_Pin_11 //
- #define RF_PAN312x_IO1_PORT GPIOB
- #define RF_PAN312x_IO1 RF_PAN312x_IO1_PORT, RF_PAN312x_IO1_PIN //
- // -> 5 -> G
- #define RF_PAN312x_IO2_PIN GPIO_Pin_12 //
- #define RF_PAN312x_IO2_PORT GPIOB
- #define RF_PAN312x_IO2 RF_PAN312x_IO2_PORT, RF_PAN312x_IO2_PIN //
- // RST和GPIO3复用 -> A
- #define RF_PAN312x_RST_PIN GPIO_Pin_5 //
- #define RF_PAN312x_RST_PORT GPIOC
- #define RF_PAN312x_RST RF_PAN312x_RST_PORT, RF_PAN312x_RST_PIN //
- // IRQ和GPIO8复用 -> 0 -> B
- #define RF_PAN312x_IRQ_PIN GPIO_Pin_0 //
- #define RF_PAN312x_IRQ_PORT GPIOB
- #define RF_PAN312x_IRQ RF_PAN312x_IRQ_PORT, RF_PAN312x_IRQ_PIN //
- // -> 1 -> C
- #define RF_PAN312x_IO9_PIN GPIO_Pin_1 //
- #define RF_PAN312x_IO9_PORT GPIOB
- #define RF_PAN312x_IO9 RF_PAN312x_IO9_PORT, RF_PAN312x_IO9_PIN //
- // -> 2 -> D
- #define RF_PAN312x_IO10_PIN GPIO_Pin_2 //
- #define RF_PAN312x_IO10_PORT GPIOA
- #define RF_PAN312x_IO10 RF_PAN312x_IO10_PORT, RF_PAN312x_IO10_PIN //
- //-------------射频模块引脚映射到转接板排针---------------END
- uint8_t READ_RF_PAN312x_IRQ(void);
- void RF_PAN312x_IRQ_H(void);
- void RF_PAN312x_IRQ_L(void);
- void BOARD_SPI_NSS_H(void);
- void BOARD_SPI_NSS_L(void);
- //-------------将封装的API映射到射频模块硬件层---------------
- void myRadio_gpio_init(RADIO_GPIO_CALLBACK cb);
- uint8_t myRadioSpi_rwByte(uint8_t byteToWrite);
- void myRadioSpi_wBuffer(uint8_t* pData, uint8_t len);
- void myRadioSpi_rBuffer(uint8_t* pData, uint8_t len);
- #define SpiReadWrite(p) myRadioSpi_rwByte(p)
- #define SpiWriteData(p1, p2) myRadioSpi_wBuffer(p2, p1)
- #define SpiReadData(p1, p2) myRadioSpi_rBuffer(p2, p1)
- //-------------将封装的API映射到射频模块硬件层---------------END
- #endif
|