summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-07-16 14:52:32 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2019-07-16 14:52:32 +0200
commitb47295e3b04413cc5d278df2ea8fe2c168beefd2 (patch)
treeebf340f74ad5fcbd1db4d0e3bee091356c9bc3de /src/driver
parenta426c8d552d4b477758f90d6bb08619fb1ff3edd (diff)
more radio tests
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/nrf24l01.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/driver/nrf24l01.cc b/src/driver/nrf24l01.cc
index abd42ea..937831b 100644
--- a/src/driver/nrf24l01.cc
+++ b/src/driver/nrf24l01.cc
@@ -131,7 +131,7 @@ void Nrf24l01::powerUp(void)
void Nrf24l01::powerDown(void)
{
- gpio.write(NRF24L01_EN_PIN, 0);
+ ceLow();
writeRegister(NRF_CONFIG, readRegister(NRF_CONFIG) & ~(1 << PWR_UP));
}
@@ -234,18 +234,18 @@ uint8_t Nrf24l01::write(const void *buf, uint8_t len, bool await_ack, bool block
{
writePayload(buf, len, await_ack ? W_TX_PAYLOAD : W_TX_PAYLOAD_NO_ACK);
- gpio.write(NRF24L01_EN_PIN, 1);
+ ceHigh();
if (!blocking)
{
arch.delay_us(10);
- gpio.write(NRF24L01_EN_PIN, 0);
+ ceLow();
return 0;
}
while (!(getStatus() & ((1 << TX_DS) | (1 << MAX_RT))))
;
- gpio.write(NRF24L01_EN_PIN, 1);
+ ceLow();
uint8_t status = writeRegister(NRF_STATUS, ((1 << TX_DS) | (1 << MAX_RT)));
if (status & (1 << MAX_RT))
@@ -260,7 +260,7 @@ void Nrf24l01::startListening(void)
{
writeRegister(NRF_CONFIG, readRegister(NRF_CONFIG) | (1 << PRIM_RX));
writeRegister(NRF_STATUS, (1 << RX_DR) | (1 << TX_DS) | (1 << MAX_RT));
- gpio.write(NRF24L01_EN_PIN, 1);
+ ceHigh();
// Restore the pipe0 adddress, if exists
if (pipe0_reading_address[0] > 0)
@@ -280,7 +280,7 @@ void Nrf24l01::startListening(void)
void Nrf24l01::stopListening(void)
{
- gpio.write(NRF24L01_EN_PIN, 0);
+ ceLow();
arch.delay_us(txRxDelay);