Add a macro to determine which GPIO pin to use.

This commit is contained in:
David Betz 2015-01-27 09:11:29 -05:00
parent 9959b123d2
commit 33e361a354
1 changed files with 8 additions and 6 deletions

View File

@ -46,6 +46,8 @@
#include "osint.h" #include "osint.h"
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
#include "gpio_sysfs.h" #include "gpio_sysfs.h"
//#define GPIO_PIN GPIO_PIN
#define GPIO_PIN 0
#endif #endif
typedef int HANDLE; typedef int HANDLE;
@ -66,9 +68,9 @@ int use_reset_method(char* method)
else if (strcasecmp(method, "gpio") == 0) else if (strcasecmp(method, "gpio") == 0)
{ {
reset_method = RESET_WITH_GPIO; reset_method = RESET_WITH_GPIO;
gpio_export(17); gpio_export(GPIO_PIN);
gpio_write(17, 0); gpio_write(GPIO_PIN, 0);
gpio_direction(17, 1); gpio_direction(GPIO_PIN, 1);
} }
#endif #endif
else { else {
@ -292,7 +294,7 @@ void serial_done(void)
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
if (reset_method == RESET_WITH_GPIO) if (reset_method == RESET_WITH_GPIO)
{ {
gpio_unexport(17); gpio_unexport(GPIO_PIN);
} }
#endif #endif
} }
@ -384,7 +386,7 @@ static void assert_reset(void)
break; break;
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
case RESET_WITH_GPIO: case RESET_WITH_GPIO:
gpio_write(17, 1); gpio_write(GPIO_PIN, 1);
break; break;
#endif #endif
default: default:
@ -413,7 +415,7 @@ static void deassert_reset(void)
break; break;
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
case RESET_WITH_GPIO: case RESET_WITH_GPIO:
gpio_write(17, 0); gpio_write(GPIO_PIN, 0);
break; break;
#endif #endif
default: default: