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 PIN01 ((char *) "1\n")
#define PIN12 12 #define PIN12 ((char *) "12\n")
#define PIN11 11 #define PIN11 ((char *) "11\n")
#define PIN06 6 #define PIN06 ((char *) "6\n")
#define IN ((const unsigned char *)"in\n") #define IN ((char *)"in\n")
#define OUT ((const unsigned char *)"out\n") #define OUT ((char *)"out\n")
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
int reserve(char gpioPort) int reserve(char* gpioPort)
{ {
int fd; int fd;
char buffer[2]; 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); perror(NULL);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@@ -45,6 +48,6 @@ int inOut(char gpioPort, char * inOut)
int main() int main()
{ {
reserve(PIN06);
return 0; return 0;
} }