McMajan Library Pack  v 2.00
Improve your Arduino !
ss_nrf24 Class Reference

#include <Ss_McAir24.h>

+ Collaboration diagram for ss_nrf24:

Classes

union  DataMix
 
union  dataRF24
 
struct  McMajanData
 

Public Member Functions

void SendAirData (uint8_t, uint8_t, char, uint8_t del=30)
 
void SendAirData (uint8_t, uint8_t, int, uint8_t del=30)
 
void SendAirData (uint8_t, uint8_t, float, uint8_t del=30)
 
void SendAirData (uint8_t, uint8_t, unsigned long, uint8_t del=30)
 
void SendData (uint8_t del=30)
 Send data using McAir protocol. More...
 
bool GetAirData ()
 
void SetGE (uint8_t, uint8_t)
 
bool init (uint8_t, uint8_t)
 
uint8_t spiCommand (uint8_t)
 
void send (uint8_t *value)
 
void setRADDR (uint8_t *adr)
 
void setTADDR (uint8_t *adr)
 
void setChannel (uint8_t)
 
void setPayLoadSize (uint8_t)
 
bool dataReady ()
 
bool isSending ()
 
bool rxFifoEmpty ()
 
bool txFifoEmpty ()
 
void getData (uint8_t *data)
 
uint8_t getStatus ()
 
void transmitSync (uint8_t *dataout, uint8_t len)
 
void transferSync (uint8_t *dataout, uint8_t *datain, uint8_t len)
 
uint8_t configRegister (uint8_t reg, uint8_t value)
 
uint8_t readRegister (uint8_t reg, uint8_t *value, uint8_t len)
 
uint8_t readRegister (uint8_t reg)
 
void writeRegister (uint8_t reg, uint8_t *value, uint8_t len)
 
bool powerUpRx ()
 
void powerUpTx ()
 
void powerDown ()
 
void csnHi ()
 
void csnLow ()
 
void ceHi ()
 
void ceLow ()
 
uint8_t flushRx ()
 
uint8_t flushTx ()
 
bool Set_Speed_Power (uint8_t)
 
bool waitAvailableTimeout (uint16_t)
 
uint8_t spiRead (uint8_t)
 
uint8_t spiWrite (uint8_t, uint8_t)
 
void Print_Internal_Registers ()
 
bool isSignal (void)
 

Public Attributes

dataRF24 RefData
 
uint8_t PTX
 
uint8_t cePin
 
uint8_t csnPin
 
uint8_t payload
 

Detailed Description

Definition at line 31 of file Ss_McAir24.h.

Member Function Documentation

§ ceHi()

void ceHi ( )

Definition at line 311 of file Ss_McAir24.cpp.

+ Here is the caller graph for this function:

§ ceLow()

void ceLow ( )

Definition at line 315 of file Ss_McAir24.cpp.

+ Here is the caller graph for this function:

§ configRegister()

uint8_t configRegister ( uint8_t  reg,
uint8_t  value 
)

Definition at line 158 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

§ csnHi()

void csnHi ( )

Definition at line 319 of file Ss_McAir24.cpp.

+ Here is the caller graph for this function:

§ csnLow()

void csnLow ( )

Definition at line 323 of file Ss_McAir24.cpp.

+ Here is the caller graph for this function:

§ dataReady()

bool dataReady ( )

Checks if data is available for reading

Returns
This function return true if you have data ready, or false if data aren't ready

Definition at line 109 of file Ss_McAir24.cpp.

References rxFifoEmpty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ flushRx()

uint8_t flushRx ( )

Definition at line 294 of file Ss_McAir24.cpp.

§ flushTx()

uint8_t flushTx ( )

Definition at line 299 of file Ss_McAir24.cpp.

§ GetAirData()

bool GetAirData ( )

If there are data ready, this function copies data to internal buffer

After you used this function you can read the internal buffer in very simple mode. You can read Group Element and Data sent by some simple macros:
McAirGroup: contains the group
McAirElement: contains the element of the specific group
For the data you can use some macros depending the type of data you want to read (char, int, float, unsigned long). These are:

  • McAirDataChar
  • McAirDataInt
  • McAirDataFloat
  • McAirDataLong
if(McAir24.GetAirData()) // check iv data ready
{
if(McAirGroup=='T') // group 'T'
{
Serial.print("ok received number: ");
Serial.print((int)McAirElement); //this is the element of specific group
Serial.print(" - content: ");
Serial.println(McAirDataFloat); //this is the float value transmitted in the specific group and element
}
}
Returns
This function return true if data was read, else return false

Definition at line 491 of file Ss_McAir24.cpp.

References dataReady(), and isSending().

+ Here is the call graph for this function:

§ getData()

void getData ( uint8_t *  data)

Reads data from module and transfert it to Arduino's buffer

Parameters
datais the buffer where you want to copy the data. Please remember that data buffer MUST be at least as payload size.

Definition at line 140 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

§ getStatus()

uint8_t getStatus ( )

Definition at line 245 of file Ss_McAir24.cpp.

§ init()

bool init ( uint8_t  ce,
uint8_t  csn 
)

Initialize the nrf24 library

Parameters
cece pin
scncsn pin
Returns
return false if some initializing errors was found

Definition at line 24 of file Ss_McAir24.cpp.

References ceLow(), csnHi(), powerDown(), and powerUpRx().

+ Here is the call graph for this function:

§ isSending()

bool isSending ( )

Definition at line 229 of file Ss_McAir24.cpp.

+ Here is the caller graph for this function:

§ isSignal()

bool isSignal ( void  )

RPD: Receive Power Detector: This function tell you if the spicificated channel has a sufficient signal power

Returns
true if signal is present

Definition at line 528 of file Ss_McAir24.cpp.

§ powerDown()

void powerDown ( )

Definition at line 327 of file Ss_McAir24.cpp.

References ceLow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ powerUpRx()

bool powerUpRx ( )

Definition at line 251 of file Ss_McAir24.cpp.

References ceHi(), and ceLow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ powerUpTx()

void powerUpTx ( )

Definition at line 304 of file Ss_McAir24.cpp.

+ Here is the caller graph for this function:

§ Print_Internal_Registers()

void Print_Internal_Registers ( )

Show internal registers in hex and binary format. useful for debug.

Definition at line 506 of file Ss_McAir24.cpp.

§ readRegister() [1/2]

uint8_t readRegister ( uint8_t  reg,
uint8_t *  value,
uint8_t  len 
)

Definition at line 175 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

§ readRegister() [2/2]

uint8_t readRegister ( uint8_t  reg)

Definition at line 184 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

§ rxFifoEmpty()

bool rxFifoEmpty ( )

Definition at line 129 of file Ss_McAir24.cpp.

+ Here is the caller graph for this function:

§ send()

void send ( uint8_t *  value)

Send data to remote module

Parameters
valueis the buffer of data. The lenght is not specificated because it's used the payload size.

Definition at line 197 of file Ss_McAir24.cpp.

References ceHi(), ceLow(), csnHi(), csnLow(), and powerUpTx().

+ Here is the call graph for this function:

§ SendAirData() [1/4]

void SendAirData ( uint8_t  group,
uint8_t  element,
char  dato,
uint8_t  del = 30 
)

This function sensds data (char) using McAirData protocol

Parameters
groupis the grop of data (0 to 255)
elemntis a element of the specific group (0 to 255)
datois the char you want to send is optional (default=30). It's a little delay in milliseconds after data send. It's necessary to prevent buffer overflow if yo are using intensive transmission. If you send only a single data you can set to 0 for a faster transmission.

Definition at line 390 of file Ss_McAir24.cpp.

References ss_nrf24::McMajanData::Data, ss_nrf24::DataMix::datachar, ss_nrf24::dataRF24::IO, and RefData.

§ SendAirData() [2/4]

void SendAirData ( uint8_t  group,
uint8_t  element,
int  dato,
uint8_t  del = 30 
)

This function sensds data (int) using McAirData protocol

Parameters
groupis the grop of data (0 to 255)
elemntis a element of the specific group (0 to 255)
datois the int you want to send is optional (default=30). It's a little delay in milliseconds after data send. It's necessary to prevent buffer overflow if yo are using intensive transmission. If you send only a single data you can set to 0 for a faster transmission.

Definition at line 405 of file Ss_McAir24.cpp.

References ss_nrf24::McMajanData::Data, ss_nrf24::DataMix::dataint, ss_nrf24::dataRF24::IO, and RefData.

§ SendAirData() [3/4]

void SendAirData ( uint8_t  group,
uint8_t  element,
float  dato,
uint8_t  del = 30 
)

This function sensds data (float) using McAirData protocol

Parameters
groupis the grop of data (0 to 255)
elemntis a element of the specific group (0 to 255)
datois the float you want to send is optional (default=30). It's a little delay in milliseconds after data send. It's necessary to prevent buffer overflow if yo are using intensive transmission. If you send only a single data you can set to 0 for a faster transmission.

Definition at line 419 of file Ss_McAir24.cpp.

References ss_nrf24::McMajanData::Data, ss_nrf24::DataMix::datafloat, ss_nrf24::dataRF24::IO, and RefData.

§ SendAirData() [4/4]

void SendAirData ( uint8_t  group,
uint8_t  element,
unsigned long  dato,
uint8_t  del = 30 
)

This function sensds data (unsigned long) using McAirData protocol

Parameters
groupis the grop of data (0 to 255)
elemntis a element of the specific group (0 to 255)
datois the unsigned long you want to send is optional (default=30). It's a little delay in milliseconds after data send. It's necessary to prevent buffer overflow if yo are using intensive transmission. If you send only a single data you can set to 0 for a faster transmission.

Definition at line 433 of file Ss_McAir24.cpp.

References ss_nrf24::McMajanData::Data, ss_nrf24::DataMix::datalong, ss_nrf24::dataRF24::IO, and RefData.

§ SendData()

void SendData ( uint8_t  del = 30)

Send data using McAir protocol.

Parameters
delis a optional delay in milli seconds (default is 30 if not specificated)

Definition at line 444 of file Ss_McAir24.cpp.

References isSending().

+ Here is the call graph for this function:

§ Set_Speed_Power()

bool Set_Speed_Power ( uint8_t  sp)

Set the speed and power of the transmitter

Parameters
spis a mix of signal power and speed of the transmitter. You can combine them using ! symbol. The option you can combine are:
In this first list you can see the transmission power and relative consumption.
  • McAir24_PWR_18dB - 11.3mA (Maximum power)
  • McAir24_PWR_12dB - 9mA
  • McAir24_PWR_6dB - 7.5mA
  • McAir24_PWR_0dB - 7mA
In this second list you can see the speed setting from 250K to 2M
  • McAir24_SPD_250K (only nrf24l01+, whith plus)
  • McAir24_SPD_1M
  • McAir24_SPD_2M

Definition at line 356 of file Ss_McAir24.cpp.

§ setChannel()

void setChannel ( uint8_t  channel)

Set rf channel

Parameters
channelis the channel number from 0 to 127. Every channel adds a 1MHz (or a bit more, related to the speed setting) to the basic 2.4GHz frequency. Warning: In some countries you can have some limitation, for example in USA the last legal channel is 84.

Definition at line 64 of file Ss_McAir24.cpp.

§ SetGE()

void SetGE ( uint8_t  group,
uint8_t  element 
)

Definition at line 455 of file Ss_McAir24.cpp.

§ setPayLoadSize()

void setPayLoadSize ( uint8_t  payload_size)

Set payload size

Note: if you don't use my McAirData protocol, you MUST set this and please remember that payload size MUST be the same in server and client module.

Parameters
payload_sizeis the size of payload.

Definition at line 75 of file Ss_McAir24.cpp.

§ setRADDR()

void setRADDR ( uint8_t *  adr)

Set receiver address (local module)

Parameters
adris a 5byte address.

Definition at line 87 of file Ss_McAir24.cpp.

References ceHi(), and ceLow().

+ Here is the call graph for this function:

§ setTADDR()

void setTADDR ( uint8_t *  adr)

Set trasmitter address (remote module)

Parameters
adris the 5bytes address.

Definition at line 97 of file Ss_McAir24.cpp.

§ spiCommand()

uint8_t spiCommand ( uint8_t  command)

Definition at line 268 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

§ spiRead()

uint8_t spiRead ( uint8_t  command)

Definition at line 276 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

§ spiWrite()

uint8_t spiWrite ( uint8_t  command,
uint8_t  val 
)

Definition at line 285 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

§ transferSync()

void transferSync ( uint8_t *  dataout,
uint8_t *  datain,
uint8_t  len 
)

Definition at line 6 of file Ss_McAir24.cpp.

§ transmitSync()

void transmitSync ( uint8_t *  dataout,
uint8_t  len 
)

Definition at line 11 of file Ss_McAir24.cpp.

§ txFifoEmpty()

bool txFifoEmpty ( )

§ waitAvailableTimeout()

bool waitAvailableTimeout ( uint16_t  timeout)

Definition at line 374 of file Ss_McAir24.cpp.

References isSending(), and powerUpRx().

+ Here is the call graph for this function:

§ writeRegister()

void writeRegister ( uint8_t  reg,
uint8_t *  value,
uint8_t  len 
)

Definition at line 167 of file Ss_McAir24.cpp.

References csnHi(), and csnLow().

+ Here is the call graph for this function:

Member Data Documentation

§ cePin

uint8_t cePin

Definition at line 109 of file Ss_McAir24.h.

§ csnPin

uint8_t csnPin

Definition at line 110 of file Ss_McAir24.h.

§ payload

uint8_t payload

Definition at line 112 of file Ss_McAir24.h.

§ PTX

uint8_t PTX

Definition at line 108 of file Ss_McAir24.h.

§ RefData

dataRF24 RefData

Definition at line 56 of file Ss_McAir24.h.


The documentation for this class was generated from the following files: