5.6.1 Pin Manager

I/O Port Management and Configuration

5.6.1.1 Introduction

The Mega AVR Pin Manager controls the I/O pins that represent the instances of the PORT peripheral registers. Each PORT instance has up to eight I/O pins. The PORTs are named PORTA, PORTB, PORTC, etc.

5.6.1.2 Supported Device Families

ATmega32x

5.6.1.3 Required header files:

#include"mcc_generated_files/system/pins.h"

5.6.1.4 Module Documentation

5.6.1.4.1 Pins Driver

This file contains the API prototypes and function macros for the Pins driver.

Module description

This file contains the API prototypes and function macros for the Pins driver.

Version: Driver Version 1.0.0
Functions
  • void PIN_MANAGER_Initialize ()

    Initializes the General Purpose Input/Output (GPIO), peripheral I/O pins and related registers.

Function Documentation

PIN_MANAGER_Initialize()

void PIN_MANAGER_Initialize ( )

Initializes the General Purpose Input/Output (GPIO), peripheral I/O pins and related registers.

Parameters:
None.
Returns:

None.

5.6.1.5 File Documentation

5.6.1.5.1 source/pins.c File Reference

This file contains the API implementations for the Pins driver.

#include "../pins.h"

Functions

  • void PIN_MANAGER_Initialize ()

    Initializes the General Purpose Input/Output (GPIO), peripheral I/O pins and related registers.

Detailed Description

This file contains the API implementations for the Pins driver.

Generated Driver File

Version: Driver Version 1.0.0

5.6.1.5.2 source/pins.h File Reference

#include <avr/io.h>
#include "./port.h"

Functions

  • void PIN_MANAGER_Initialize ()

    Initializes the General Purpose Input/Output (GPIO), peripheral I/O pins and related registers.

Macros

Pin Function Macros
Macros for the individual pin functions.
Note:

These sets of macros are generated for all the selected pins in the Pins module.

Detailed Description

Generated Pins Header File

Macro Definition Documentation

IO_PB0_GetValue

#define IO_PB0_GetValue( ) (PINB & (0x1 << 0))

IO_PB0_ResetPullUp

#define IO_PB0_ResetPullUp( ) do { PORTB &= ~0x1; } while(0)

IO_PB0_SetDigitalInput

#define IO_PB0_SetDigitalInput( ) do { DDRB &= ~0x1; } while(0)

IO_PB0_SetDigitalOutput

#define IO_PB0_SetDigitalOutput( ) do { DDRB |= 0x1; } while(0)

IO_PB0_SetHigh

#define IO_PB0_SetHigh( ) do { PORTB |= 0x1; } while(0)

IO_PB0_SetLow

#define IO_PB0_SetLow( ) do { PORTB &= ~0x1; } while(0)

IO_PB0_SetPullUp

#define IO_PB0_SetPullUp( ) do { PORTB |= 0x1; } while(0)

IO_PB0_Toggle

#define IO_PB0_Toggle( ) do { PINB |= 0x1; } while(0)

IO_PB1_GetValue

#define IO_PB1_GetValue( ) (PINB & (0x1 << 1))

IO_PB1_ResetPullUp

#define IO_PB1_ResetPullUp( ) do { PORTB &= ~0x2; } while(0)

IO_PB1_SetDigitalInput

#define IO_PB1_SetDigitalInput( ) do { DDRB &= ~0x2; } while(0)

IO_PB1_SetDigitalOutput

#define IO_PB1_SetDigitalOutput( ) do { DDRB |= 0x2; } while(0)

IO_PB1_SetHigh

#define IO_PB1_SetHigh( ) do { PORTB |= 0x2; } while(0)

IO_PB1_SetLow

#define IO_PB1_SetLow( ) do { PORTB &= ~0x2; } while(0)

IO_PB1_SetPullUp

#define IO_PB1_SetPullUp( ) do { PORTB |= 0x2; } while(0)

IO_PB1_Toggle

#define IO_PB1_Toggle( ) do { PINB |= 0x2; } while(0)

5.6.1.5.3 source/port.h File Reference

This file contains enumerations related to the operation of the Pins driver.

#include "utils/compiler.h"

Detailed Description

This file contains enumerations related to the operation of the Pins driver.

Generated Ports Header File

Version: Driver Version 1.0.0

Enumeration Type Documentation

port_dir

enum port_dir

PORT_DIR_IN
PORT_DIR_OUT
PORT_DIR_OFF