diff options
-rw-r--r-- | bus.c | 8 | ||||
-rw-r--r-- | dds.c | 2 |
2 files changed, 5 insertions, 5 deletions
@@ -259,7 +259,7 @@ static int gpio_export(unsigned gpio_pin) { FILE* exportfile = fopen(GPIO_SYSFSPATH"/"GPIO_EXPORTNODE, "w"); if (exportfile != NULL) { - fprintf(exportfile, "%d\n", gpio_pin); + fprintf(exportfile, "%u\n", gpio_pin); fclose(exportfile); return 0; } @@ -274,7 +274,7 @@ static int gpio_unexport(unsigned gpio_pin) { FILE* unexportfile = fopen(GPIO_SYSFSPATH"/"GPIO_UNEXPORTNODE, "w"); if (unexportfile != NULL) { - fprintf(unexportfile, "%d\n", gpio_pin); + fprintf(unexportfile, "%u\n", gpio_pin); fclose(unexportfile); return 0; } @@ -288,7 +288,7 @@ static int gpio_unexport(unsigned gpio_pin) static int gpio_changedirection(unsigned gpio_pin, bool out) { char path[PATHLEN]; - snprintf(path, PATHLEN, GPIO_SYSFSPATH"/gpio%d/"GPIO_DIRECTIONNODE, gpio_pin); + snprintf(path, PATHLEN, GPIO_SYSFSPATH"/gpio%u/"GPIO_DIRECTIONNODE, gpio_pin); FILE* directionfile = fopen(path, "w"); if (directionfile != NULL) { if (out) { @@ -305,7 +305,7 @@ static int gpio_changedirection(unsigned gpio_pin, bool out) static void gpio_getvaluenodepath(unsigned gpio_pin, char* buffer) { - snprintf(buffer, PATHLEN, GPIO_SYSFSPATH"/gpio%d/"GPIO_VALUENODE, gpio_pin); + snprintf(buffer, PATHLEN, GPIO_SYSFSPATH"/gpio%u/"GPIO_VALUENODE, gpio_pin); } /* @@ -36,7 +36,7 @@ void dds_setamplitude(float millivolts) char scalebuff[64]; if (read(scalefd, scalebuff, sizeof(scalebuff))) { - sscanf(scalebuff, "%f\n", &scale); + sscanf(scalebuff, "%10f\n", &scale); // the string should be ?.??? but round up the width a bit just in case } if (scale == 0) { |