Commit 83346aee authored by Gunter Windau's avatar Gunter Windau
Browse files

more lslder_uni

parent 1a88cb54
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -25,15 +25,15 @@
#include <wiringPi.h>
#include "led.h"
//#define DEBUG
#define DEBUG
using namespace lsl;
#ifdef LSLDER_1CHAN
// 1 channel portable version without LEDs
const int ngpio = 8;
const int gpioinp[ngpio] = { 12, 7, 8, 25, 24, 23, 18, 15 };
const int ngpio = 1;
const int gpioinp[ngpio] = { 8 };
const int *ledgpio = 0;
const int nled = 0;
......@@ -67,6 +67,13 @@ void gpioInterrupt(int channel)
{
std::lock_guard<std::mutex> guard(lsl_mutex);
#ifdef DEBUG
std::cout
<< "Interrupt on channel " << channel
<< " (GPIO " << gpioinp[channel] << ")"
<< std::endl;
#endif
static int edge=1;
outlet[channel]->push_sample(&edge);
ledtimer[channel]=ledtime;
......@@ -79,7 +86,7 @@ void gpioInterrupt(int channel)
void handleLeds()
{
for (int i=0; i<ngpio; i++)
for (int i=0; (i<ngpio) && (i<nled); i++)
{
if (ledtimer[i] > 0) {
if (!ledstatus[i]) {
......@@ -96,7 +103,7 @@ void handleLeds()
ledstatus[i]=0;
}
}
}
}
}
......@@ -142,7 +149,8 @@ void gpioISR_7()
typedef void(*gpioISR)();
gpioISR ISR[8] = { gpioISR_1, };
gpioISR ISR[] = { gpioISR_0, gpioISR_1, gpioISR_2, gpioISR_3,
gpioISR_4, gpioISR_5, gpioISR_6, gpioISR_7 };
int main(int argc, char* argv[]) {
piHiPri(99); // shortcut for running at real time priority
......@@ -176,19 +184,15 @@ int main(int argc, char* argv[]) {
// The 4N35 optocoupler in the input circuit inverts the signal, we want to
// detect rising edges in the input signal, so here we program INT_EDGE_FALLING.
wiringPiISR(15, INT_EDGE_FALLING, &gpioISR_0);
wiringPiISR(18, INT_EDGE_FALLING, &gpioISR_1);
wiringPiISR(23, INT_EDGE_FALLING, &gpioISR_2);
wiringPiISR(24, INT_EDGE_FALLING, &gpioISR_3);
wiringPiISR(25, INT_EDGE_FALLING, &gpioISR_4);
wiringPiISR(8, INT_EDGE_FALLING, &gpioISR_5);
wiringPiISR(7, INT_EDGE_FALLING, &gpioISR_6);
wiringPiISR(12, INT_EDGE_FALLING, &gpioISR_7);
for (int i=0; i<ngpio; i++)
{
wiringPiISR(gpioinp[i], INT_EDGE_FALLING, ISR[i]);
}
// do this forever
while(true) {
std::this_thread::sleep_for(std::chrono::milliseconds(20));
handleLeds();
std::this_thread::sleep_for(std::chrono::milliseconds(20));
handleLeds();
}
return 0;
}
......
#!/bin/bash
#run this as root
cd /home/pi/firmware/lslder
export LD_LIBRARY_PATH=../labstreaminglayer/build/LSL/liblsl
./lslder_1chan
#!/bin/bash
#run this as root
cd /home/pi/firmware/lslder
export LD_LIBRARY_PATH=../labstreaminglayer/build/LSL/liblsl
./lslder_1chan
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment