remove some bugs

This commit is contained in:
Siegfried Kienzle
2017-03-24 16:34:06 +01:00
parent f230a08868
commit b15d09216e

View File

@@ -7,24 +7,27 @@
*
* */
#define PIN01 1
#define PIN12 12
#define PIN11 11
#define PIN06 6
#define IN ((const unsigned char *)"in\n")
#define OUT ((const unsigned char *)"out\n")
#define PIN01 ((char *) "1\n")
#define PIN12 ((char *) "12\n")
#define PIN11 ((char *) "11\n")
#define PIN06 ((char *) "6\n")
#define IN ((char *)"in\n")
#define OUT ((char *)"out\n")
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
int reserve(char gpioPort)
int reserve(char* gpioPort)
{
int fd;
char buffer[2];
printf("%s", gpioPort);
strcpy(buffer, gpioPort );
strcpy(buffer, gpioPort + "\n");
if((fd=open("/sys/class/gpio/export", O_RDWR | O_CREAT | O_TRUNC) == -1) {
if((fd=open("/sys/class/gpio/export", O_RDWR | O_CREAT | O_TRUNC) == -1)) {
perror(NULL);
return EXIT_FAILURE;
}
@@ -45,6 +48,6 @@ int inOut(char gpioPort, char * inOut)
int main()
{
reserve(PIN06);
return 0;
}