SpaceTeddy / CC1101

driver library for Ti CC1100 / CC1101. For Arduino and Raspberry Pi
MIT License
281 stars 93 forks source link

setting channel spacing? #19

Open dsvensson opened 6 years ago

dsvensson commented 6 years ago

Not really a good issue, but I'm not sure how to use this library to accomplish the following setup I'm using with RfCat:

    d.setFreq(868000000)
    d.setMdmModulation(MOD_2FSK)
    d.setMdmChanSpc(40000)
    d.setMdmDeviatn(20000)
    d.setMdmNumPreamble(32)
    d.setMdmDRate(38391)
    d.setMdmSyncWord(0xD201)
    d.setMdmSyncMode(1)
    d.makePktFLEN(20)

I've tried extending the RxDemo with:

cc1100_mode_select = 2;
cc1100_freq_select = 3;

before begin(..)w and:

cc1100.set_sync_mode(1)
cc1100.spi_write_register(SYNC1, 0xD2);
cc1100.spi_write_register(SYNC0, 0x01);

If I configure PKTCTRL0 with the flag that doesn't gate the incoming the data, I'll get data in the buffer, so I'm fairly sure I've connected it correctly.

From the above settings, I think the mode and freq selects are correct, as are the other sync_mode/sync_word, but the datarate, channel spacing and deviation, I'm not sure how to set. I see this API, but it's not clear what I should feed it:

void CC1100::set_datarate(uint8_t mdmcfg4, uint8_t mdmcfg3, uint8_t deviant)

Is it an oversight that setting sync_word is not in the API?