Open frspp opened 1 year ago
This does not help when using "GD-free" communication.
gettCC1101()
just reads register 0x31 (CC1101_VERSION
according to the header file).
When a chip is connected, this returns for me the value 0x04, without chip, returns 0xFF - The library checks for a value >0, so this is probably the problem. I'd guess reading from a non-existing register on SPI will just return something with all bits set. The result is independent from whether or not I initialize the chip first.
Thus, the function should better read
bool ELECHOUSE_CC1101::getCC1101(void) {
setSpi();
// Assuming only Version 4 is around...
if (SpiReadStatus(CC1101_VERSION) == 0x04) {
return 1;
} else {
return 0;
}
}
This check is not very elaborate and could be true for many SPI devices, though.
One need first define the settings and only after that try getCC1101(), not the other way around. Examples does not work because they have it the wrong way around around.
Correct way: