Fix pins.c
This commit is contained in:
parent
41f70bd135
commit
90d2f0dfbf
@ -1,23 +1,24 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "pins.h"
|
#include "pins.h"
|
||||||
|
|
||||||
void setPin(volatile uint8_t *port, unsigned int pin)
|
void setPin(volatile uint8_t *port, unsigned int pin)
|
||||||
{
|
{
|
||||||
*port |= (1 << 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)
|
void unsetPin(volatile uint8_t *port, unsigned int pin)
|
||||||
{
|
{
|
||||||
*port &= ~(1 << 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)
|
void togglePin(volatile uint8_t *port, unsigned int pin)
|
||||||
{
|
{
|
||||||
*port ^= (1 << 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)
|
if ((*port & (1 << pin)) > 0)
|
||||||
printf("on");
|
printf("on");
|
||||||
|
Loading…
Reference in New Issue
Block a user