void TICC1100::initChip() { try { if(_fileDescriptor->descriptor == -1) { _out.printError("Error: Could not initialize TI CC1100. The spi device's file descriptor is not valid."); return; } reset(); int32_t index = 0; for(std::vector<uint8_t>::const_iterator i = _config.begin(); i != _config.end(); ++i) { if(writeRegister((Registers::Enum)index, *i, true) != *i) { closeDevice(); return; } index++; } if(writeRegister(Registers::Enum::FSTEST, 0x59, true) != 0x59) { closeDevice(); return; } if(writeRegister(Registers::Enum::TEST2, 0x81, true) != 0x81) //Determined by SmartRF Studio { closeDevice(); return; } if(writeRegister(Registers::Enum::TEST1, 0x35, true) != 0x35) //Determined by SmartRF Studio { closeDevice(); return; } if(writeRegister(Registers::Enum::PATABLE, _settings->txPowerSetting, true) != _settings->txPowerSetting) { closeDevice(); return; } sendCommandStrobe(CommandStrobes::Enum::SFRX); usleep(20); enableRX(true); } catch(const std::exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { _out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
void nRF24L01p::init(){ flushRX(); flushTX(); dynamicPayload(P0|P1); feature(DPL|DYN_ACK); writeReg(SETUP_RETR,0x2F); writeReg(STATUS,0x70); powerUp(); if(_prim_rx && _prim_tx){ enableRX(P1|P0); primPRX(); ceHigh(); }else if(_prim_rx && !_prim_tx){ enableRX(P1); primPRX(); ceHigh(); }else if(!_prim_rx && _prim_tx){ enableRX(P0); primPTX(); } _init=true; }