Embedded C Firmware Library : Arduino / Atmega328p
1
Register Level Embedded C Hardware Abstraction Library for AVR ATmega48A/PA/88A/PA/168A/PA/328/P or Arduino UNO/NANO/MINI
|
Library for using GPIO as Digital I/O. More...
#include <avr/io.h>
Go to the source code of this file.
Macros | |
GPIO_MODE | |
Options for GPIO Operation Mode | |
#define | GPIO_MODE_OUTPUT 0x00 |
#define | GPIO_MODE_TRI_STATE 0x02 |
#define | GPIO_MODE_INPUT_WITH_PULL_UP 0x01 |
#define | GPIO_MODE_INPUT_WITHOUT_PULL_UP 0x02 |
GPIO_PIN_STATE | |
Options for Digital I/O Pin State | |
#define | LOW 0x00 |
#define | HIGH 0x01 |
#define | TOGGLE 0x02 |
GPIO_PORT_DATA_REGISTER | |
Options for GPIO Port Data Register | |
#define | PB &PORTB |
#define | PC &PORTC |
#define | PD &PORTD |
GPIO_PORT_BIT_MASK | |
Options for GPIO Port Bit Mask | |
#define | P0 (1<<0) |
#define | P1 (1<<1) |
#define | P2 (1<<2) |
#define | P3 (1<<3) |
#define | P4 (1<<4) |
#define | P5 (1<<5) |
#define | P6 (1<<6) |
#define | P7 (1<<7) |
#define | ALL_PINS 0xFF |
GPIO_ARDUINO_PINS | |
Options for GPIO Digital I/O Pin in Arduino Style | |
#define | D0 PD,P0 |
#define | D1 PD,P1 |
#define | D2 PD,P2 |
#define | D3 PD,P3 |
#define | D4 PD,P4 |
#define | D5 PD,P5 |
#define | D6 PD,P6 |
#define | D7 PD,P7 |
#define | D8 PB,P0 |
#define | D9 PB,P1 |
#define | D10 PB,P2 |
#define | D11 PB,P3 |
#define | D12 PB,P4 |
#define | D13 PB,P5 |
#define | D14 PC,P0 |
#define | D15 PC,P1 |
#define | D16 PC,P2 |
#define | D17 PC,P3 |
#define | D18 PC,P4 |
#define | D19 PC,P5 |
#define | A0 PC,P0 |
#define | A1 PC,P1 |
#define | A2 PC,P2 |
#define | A3 PC,P3 |
#define | A4 PC,P4 |
#define | A5 PC,P5 |
Functions | |
GPIO_GLOBAL_PULL_UP_CONTROL | |
Public Functions to Control Global GPIO Pull Up | |
void | GPIO_DisableGlobalPullUp () |
Public Function to Disable Global Pull Up. More... | |
void | GPIO_EnableGlobalPullUp () |
Public Function to Enable Global Pull Up. More... | |
GPIO_CONFIGURATION | |
Public Functions to Configure GPIO as Digital I/O | |
void | GPIO_Init (volatile uint8_t *Port, uint8_t Pin, uint8_t PinMode) |
Public Function to Configure and Initialize Digital I/O Pin. More... | |
void | GPIO_InitPin (uint8_t Pin, uint8_t PinMode) |
Public Function to Configure and Initialize Digital I/O Pin. More... | |
void | GPIO_DeInit (volatile uint8_t *Port, uint8_t Pin) |
Public Function to De-Initialize Digital I/O Pin. More... | |
void | GPIO_DeInitPin (uint8_t Pin) |
Public Function to De-Initialize Digital I/O Pin. More... | |
GPIO_PIN_READ_WRITE | |
Public Functions to Read and Write Digital I/O Pin | |
uint8_t | GPIO_Read (volatile uint8_t *Port, uint8_t Pin) |
Public Function to Read Digital I/O Pin. More... | |
uint8_t | GPIO_ReadPin (uint8_t Pin) |
Public Function to Read Digital I/O Pin. More... | |
void | GPIO_Write (volatile uint8_t *Port, uint8_t Pin, uint8_t PinState) |
Public Function to Write Output Value Digital I/O Pin. More... | |
void | GPIO_Toggle (volatile uint8_t *Port, uint8_t Pin) |
Public Function to Toggle Output Value of Digital I/O Pin. More... | |
void | GPIO_WritePinLow (uint8_t Pin) |
Public Function to Write Output Value of Digital I/O Pin to LOW. More... | |
void | GPIO_WritePinHigh (uint8_t Pin) |
Public Function to Write Output Value of Digital I/O Pin to HIGH. More... | |
void | GPIO_WritePinToggle (uint8_t Pin) |
Public Function to Write Output Value of Digital I/O Pin to TOGGLE. More... | |
Library for using GPIO as Digital I/O.
Created: 08-08-2020 06:12:10 PM Author : Arnab Kumar Das Website: www.ArnabKumarDas.com Microcontroller Supported: ATmega48A/PA/88A/PA/168A/PA/328/P or Arduino UNO/NANO/MINI +-\/-+ PC6 1| |28 PC5 (A5/ADC5) RXD (D0) PD0 2| |27 PC4 (A4/ADC4) TXD (D1) PD1 3| |26 PC3 (A3/ADC3) (D2) PD2 4| |25 PC2 (A2/ADC2) PWM (D3) PD3 5| |24 PC1 (A1/ADC1) XCK (D4) PD4 6| |23 PC0 (A0/ADC0) VCC 7| |22 GND GND 8| |21 AREF PB6 9| |20 AVCC PB7 10| |19 PB5 (D13) PWM (D5) PD5 11| |18 PB4 (D12) PWM (D6) PD6 12| |17 PB3 (D11) PWM (D7) PD7 13| |16 PB2 (D10) PWM (D8) PB0 14| |15 PB1 (D9) PWM +----+
#define GPIO_MODE_OUTPUT 0x00 |
Sets the GPIO Mode of Operation to : Output
#define GPIO_MODE_TRI_STATE 0x02 |
Sets the GPIO Mode of Operation to : Tri-state (Hi-Z)
#define GPIO_MODE_INPUT_WITH_PULL_UP 0x01 |
Sets the GPIO Mode of Operation to : Input with Internal Pull Up
#define GPIO_MODE_INPUT_WITHOUT_PULL_UP 0x02 |
Sets the GPIO Mode of Operation to : Input without Internal Pull Up
#define LOW 0x00 |
Sets the GPIO Pin State to : Output LOW / 0V / GND
#define HIGH 0x01 |
Sets the GPIO Pin State to : Output HIGH / ~5V / VCC
#define TOGGLE 0x02 |
Sets the GPIO Pin State to : Toggle the Output Level
|
inline |
Public Function to Disable Global Pull Up.
|
inline |
Public Function to Enable Global Pull Up.
|
inline |
Public Function to Configure and Initialize Digital I/O Pin.
[in] | Port | : Memory Address of Data Register PORTx of I/O Port |
[in] | Pin | : Bit Mask of Data Register PORTx |
[in] | PinMode | : Digital I/O Pin Operation Mode |
|
inline |
Public Function to Configure and Initialize Digital I/O Pin.
[in] | Pin | : Digital I/O Pin Number 0 ... 19 |
[in] | PinMode | : Digital I/O Pin Operation Mode |
|
inline |
Public Function to De-Initialize Digital I/O Pin.
[in] | Port | : Memory Address of Data Register PORTx of I/O Port |
[in] | Pin | : Bit Mask of Data Register PORTx |
|
inline |
Public Function to De-Initialize Digital I/O Pin.
[in] | Pin | : Digital I/O Pin Number 0 ... 19 |
|
inline |
Public Function to Read Digital I/O Pin.
[in] | Port | : Memory Address of Data Register PORTx of I/O Port |
[in] | Pin | : Bit Mask of Data Register PORTx |
|
inline |
Public Function to Read Digital I/O Pin.
[in] | Pin | : Digital I/O Pin Number 0 ... 19 |
|
inline |
Public Function to Write Output Value Digital I/O Pin.
[in] | Port | : Memory Address of Data Register PORTx of I/O Port |
[in] | Pin | : Bit Mask of Data Register PORTx |
[in] | PinState | : Digital I/O Pin State |
|
inline |
Public Function to Toggle Output Value of Digital I/O Pin.
[in] | Port | : Memory Address of Data Register PORTx of I/O Port |
[in] | Pin | : Bit Mask of Data Register PORTx |
|
inline |
Public Function to Write Output Value of Digital I/O Pin to LOW.
[in] | Pin | : Digital I/O Pin Number 0 ... 19 |
|
inline |
Public Function to Write Output Value of Digital I/O Pin to HIGH.
[in] | Pin | : Digital I/O Pin Number 0 ... 19 |
|
inline |
Public Function to Write Output Value of Digital I/O Pin to TOGGLE.
[in] | Pin | : Digital I/O Pin Number 0 ... 19 |