From fd58b937679bb9346080a1b0690166aefd4c93b6 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Sun, 13 Mar 2011 18:35:18 +0000 Subject: [PATCH] Now that we're in cpp land, remove the mrf_ prefixes from all methods. Also, add a proper set_channel method, and a method for promiscuous mode. --- examples/Basic_TwoWay/Basic_TwoWay.pde | 26 ++--- mrf24j.cpp | 128 +++++++++++++------------ mrf24j.h | 32 ++++--- 3 files changed, 98 insertions(+), 88 deletions(-) diff --git a/examples/Basic_TwoWay/Basic_TwoWay.pde b/examples/Basic_TwoWay/Basic_TwoWay.pde index 40a79c0..8a2b3eb 100644 --- a/examples/Basic_TwoWay/Basic_TwoWay.pde +++ b/examples/Basic_TwoWay/Basic_TwoWay.pde @@ -20,10 +20,10 @@ long tx_interval = 1000; void setup() { Serial.begin(9600); - Serial.println("Starting to reset and startup..."); - mrf.mrf_pan_write(0xcafe); - mrf.mrf_address16_write(0x6001); + mrf.set_pan(0xcafe); + // This is _our_ address + mrf.address16_write(0x6001); attachInterrupt(0, interrupt_routine, CHANGE); last_time = millis(); } @@ -34,7 +34,7 @@ volatile uint8_t last_interrupt; void interrupt_routine() { // read and clear from the radio - last_interrupt = mrf.mrf_read_short(MRF_INTSTAT); + last_interrupt = mrf.read_short(MRF_INTSTAT); if (last_interrupt & MRF_I_RXIF) { gotrx = 1; } @@ -44,19 +44,19 @@ void interrupt_routine() { } void loop() { - //mrf.mrf_write_short(MRF_RXMCR, 0x01); // promiscuous! + //mrf.set_promiscuous(true); int tmp; interrupts(); unsigned long current_time = millis(); if (current_time - last_time > tx_interval) { last_time = current_time; Serial.println("txxxing..."); - mrf.mrf_send16(0x4202, 4, "abcd"); + mrf.send16(0x4202, 4, "abcd"); } if (txok) { txok = 0; Serial.print("tx went ok:"); - tmp = mrf.mrf_read_short(MRF_TXSTAT); + tmp = mrf.read_short(MRF_TXSTAT); Serial.print(tmp); if (!(tmp & ~(1<