This commit is contained in:
mstroh76
2024-05-03 15:15:20 +02:00
parent 95ba7fa380
commit 783d95962f
3 changed files with 14 additions and 15 deletions

View File

@@ -610,7 +610,6 @@ void printgpioflush(const char* text) {
void printgpio(const char* text) {
if (gpioDebug) {
printf("%s", text);
fflush(stdout);
}
}
@@ -660,7 +659,7 @@ void doWfi (int argc, char *argv [])
exit (1) ;
}
printgpio("wait for interrupt function call \n");
printgpio("wait for interrupt function call\n");
for (int Sec=0; Sec<timeoutSec; ++Sec) {
printgpioflush(".");
delay (999);

View File

@@ -58,10 +58,10 @@ static int myAnalogRead(struct wiringPiNodeStruct *node, int pin)
static void myAnalogWrite(struct wiringPiNodeStruct *node, int pin, int value)
{
int *ptr = (int *)(intptr_t)node->data0;
int myPin = pin - node->pinBase;
int *ptr = (int *)(intptr_t)node->data0;
int myPin = pin - node->pinBase;
*(ptr + myPin) = value;
*(ptr + myPin) = value;
}
@@ -79,25 +79,25 @@ int pseudoPinsSetup(const int pinBase)
node = wiringPiNewNode(pinBase, PSEUDO_PINS);
if (node == NULL) {
perror("Error creating new wiringPi node");
return FALSE;
fprintf(stderr, "Error creating new wiringPi node");
return FALSE;
}
node->fd = shm_open(SHARED_NAME, O_CREAT | O_RDWR, 0666);
if (node->fd < 0) {
perror("Error opening shared memory");
return FALSE;
perror("Error opening shared memory");
return FALSE;
}
if (ftruncate(node->fd, PSEUDO_PINS * sizeof(int)) < 0) {
perror("Error resizing shared memory");
return FALSE;
perror("Error resizing shared memory");
return FALSE;
}
ptr = mmap(NULL, PSEUDO_PINS * sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, node->fd, 0);
if (ptr == MAP_FAILED) {
perror("Error mapping shared memory");
return FALSE;
perror("Error mapping shared memory");
return FALSE;
}
node->data0 = (unsigned int)(uintptr_t)ptr;

View File

@@ -157,7 +157,7 @@ void serialPutchar(const int fd, const unsigned char c)
{
ssize_t bytes_written = write(fd, &c, 1);
if (bytes_written != 1) {
perror("Error writing to file descriptor");
perror("Error writing to file descriptor");
}
}
@@ -173,7 +173,7 @@ void serialPuts(const int fd, const char *s)
size_t len = strlen(s);
ssize_t bytes_written = write(fd, s, len);
if (bytes_written != (ssize_t)len) {
perror("Error writing to file descriptor");
perror("Error writing to file descriptor");
}
}