예제 #1
0
 /** Initializes the QSPI for TLC549. */
 public static void init() {
   US.PUT2(SPCR1, 0x0); // disable QSPI
   US.PUT1(PQSPAR, 0xB); // use PCS0, MOSI, MISO for QSPI //
   US.PUT1(DDRQS, 0xE); // SCK, MOSI, PCS0 outputs; MISO is input
   US.PUT2(PORTQS, 0xFF); // all Pins, in case QSPI disabled, are high
   US.PUT2(SPCR0, 0xA028); // QSPI is master, 8 bits per transfer, inactive state of
   // SCLK is LOW (CPOL=0), data captured on leading edge (CPHA=0), clock = 0.5 MHz
   US.PUT2(SPCR2, 0x4000); // no interrupts, wraparound mode, NEWQP=0, ENDQP=0
   US.PUT1(COMDRAM, 0x3E); // disable chip select after transfer, 8 bits,  DT=1, DSCK=1, use PCS0
   US.PUT2(SPCR1, 0xB816); // enable QSPI, 1.4usec delay from PCS to SCK,
   // wait 17 usec for conversion after transfer
 }
예제 #2
0
 /**
  * Reads a digitized analog input value.
  *
  * @return Input value (8bit, 0..255)
  */
 public static short read() {
   return US.GET2(RECRAM);
 }