ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
Loading...
Searching...
No Matches
ACDC_GPIO.h
Go to the documentation of this file.
1
11#ifndef __ACDC_GPIO_H
12#define __ACDC_GPIO_H
13
14#include "stm32f1xx.h"
15#include "ACDC_stdint.h"
16
17#define GPIO_PIN_0 ((uint16_t)0x0001)
18#define GPIO_PIN_1 ((uint16_t)0x0002)
19#define GPIO_PIN_2 ((uint16_t)0x0004)
20#define GPIO_PIN_3 ((uint16_t)0x0008)
21#define GPIO_PIN_4 ((uint16_t)0x0010)
22#define GPIO_PIN_5 ((uint16_t)0x0020)
23#define GPIO_PIN_6 ((uint16_t)0x0040)
24#define GPIO_PIN_7 ((uint16_t)0x0080)
25#define GPIO_PIN_8 ((uint16_t)0x0100)
26#define GPIO_PIN_9 ((uint16_t)0x0200)
27#define GPIO_PIN_10 ((uint16_t)0x0400)
28#define GPIO_PIN_11 ((uint16_t)0x0800)
29#define GPIO_PIN_12 ((uint16_t)0x1000)
30#define GPIO_PIN_13 ((uint16_t)0x2000)
31#define GPIO_PIN_14 ((uint16_t)0x4000)
32#define GPIO_PIN_15 ((uint16_t)0x8000)
33#define GPIO_PIN_All ((uint16_t)0xFFFF)
35#define GPIO_MODE_INPUT ((uint16_t)0b00)
36#define GPIO_MODE_OUTPUT_SPEED_2MHz ((uint16_t)0b10)
37#define GPIO_MODE_OUTPUT_SPEED_10MHz ((uint16_t)0b01)
38#define GPIO_MODE_OUTPUT_SPEED_50MHz ((uint16_t)0b11)
40#define GPIO_CNF_OUTPUT_PUSH_PULL ((uint16_t)0b00)
41#define GPIO_CNF_OUTPUT_OPEN_DRAIN ((uint16_t)0b01)
42#define GPIO_CNF_OUTPUT_AF_PUSH_PULL ((uint16_t)0b10)
43#define GPIO_CNF_OUTPUT_AF_OPEN_DRAIN ((uint16_t)0b11)
45#define GPIO_CNF_INPUT_ANALOG ((uint16_t)0b000)
46#define GPIO_CNF_INPUT_FLOATING ((uint16_t)0b001)
47#define GPIO_CNF_INPUT_PULLDOWN ((uint16_t)0b010)
48#define GPIO_CNF_INPUT_PULLUP ((uint16_t)0b110)
55void GPIO_PinDirection(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN, uint8_t GPIO_MODE, uint8_t GPIO_CNF);
56
60void GPIO_Deinit(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN);
61
66void GPIO_Write(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN, uint16_t GPIO_VALUE);
67
71void GPIO_Set(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN);
72
76void GPIO_Clear(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN);
77
81void GPIO_Toggle(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN);
82
87uint8_t GPIO_Read(const GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN);
88
93#endif
void GPIO_Write(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN, uint16_t GPIO_VALUE)
Sets the pins output to the value passed into GPIO_VALUE.
Definition ACDC_GPIO.c:59
uint8_t GPIO_Read(const GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN)
Returns the current value of GPIO_PIN on GPIOx.
Definition ACDC_GPIO.c:78
void GPIO_PinDirection(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN, uint8_t GPIO_MODE, uint8_t GPIO_CNF)
Sets the Direction of the Pin to Input/Output (MODE) and the sets its Configuration (CNF) [CAN ONLY S...
Definition ACDC_GPIO.c:28
void GPIO_Toggle(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN)
Toggles the pins output. From 0 -> 1 or 1 -> 0.
Definition ACDC_GPIO.c:74
uint8_t GPIO_GetPinNumber(uint16_t GPIO_PIN)
Returns the Pin number of the GPIO_PIN_#.
Definition ACDC_GPIO.c:83
void GPIO_Clear(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN)
Sets the pins output to LOW or 0.
Definition ACDC_GPIO.c:70
void GPIO_Deinit(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN)
Deinitializes GPIO_PIN on GPIOx back to its reset value.
Definition ACDC_GPIO.c:47
void GPIO_Set(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN)
Sets the pins output to HIGH or 1.
Definition ACDC_GPIO.c:66
Header file for intx_t and uintx_t types.
unsigned short uint16_t
Definition ACDC_stdint.h:15
unsigned char uint8_t
Definition ACDC_stdint.h:14