Implement setDIOMapping for CC1101

This commit is contained in:
obones 2022-07-06 15:29:07 +02:00
parent e421ab4272
commit e1412108c1
2 changed files with 18 additions and 0 deletions

View file

@ -885,6 +885,13 @@ void CC1101::readBit(RADIOLIB_PIN_TYPE pin) {
updateDirectBuffer((uint8_t)digitalRead(pin)); updateDirectBuffer((uint8_t)digitalRead(pin));
} }
int16_t CC1101::setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value) {
if (pin > 2)
return RADIOLIB_ERR_INVALID_DIO_PIN;
return(SPIsetRegValue(RADIOLIB_CC1101_REG_IOCFG0 - pin, value));
}
int16_t CC1101::config() { int16_t CC1101::config() {
// Reset the radio. Registers may be dirty from previous usage. // Reset the radio. Registers may be dirty from previous usage.
SPIsendCommand(RADIOLIB_CC1101_CMD_RESET); SPIsendCommand(RADIOLIB_CC1101_CMD_RESET);

View file

@ -932,6 +932,17 @@ class CC1101: public PhysicalLayer {
*/ */
void readBit(RADIOLIB_PIN_TYPE pin); void readBit(RADIOLIB_PIN_TYPE pin);
/*!
\brief Configure DIO pin mapping to get a given signal on a DIO pin (if available).
\param pin Pin number onto which a signal is to be placed.
\param value The value that indicates which function to place on that pin. See chip datasheet for details.
\returns \ref status_codes
*/
int16_t setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value);
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
protected: protected:
#endif #endif