From: Nathael Pajani Date: Tue, 27 Sep 2016 21:09:32 +0000 (+0200) Subject: Adding cc1101_power_down() to CC1101 driver X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=0f3ec2be6eb5a2ae52e058012966857d3a1063e6;p=soft%2Flpc122x%2Fcore Adding cc1101_power_down() to CC1101 driver --- diff --git a/extdrv/cc1101.c b/extdrv/cc1101.c index 3dd40c6..9649da8 100644 --- a/extdrv/cc1101.c +++ b/extdrv/cc1101.c @@ -389,6 +389,18 @@ void cc1101_set_channel(uint8_t chan) cc1101_write_reg(CC1101_REGS(channel_number), chan); } +/* Enter power down mode + * Power down mode is exited by setting the chip select pin low (any access to the CC1101 will do so) + */ +void cc1101_power_down(void) +{ + cc1101_send_cmd(CC1101_CMD(state_idle)); + msleep(1); + cc1101_send_cmd(CC1101_CMD(crystal_off)); + msleep(1); + cc1101_send_cmd(CC1101_CMD(state_power_down)); +} + /* Change a configuration byte. * This function places the CC1101 chip in idle state. */ diff --git a/include/extdrv/cc1101.h b/include/extdrv/cc1101.h index 3a50a13..39bb688 100644 --- a/include/extdrv/cc1101.h +++ b/include/extdrv/cc1101.h @@ -267,6 +267,11 @@ void cc1101_set_address(uint8_t address); */ void cc1101_set_channel(uint8_t chan); +/* Enter power down mode + * Power down mode is exited by setting the chip select pin low (any access to the CC1101 will do so) + */ +void cc1101_power_down(void); + /* Change a configuration byte. * This function places the CC1101 chip in idle state. */