TommyPROM/TommyPROM/PromDevice.h
per1234 642f540df2 Move sketch to appropriately named subfolder
The Arduino IDE requires that a sketch be located in a folder of the same name. Although the name of the repository does match the sketch name, when GitHub's popular Clone or download > Download ZIP feature is used to download the contents of a repository the branch/release/commit name is appended to the folder name, causing a mismatch.

When opening a file that does not meet this sketch/folder name matching requirement the Arduino IDE presents a dialog:

The file "TommyPROM.ino" needs to be inside a sketch folder named "TommyPROM".
Create this folder, move the file, and continue?

After clicking "OK" the Arduino IDE currently moves only the file TommyPROM.ino to the new folder, leaving behind the other source files. This causes compilation of the sketch to fail:

TommyPROM-master\TommyPROM\TommyPROM.ino:13:23: fatal error: Configure.h: No such file or directory

 #include "Configure.h"
2018-05-11 00:58:55 -07:00

47 lines
1.6 KiB
C++

#ifndef INCLUDE_PROM_DEVICE_H
#define INCLUDE_PROM_DEVICE_H
#include "Arduino.h"
/*****************************************************************************/
/*****************************************************************************/
/**
* PromDevice class
*
* Provides the interface to read and write data from a parallel PROM using the
* Arduino.
*
* Block writes are supported on compatible devices by specifying a blockSize
* in the constructor. Use zero for devices that only support byte writes.
*/
class PromDevice
{
public:
PromDevice(unsigned long size, word blockSize, unsigned maxWriteTime, bool polling);
bool writeData(byte data[], word len, word address);
byte readData(word address) { return readByte(address); }
virtual void begin() = 0;
virtual void disableSoftwareWriteProtect() {}
protected:
unsigned int mSize; // Size of the device, in bytes
unsigned int mBlockSize; // Block size for page writes, zero if N/A
unsigned int mMaxWriteTime; // Max time (in ms) to wait for write cycle to complete
bool mSupportsDataPoll; // End of write detected by data polling
void setDataBusMode(uint8_t mode);
byte readDataBus();
void writeDataBus(byte data);
virtual void setAddress(word address) = 0;
virtual byte readByte(word address) = 0;
virtual bool burnByte(byte value, word address) = 0;
virtual bool burnBlock(byte data[], word len, word address) { return false; }
};
#endif // #define INCLUDE_PROM_DEVICE_H