summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-06-07 22:18:27 +0100
committerTim Redfern <tim@eclectronics.org>2012-06-07 22:18:27 +0100
commitb6d6289b59a13547e9511573d70f412550874268 (patch)
tree9d0bc2c901118874c30ee50d9338dd4d7e04effd /src
parent2a08f731909e8f7d4b319b320ebe227bd46b260a (diff)
fixed direction bug output
Diffstat (limited to 'src')
-rw-r--r--src/overo_gpioout.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/overo_gpioout.c b/src/overo_gpioout.c
index f2eb3ae..b7a5234 100644
--- a/src/overo_gpioout.c
+++ b/src/overo_gpioout.c
@@ -31,7 +31,7 @@ typedef struct overo_gpioout
{
t_object x_obj;
int gpioNum;
- char outfile[32];
+ char outfile[40];
FILE *fs;
int set; //0 or 1
} t_overo_gpioout;
@@ -62,9 +62,9 @@ void *overo_gpioout_new(t_floatarg f)
t_overo_gpioout *x = (t_overo_gpioout *)pd_new(overo_gpioout_class);
int nums[]={144,170,145};
x->gpioNum=nums[min(2,max(0,((int) f)-1))]; //maps switch number to GPIO number
- post("overo_gpoout: using GPIO(%d): switch %d\n",x->gpioNum,min(2,max(1,(int) f)));
+ post("overo_gpoout: using GPIO(%d): switch %d\n",x->gpioNum,min(3,max(1,(int) f)));
sprintf(x->outfile,"/sys/class/gpio/gpio%d/value",x->gpioNum);
- post("outfile: %s\n",x->outfile);
+ //post("outfile: %s\n",x->outfile);
char gpionum[4];
sprintf(gpionum,"%d",x->gpioNum);
@@ -79,16 +79,16 @@ void *overo_gpioout_new(t_floatarg f)
int t=fwrite( gpionum, sizeof(char), 3, x->fs );
fclose(x->fs);
- char dirfile[35];
+ char dirfile[40];
sprintf(dirfile,"/sys/class/gpio/gpio%d/direction",x->gpioNum);
x->fs = fopen(dirfile, "w" );
- t=fwrite( "out", sizeof(char), 4, x->fs );
+ t=fwrite( "out", sizeof(char), 3, x->fs );
fclose(x->fs);
//if ((
x->fs = fopen( x->outfile, "w" );
//) < 0 )
- //{
+ //
// error( "Unable to open outfile" );
// exit( 1 );
//}