update to SPI com

This commit is contained in:
flavienhaas 2018-04-10 11:19:32 +02:00
parent 9981801c61
commit fef20671a4
2 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,7 @@
SPIClass mySPI (&sercom2, 3, 5, 4, SPI_PAD_0_SCK_3, SERCOM_RX_PAD_1); //digital 3,5,4 for PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI
void setup() {
Serial.begin(115200);
SerialUSB.begin(9600);
// do this first, for Reasons
mySPI.begin();
@ -17,8 +17,9 @@ void setup() {
uint8_t i=0;
void loop() {
Serial.println(i);
mySPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
int recu = mySPI.transfer(i++);
SerialUSB.println(recu);
mySPI.endTransaction();
delay(100);
}

View File

@ -4,7 +4,7 @@
SPIClass mySPI (&sercom2, 3, 5, 4, SPI_PAD_0_SCK_3, SERCOM_RX_PAD_1); //digital 3,5,4 for PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI
void setup() {
Serial.begin(115200);
SerialUSB.begin(9600);
// do this first, for Reasons
mySPI.begin();
@ -17,9 +17,10 @@ void setup() {
uint8_t i=0;
void loop() {
Serial.println(i);
SerialUSB.println(i);
mySPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
mySPI.transfer(i++);
mySPI.transfer(7);
mySPI.endTransaction();
delay(100);
}