support for ext_ptt, compiles OKbut not tested
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 3 Oct 2014 03:24:17 +0000 (03:24 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 3 Oct 2014 03:24:17 +0000 (03:24 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1871 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/stm32/inc/sm1000_leds_switches.h
codec2-dev/stm32/src/sm1000_leds_switches.c
codec2-dev/stm32/src/sm1000_main.c

index c5ba89535c45fb86fd54ef056f6673d39af5d00c..b98f74df6629ec1ffc2770aa3f8ef687c9b894cd 100644 (file)
@@ -39,6 +39,7 @@ void not_cptt(int state);
 int switch_ptt(void);
 int switch_select(void);
 int switch_back(void);
+int ext_ptt(void);
 
 void ColorfulRingOfDeath(int code);
 
index f936ca22d4c13a532e7cc6130d171a73ac8cc4ae..e630cf070c0f014ff1fe93ae8889765fb76cdcd5 100644 (file)
@@ -33,6 +33,7 @@
 #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>
@@ -47,7 +48,7 @@ void sm1000_leds_switches_init(void) {
 
     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);                
@@ -56,9 +57,17 @@ void sm1000_leds_switches_init(void) {
 
     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) {
@@ -108,6 +117,10 @@ int switch_back(void) {
     return GPIOD->IDR & (1 << 1);
 }
 
+int ext_ptt(void) {
+    return GPIOD->IDR & (1 << 8);
+}
+
 /*
   FUNCTION: ColorfulRingOfDeath()
   AUTHOR..: xenovacivus
index 72b40cc96de67030f1cae81269f7a7948307be03..1f719f26fde1db3847a15fbcaa72487e0a3d4d26 100644 (file)
@@ -103,8 +103,8 @@ int main(void) {
         \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
@@ -125,7 +125,6 @@ int main(void) {
                     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