Files
BloomPatched/src/Targets/Microchip/AVR/AVR8/PadDescriptor.hpp
Nav 571211b337 Renamed part description files to target description files.
Introduced a generic target description file class with an AVR8 derivation.
Moved AVR8 target description files
2021-05-31 01:42:18 +01:00

43 lines
1.5 KiB
C++

#pragma once
#include <string>
#include <cstdint>
#include <optional>
namespace Bloom::Targets::Microchip::Avr::Avr8Bit
{
/**
* Pin configurations for AVR8 targets may vary across target variants. This is why we must differentiate a pin
* to a pad. A pin is mapped to a pad, but this mapping is variant specific. For example, pin 4 on
* the ATmega328P-PN (DIP variant) is mapped to a GPIO pad (PORTD/PIN2), but on the QFN variant (ATmega328P-MN),
* pin 4 is mapped to a GND pad.
*
* PadDescriptor describes a single pad on an AVR8 target. On target configuration, PadDescriptors are
* generated from the AVR8 target description file. These descriptors are mapped to pad names.
* See Avr8::loadPadDescriptors() for more.
*/
struct PadDescriptor
{
std::string name;
std::optional<std::uint8_t> gpioPinNumber;
/**
* AVR8 GPIO pins can be manipulated by writing to an IO register address. The gpioPortAddress member
* holds this address.
*/
std::optional<std::uint16_t> gpioPortSetAddress;
std::optional<std::uint16_t> gpioPortInputAddress;
std::optional<std::uint16_t> gpioPortClearAddress;
/**
* The data direction of a pin is configured via a data direction register (DDR), which, like the
* gpioPortSetAddress, is an IO register.
*/
std::optional<std::uint16_t> ddrSetAddress;
std::optional<std::uint16_t> ddrClearAddress;
};
}