Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 45 additions & 44 deletions IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ uint32_t IO::getWatchdog()

void IO::selfTest()
{
#define FLASH_DELAY 125

bool ledValue = false;

for (uint8_t i = 0; i < 6; i++) {
Expand All @@ -560,7 +562,12 @@ void IO::selfTest()
setP25Int(ledValue);
setNXDNInt(ledValue);

delayInt(250);
#if defined(STM32F4_DVMV1)
setFMInt(ledValue);
setPTTLEDInt(ledValue);
#endif

delayInt(FLASH_DELAY);
}

// blinkin lights
Expand All @@ -569,71 +576,65 @@ void IO::selfTest()
setDMRInt(false);
setP25Int(false);
setNXDNInt(false);
delayInt(250);
#if defined(STM32F4_DVMV1)
setFMInt(false);
setPTTLEDInt(false);
#endif
delayInt(FLASH_DELAY);

setLEDInt(true);
setCOSInt(false);
setDMRInt(false);
setP25Int(false);
delayInt(250);
delayInt(FLASH_DELAY);

setLEDInt(false);
setCOSInt(true);
setDMRInt(false);
setP25Int(false);
delayInt(250);
delayInt(FLASH_DELAY);

setLEDInt(false);
setCOSInt(false);
setDMRInt(true);
setP25Int(false);
delayInt(250);
delayInt(FLASH_DELAY);

setLEDInt(false);
setCOSInt(false);
setDMRInt(false);
setP25Int(true);
delayInt(250);
delayInt(FLASH_DELAY);

setLEDInt(false);
setCOSInt(false);
setDMRInt(false);
setP25Int(false);
setNXDNInt(true);
delayInt(250);
delayInt(FLASH_DELAY);

setLEDInt(false);
setCOSInt(false);
setDMRInt(false);
setP25Int(true);
#if defined(STM32F4_DVMV1)
setNXDNInt(false);
delayInt(250);
setFMInt(true);
delayInt(FLASH_DELAY);

setFMInt(false);
setPTTLEDInt(true);
delayInt(FLASH_DELAY);

setPTTLEDInt(false);
setFMInt(true);
delayInt(FLASH_DELAY);

setFMInt(false);
setNXDNInt(true);
delayInt(FLASH_DELAY);
#endif

setLEDInt(false);
setCOSInt(false);
setDMRInt(true);
setP25Int(false);
setNXDNInt(false);
delayInt(250);
setP25Int(true);
delayInt(FLASH_DELAY);

setLEDInt(false);
setCOSInt(true);
setDMRInt(false);
setP25Int(false);
setNXDNInt(false);
delayInt(250);
setDMRInt(true);
delayInt(FLASH_DELAY);

setLEDInt(true);
setCOSInt(false);
setDMRInt(false);
setP25Int(false);
setNXDNInt(false);
delayInt(250);
setCOSInt(true);
delayInt(FLASH_DELAY);

setLEDInt(false);
setCOSInt(false);
setDMRInt(false);
setP25Int(false);
setNXDNInt(false);
delayInt(250);
setLEDInt(true);
delayInt(FLASH_DELAY);

setLEDInt(false);
delayInt(FLASH_DELAY);
}
8 changes: 8 additions & 0 deletions IO.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ class DSP_FW_API IO {
*/
void setNXDNInt(bool on);

#if defined(STM32F4_DVMV1)

void setFMInt(bool on);

void setPTTLEDInt(bool on);

#endif

/**
* @brief
* @param dly
Expand Down
35 changes: 35 additions & 0 deletions IOSTM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,23 @@ void IO::initInt()
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_Init(PORT_NXDN, &GPIO_InitStruct);

// DVM-V1 LEDs
#if defined(STM32F4_DVMV1)

// FM pin (never actually used since we don't do FM)
RCC_AHB1PeriphClockCmd(RCC_Per_FM, ENABLE);
GPIO_InitStruct.GPIO_Pin = PIN_FM;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_Init(PORT_FM, &GPIO_InitStruct);

// PTT LED pin (separate from the actual PTT pin for ESD reasons)
RCC_AHB1PeriphClockCmd(RCC_Per_PTTLED, ENABLE);
GPIO_InitStruct.GPIO_Pin = PIN_PTTLED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_Init(PORT_PTTLED, &GPIO_InitStruct);

#endif

#if SPI_ENABLED
// Init SPI Clock
SPI_APB_CLK_INIT(SPI_APB_CLK, ENABLE);
Expand Down Expand Up @@ -883,6 +900,10 @@ void IO::setLEDInt(bool on)
void IO::setPTTInt(bool on)
{
GPIO_WriteBit(PORT_PTT, PIN_PTT, on ? Bit_SET : Bit_RESET);
#if defined(STM32F4_DVMV1)
// We tie the PTT LED to PTT on the V1
setPTTLEDInt(on);
#endif
}

/* */
Expand Down Expand Up @@ -915,6 +936,20 @@ void IO::setNXDNInt(bool on)

/* */

#if defined(STM32F4_DVMV1)

void IO::setFMInt(bool on)
{
GPIO_WriteBit(PORT_FM, PIN_FM, on ? Bit_SET : Bit_RESET);
}

void IO::setPTTLEDInt(bool on)
{
GPIO_WriteBit(PORT_PTTLED, PIN_PTTLED, on ? Bit_SET : Bit_RESET);
}

#endif

void IO::delayInt(unsigned int dly)
{
unsigned int loopsPerMillisecond = (SystemCoreClock / 1000) / 3;
Expand Down
Loading