Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostlib: support build-time override of the EN_PIN #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions hostlib/hostLib/platform/rsp/se05x_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#include "ax_reset.h"
#include "se05x_apis.h"

#define EN_PIN 22
#ifndef SE050_EN_PIN
#define SE050_EN_PIN 22
#endif

void axReset_HostConfigure()
{
Expand All @@ -25,7 +27,7 @@ void axReset_HostConfigure()
return;
}
/* Export GPIO pin to toggle */
if (snprintf(buf, sizeof(buf), "%d", EN_PIN) < 0) {
if (snprintf(buf, sizeof(buf), "%d", SE050_EN_PIN) < 0) {
perror("snprintf failed");
return;
}
Expand All @@ -36,7 +38,7 @@ void axReset_HostConfigure()
close(fd);

/* Open direction file to configure GPIO direction */
if (snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/direction", EN_PIN) < 0) {
if (snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/direction", SE050_EN_PIN) < 0) {
perror("snprintf failed");
return;
}
Expand Down Expand Up @@ -72,7 +74,7 @@ void axReset_HostUnconfigure()
return;
}

if (snprintf(buf, sizeof(buf), "%d", EN_PIN) < 0) {
if (snprintf(buf, sizeof(buf), "%d", SE050_EN_PIN) < 0) {
perror("snprintf error");
return;
}
Expand Down Expand Up @@ -107,7 +109,7 @@ void axReset_PowerDown()
int fd;
char buf[50];
char logic[10];
if (snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/value", EN_PIN) < 0) {
if (snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/value", SE050_EN_PIN) < 0) {
perror("snprintf failed");
return;
}
Expand Down Expand Up @@ -140,7 +142,7 @@ void axReset_PowerUp()
int fd;
char buf[50];
char logic[10];
if (snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/value", EN_PIN) < 0) {
if (snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/value", SE050_EN_PIN) < 0) {
perror("snprintf failed");
return;
}
Expand Down