diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbddb40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,165 @@ +# Created by https://www.toptal.com/developers/gitignore/api/vim,python +# Edit at https://www.toptal.com/developers/gitignore?templates=vim,python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +pytestdebug.log + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ +doc/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +pythonenv* + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# profiling data +.prof + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# End of https://www.toptal.com/developers/gitignore/api/vim,python diff --git a/arduino_programs/arduino_programmer/arduino_programmer.ino b/arduino_programs/arduino_programmer/arduino_programmer.ino index 3b410b5..c10b2ed 100644 --- a/arduino_programs/arduino_programmer/arduino_programmer.ino +++ b/arduino_programs/arduino_programmer/arduino_programmer.ino @@ -17,6 +17,7 @@ // Digital pins 8 to 13 correspond to PB0 to PB5 byte lastOp; +static char printBuff[128]; void latchOutput() { static byte latchMask = 0b00010000; @@ -52,12 +53,12 @@ void setBusMode(bool busMode) { void setAddress(int address, bool outputEnable) { // Position of the output enable bit withing the data to be shifted out. - static byte outputEnableMask = 0x8000; + static int outputEnableMask = 0x8000; // Position of the data bit within PORTD. static byte dataMask = 0b00000100; // Position of the clock bit within PORTD. static byte clockMask = 0b00001000; - + if (outputEnable) { // Clear output enable bit. address &= ~outputEnableMask; @@ -65,10 +66,9 @@ void setAddress(int address, bool outputEnable) { // Set output enable bit. address |= outputEnableMask; } - - // Make sure the clock pin is low. - PORTD &= ~clockMask; + // Make sure the clock pin is low. + PORTD &= ~clockMask; // Shift the data out LSB first. for (uint8_t i = 0; i < 16; i++, address >>= 1) { if (address & 1) { @@ -148,7 +148,8 @@ void setup() { Serial.begin(9600); - + writeEEPROM(0x1234, 0x55, true); + writeEEPROM(0x4321, 0x7E, true); } void loop() { diff --git a/arduino_programs/arduino_tester/arduino_tester.ino b/arduino_programs/arduino_tester/arduino_tester.ino index 9e45e71..24484da 100644 --- a/arduino_programs/arduino_tester/arduino_tester.ino +++ b/arduino_programs/arduino_tester/arduino_tester.ino @@ -7,8 +7,31 @@ #define ADDRESS_0 22 #define ADDRESS_15 50 -void setup() { +#define ADDRESS_CLOCK 18 +#define WRITE_CLOCK 19 +void setup() { + Serial.begin(9600); + attachInterrupt(digitalPinToInterrupt(ADDRESS_CLOCK), onAddressClock, RISING); + attachInterrupt(digitalPinToInterrupt(WRITE_CLOCK), onWriteClock, FALLING); +} + +void onAddressClock() { + delayMicroseconds(1); + Serial.print("Address: 0b"); + Serial.print(digitalRead(OUTPUT_ENABLE)); + for (int pin = ADDRESS_15; pin >= ADDRESS_0; pin -= 2) { + Serial.print(digitalRead(pin)); + } + Serial.println(); +} + +void onWriteClock() { + Serial.print("Data: 0b"); + for (int pin = DATA_7; pin >= DATA_0; pin--) { + Serial.print(digitalRead(pin)); + } + Serial.println(); } void loop() {