/* 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(KYOSHO3_CYRF6936_INO) #include "iface_cyrf6936.h" //#define KYOSHO3_FORCE_ID //#define KYOSHO3_DEBUG #define KYOSHO3_BIND_PACKET_SIZE 4 #define KYOSHO3_PACKET_SIZE 9 const uint8_t PROGMEM KYOSHO3_init_vals[][2] = { //Init from dump {CYRF_0B_PWR_CTRL, 0x00}, // PMU {CYRF_32_AUTO_CAL_TIME, 0x3C}, // Default init value {CYRF_35_AUTOCAL_OFFSET, 0x14}, // Default init value {CYRF_03_TX_CFG, 0x28 | CYRF_BIND_POWER}, // 8DR Mode, 64 chip codes {CYRF_10_FRAMING_CFG, 0xA4}, // SOP and LEN enable {CYRF_1F_TX_OVERRIDE, 0x05}, // Disable CRC, Data invert {CYRF_1E_RX_OVERRIDE, 0x04}, // CRC check disabled //{CYRF_11_DATA32_THOLD, 0x04}, // ???Using 64 chip... {CYRF_12_DATA64_THOLD, 0x0E}, // Default {CYRF_06_RX_CFG, 0x52}, // AGC disabled, LNA enabled, override enabled }; static uint16_t __attribute__((unused)) KYOSHO3_send_packet() { CYRF_SetPower(0x28); if(IS_BIND_IN_PROGRESS) { if(--bind_counter==0) BIND_DONE; packet[0] = 0xAA; //ID memcpy(&packet[1],&rx_tx_addr[1],3); CYRF_WriteDataPacketLen(packet, KYOSHO3_BIND_PACKET_SIZE); #ifdef KYOSHO3_DEBUG debug("P:"); for(uint8_t i=0;i>= 2; packet[3] |= Channel_data[i]<<6; packet[4+i] = Channel_data[i]>>3; } //Checksum packet[8] = packet[3]; for(uint8_t i=4;i<8;i++) packet[8] += packet[i]; //Timing phase ^= 0x01; CYRF_WriteDataPacketLen(packet, KYOSHO3_PACKET_SIZE); #ifdef KYOSHO3_DEBUG debug("P:"); for(uint8_t i=0;i