IQRF SPI library for Arduino  Version 1.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
iqrf_library.cpp File Reference
#include "iqrf_library.h"
Include dependency graph for iqrf_library.cpp:

Functions

void trInfoTask ()
 
void IQRF_Init (IQRFCallbacks::rxCallback_t rxCallback, IQRFCallbacks::txCallback_t txCallback)
 
void IQRF_Driver ()
 
void IQRF_GetRxData (uint8_t *dataBuffer, uint8_t dataLength)
 
void trIdentify ()
 
uint8_t TR_SendSpiPacket (uint8_t spiCmd, uint8_t *dataBuffer, uint8_t dataLength, uint8_t unallocationFlag)
 

Variables

uint8_t dataLength
 Data length.
 
trInfo_t trInfo
 TR info structure.
 
packetBuffer_t iqrfPacketBuffer [PACKET_BUFFER_SIZE]
 IQRF packet buffer.
 
uint16_t packetBufferInPtr
 Packet input buffer.
 
uint16_t packetBufferOutPtr
 Packet output buffer.
 
const uint8_t endPgmMode [] = {0xDE, 0x01, 0xFF}
 Packet to end program mode.
 
IQRF _iqrf
 Instance of IQRF class.
 
IQRFBuffers _buffers
 Instance of IQRFBuffers class.
 
IQRFCRC _crc
 Instance of IQRFCRC class.
 
IQRFCallbacks _callbacks
 Instance of IQRFCallbacks class.
 
IQRFPackets _packets
 Instance of IQRFPackets class.
 
IQRFSPI _spi
 Instance of IQRFSPI class.
 
IQRFTR _tr
 Instance of IQRFTR class.
 
IQSPI _iqSpi
 Instance of IQSPI class.
 

Detailed Description

Author
Rostislav Špinar rosti.nosp@m.slav.nosp@m..spin.nosp@m.ar@m.nosp@m.icror.nosp@m.isc..nosp@m.com
Roman Ondráček ondra.nosp@m.cek..nosp@m.roman.nosp@m.@cen.nosp@m.trum..nosp@m.cz
Version
1.1

Copyright 2015-2016 MICRORISC s.r.o.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

void IQRF_Driver ( )

Periodically called IQRF_Driver

void IQRF_GetRxData ( uint8_t *  dataBuffer,
uint8_t  dataLength 
)

Function is usually called inside the callback function, whitch is called when the driver receives data from TR module

Parameters
dataBufferPointer to my buffer, to which I want to load data received from the TR module
dataLengthNumber of bytes I want to read
void IQRF_Init ( IQRFCallbacks::rxCallback_t  rxCallback,
IQRFCallbacks::txCallback_t  txCallback 
)

Function perform a TR-module driver initialization Function performes initialization of trInfo identification data structure

Parameters
rxCallbackPointer to callback function. Function is called when the driver receives data from the TR module
txCallbackPointer to callback function. unction is called when the driver sent data to the TR module
uint8_t TR_SendSpiPacket ( uint8_t  spiCmd,
uint8_t *  dataBuffer,
uint8_t  dataLength,
uint8_t  unallocationFlag 
)

Prepare SPI packet to packet buffer

Parameters
spiCmdCommand that I want to send to TR module
dataBufferPointer to a buffer that contains data that I want to send to TR module
dataLengthNumber of bytes to send
unallocationFlagIf the dataBuffer is dynamically allocated using malloc function. If you wish to unallocate buffer after data is sent, set the unallocationFlag to 1, otherwise to 0.
Returns
Packet ID
void trIdentify ( )

Process identification data packet from TR module

void trInfoTask ( )

Read Module Info from TR module, uses SPI master implementation