Обмен нормально запустился

This commit is contained in:
Dmitriy 2025-04-08 23:58:14 +03:00
parent 90e007dd31
commit c3df51d298
5 changed files with 2188 additions and 2173 deletions

View File

@ -77,18 +77,20 @@ void read_fifo_mfrc522( pcd_register reg, uint8_t count, uint8_t *values, uint8_
//Serial.print(F("Reading ")); Serial.print(count); Serial.println(F(" bytes from register.")); //Serial.print(F("Reading ")); Serial.print(count); Serial.println(F(" bytes from register."));
uint8_t index = 0; // Index in values array. uint8_t index = 0; // Index in values array.
uint8_t ret = 0; uint8_t ret = 0;
uint8_t address = 0x80 | reg; uint8_t address = ((reg << 1) & 0x7e) | 0x80;
spi_getSem();
spi_selectChip(MFRC522_SPI); spi_selectChip(MFRC522_SPI);
count--; // One read is performed outside of the loop count--; // One read is performed outside of the loop
SpiExchange(MFRC522_SPI, address);
if (rx_align) { // Only update bit positions rx_align..7 in values[0] if (rx_align) { // Only update bit positions rx_align..7 in values[0]
// Create bit mask for bit positions rx_align..7 // Create bit mask for bit positions rx_align..7
uint8_t mask = (0xFF << rx_align) & 0xFF; uint8_t mask = (0xFF << rx_align) & 0xFF;
// Read value and tell that we want to read the same address again. // Read value and tell that we want to read the same address again.
uint8_t value; uint8_t value;
ret = read_mfrc522(address); ret = SpiExchange(MFRC522_SPI, address);
value=ret; value=ret;
// Apply mask to both current value of values[0] and the new data in value. // Apply mask to both current value of values[0] and the new data in value.
values[0] = (values[0] & ~mask) | (value & mask); values[0] = (values[0] & ~mask) | (value & mask);
@ -96,15 +98,16 @@ void read_fifo_mfrc522( pcd_register reg, uint8_t count, uint8_t *values, uint8_
} }
while (index < count) { while (index < count) {
ret = read_mfrc522(address); ret = SpiExchange(MFRC522_SPI, address);
values[index] = ret; // Read value and tell that we want to read the same address again. values[index] = ret; // Read value and tell that we want to read the same address again.
index++; index++;
} }
ret = read_mfrc522(0); ret = SpiExchange(MFRC522_SPI, 0);
values[index] = ret; // Read value and tell that we want to read the same address again. values[index] = ret; // Read value and tell that we want to read the same address again.
spi_unselectChip(MFRC522_SPI); // Release slave again spi_unselectChip(MFRC522_SPI); // Release slave again
spi_freeSem();
} // End PCD_ReadRegister() } // End PCD_ReadRegister()
/** /**

File diff suppressed because one or more lines are too long

View File

@ -50,7 +50,7 @@
<MemConfigValue>C:\Program Files\IAR Systems\Embedded Workbench 9.0\arm\CONFIG\debugger\NXP\LPC2368.ddf</MemConfigValue> <MemConfigValue>C:\Program Files\IAR Systems\Embedded Workbench 9.0\arm\CONFIG\debugger\NXP\LPC2368.ddf</MemConfigValue>
</PlDriver> </PlDriver>
<DebugChecksum> <DebugChecksum>
<Checksum>4119436880</Checksum> <Checksum>1659803731</Checksum>
</DebugChecksum> </DebugChecksum>
<Exceptions> <Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught> <StopOnUncaught>_ 0</StopOnUncaught>
@ -79,6 +79,16 @@
<Enabled>0</Enabled> <Enabled>0</Enabled>
<ShowSource>0</ShowSource> <ShowSource>0</ShowSource>
</Trace2> </Trace2>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Bp0>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.263.5" 0 0 1 "" 0 "" 0</Bp0>
<Bp1>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.321.7" 0 0 1 "" 0 "" 0</Bp1>
<Bp2>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.190.3" 0 0 1 "" 0 "" 0</Bp2>
<Bp3>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\app\app_vlad.c}.738.31" 0 0 1 "" 0 "" 0</Bp3>
<Count>4</Count>
</Breakpoints2>
<TermIOLog> <TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled> <LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile> <LogFile>_ ""</LogFile>
@ -88,6 +98,10 @@
<LogFile>_ ""</LogFile> <LogFile>_ ""</LogFile>
<Category>_ 0</Category> <Category>_ 0</Category>
</LogFile> </LogFile>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
<DriverProfiling> <DriverProfiling>
<Enabled>0</Enabled> <Enabled>0</Enabled>
<Mode>1</Mode> <Mode>1</Mode>
@ -100,21 +114,4 @@
<CallStackStripe> <CallStackStripe>
<ShowTiming>1</ShowTiming> <ShowTiming>1</ShowTiming>
</CallStackStripe> </CallStackStripe>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Bp0>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\app\app_vlad.c}.734.23" 0 0 1 "" 0 "" 0</Bp0>
<Bp1>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.556.7" 0 0 1 "" 0 "" 0</Bp1>
<Bp2>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.545.9" 0 0 1 "" 0 "" 0</Bp2>
<Bp3>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.534.9" 0 0 1 "" 0 "" 0</Bp3>
<Bp4>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.180.7" 0 0 1 "" 0 "" 0</Bp4>
<Bp5>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.260.5" 0 0 1 "" 0 "" 0</Bp5>
<Bp6>_ 1 "EMUL_CODE" "{$PROJ_DIR$\PROJECT\drivers\mfrc522\rfid-spi.c}.622.7" 0 0 1 "" 0 "" 0</Bp6>
<Count>7</Count>
</Breakpoints2>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
</settings> </settings>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff