/*
 * Copyright (C) 2020-2021 Aloysius Indrayanto
 *
 * This file is part of the eCxx library, see LICENSE file for the license details.
 */


#ifndef ECXX_PLATFORM_AVR_SPI_INLINE_H
#define ECXX_PLATFORM_AVR_SPI_INLINE_H


namespace eCxx {


//
// According to the datasheets, the position of SPI1's configuration bits are the same as SPI0's
//
#if defined(SPE1) && (SPE != SPE1 || MSTR != MSTR1 || SPR1 != SPR11 || SPR0 != SPR10 || SPIF != SPIF1 || SPI2X != SPI2X1)
#error "SPI1's configuration bits position are not the same as SPI0's"
#endif


//
// Private inline member functions of the AVR SPI class
//
#ifdef ECXX_AVR_HAVE_MULTIPLE_SPI_INTERFACES

inline SPI::SPI(
             uint8_t  pinSet,
    volatile uint8_t* SPCR_,
    volatile uint8_t* SPDR_,
    volatile uint8_t* SPSR_
)
: _pinSet(pinSet)
, _SPCR  (SPCR_ )
, _SPDR  (SPDR_ )
, _SPSR  (SPSR_ )
{}

#endif


} // namespace eCxx


#endif
