2020-04-02 18:32:37 +02:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
2020-10-13 01:05:02 +02:00
|
|
|
#include "IOBoard.h"
|
2020-10-12 23:49:49 +02:00
|
|
|
#include "ArduinoConfig.h"
|
2020-04-02 18:32:37 +02:00
|
|
|
|
2020-04-15 17:50:30 +02:00
|
|
|
#include <avr/io.h>
|
|
|
|
|
2020-04-02 18:32:37 +02:00
|
|
|
//SPI is formally a library, so it is not part of the objects compiled
|
|
|
|
//from the core and we need to include it explicitly
|
2020-10-12 23:24:39 +02:00
|
|
|
#include <SPI.h>
|
2020-04-02 18:32:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
2020-10-13 00:37:09 +02:00
|
|
|
// Set data direction of selected port to output.
|
2020-10-13 01:05:02 +02:00
|
|
|
CS_DDR = 0xff;
|
|
|
|
// Drive all the slave selects high as required for the SPI protocol
|
|
|
|
// if no transfer is going on.
|
|
|
|
CS_PORT = 0xff;
|
|
|
|
Serial.begin(BAUD_RATE);
|
2020-10-13 00:56:03 +02:00
|
|
|
#if PROGRAMMING_OUTPUT == 1
|
2020-10-13 01:05:02 +02:00
|
|
|
Serial.println("-AI- Setting up Arduino IO interface board.");
|
|
|
|
Serial.print("-AI- Configured baud rate for serial communication: ");
|
|
|
|
Serial.println(BAUD_RATE, DEC);
|
|
|
|
Serial.print("-AI- Size of serial receiver buffer: ");
|
|
|
|
Serial.print(SERIAL_RX_BUFFER_SIZE, DEC);
|
|
|
|
Serial.println(" bytes");
|
2020-10-13 00:56:03 +02:00
|
|
|
#endif
|
2020-10-13 01:05:02 +02:00
|
|
|
SPI.begin();
|
2020-04-02 18:32:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2020-10-13 01:05:02 +02:00
|
|
|
IOBoard::handleNewData();
|
|
|
|
delay(1000);
|
2020-04-02 18:32:37 +02:00
|
|
|
}
|
2020-10-13 01:05:02 +02:00
|
|
|
|
|
|
|
|