From 0f3ec2be6eb5a2ae52e058012966857d3a1063e6 Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Tue, 27 Sep 2016 23:09:32 +0200 Subject: [PATCH] Adding cc1101_power_down() to CC1101 driver --- extdrv/cc1101.c | 12 ++++++++++++ include/extdrv/cc1101.h | 5 +++++ 2 files changed, 17 insertions(+) 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. */ -- 2.43.0