as3993 ST25RU3993 Firmware
|
#include "as3993_config.h"
#include "platform.h"
#include "as3993.h"
#include "as3993_public.h"
#include "global.h"
#include "logger.h"
#include "timer.h"
#include "gen2.h"
#include "stdlib.h"
#include "string.h"
#include "Compiler.h"
Go to the source code of this file.
Macros | |
#define | READ 0x40 |
#define | AS3980WAITTIME 510 |
#define | WaitForAS3980() {} |
Variables | |
volatile u16 | as3993Response = 0 |
static u8 | as3993PowerDownRegs [AS3993_REG_ICD+6] |
static u8 | gChipRevisionZero = 1 |
Functions provided by the as3993 series chips.
Functions provided by the as3993 series chips. All higher level and protocol work is contained in gen2.c and iso6b.c
Definition in file as3993.c.
#define AS3980WAITTIME 510 |
void as3993AntennaPower | ( | u8 | on | ) |
void as3993CommandContinuousAddress | ( | u8 * | command, |
u8 | com_len, | ||
u8 | address, | ||
u8 * | buf, | ||
u8 | buf_len | ||
) |
Sends first some commands to the AS3993. The number of commands is specified with the parameter com_len. Then it sets the address where the first byte has to be written and after that every byte from the buffer is written to the AS3993.
*command | Pointer to the first byte of the command buffer |
com_len | Length of the command buffer. |
address | addressbyte |
*buf | Pointer to the first byte of the data array. |
buf_len | Length of the buffer. |
void as3993ContinuousRead | ( | u8 | address, |
s8 | len, | ||
u8 * | readbuf | ||
) |
Reads data from a address and some following addresses from the AS3993. The len parameter defines the number of address read.
address | addressbyte |
len | Length of the buffer. |
*readbuf | Pointer to the first byte of the array where the data has to be stored in. |
void as3993ContinuousWrite | ( | u8 | address, |
u8 * | buf, | ||
s8 | len | ||
) |
void as3993EnterDirectMode | ( | ) |
void as3993ExitDirectMode | ( | ) |
void as3993FifoRead | ( | s8 | len, |
u8 * | readbuf | ||
) |
s8 as3993GetADC | ( | void | ) |
u16 as3993GetReflectedPower | ( | void | ) |
This function gets the values for the reflected power. For measuring the antenna will be switched on, a measurement performed and the antenna if necessary turned back off. The two measured 8-bit values are returned as one 16-bit value, the lower byte containing receiver-A (I) value, the higher byte containing receiver-B (Q) value. The two values are signed values and will be converted from sign magnitude representation to natural. Note: To get a more accurate result the I and Q values of as3993GetReflectedPowerNoiseLevel() should be subtracted from the result of as3993GetReflectedPower()
u16 as3993GetReflectedPowerNoiseLevel | ( | void | ) |
This function measures and returns the noise level of the reflected power measurement of the active antenna. The returned value is of type u16 and contains the 8 bit I and Q values of the reflected power. The I value is located in the lower 8 bits, the Q value in the upper 8 bits.
See as3993GetReflectedPower() fore more info.
s8 as3993GetSensitivity | ( | void | ) |
u16 as3993Initialize | ( | u32 | baseFreq | ) |
This function initialises the AS3993. A return value greater 0 indicates an error.
baseFreq | the base frequency to set at initialization time, may be changed later on. |
void INTERRUPT as3993Isr | ( | void | ) |
u8 as3993ReadChipVersion | ( | void | ) |
void as3993Reset | ( | void | ) |
void as3993ResetDoNotPreserveRegisters | ( | void | ) |
void as3993SetBaseFrequency | ( | u8 | regs, |
u32 | frequency | ||
) |
void as3993SingleCommand | ( | u8 | command | ) |
u8 as3993SingleRead | ( | u8 | address | ) |
void as3993SingleWrite | ( | u8 | address, |
u8 | value | ||
) |
s8 as3993TxRxGen2Bytes | ( | u8 | cmd, |
u8 * | txbuf, | ||
u16 | txbits, | ||
u8 * | rxbuf, | ||
u16 * | rxbits, | ||
u8 | norestime, | ||
u8 | followCmd, | ||
u8 | waitTxIrq | ||
) |
This function is for generic sending and receiving gen2 commands through the FIFO. The parameters are:
cmd,: | One of the AS3993_CMD_* commands wich transmits something. |
txbuf,: | buffer to be tranmitted. |
txbits,: | the size of txbuf in bits |
rxbuf,: | a buffer getting the response of the tag |
rxbits,: | the maximum number of expected rx bits (size of rxbuf in bits) The value will be written to rxlength register. If 0 rxlength is automatically calculated by the reader and no boundary check for rxbuf is done. |
norestime,: | value for register AS3993_REG_RXNORESPONSEWAITTIME 0xff means 26 ms. Other values are much shorter. |
followCmd,: | Command to be sent after rxdone interrupt but before emptying FIFO. This is needed for not violating T2 timing requirement. |
waitTxIrq,: | If 0 tx irq will not be handled after transmitting command, otherwise FW will wait for Tx irq after transmitting command. |
Certain values may be set to 0/NULL thus changing the behavior. Examples:
void as3993WaitForResponse | ( | u16 | waitMask | ) |
void as3993WaitForResponseFAST | ( | u16 | waitMask | ) |
void as3993WaitForResponseTimed | ( | u16 | waitMask, |
u16 | ms | ||
) |
|
static |
volatile u16 as3993Response = 0 |