stateMachine/lib/ssiSpi/ssiSpi.h
inline static void beginTransaction(SPISettings settings) {
		if (interruptMasksUsed) {
			__disable_irq();
			if (interruptMasksUsed & 0x01) {
				interruptSave[0] = NVIC_ICER0 & interruptMask[0];
				NVIC_ICER0 = interruptSave[0];
			}
			#if NVIC_NUM_INTERRUPTS > 32
			if (interruptMasksUsed & 0x02) {
				interruptSave[1] = NVIC_ICER1 & interruptMask[1];
				NVIC_ICER1 = interruptSave[1];
			}
			#endif
			#if NVIC_NUM_INTERRUPTS > 64 && defined(NVIC_ISER2)
			if (interruptMasksUsed & 0x04) {
				interruptSave[2] = NVIC_ICER2 & interruptMask[2];
				NVIC_ICER2 = interruptSave[2];
			}
			#endif
			#if NVIC_NUM_INTERRUPTS > 96 && defined(NVIC_ISER3)
			if (interruptMasksUsed & 0x08) {
				interruptSave[3] = NVIC_ICER3 & interruptMask[3];
				NVIC_ICER3 = interruptSave[3];
			}
			#endif
			__enable_irq();
		}
		#if 0
		if (inTransactionFlag) {
			pinMode(SPI_TRANSACTION_MISMATCH_LED, OUTPUT);
			digitalWrite(SPI_TRANSACTION_MISMATCH_LED, HIGH);
		}
		inTransactionFlag = 1;
		#endif
		if (SPI0_CTAR0 != settings.ctar) {
			SPI0_MCR = SPI_MCR_MDIS | SPI_MCR_HALT | SPI_MCR_PCSIS(0x1F);
			SPI0_CTAR0 = settings.ctar;
			SPI0_CTAR1 = settings.ctar| SPI_CTAR_FMSZ(8);
			SPI0_MCR = SPI_MCR_MSTR | SPI_MCR_PCSIS(0x1F);
		}
	}
// Before using SPI.transfer() or asserting chip select pins,
// this function is used to gain exclusive access to the SPI bus
// and configure the correct settings.
Before using SPI.transfer() or asserting chip select pins,
this function is used to gain exclusive access to the SPI bus
and configure the correct settings.
Before using SPI . transfer () or asserting chip select pins this function is used to gain exclusive access to the SPI bus and configure the correct settings .
inline static void beginTransaction(SPISettings settings) {
		if (interruptMasksUsed) {
			__disable_irq();
			if (interruptMasksUsed & 0x01) {
				interruptSave[0] = NVIC_ICER0 & interruptMask[0];
				NVIC_ICER0 = interruptSave[0];
			}
			#if NVIC_NUM_INTERRUPTS > 32
			if (interruptMasksUsed & 0x02) {
				interruptSave[1] = NVIC_ICER1 & interruptMask[1];
				NVIC_ICER1 = interruptSave[1];
			}
			#endif
			#if NVIC_NUM_INTERRUPTS > 64 && defined(NVIC_ISER2)
			if (interruptMasksUsed & 0x04) {
				interruptSave[2] = NVIC_ICER2 & interruptMask[2];
				NVIC_ICER2 = interruptSave[2];
			}
			#endif
			#if NVIC_NUM_INTERRUPTS > 96 && defined(NVIC_ISER3)
			if (interruptMasksUsed & 0x08) {
				interruptSave[3] = NVIC_ICER3 & interruptMask[3];
				NVIC_ICER3 = interruptSave[3];
			}
			#endif
			__enable_irq();
		}
		#if 0
		if (inTransactionFlag) {
			pinMode(SPI_TRANSACTION_MISMATCH_LED, OUTPUT);
			digitalWrite(SPI_TRANSACTION_MISMATCH_LED, HIGH);
		}
		inTransactionFlag = 1;
		#endif
		if (SPI0_CTAR0 != settings.ctar) {
			SPI0_MCR = SPI_MCR_MDIS | SPI_MCR_HALT | SPI_MCR_PCSIS(0x1F);
			SPI0_CTAR0 = settings.ctar;
			SPI0_CTAR1 = settings.ctar| SPI_CTAR_FMSZ(8);
			SPI0_MCR = SPI_MCR_MSTR | SPI_MCR_PCSIS(0x1F);
		}
	}
inline static void beginTransaction ( SPISettings settings ) { if ( interruptMasksUsed ) { __disable_irq ( ) ; if ( interruptMasksUsed & 0x01 ) { interruptSave [ 0 ] = NVIC_ICER0 & interruptMask [ 0 ] ; NVIC_ICER0 = interruptSave [ 0 ] ; } #if NVIC_NUM_INTERRUPTS > 32 if ( interruptMasksUsed & 0x02 ) { interruptSave [ 1 ] = NVIC_ICER1 & interruptMask [ 1 ] ; NVIC_ICER1 = interruptSave [ 1 ] ; } #endif #if NVIC_NUM_INTERRUPTS > 64 && defined ( NVIC_ISER2 ) if ( interruptMasksUsed & 0x04 ) { interruptSave [ 2 ] = NVIC_ICER2 & interruptMask [ 2 ] ; NVIC_ICER2 = interruptSave [ 2 ] ; } #endif #if NVIC_NUM_INTERRUPTS > 96 && defined ( NVIC_ISER3 ) if ( interruptMasksUsed & 0x08 ) { interruptSave [ 3 ] = NVIC_ICER3 & interruptMask [ 3 ] ; NVIC_ICER3 = interruptSave [ 3 ] ; } #endif __enable_irq ( ) ; } #if 0 if ( inTransactionFlag ) { pinMode ( SPI_TRANSACTION_MISMATCH_LED , OUTPUT ) ; digitalWrite ( SPI_TRANSACTION_MISMATCH_LED , HIGH ) ; } inTransactionFlag = 1 ; #endif if ( SPI0_CTAR0 != settings . ctar ) { SPI0_MCR = SPI_MCR_MDIS | SPI_MCR_HALT | SPI_MCR_PCSIS ( 0x1F ) ; SPI0_CTAR0 = settings . ctar ; SPI0_CTAR1 = settings . ctar | SPI_CTAR_FMSZ ( 8 ) ; SPI0_MCR = SPI_MCR_MSTR | SPI_MCR_PCSIS ( 0x1F ) ; } }
Before using SPI.transfer() or asserting chip select pins,
this function is used to gain exclusive access to the SPI bus
and configure the correct settings.
Before using SPI . transfer () or asserting chip select pins this function is used to gain exclusive access to the SPI bus and configure the correct settings .