class::hal::PinAssignment

class hal::PinAssignment
  : public api::InfoObject

The Pin Assignment class is a template class for manipulating pin assignment data structures.

The following is an example of how to configure the SPI using the hal::SpiPinAssignment class (which inherits this class).

#include <sapi/hal.hpp>

SpiPinAssignment pin_assignment;
pin_assignment->mosi = mcu_pin(2,0);
pin_assignment->sck = mcu_pin(2,0);
pin_assignment->miso = mcu_pin(2,0);

Spi spi(0);

spi.init(
 Spi::FLAG_SET_MASTER|Spi::FLAG_IS_MODE0|Spi::FLAG_IS_FORMAT_SPI,
 10000000, 8, pin_assignment
);

Summary

[PinAssignment](#classhal_1_1_pin_assignment_1aa7ca805dac4e63aadc3450c3a28d58b0)()

void assign(

const pin_assignment_type & pin_assignment
)

void clear()

void copy(

pin_assignment_type & pin_assignment
)

u32 count() const

pin_assignment_type * operator ->()

[operator const pin_assignment_type *](#classhal_1_1_pin_assignment_1ac4329e79b063694b3367ed595d1e8f1b)() *const*

u32 size() const

Members

PinAssignment()

Contructs a new pin assignment object.

All pin assignments are “cleared” when created meaning all ports and pins are set to 0xff so that any access to the pin assignment info will be ignored.


void assign(

const pin_assignment_type & pin_assignment
)

Assigns the value of the pin assignment as specified.

Parameters

  • pin_assignment A reference to the pin assignment which will be assigned to this object

void clear()

Clears the pin assignment data structure (assigns 0xff to all ports/pins.


void copy(

pin_assignment_type & pin_assignment
)

Copies the pin assignment information to the object specified.

Parameters

  • pin_assignment A reference to the destination pin assignment data

u32 count() const

Returns the number of pins in the pin assignment data structure.


pin_assignment_type * operator ->()

Provides read and write access to the members of the pin assignment structure.


operator const pin_assignment_type *() const

Returns a const pointer to the pin assignment data structure.

This operator makes it easy to pass pin assignment data to set_attr() methods.


u32 size() const

Returns the number of bytes in the data structure.


X

Thanks for Coming!

Subscribe to news and updates