Fix pins.c

This commit is contained in:
Marco 2022-05-23 21:28:20 +02:00
parent 41f70bd135
commit 90d2f0dfbf

View File

@ -1,23 +1,24 @@
#include <inttypes.h>
#include <stdio.h>
#include "pins.h"
void setPin(volatile uint8_t *port, unsigned int pin)
{
*port |= (1 << pin);
printf("Port %d, Pin %d set\n\r", port, pin);
printf("Port %d, Pin %d set\n\r", (int)port, pin);
}
void unsetPin(volatile uint8_t *port, unsigned int pin)
{
*port &= ~(1 << pin);
printf("Port %d, Pin %d unset\n\r", port, pin);
printf("Port %d, Pin %d unset\n\r", (int)port, pin);
}
void togglePin(volatile uint8_t *port, unsigned int pin)
{
*port ^= (1 << pin);
printf("Port %d, Pin %d toggled to ", port, pin);
printf("Port %d, Pin %d toggled to ", (int)port, pin);
if ((*port & (1 << pin)) > 0)
printf("on");