Clark Scheff / A7105TxRx

Dependents:   HubsanTX

Embed: (wiki syntax)

« Back to documentation index

A7105 Class Reference

A7105 Class Reference

Class for interfacing with the AMICCOM A7105 2.4G FSK/GFSK Transceiver. More...

#include <A7105.h>

Public Member Functions

 A7105 (PinName mosi, PinName miso, PinName clk, PinName cs, uint32_t freqHz)
uint8_t writeRegister (uint8_t regAddr, uint8_t value)
 Writes a value to the given register.
uint8_t readRegister (uint8_t regAddr)
 Reads a value from the given register.
uint8_t strobe (enum A7105_State state)
 Sends a strobe command to the A7105.
void writeData (uint8_t *data, size_t len, uint8_t channel)
 Send a packet of data to the A7105.
void readData (uint8_t *buffer, size_t len)
 Read a packet of date from the A7105.
void setId (uint32_t id)
 Set the A7105's ID.
void setPower (int32_t power)
 Set the TX power.
void setTxRxMode (enum TXRX_State mode)
 Sets the TxRx mode.
int8_t reset ()
 Resets the A7105, putting it into standby mode.

Detailed Description

Class for interfacing with the AMICCOM A7105 2.4G FSK/GFSK Transceiver.

See the A7105 datasheet for complete documentation on this part http://www.avantcom.com.tw/AVANTCOM/TC/DATA/PRODUCT/SOLVE/18_3.pdf

Example:

 #include "mbed.h"
 #include "A7105.h"

 #define A7105_SPI_FREQUENCY  10000000 // 10MHz
 
 A7105 txrx(D4, D5, D3, D6, A7105_SPI_FREQUENCY);
 
 int main() {
     // reset
     ret = txrx.reset();
     // use GPIO1 as miso
     ret = txrx.writeRegister(A7105_0B_GPIO1_PIN_I, 0x19);
     // set various radio options
     ret = txrx.writeRegister(A7105_01_MODE_CONTROL, 0x63);
     // set packet length (FIFO end pointer) to 0x0f + 1 == 16
     ret = txrx.writeRegister(A7105_03_FIFOI, 0x0f);
     // select crystal oscillator and system clock divider of 1/2
     ret = txrx.writeRegister(A7105_0D_CLOCK, 0x05);
 
     // sanity check
     ret = txrx.readRegister(A7105_0D_CLOCK);
     if (ret != 0x05) {
         // do something :)
     }
 }

Definition at line 129 of file A7105.h.


Constructor & Destructor Documentation

A7105 ( PinName  mosi,
PinName  miso,
PinName  clk,
PinName  cs,
uint32_t  freqHz 
)
Parameters:
mosiPin used to transmit data to the slave
misoPin used to receive data from the slave
clkPin used for the clock
csPin used for the chip select
freqHzFrequency used to clock data in and out

Definition at line 4 of file A7105.cpp.


Member Function Documentation

void readData ( uint8_t *  buffer,
size_t  len 
)

Read a packet of date from the A7105.

Parameters:
bufferByte array to hold the incoming data
lenLength of the buffer, number of bytes to read in

Definition at line 64 of file A7105.cpp.

uint8_t readRegister ( uint8_t  regAddr )

Reads a value from the given register.

Parameters:
regAddrAddress of the register to read
Returns:
The value of the register

Definition at line 26 of file A7105.cpp.

int8_t reset (  )

Resets the A7105, putting it into standby mode.

Definition at line 127 of file A7105.cpp.

void setId ( uint32_t  id )

Set the A7105's ID.

Parameters:
id32-bit identifier

Definition at line 71 of file A7105.cpp.

void setPower ( int32_t  power )

Set the TX power.

Parameters:
powerOutput power in dBm

Definition at line 83 of file A7105.cpp.

void setTxRxMode ( enum TXRX_State  mode )

Sets the TxRx mode.

mode TxRx mode

Definition at line 110 of file A7105.cpp.

uint8_t strobe ( enum A7105_State  state )

Sends a strobe command to the A7105.

Parameters:
stateStrobe command state

Definition at line 38 of file A7105.cpp.

void writeData ( uint8_t *  data,
size_t  len,
uint8_t  channel 
)

Send a packet of data to the A7105.

Parameters:
dataByte array to send
lenLength of the byte array
channelChannel to transmit data on

Definition at line 49 of file A7105.cpp.

uint8_t writeRegister ( uint8_t  regAddr,
uint8_t  value 
)

Writes a value to the given register.

Parameters:
regAddrAddress of the register to write to
valueValue to write into the register
Returns:
Value returned from slave when writing the register

Definition at line 13 of file A7105.cpp.