This document describes an AVR microcontroller GPIO driver. It defines data types for pin and port directions. It then lists 6 GPIO functions: to set up pin/port directions, write to/read from pins/ports. Each function is described in detail, including its inputs, return value, and purpose of controlling individual pins and entire ports as inputs/outputs. The document is authored by Eng. Mohamed Tarek and provides his contact details and links to additional resources.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
49 views11 pages
GPIO Driver
This document describes an AVR microcontroller GPIO driver. It defines data types for pin and port directions. It then lists 6 GPIO functions: to set up pin/port directions, write to/read from pins/ports. Each function is described in detail, including its inputs, return value, and purpose of controlling individual pins and entire ports as inputs/outputs. The document is authored by Eng. Mohamed Tarek and provides his contact details and links to additional resources.
GPIO_PinDirectionType direction) ▪ Inputs: • port_num: ID for the port number. • pin_num: ID for the pin number. • direction: The required direction for this pin its value should be PIN_INPUT or PIN_OUTPUT ▪ Return Value: void ▪ Description: • Setup the direction of the required pin input/output. • If the input port number or pin number are not correct, The function will not handle the request.
▪ Inputs: • port_num: ID for the port number. • pin_num: ID for the pin number. • value: value to be written on this pin it should be LOGIC_HIGH or LOGIC_LOW ▪ Return Value: void ▪ Description: • Write the value Logic High or Logic Low on the required pin. • If the input port number or pin number are not correct, The function will not handle the request. • If the pin is input, this function will enable/disable the internal pull-up resistor.
▪ Inputs: • port_num: ID for the port number. • pin_num: ID for the pin number. ▪ Return Value: pin value it should be LOGIC_HIGH or LOGIC_LOW ▪ Description: • Read and return the value for the required pin, it should be Logic High or Logic Low. • If the input port number or pin number are not correct, The function will return Logic Low.
▪ Inputs: • port_num: ID for the port number. • direction: The required direction for all port its value should be PORT_INPUT or PORT_OUTPUT ▪ Return Value: void ▪ Description: • Setup the direction of the required port all pins input/output. • If the direction value is PORT_INPUT all pins in this port should be input pins. • If the direction value is PORT_OUTPUT all pins in this port should be output pins. • If the input port number is not correct, The function will not handle the request.
▪ Inputs: • port_num: ID for the port number. • value: value to be written on all port pins. ▪ Return Value: void ▪ Description: • Write the value on the required port. • If any pin in the port is output pin the value will be written. • If any pin in the port is input pin this will activate/deactivate the internal pull-up resistor. • If the input port number is not correct, The function will not handle the request.
▪ Inputs: • port_num: ID for the port number. ▪ Return Value: value for all the pins on this port. ▪ Description: • Read and return the value of the required port. • If the input port number is not correct, The function will return ZERO value.