Exemplo n.º 1
0
void
Test::threadMain(void)
{
  if (os.isDebug())
    {
      os.sched.lock.enter();
        {
          debug.putString("Thread '");
          debug.putString(getName());
          debug.putString("'");
          debug.putNewLine();
        }
      os.sched.lock.exit();
    }

#if false
  testSpi(avr32::uc3::spi::MODULE_0, avr32::uc3::spi::BITS_8);
  testSpi(avr32::uc3::spi::MODULE_0, avr32::uc3::spi::BITS_16);
  testSpi(avr32::uc3::spi::MODULE_1, avr32::uc3::spi::BITS_8);
  testSpi(avr32::uc3::spi::MODULE_1, avr32::uc3::spi::BITS_16);
#endif

#if false
  testPdcaSpiSingleTransfer();
#endif

#if true
  testPdcaSpiMultipleTransfer();
#endif

  // Thread endless loop
  for (;;)
    {
      os.sched.timerSeconds.sleep(10);
    }
}
Exemplo n.º 2
0
int main(void) {
	u08 wr = 0;
	u08 rd;
	// First construct the necessary objects.
	// Create an output pin for the slave chip select.
	Cpin spiSS(PORTC, 4, PORT_OPC_PULLUP_gc, true);
	Cpin spiMOSI(PORTC, 5, PORT_OPC_TOTEM_gc);
	Cpin spiSCK(PORTC, 7, PORT_OPC_TOTEM_gc);
	Cpin rfSDN(PORTA, 7, PORT_OPC_TOTEM_gc);
	rfSDN.clr();
	// Create an spi object that uses the spiCS chip select
	Cspi testSpi(0, &spiSS, SPI_INTLVL_OFF_gc, SPI_PRESCALER_DIV128_gc, SPI_MODE_0_gc, false);

	while (1) {
		wr++;
		rd = testSpi.writeread(wr);
	}
}