From 3629796937e46c338d5655ea4de0e746e7fd7748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20G=C3=BCndo=C4=9Fan?= <mail-github@cgundogan.de> Date: Wed, 22 Mar 2017 13:10:24 +0100 Subject: [PATCH] drivers/nrf24l01p: add function to disable crc --- drivers/include/nrf24l01p.h | 9 +++++++++ drivers/nrf24l01p/nrf24l01p.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/include/nrf24l01p.h b/drivers/include/nrf24l01p.h index 53b306d9c3..ec90b80114 100644 --- a/drivers/include/nrf24l01p.h +++ b/drivers/include/nrf24l01p.h @@ -546,6 +546,15 @@ int nrf24l01p_enable_pipe(nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe); */ int nrf24l01p_disable_pipe(nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe); +/** +* @brief Disable CRC error detection on the nrf24l01+ transceiver. +* +* @param[in] dev Transceiver device to use. +* +* @return 0. +*/ +int nrf24l01p_disable_crc(nrf24l01p_t *dev); + /** * @brief Enable CRC error detection on the nrf24l01+ transceiver. * diff --git a/drivers/nrf24l01p/nrf24l01p.c b/drivers/nrf24l01p/nrf24l01p.c index 344a381b7a..d409430854 100644 --- a/drivers/nrf24l01p/nrf24l01p.c +++ b/drivers/nrf24l01p/nrf24l01p.c @@ -815,7 +815,13 @@ int nrf24l01p_disable_pipe(nrf24l01p_t *dev, nrf24l01p_rx_pipe_t pipe) return nrf24l01p_write_reg(dev, REG_EN_RXADDR, pipe_conf); } +int nrf24l01p_disable_crc(nrf24l01p_t *dev) +{ + char conf; + nrf24l01p_read_reg(dev, REG_CONFIG, &conf); + return nrf24l01p_write_reg(dev, REG_CONFIG, (conf & ~(EN_CRC))); +} int nrf24l01p_enable_crc(nrf24l01p_t *dev, nrf24l01p_crc_t crc) { -- GitLab