mirror of https://github.com/g4klx/MMDVM.git
Merge branch 'master' into boxcar
This commit is contained in:
commit
3c1b41c03f
78
IO.cpp
78
IO.cpp
|
@ -70,6 +70,84 @@ m_lockout(false)
|
||||||
m_boxcarFilter.pCoeffs = BOXCAR_FILTER;
|
m_boxcarFilter.pCoeffs = BOXCAR_FILTER;
|
||||||
|
|
||||||
initInt();
|
initInt();
|
||||||
|
|
||||||
|
selfTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIO::selfTest()
|
||||||
|
{
|
||||||
|
bool ledValue = false;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < 6; i++) {
|
||||||
|
ledValue = !ledValue;
|
||||||
|
|
||||||
|
// We exclude PTT to avoid trigger the transmitter
|
||||||
|
setLEDInt(ledValue);
|
||||||
|
setCOSInt(ledValue);
|
||||||
|
#if defined(ARDUINO_MODE_PINS)
|
||||||
|
setDStarInt(ledValue);
|
||||||
|
setDMRInt(ledValue);
|
||||||
|
setYSFInt(ledValue);
|
||||||
|
setP25Int(ledValue);
|
||||||
|
#endif
|
||||||
|
delayInt(250);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(ARDUINO_MODE_PINS)
|
||||||
|
setDStarInt(true);
|
||||||
|
setDMRInt(false);
|
||||||
|
setYSFInt(false);
|
||||||
|
setP25Int(false);
|
||||||
|
|
||||||
|
delayInt(250);
|
||||||
|
|
||||||
|
setDStarInt(true);
|
||||||
|
setDMRInt(true);
|
||||||
|
setYSFInt(false);
|
||||||
|
setP25Int(false);
|
||||||
|
|
||||||
|
delayInt(250);
|
||||||
|
|
||||||
|
setDStarInt(true);
|
||||||
|
setDMRInt(true);
|
||||||
|
setYSFInt(true);
|
||||||
|
setP25Int(false);
|
||||||
|
|
||||||
|
delayInt(250);
|
||||||
|
|
||||||
|
setDStarInt(true);
|
||||||
|
setDMRInt(true);
|
||||||
|
setYSFInt(true);
|
||||||
|
setP25Int(true);
|
||||||
|
|
||||||
|
delayInt(250);
|
||||||
|
|
||||||
|
setDStarInt(true);
|
||||||
|
setDMRInt(true);
|
||||||
|
setYSFInt(true);
|
||||||
|
setP25Int(false);
|
||||||
|
|
||||||
|
delayInt(250);
|
||||||
|
|
||||||
|
setDStarInt(true);
|
||||||
|
setDMRInt(true);
|
||||||
|
setYSFInt(false);
|
||||||
|
setP25Int(false);
|
||||||
|
|
||||||
|
delayInt(250);
|
||||||
|
|
||||||
|
setDStarInt(true);
|
||||||
|
setDMRInt(false);
|
||||||
|
setYSFInt(false);
|
||||||
|
setP25Int(false);
|
||||||
|
|
||||||
|
delayInt(250);
|
||||||
|
|
||||||
|
setDStarInt(false);
|
||||||
|
setDMRInt(false);
|
||||||
|
setYSFInt(false);
|
||||||
|
setP25Int(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::start()
|
void CIO::start()
|
||||||
|
|
4
IO.h
4
IO.h
|
@ -53,6 +53,8 @@ public:
|
||||||
|
|
||||||
void resetWatchdog();
|
void resetWatchdog();
|
||||||
uint32_t getWatchdog();
|
uint32_t getWatchdog();
|
||||||
|
|
||||||
|
void selfTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_started;
|
bool m_started;
|
||||||
|
@ -103,6 +105,8 @@ private:
|
||||||
void setDMRInt(bool on);
|
void setDMRInt(bool on);
|
||||||
void setYSFInt(bool on);
|
void setYSFInt(bool on);
|
||||||
void setP25Int(bool on);
|
void setP25Int(bool on);
|
||||||
|
|
||||||
|
void delayInt(unsigned int dly);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -226,4 +226,9 @@ void CIO::setP25Int(bool on)
|
||||||
digitalWrite(PIN_P25, on ? HIGH : LOW);
|
digitalWrite(PIN_P25, on ? HIGH : LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::delayInt(unsigned int dly)
|
||||||
|
{
|
||||||
|
delay(dly);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
26
IOSTM.cpp
26
IOSTM.cpp
|
@ -764,4 +764,30 @@ void CIO::setP25Int(bool on)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simple delay function for STM32
|
||||||
|
// Example from: http://thehackerworkshop.com/?p=1209
|
||||||
|
void CIO::delayInt(unsigned int dly)
|
||||||
|
{
|
||||||
|
#if defined(STM32F7_NUCLEO)
|
||||||
|
unsigned int loopsPerMillisecond = (SystemCoreClock/1000);
|
||||||
|
#else
|
||||||
|
unsigned int loopsPerMillisecond = (SystemCoreClock/1000) / 3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (; dly > 0; dly--)
|
||||||
|
{
|
||||||
|
asm volatile //this routine waits (approximately) one millisecond
|
||||||
|
(
|
||||||
|
"mov r3, %[loopsPerMillisecond] \n\t" //load the initial loop counter
|
||||||
|
"loop: \n\t"
|
||||||
|
"subs r3, #1 \n\t"
|
||||||
|
"bne loop \n\t"
|
||||||
|
|
||||||
|
: //empty output list
|
||||||
|
: [loopsPerMillisecond] "r" (loopsPerMillisecond) //input to the asm routine
|
||||||
|
: "r3", "cc" //clobber list
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -210,4 +210,9 @@ void CIO::setP25Int(bool on)
|
||||||
digitalWrite(PIN_P25, on ? HIGH : LOW);
|
digitalWrite(PIN_P25, on ? HIGH : LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
void CIO::delayInt(unsigned int dly)
|
||||||
|
{
|
||||||
|
delay(dly);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue