mirror of
https://git.code.sf.net/p/fldigi/fldigi
synced 2026-08-13 17:47:54 -04:00
gpio ptt
* correct gpio export routine
This commit is contained in:
parent
c6e45f66cb
commit
e0f72304d5
1 changed files with 10 additions and 4 deletions
|
|
@ -286,8 +286,14 @@ static const char *gpio_name[] = {
|
|||
void export_gpio(int bcm)
|
||||
{
|
||||
if (bcm < 0 || bcm > 16) return;
|
||||
std::string exec_str = "gpio export ";
|
||||
exec_str.append(gpio_name[bcm]).append(" out");
|
||||
std::string exec_str = "echo ";
|
||||
exec_str.append(gpio_name[bcm]).append(" >/sys/class/gpio/export");
|
||||
gpioEXEC(exec_str);
|
||||
LOG_INFO("%s", exec_str.c_str());
|
||||
// Wait a bit for OS to set file permissions
|
||||
MilliSleep(1);
|
||||
exec_str = "echo 'out' >/sys/class/gpio/gpio";
|
||||
exec_str.append(gpio_name[bcm]).append("/direction");
|
||||
gpioEXEC(exec_str);
|
||||
LOG_INFO("%s", exec_str.c_str());
|
||||
}
|
||||
|
|
@ -295,8 +301,8 @@ void export_gpio(int bcm)
|
|||
void unexport_gpio(int bcm)
|
||||
{
|
||||
if (bcm < 0 || bcm > 16) return;
|
||||
std::string exec_str = "gpio unexport ";
|
||||
exec_str.append(gpio_name[bcm]);
|
||||
std::string exec_str = "echo ";
|
||||
exec_str.append(gpio_name[bcm]).append(" >/sys/class/gpio/unexport");
|
||||
gpioEXEC(exec_str);
|
||||
LOG_INFO("%s", exec_str.c_str());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue