#define SWITCH_PTT GPIO_Pin_7
#define SWITCH_SELECT GPIO_Pin_0
#define SWITCH_BACK GPIO_Pin_1
+#define EXT_PTT GPIO_Pin_8
#include <stm32f4xx.h>
#include <stm32f4xx_gpio.h>
GPIO_InitStruct.GPIO_Pin = LED_PWR | LED_PTT | LED_RT | LED_ERR | _CPTT;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
- GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
+ GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOD, &GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = SWITCH_PTT | SWITCH_SELECT | SWITCH_BACK;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;
- GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
+ GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; /* we have our own external pull ups */
- GPIO_Init(GPIOD, &GPIO_InitStruct);
+ GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+ GPIO_InitStruct.GPIO_Pin = EXT_PTT;
+ GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;
+ GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz;
+ GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; /* use internal pull up */
+ GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+
}
void led_pwr(int state) {
return GPIOD->IDR & (1 << 1);
}
+int ext_ptt(void) {
+ return GPIOD->IDR & (1 << 8);
+}
+
/*
FUNCTION: ColorfulRingOfDeath()
AUTHOR..: xenovacivus
\r
iterate_select_state_machine(&ss);\r
\r
- if (switch_ptt()) {\r
-\r
+ if (switch_ptt() || (ext_ptt() == 0)) {\r
+ \r
/* Transmit -------------------------------------------------------------------------*/\r
\r
/* ADC2 is the SM1000 microphone, DAC1 is the modulator signal we send to radio tx */\r
fdmdv_8_to_16_short(dac16k, &dac8k[FDMDV_OS_TAPS_8K], FREEDV_NSAMPLES); \r
dac1_write(dac16k, FREEDV_NSAMPLES_16K);\r
}\r
-\r
if (ss.mode == TONE) {\r
while(dac1_write((short*)aSine, SINE_SAMPLES) == 0);\r
}\r