mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-03-15 12:59:09 +00:00
XN297Emu add ReSendPayload
This commit is contained in:
parent
ed63ef7efe
commit
2918e63fb4
@ -169,7 +169,7 @@ uint16_t SGF22_callback()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//send 3 times in total the same packet
|
{//send 3 times in total the same packet
|
||||||
NRF24L01_Strobe(REUSE_TX_PL);
|
XN297_ReSendPayload();
|
||||||
phase++;
|
phase++;
|
||||||
if(phase > 2)
|
if(phase > 2)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,8 @@ Multiprotocol is distributed in the hope that it will be useful,
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
//Models: UDIRC UD160x(PRO), Pinecone Models SG-160x, Eachine EAT15
|
||||||
|
|
||||||
#if defined(UDIRC_CCNRF_INO)
|
#if defined(UDIRC_CCNRF_INO)
|
||||||
|
|
||||||
#include "iface_xn297.h"
|
#include "iface_xn297.h"
|
||||||
@ -60,8 +62,8 @@ static void __attribute__((unused)) UDIRC_send_packet()
|
|||||||
if(!bind_counter)
|
if(!bind_counter)
|
||||||
{//Normal
|
{//Normal
|
||||||
packet[0] = 0x08;
|
packet[0] = 0x08;
|
||||||
//Channels ST/TH/CH4 /CH3 /UNK/UNK/UNK/UNK/GYRO/ST_TRIM/ST_DR
|
//Channels SG-16xx: ST/TH/CH4 /CH3 /UNK/UNK/UNK/UNK/GYRO/ST_TRIM/ST_DR
|
||||||
//Channels ST/TH/RATE/LIGHT/UNK/UNK/UNK/UNK/GYRO/ST_TRIM/ST_DR
|
//Channels EAT15 : ST/TH/RATE/LIGHT/UNK/UNK/UNK/UNK/GYRO/ST_TRIM/ST_DR
|
||||||
for(uint8_t i=0; i<9; i++)
|
for(uint8_t i=0; i<9; i++)
|
||||||
packet[i+1] = convert_channel_16b_limit(i,0,200);
|
packet[i+1] = convert_channel_16b_limit(i,0,200);
|
||||||
//Just for now let's set the additional channels to 0
|
//Just for now let's set the additional channels to 0
|
||||||
@ -152,7 +154,7 @@ uint16_t UDIRC_callback()
|
|||||||
return UDIRC_P1_P2_TIME;
|
return UDIRC_P1_P2_TIME;
|
||||||
case UDIRC_DATA2:
|
case UDIRC_DATA2:
|
||||||
//Resend packet
|
//Resend packet
|
||||||
NRF24L01_Strobe(NRF24L01_E3_REUSE_TX_PL);
|
XN297_ReSendPayload();
|
||||||
phase++;
|
phase++;
|
||||||
return UDIRC_WRITE_TIME;
|
return UDIRC_WRITE_TIME;
|
||||||
default: //UDIRC_RX
|
default: //UDIRC_RX
|
||||||
|
@ -207,6 +207,27 @@ static void __attribute__((unused)) XN297_SetTxRxMode(enum TXRX_State mode)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CC2500_INSTALLED
|
||||||
|
uint8_t XN297_Buffer[32];
|
||||||
|
uint8_t XN297_Buffer_Len = 0;
|
||||||
|
|
||||||
|
static void __attribute__((unused)) XN297_SendCC2500Payload()
|
||||||
|
{
|
||||||
|
// stop TX/RX
|
||||||
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
// flush tx FIFO
|
||||||
|
CC2500_Strobe(CC2500_SFTX);
|
||||||
|
// packet length
|
||||||
|
CC2500_WriteReg(CC2500_06_PKTLEN, XN297_Buffer_Len + 4); // Packet len, fix packet len
|
||||||
|
// xn297L preamble
|
||||||
|
CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, (uint8_t*)"\x0C\x71\x0F\x55", 4);
|
||||||
|
// xn297 packet
|
||||||
|
CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, XN297_Buffer, XN297_Buffer_Len);
|
||||||
|
// transmit
|
||||||
|
CC2500_Strobe(CC2500_STX);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void __attribute__((unused)) XN297_SendPayload(uint8_t* msg, uint8_t len)
|
static void __attribute__((unused)) XN297_SendPayload(uint8_t* msg, uint8_t len)
|
||||||
{
|
{
|
||||||
#ifdef NRF24L01_INSTALLED
|
#ifdef NRF24L01_INSTALLED
|
||||||
@ -220,22 +241,25 @@ static void __attribute__((unused)) XN297_SendPayload(uint8_t* msg, uint8_t len)
|
|||||||
#ifdef CC2500_INSTALLED
|
#ifdef CC2500_INSTALLED
|
||||||
if(xn297_rf == XN297_CC2500)
|
if(xn297_rf == XN297_CC2500)
|
||||||
{
|
{
|
||||||
// stop TX/RX
|
memcpy(XN297_Buffer, msg, len);
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
XN297_Buffer_Len = len;
|
||||||
// flush tx FIFO
|
XN297_SendCC2500Payload();
|
||||||
CC2500_Strobe(CC2500_SFTX);
|
|
||||||
// packet length
|
|
||||||
CC2500_WriteReg(CC2500_06_PKTLEN, len + 4); // Packet len, fix packet len
|
|
||||||
// xn297L preamble
|
|
||||||
CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, (uint8_t*)"\x0C\x71\x0F\x55", 4);
|
|
||||||
// xn297 packet
|
|
||||||
CC2500_WriteRegisterMulti(CC2500_3F_TXFIFO, msg, len);
|
|
||||||
// transmit
|
|
||||||
CC2500_Strobe(CC2500_STX);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) XN297_ReSendPayload()
|
||||||
|
{
|
||||||
|
#ifdef NRF24L01_INSTALLED
|
||||||
|
if(xn297_rf == XN297_NRF)
|
||||||
|
NRF24L01_Strobe(NRF24L01_E3_REUSE_TX_PL);
|
||||||
|
#endif
|
||||||
|
#ifdef CC2500_INSTALLED
|
||||||
|
if(xn297_rf == XN297_CC2500)
|
||||||
|
XN297_SendCC2500Payload();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) XN297_WritePayload(uint8_t* msg, uint8_t len)
|
static void __attribute__((unused)) XN297_WritePayload(uint8_t* msg, uint8_t len)
|
||||||
{
|
{
|
||||||
uint8_t buf[32];
|
uint8_t buf[32];
|
||||||
|
@ -28,6 +28,7 @@ static void __attribute__((unused)) XN297_SetTXAddr(const uint8_t*, uint8_t);
|
|||||||
static void __attribute__((unused)) XN297_SetRXAddr(const uint8_t*, uint8_t);
|
static void __attribute__((unused)) XN297_SetRXAddr(const uint8_t*, uint8_t);
|
||||||
static void __attribute__((unused)) XN297_SetTxRxMode(enum TXRX_State);
|
static void __attribute__((unused)) XN297_SetTxRxMode(enum TXRX_State);
|
||||||
static void __attribute__((unused)) XN297_SendPayload(uint8_t*, uint8_t);
|
static void __attribute__((unused)) XN297_SendPayload(uint8_t*, uint8_t);
|
||||||
|
static void __attribute__((unused)) XN297_ReSendPayload();
|
||||||
static void __attribute__((unused)) XN297_WritePayload(uint8_t*, uint8_t);
|
static void __attribute__((unused)) XN297_WritePayload(uint8_t*, uint8_t);
|
||||||
static void __attribute__((unused)) XN297_WriteEnhancedPayload(uint8_t*, uint8_t, uint8_t);
|
static void __attribute__((unused)) XN297_WriteEnhancedPayload(uint8_t*, uint8_t, uint8_t);
|
||||||
static bool __attribute__((unused)) XN297_IsRX();
|
static bool __attribute__((unused)) XN297_IsRX();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user