37 lines
912 B
C++
37 lines
912 B
C++
#include <Arduino.h>
|
|
|
|
#include "IOBoard.h"
|
|
#include "ArduinoConfig.h"
|
|
|
|
#include <avr/io.h>
|
|
|
|
//SPI is formally a library, so it is not part of the objects compiled
|
|
//from the core and we need to include it explicitly
|
|
#include <SPI.h>
|
|
|
|
|
|
void setup() {
|
|
// Set data direction of selected port to output.
|
|
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);
|
|
#if PROGRAMMING_OUTPUT == 1
|
|
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");
|
|
#endif
|
|
SPI.begin();
|
|
}
|
|
|
|
void loop() {
|
|
IOBoard::handleNewData();
|
|
delay(1000);
|
|
}
|
|
|
|
|