Hi,
thank you to hacst who helped me to find a solution.
Stephan
- Code: Select all
apt-get install build-essential pkg-config qt5-default libqt5svg5-dev \
libboost-dev libasound2-dev libssl-dev \
libspeechd-dev libzeroc-ice-dev libpulse-dev \
libcap-dev libprotobuf-dev protobuf-compiler \
libogg-dev libavahi-compat-libdnssd-dev libsndfile1-dev \
libg15daemon-client-dev libxi-dev qttools5-dev-tools mesa-common-dev
on raspberry pi2 i had to extend the swap file
- Code: Select all
sudo su -c 'echo "CONF_SWAPSIZE=2048" > /etc/dphys-swapfile'
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
get mumble source
- Code: Select all
git clone https://github.com/mumble-voip/mumble.git
git submodule init
git submodule update
add this line in main.pro
- Code: Select all
LIBS = -lwiringPi -lwiringPiDev
new public slot in MainWindow.h
add it in public slots:
- Code: Select all
void onGpioPoll();
MainWindow.cpp
- Code: Select all
#include <wiringPi.h>
MainWindow.cpp
- Code: Select all
void MainWindow::onGpioPoll() {
static bool pttGpioPrevState = false;
static bool pttGpioState = false;
if (digitalRead(25)==1) {
pttGpioState=true;
}
if (digitalRead(25)==0) {
pttGpioState=false;
}
if (pttGpioState != pttGpioPrevState) {
on_PushToTalk_triggered(pttGpioState, QVariant());
pttGpioPrevState = pttGpioState;
}
QList<ClientUser *> talkingUsers = ClientUser::getTalking();
// For someone else to be talking we have to be connected to the
//server and there must be at least one person talking that isn't ourselves
static bool pttPrev = false;
const bool someoneElseTalking = g.sh && !(talkingUsers.empty() ||
(talkingUsers.size() == 1 && g.uiSession ==
talkingUsers.first()->uiSession));
if (someoneElseTalking) {
if(!pttPrev){
digitalWrite(10, 1);
pttPrev=true;
}
}
if(!someoneElseTalking){
if (pttPrev){
digitalWrite(10, 0);
pttPrev=false;
}
}
}
add the following in MainWindow.cpp in MainWindow::MainWindow(QWidget *p)
- Code: Select all
QTimer *gpioPollingTimer = new QTimer(this);
connect(gpioPollingTimer, SIGNAL(timeout()), this, SLOT(onGpioPoll()));
gpioPollingTimer->start(100); // 100ms polling Intervall
main.cpp
- Code: Select all
#include <wiringPi.h>
main.cpp in the int main(int argc, char **argv) function
- Code: Select all
wiringPiSetupSys();
pinMode(10,OUTPUT);
pinMode(25,INPUT);
Compiling from mumble directory
- Code: Select all
qmake -recursive main.pro CONFIG+="no-g15 no-server" LIBS+="-lwiringPi"
make
you also need a small shell scrip to set gpio pins.
this worked for me:
create file gpio.sh
- Code: Select all
#!/bin/sh
echo "10" > /sys/class/gpio/export
echo "25" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio25/direction
echo "out" > /sys/class/gpio/gpio10/direction
chmod 666 /sys/class/gpio/gpio10/value
chown pi /sys/class/gpio/gpio25/value
chmod 666 /sys/class/gpio/gpio10/direction
chown pi /sys/class/gpio/gpio25/direction
I start the script in /etc/rc.local automatically.
Otherwise you have to start it manually as root after every reboot
sudo ./gpio.sh
Please see to find the correct gpio pin.
http://raspberrypiguide.de/howtos/raspb ... io-how-to/It is GPIO10 and GPIO25 or Wiring 12 and Wiring 6.
73
Stephan, DL4STE