first upload
This commit is contained in:
29
Core/Src/readpin.c
Normal file
29
Core/Src/readpin.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "gpio.h"
|
||||
#include "main.h"
|
||||
|
||||
unsigned char ReadPin(void)
|
||||
{
|
||||
unsigned char pin = 0x00;
|
||||
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_0) == GPIO_PIN_SET)
|
||||
{
|
||||
pin = pin+1;
|
||||
}
|
||||
pin = pin*2;
|
||||
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_1) == GPIO_PIN_SET)
|
||||
{
|
||||
pin = pin+1;
|
||||
}
|
||||
pin = pin*2;
|
||||
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_2) == GPIO_PIN_SET)
|
||||
{
|
||||
pin = pin+1;
|
||||
}
|
||||
pin = pin*2;
|
||||
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_3) == GPIO_PIN_SET)
|
||||
{
|
||||
pin = pin+1;
|
||||
}
|
||||
pin = pin*2;
|
||||
|
||||
return pin;
|
||||
}
|
||||
Reference in New Issue
Block a user