From: Nathael Pajani Date: Sat, 20 Dec 2014 15:28:59 +0000 (+0100) Subject: Allow app-level CC1101 configuration modifications X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=e946b7f601175d8afe50016dc68bfc937b379459;p=soft%2Flpc122x%2Fcore Allow app-level CC1101 configuration modifications --- diff --git a/extdrv/cc1101.c b/extdrv/cc1101.c index b586b56..065b5fc 100644 --- a/extdrv/cc1101.c +++ b/extdrv/cc1101.c @@ -459,4 +459,24 @@ void cc1101_config(void) cc1101_write_reg(CC1101_PATABLE, paTable[0]); } +/* Update CC1101 config + * Arguments are the settings table which is a table of address and value pairs, + * and the table length, which must be even. + */ +void cc1101_update_config(uint8_t* settings, uint8_t len) +{ + int i = 0; + if (len & 0x01) { + return; + } + for (i = 0; i < len; i += 2) { + cc1101_write_reg(settings[i], settings[i + 1]); + } +} + +/* Change PA Table value */ +void cc1101_set_patable(uint8_t val) +{ + cc1101_write_reg(CC1101_PATABLE, val); +} diff --git a/include/extdrv/cc1101.h b/include/extdrv/cc1101.h index 153e32d..5549fe7 100644 --- a/include/extdrv/cc1101.h +++ b/include/extdrv/cc1101.h @@ -265,5 +265,13 @@ void cc1101_init(uint8_t ssp_num, const struct pio* cs_pin, const struct pio* mi /* Write / send all the configuration register values to the CC1101 chip */ void cc1101_config(void); +/* Update CC1101 config + * Arguments are the settings table which is a table of address and value pairs, + * and the table length, which must be even. + */ +void cc1101_update_config(uint8_t* settings, uint8_t len); + +/* Change PA Table value */ +void cc1101_set_patable(uint8_t val); #endif /* EXTDRV_CC1101_H */