![]() |
McMajan Library Pack
v 2.00
Improve your Arduino !
|
#include <Ss_McAir24.h>
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 |
Definition at line 31 of file Ss_McAir24.h.
void ceHi | ( | ) |
void ceLow | ( | ) |
uint8_t configRegister | ( | uint8_t | reg, |
uint8_t | value | ||
) |
Definition at line 158 of file Ss_McAir24.cpp.
References csnHi(), and csnLow().
void csnHi | ( | ) |
void csnLow | ( | ) |
bool dataReady | ( | ) |
Checks if data is available for reading
Definition at line 109 of file Ss_McAir24.cpp.
References rxFifoEmpty().
uint8_t flushRx | ( | ) |
Definition at line 294 of file Ss_McAir24.cpp.
uint8_t flushTx | ( | ) |
Definition at line 299 of file Ss_McAir24.cpp.
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:
Definition at line 491 of file Ss_McAir24.cpp.
References dataReady(), and isSending().
void getData | ( | uint8_t * | data | ) |
Reads data from module and transfert it to Arduino's buffer
data | is 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().
uint8_t getStatus | ( | ) |
Definition at line 245 of file Ss_McAir24.cpp.
bool init | ( | uint8_t | ce, |
uint8_t | csn | ||
) |
Initialize the nrf24 library
ce | ce pin |
scn | csn pin |
Definition at line 24 of file Ss_McAir24.cpp.
References ceLow(), csnHi(), powerDown(), and powerUpRx().
bool isSending | ( | ) |
bool isSignal | ( | void | ) |
RPD: Receive Power Detector: This function tell you if the spicificated channel has a sufficient signal power
Definition at line 528 of file Ss_McAir24.cpp.
void powerDown | ( | ) |
Definition at line 327 of file Ss_McAir24.cpp.
References ceLow().
bool powerUpRx | ( | ) |
Definition at line 251 of file Ss_McAir24.cpp.
References ceHi(), and ceLow().
void powerUpTx | ( | ) |
void Print_Internal_Registers | ( | ) |
Show internal registers in hex and binary format. useful for debug.
Definition at line 506 of file Ss_McAir24.cpp.
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().
uint8_t readRegister | ( | uint8_t | reg | ) |
Definition at line 184 of file Ss_McAir24.cpp.
References csnHi(), and csnLow().
bool rxFifoEmpty | ( | ) |
void send | ( | uint8_t * | value | ) |
Send data to remote module
value | is 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().
void SendAirData | ( | uint8_t | group, |
uint8_t | element, | ||
char | dato, | ||
uint8_t | del = 30 |
||
) |
This function sensds data (char) using McAirData protocol
group | is the grop of data (0 to 255) |
elemnt | is a element of the specific group (0 to 255) |
dato | is 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.
void SendAirData | ( | uint8_t | group, |
uint8_t | element, | ||
int | dato, | ||
uint8_t | del = 30 |
||
) |
This function sensds data (int) using McAirData protocol
group | is the grop of data (0 to 255) |
elemnt | is a element of the specific group (0 to 255) |
dato | is 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.
void SendAirData | ( | uint8_t | group, |
uint8_t | element, | ||
float | dato, | ||
uint8_t | del = 30 |
||
) |
This function sensds data (float) using McAirData protocol
group | is the grop of data (0 to 255) |
elemnt | is a element of the specific group (0 to 255) |
dato | is 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.
void SendAirData | ( | uint8_t | group, |
uint8_t | element, | ||
unsigned long | dato, | ||
uint8_t | del = 30 |
||
) |
This function sensds data (unsigned long) using McAirData protocol
group | is the grop of data (0 to 255) |
elemnt | is a element of the specific group (0 to 255) |
dato | is 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.
void SendData | ( | uint8_t | del = 30 | ) |
Send data using McAir protocol.
del | is a optional delay in milli seconds (default is 30 if not specificated) |
Definition at line 444 of file Ss_McAir24.cpp.
References isSending().
bool Set_Speed_Power | ( | uint8_t | sp | ) |
Set the speed and power of the transmitter
sp | is 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.
|
Definition at line 356 of file Ss_McAir24.cpp.
void setChannel | ( | uint8_t | channel | ) |
Set rf channel
channel | is 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.
void SetGE | ( | uint8_t | group, |
uint8_t | element | ||
) |
Definition at line 455 of file Ss_McAir24.cpp.
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.
payload_size | is the size of payload. |
Definition at line 75 of file Ss_McAir24.cpp.
void setRADDR | ( | uint8_t * | adr | ) |
Set receiver address (local module)
adr | is a 5byte address. |
Definition at line 87 of file Ss_McAir24.cpp.
References ceHi(), and ceLow().
void setTADDR | ( | uint8_t * | adr | ) |
Set trasmitter address (remote module)
adr | is the 5bytes address. |
Definition at line 97 of file Ss_McAir24.cpp.
uint8_t spiCommand | ( | uint8_t | command | ) |
Definition at line 268 of file Ss_McAir24.cpp.
References csnHi(), and csnLow().
uint8_t spiRead | ( | uint8_t | command | ) |
Definition at line 276 of file Ss_McAir24.cpp.
References csnHi(), and csnLow().
uint8_t spiWrite | ( | uint8_t | command, |
uint8_t | val | ||
) |
Definition at line 285 of file Ss_McAir24.cpp.
References csnHi(), and csnLow().
void transferSync | ( | uint8_t * | dataout, |
uint8_t * | datain, | ||
uint8_t | len | ||
) |
Definition at line 6 of file Ss_McAir24.cpp.
void transmitSync | ( | uint8_t * | dataout, |
uint8_t | len | ||
) |
Definition at line 11 of file Ss_McAir24.cpp.
bool txFifoEmpty | ( | ) |
bool waitAvailableTimeout | ( | uint16_t | timeout | ) |
Definition at line 374 of file Ss_McAir24.cpp.
References isSending(), and powerUpRx().
void writeRegister | ( | uint8_t | reg, |
uint8_t * | value, | ||
uint8_t | len | ||
) |
Definition at line 167 of file Ss_McAir24.cpp.
References csnHi(), and csnLow().
uint8_t cePin |
Definition at line 109 of file Ss_McAir24.h.
uint8_t csnPin |
Definition at line 110 of file Ss_McAir24.h.
uint8_t payload |
Definition at line 112 of file Ss_McAir24.h.
uint8_t PTX |
Definition at line 108 of file Ss_McAir24.h.
dataRF24 RefData |
Definition at line 56 of file Ss_McAir24.h.