Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
common.cpp
- Committer:
- pannaanna
- Date:
- 2017-01-05
- Revision:
- 2:6541a391bdbd
- Child:
- 8:1861d0eef60a
File content as of revision 2:6541a391bdbd:
#include "common.h" std::string Data::serialize() { std::string serialized; serialized.push_back(type); serialized.push_back(counter); return serialized; }; void radio_init(nRF24L01P* radio, unsigned long long rx_address, unsigned long long tx_address) { radio->powerDown(); radio->powerUp(); radio->setAirDataRate(DATA_RATE); radio->setRfOutputPower(POWER); radio->setRfFrequency(NRF24L01P_MIN_RF_FREQUENCY + 4 * CHANNEL); radio->setCrcWidth(NRF24L01P_CRC_8_BIT); radio->enableAutoAcknowledge(NRF24L01P_PIPE_P0); radio->enableAutoAcknowledge(NRF24L01P_PIPE_P1); radio->enableAutoRetransmit(0x0F, 0x0F); radio->setTxAddress(tx_address, 4); radio->setRxAddress(tx_address, 4, NRF24L01P_PIPE_P0); radio->setRxAddress(rx_address, 4, NRF24L01P_PIPE_P1); radio->setTransferSize(TRANSFER_SIZE, NRF24L01P_PIPE_P0); radio->setTransferSize(TRANSFER_SIZE, NRF24L01P_PIPE_P1); radio->setReceiveMode(); radio->enable(); }