Fixed a bug in reading hitagU and hitagS on RDV4.

This commit is contained in:
dxl
2026-08-19 18:53:35 +02:00
committed by Philippe Teuwen
parent 75c2803d30
commit 86dfdfff89
+4 -2
View File
@@ -272,10 +272,12 @@ uint16_t RAMFUNC GetLoEdgeCaptureCount(void) {
}
lo_edge_t RAMFUNC GetLoEdgeCaptureStatus(void) {
if (AT91C_BASE_TC1->TC_SR & INPUT_CAPTURE_EVT_RISING_EDGE) {
// Read Once Only: Reading TC_SR will simultaneously clear status bits such as LDRAS/LDRBS.
uint32_t sr = AT91C_BASE_TC1->TC_SR;
if (sr & INPUT_CAPTURE_EVT_RISING_EDGE) {
return LO_EDGE_RISING;
}
if (AT91C_BASE_TC1->TC_SR & INPUT_CAPTURE_EVT_FALLING_EDGE) {
if (sr & INPUT_CAPTURE_EVT_FALLING_EDGE) {
return LO_EDGE_FALLING;
}
return LO_EDGE_NO;