radio.setFrequencyBand support (#2495)

* setfrequencyband support

* revert line change

* add bounds check
This commit is contained in:
Peli de Halleux
2019-10-25 10:21:34 -07:00
committed by GitHub
parent 4382868d5f
commit 7e18be3c9b
6 changed files with 75 additions and 0 deletions

View File

@ -109,4 +109,18 @@ namespace radio {
uBit.radio.setTransmitPower(power);
}
/**
* Change the transmission and reception band of the radio to the given channel
* @param band a frequency band in the range 0 - 83. Each step is 1MHz wide, based at 2400MHz.
**/
//% help=radio/set-frequency-band
//% weight=8 blockGap=8
//% blockId=radio_set_frequency_band block="radio set frequency band %band"
//% band.min=0 band.max=83
//% advanced=true
void setFrequencyBand(int band) {
if (radioEnable() != MICROBIT_OK) return;
uBit.radio.setFrequencyBand(band);
}
}