Implement get and set channel in cmt2300 wrapper class
This commit is contained in:
parent
fffd872b20
commit
2a92f67a9a
@ -60,6 +60,16 @@ bool CMT2300A::write(const uint8_t* buf, uint8_t len)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMT2300A::setChannel(uint8_t channel)
|
||||||
|
{
|
||||||
|
CMT2300A_SetFrequencyChannel(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CMT2300A::getChannel(void)
|
||||||
|
{
|
||||||
|
return CMT2300A_ReadReg(CMT2300A_CUS_FREQ_CHNL);
|
||||||
|
}
|
||||||
|
|
||||||
bool CMT2300A::setPALevel(int8_t level)
|
bool CMT2300A::setPALevel(int8_t level)
|
||||||
{
|
{
|
||||||
uint16_t Tx_dBm_word;
|
uint16_t Tx_dBm_word;
|
||||||
|
|||||||
@ -21,6 +21,18 @@ public:
|
|||||||
|
|
||||||
bool write(const uint8_t* buf, uint8_t len);
|
bool write(const uint8_t* buf, uint8_t len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set RF communication channel. The frequency used by a channel is
|
||||||
|
* @param channel Which RF channel to communicate on, 0-254
|
||||||
|
*/
|
||||||
|
void setChannel(uint8_t channel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get RF communication channel
|
||||||
|
* @return The currently configured RF Channel
|
||||||
|
*/
|
||||||
|
uint8_t getChannel(void);
|
||||||
|
|
||||||
bool setPALevel(int8_t level);
|
bool setPALevel(int8_t level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -26,9 +26,7 @@ String HoymilesRadio_CMT::cmtChToFreq(const uint8_t channel)
|
|||||||
|
|
||||||
void HoymilesRadio_CMT::cmtSwitchChannel(const uint8_t channel)
|
void HoymilesRadio_CMT::cmtSwitchChannel(const uint8_t channel)
|
||||||
{
|
{
|
||||||
yield();
|
_radio->setChannel(channel);
|
||||||
CMT2300A_SetFrequencyChannel(channel);
|
|
||||||
yield();
|
|
||||||
cmtCurrentCh = channel;
|
cmtCurrentCh = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user