/*
 * Mfrc530_Internal.h
 *
 *  Created on: Nov 18, 2011
 *      Author: RomanM
 */

#ifndef MFRC530_INTERNAL_H_
#define MFRC530_INTERNAL_H_

#define	Mfrc530_IsBusy()		Mfrc530_ReadReg(Command)
#define Mfrc530_Command(Cmd)	Mfrc530_WriteReg(Command, Cmd)
#define Mfrc530_FlushFIFO()		Mfrc530_ClearRegMask(Control, FlushFIFO)
#define	Mfrc530_E2Ready()		(Mfrc530_ReadReg(SecondaryStatus) & E2Ready)
#define	Mfrc530_TimerEnable()	Mfrc530_SetRegMask(TimerControl, TStartTxEnd | TStopRxBegin)
#define	Mfrc530_TimerDisable()	Mfrc530_ClearRegMask(TimerControl, TStartTxEnd | TStopRxBegin)

void Mfrc530_SetTimeout(uint32_t tmoLength);
void Mfrc530_SetDefaultValues(void);

uint8_t Mfrc530_ReadReg(uint8_t address);
void Mfrc530_WriteReg(uint8_t address, uint8_t data);
void Mfrc530_SetRegMask(uint8_t address, uint8_t mask);
void Mfrc530_ClearRegMask(uint8_t address, uint8_t mask);

void Mfrc530_Transmit(uint8_t *data, uint8_t n);
uint8_t Mfrc530_Transceive(uint8_t *dataOut, uint8_t *dataIn, uint8_t nOut);
void Mfrc530_ReadE2(uint16_t address, uint8_t *data, uint8_t n);


#endif /* MFRC530_INTERNAL_H_ */
