/*
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Multiprotocol is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Multiprotocol. If not, see .
*/
#if defined(MOULDKG_NRF24L01_INO)
#include "iface_xn297.h"
//#define FORCE_MOULDKG_ORIGINAL_ID
#define MOULDKG_PACKET_PERIOD 5000
#define MOULDKG_BIND_PACKET_PERIOD 12000
#define MOULDKG_TX_BIND_CHANNEL 11
#define MOULDKG_RX_BIND_CHANNEL 76
#define MOULDKG_PAYLOAD_SIZE 5
#define MOULDKG_BIND_PAYLOAD_SIZE 7
#define MOULDKG_BIND_COUNT 300
#define MOULDKG_RF_NUM_CHANNELS 4
enum {
MOULDKG_BINDTX=0,
MOULDKG_BINDRX,
MOULDKG_DATA,
};
static void __attribute__((unused)) MOULDKG_send_packet()
{
memcpy(&packet[1],rx_tx_addr,3);
if(IS_BIND_IN_PROGRESS)
{
packet[0] = 0xC0;
memset(&packet[4], 0x00, 3);
}
else
{
XN297_RFChannel(hopping_frequency[(packet_count>>1)&0x03]);
uint8_t val=0;
if(packet_count&1)
{
packet[0] = 0x31;
//Button B
if(Channel_data[CH2]>CHANNEL_MAX_COMMAND) val |= 0x40;
else if(Channel_data[CH2]CHANNEL_MAX_COMMAND) val |= 0x10;
else if(Channel_data[CH3]CHANNEL_MAX_COMMAND) val |= 0x01;
else if(Channel_data[CH1]CHANNEL_MAX_COMMAND) val |= 0x04;
else if(Channel_data[CH4]