26 template<
typename CLK,
typename MOSI,
typename MISO,
typename SPI_SS >
class SPi {
34 SPI_SS::SetDirWrite();
45 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
48 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
51 #if defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__)
55 template<
typename SS,
typename INTR >
class MAX3421e {
56 static uint8_t vbusState;
60 void regWr(uint8_t reg, uint8_t data);
61 uint8_t*
bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
63 uint8_t
regRd(uint8_t reg);
64 uint8_t*
bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
78 template<
typename SS,
typename INTR >
82 template<
typename SS,
typename INTR >
101 template<
typename SS,
typename INTR >
105 while(!(SPSR & (1 << SPIF)));
107 while(!(SPSR & (1 << SPIF)));
114 template<
typename SS,
typename INTR >
119 while(!(SPSR & (1 << SPIF)));
123 while(!(SPSR & (1 << SPIF)));
131 template<
typename SS,
typename INTR >
140 template<
typename SS,
typename INTR >
144 while(!(SPSR & (1 << SPIF)));
146 while(!(SPSR & (1 << SPIF)));
153 template<
typename SS,
typename INTR >
157 while(!(SPSR & (1 << SPIF)));
161 while(!(SPSR & (1 << SPIF)));
165 printf(
"%2.2x ", *data_p);
180 template<
typename SS,
typename INTR >
191 template<
typename SS,
typename INTR >
216 template<
typename SS,
typename INTR >
237 template<
typename SS,
typename INTR >
240 bus_sample = regRd(
rHRSL);
253 if((regRd(
rMODE) & bmLOWSPEED) == 0) {
272 template<
typename SS,
typename INTR >
278 pinvalue = INTR::IsSet();
281 rcode = IntHandler();
291 template<
typename SS,
typename INTR >
294 uint8_t HIRQ_sendback = 0x00;
304 regWr(
rHIRQ, HIRQ_sendback);
305 return( HIRQ_sendback);