/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
/*
Simulated spi buses and devices
*/
#include
#include
#include "SIM_SPI.h"
#include "SIM_RAMTRON_FM25V02.h"
#include
using namespace SITL;
static RAMTRON_FM25V02 ramtron_FM25V02; // 32kB 2-byte-addressing
struct spi_device_at_cs_pin {
uint8_t bus;
uint8_t cs_pin;
SPIDevice &device;
} spi_devices[] {
{ 0, 0, ramtron_FM25V02 },
};
void SPI::init()
{
for (auto &i : spi_devices) {
i.device.init();
}
// sanity check the spi_devices structure to ensure we don't have
// two devices at the same address on the same bus:
for (uint8_t i=0; i