mstroh76 hace 6 meses
padre
commit
783d95962f
Se han modificado 3 ficheros con 14 adiciones y 15 borrados
  1. +1
    -2
      gpio/gpio.c
  2. +11
    -11
      wiringPi/pseudoPins.c
  3. +2
    -2
      wiringPi/wiringSerial.c

+ 1
- 2
gpio/gpio.c Ver fichero

@@ -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);


+ 11
- 11
wiringPi/pseudoPins.c Ver fichero

@@ -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;


+ 2
- 2
wiringPi/wiringSerial.c Ver fichero

@@ -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");
}
}



Cargando…
Cancelar
Guardar