Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * GPIO.h
- *
- * Created: 1/28/2020 2:47:28 PM
- * Author: Ahmed
- */
- #ifndef GPIO_H_
- #define GPIO_H_
- #include <stdint.h>
- #define A 0
- #define B 1
- #define C 2
- #define D 3
- #define INPUT 0
- #define OUTPUT 1
- #define HIGH 0xff
- #define LOW 0x00
- #define PORTA 0x3b
- #define PORTB 0x38
- #define PORTC 0x35
- #define PORTD 0x32
- #define PINS_NUMBER 8
- #define PORTS_NUMBER 4
- #define PULLUP_ON 1
- #define PULLUP_OFF 0;
- static const uint8_t Ports_Addresses[PORTS_NUMBER] = {PORTA, PORTB, PORTC, PORTD};
- #define BASE(id, offset) (Ports_Addresses[id] - offset)
- void DIRECTION(uint8_t port, uint8_t pin, uint8_t dir, uint8_t pullup);
- char READ(uint8_t port, uint8_t pin);
- void WRITE(uint8_t port, uint8_t pin, uint8_t data);
- #endif /* GPIO_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement