*
* TODO: Implement error checking via UCxxSTAT
*
- * NOTE: Define NO_REN_ON_SPI to disable PxREN bits when SPI is acquired.
- *
* @author R. Steve McKown <rsmckown@gmail.com>
*/
PINS_SOMI,
PINS_SIMO,
PINS_CLK,
-#ifdef NO_REN_ON_SPI
PINS_RENADDR, /* This gets added to store the PxREN bit */
-#endif
};
uint8_t m_pins;
/* Configure pins for SPI, saving prior pin states */
m_pins = 0;
-#ifdef NO_REN_ON_SPI
/* - First save off and disable PxREN bits */
if (is4pin() && call STE.isRen()) {
m_pins |= (1 << (PINS_STE + PINS_RENADDR));
m_pins |= (1 << (PINS_CLK + PINS_RENADDR));
call CLK.disableRen();
}
-#endif
/* - Then save off IOFunc state and enable ModuleFunc */
if (is4pin() && call STE.isIOFunc()) {
m_pins |= (1 << PINS_STE);
if (m_pins & (1 << PINS_CLK))
call CLK.selectIOFunc();
/* - Then restore PxREN bits */
-#ifdef NO_REN_ON_SPI
if (is4pin() && (m_pins & (1 << (PINS_STE + PINS_RENADDR))))
call STE.enableRen();
if (m_pins & (1 << (PINS_SIMO + PINS_RENADDR)))
call SOMI.enableRen();
if (m_pins & (1 << (PINS_CLK + PINS_RENADDR)))
call CLK.enableRen();
-#endif
}
}