Some bugs fixed for the use with none 13.56 MHz crystals
This commit is contained in:
parent
e384b912dc
commit
2b8fb8e0f7
|
@ -107,7 +107,7 @@ void waitForOneBitTime()
|
||||||
//Skip every 17 bit times 1 cycle
|
//Skip every 17 bit times 1 cycle
|
||||||
void waitForOneBitTime()
|
void waitForOneBitTime()
|
||||||
{
|
{
|
||||||
if (rCount < 17)
|
if (rCount < 7)
|
||||||
{
|
{
|
||||||
OCR1AL = CLC_PBIT / 2 - 1;
|
OCR1AL = CLC_PBIT / 2 - 1;
|
||||||
rCount++;
|
rCount++;
|
||||||
|
@ -212,8 +212,13 @@ inline void resetRxFlags()
|
||||||
|
|
||||||
uint8_t rxMiller()
|
uint8_t rxMiller()
|
||||||
{
|
{
|
||||||
uint8_t t;
|
#if (F_CPU > 16000000)
|
||||||
uint16_t cDown = 0xFFF;
|
uint16_t t; //For hi cpu clock a 8 bit variable will overflow (CLCM > 0xFF)
|
||||||
|
#else
|
||||||
|
uint8_t t; //For low cpu clock computing time is to low for 16bit a variable
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint16_t cDown = 0x0FFF;
|
||||||
uint8_t bytePos = 0;
|
uint8_t bytePos = 0;
|
||||||
uint8_t hbitPos = 0;
|
uint8_t hbitPos = 0;
|
||||||
|
|
||||||
|
@ -245,7 +250,7 @@ uint8_t rxMiller()
|
||||||
resetRxFlags();
|
resetRxFlags();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ((ACSR & (1<<ACI)) && (TCNT1 > CMIN))
|
if ((ACSR & (1<<ACI)) && (TCNT1 > 1))
|
||||||
{
|
{
|
||||||
t = TCNT1;
|
t = TCNT1;
|
||||||
resetRxFlags();
|
resetRxFlags();
|
||||||
|
@ -333,7 +338,7 @@ void checkForNfcReader()
|
||||||
|
|
||||||
if (ACSR & (1<<ACI)) //13.56 MHz carrier available?
|
if (ACSR & (1<<ACI)) //13.56 MHz carrier available?
|
||||||
{
|
{
|
||||||
AIN1_PRNG &= ~(1<<AIN1_PORT); //Deactivate pull up to increase sensitivity
|
AIN1_PORT &= ~(1<<AIN1_BIT); //Deactivate pull up to increase sensitivity
|
||||||
|
|
||||||
while(cdow > 0)
|
while(cdow > 0)
|
||||||
{
|
{
|
||||||
|
@ -390,7 +395,7 @@ void checkForNfcReader()
|
||||||
|
|
||||||
cdow -= (bytes == 0);
|
cdow -= (bytes == 0);
|
||||||
}
|
}
|
||||||
AIN1_PRNG |= (1<<AIN1_PORT); //Activate pull up to prevent noise from toggling the comparator
|
AIN1_PORT |= (1<<AIN1_BIT); //Activate pull up to prevent noise from toggling the comparator
|
||||||
}
|
}
|
||||||
ACSR |= (1<<ACI); //Clear comparator interrupt flag
|
ACSR |= (1<<ACI); //Clear comparator interrupt flag
|
||||||
}
|
}
|
Loading…
Reference in New Issue