Exemplo n.º 1
0
// Set one of the canned FSK Modem configs
// Returns true if its a valid choice
bool RF22::setModemConfig(ModemConfigChoice index) {
	if (index > (sizeof(MODEM_CONFIG_TABLE) / sizeof(ModemConfig)))
		return false;

	RF22::ModemConfig cfg = MODEM_CONFIG_TABLE[index];

	setModemRegisters(&cfg);

	return true;
}
Exemplo n.º 2
0
// Set one of the canned Modem configs
// Returns true if its a valid choice
bool RH_RF24::setModemConfig(ModemConfigChoice index)
{
    if (index > (signed int)(sizeof(MODEM_CONFIG_TABLE) / sizeof(ModemConfig)))
        return false;

    ModemConfig cfg;
    memcpy_P(&cfg, &MODEM_CONFIG_TABLE[index], sizeof(RH_RF24::ModemConfig));
    setModemRegisters(&cfg);

    return true;
}
Exemplo n.º 3
0
// Set one of the canned FSK Modem configs
// Returns true if its a valid choice
uint8_t RF22::setModemConfig(ModemConfigChoice index)
{
    if (index > (sizeof(MODEM_CONFIG_TABLE) / sizeof(ModemConfig)))
        return false;

    RF22::ModemConfig cfg;
    // memcpy_P(&cfg, &MODEM_CONFIG_TABLE[index], sizeof(RF22::ModemConfig)); // !!!!!!!!!!!!!!!!!!! MIGHT CAUSE ISSUES
    memcpy(&cfg, &MODEM_CONFIG_TABLE[index], sizeof(RF22::ModemConfig));
    setModemRegisters(&cfg);

    return true;
}
Exemplo n.º 4
0
bool MaxRF22::init() {
  if (!RF22::init())
    return false;
  setModemRegisters(&config);
  setFrequency(868.3, 0.035);
  /* Disable TX packet control, since the RF22 doesn't do proper
   * whitening so can't read the length header or CRC. We need RX packet
   * control so the RF22 actually sends pkvalid interrupts when the
   * manually set packet length is reached. */
 // spiWrite(RF22_REG_2A_AFC_LIMITER, 0x1C);
  spiWrite(RF22_REG_30_DATA_ACCESS_CONTROL, RF22_MSBFRST | RF22_ENPACRX|RF22_ENPACTX);
  /* No packet headers, 4 sync words, fixed packet length */
  spiWrite(RF22_REG_32_HEADER_CONTROL1, RF22_BCEN_NONE | RF22_HDCH_NONE);
  spiWrite(RF22_REG_33_HEADER_CONTROL2, RF22_HDLEN_0 | RF22_FIXPKLEN | RF22_SYNCLEN_4);
  setSyncWords(sync_words, sizeof(sync_words));
  /* Detect preamble after 4 nibbles */
  spiWrite(RF22_REG_35_PREAMBLE_DETECTION_CONTROL1, (0x4 << 3));
  /* Send 8 bytes of preamble */
  setPreambleLength(255); // in nibbles
  spiWrite(RF22_REG_3E_PACKET_LENGTH, 20);
  return true;
}