|
@@ -1,11 +1,9 @@
|
|
|
-
|
|
|
#include <string.h>
|
|
|
#include <stdio.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <stdbool.h>
|
|
|
#include <sys/types.h>
|
|
|
-#include <wiringPi.h>
|
|
|
-#include <wiringPiSPI.h>
|
|
|
+#include <wiringPi.h>
|
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
#include <errno.h>
|
|
@@ -26,8 +24,8 @@ static pthread_t s_button_threadID;
|
|
|
|
|
|
void isr_function(void)
|
|
|
{
|
|
|
- //DUER_LOGI("isr_function %d\n",digitalRead(BUTTON_GPIO));
|
|
|
- return ;
|
|
|
+ DUER_LOGI("isr_function %d\n",digitalRead(BUTTON_GPIO));
|
|
|
+ return ;
|
|
|
}
|
|
|
|
|
|
int duer_app_is_test_mode(void);
|
|
@@ -44,7 +42,8 @@ static void button_polling_thread()
|
|
|
|
|
|
while(1)
|
|
|
{
|
|
|
- waitForInterrupt(BUTTON_GPIO,100);
|
|
|
+ waitForInterrupt(BUTTON_GPIO, 200);
|
|
|
+ //DUER_LOGI("button_polling_thread %d\n",digitalRead(BUTTON_GPIO));
|
|
|
if((now_state=digitalRead(BUTTON_GPIO))!=old_state)
|
|
|
{
|
|
|
DUER_LOGI("%d %d\n",now_state,old_state);
|
|
@@ -57,7 +56,7 @@ static void button_polling_thread()
|
|
|
{
|
|
|
duer_recorder_test_start(channel_id);
|
|
|
duer_dcs_dialog_cancel();
|
|
|
- duer_media_tone_play("./resources/16.mp3");
|
|
|
+ duer_media_tone_play("./resources/16.wav");
|
|
|
event_record_start();
|
|
|
if(channel_id==1)
|
|
|
{
|
|
@@ -71,7 +70,7 @@ static void button_polling_thread()
|
|
|
else
|
|
|
{
|
|
|
duer_dcs_dialog_cancel();
|
|
|
- duer_media_tone_play("./resources/16.mp3");
|
|
|
+ duer_media_tone_play("./resources/16.wav");
|
|
|
event_record_start();
|
|
|
}
|
|
|
}
|
|
@@ -91,18 +90,17 @@ int button_init(void)
|
|
|
{
|
|
|
if(wiringPiSetup()!=0)
|
|
|
{
|
|
|
- DUER_LOGE("wiringPiSetup fail\n");
|
|
|
- return -1;
|
|
|
+ DUER_LOGE("wiringPiSetup fail\n");
|
|
|
+ return -1;
|
|
|
}
|
|
|
|
|
|
if(pthread_create(&s_button_threadID, NULL, (void *)button_polling_thread, NULL)!=0)
|
|
|
{
|
|
|
- DUER_LOGE("create button thread fail!\n");
|
|
|
- return -1;
|
|
|
+ DUER_LOGE("create button thread fail!\n");
|
|
|
+ return -1;
|
|
|
}
|
|
|
|
|
|
- wiringPiISR(BUTTON_GPIO,INT_EDGE_BOTH,isr_function);
|
|
|
-
|
|
|
+ wiringPiISR(BUTTON_GPIO,INT_EDGE_FALLING,isr_function);
|
|
|
return 0;
|
|
|
}
|
|
|
|