├── firmware
├── .perl-version
├── t
│ ├── noise-maker
│ │ ├── lib
│ │ │ └── .holder
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── build.sh
│ │ └── src
│ │ │ ├── env.h
│ │ │ ├── log.h
│ │ │ ├── pins.h
│ │ │ ├── IrCtrl.h
│ │ │ ├── const.h
│ │ │ ├── timer.c
│ │ │ ├── timer.h
│ │ │ ├── IrCtrl.cpp
│ │ │ ├── IrPacker.c
│ │ │ ├── IrPacker.h
│ │ │ ├── MemoryFree.c
│ │ │ ├── MemoryFree.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── FullColorLed.cpp
│ │ │ ├── FullColorLed.h
│ │ │ ├── Makefile
│ │ │ └── noise-maker.ino
│ ├── button
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── build.sh
│ │ ├── src
│ │ │ ├── pins.h
│ │ │ ├── timer.c
│ │ │ ├── timer.h
│ │ │ ├── LongPressButton.h
│ │ │ ├── longpressbutton.c
│ │ │ └── button.ino
│ │ └── check_flash_size.rb
│ ├── test
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── build.sh
│ │ ├── src
│ │ │ ├── CRC8.c
│ │ │ ├── CRC8.h
│ │ │ ├── Keys.h
│ │ │ ├── Global.h
│ │ │ ├── Keys.cpp
│ │ │ ├── convert.h
│ │ │ ├── GSwifi_const.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ └── test.ino
│ │ └── report.txt
│ ├── .gitignore
│ ├── base64
│ │ ├── build.sh
│ │ ├── nanotap.h
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── base64encoder.c
│ │ ├── base64encoder.h
│ │ ├── src
│ │ │ ├── base64encoder.h
│ │ │ ├── base64encoder.cpp
│ │ │ └── base64.ino
│ │ ├── Makefile
│ │ ├── base64encode.pl
│ │ ├── base64decode.pl
│ │ └── test_encode.cpp
│ ├── freememory
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── src
│ │ │ ├── MemoryFree.c
│ │ │ ├── MemoryFree.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── Makefile
│ │ │ └── freememory.ino
│ │ └── build.sh
│ ├── gainspan
│ │ ├── serial.sh
│ │ ├── src
│ │ │ ├── .gitignore
│ │ │ ├── env.h
│ │ │ ├── log.h
│ │ │ ├── CRC8.c
│ │ │ ├── CRC8.h
│ │ │ ├── Keys.h
│ │ │ ├── cert.h
│ │ │ ├── const.h
│ │ │ ├── pins.h
│ │ │ ├── timer.c
│ │ │ ├── timer.h
│ │ │ ├── GSwifi.cpp
│ │ │ ├── GSwifi.h
│ │ │ ├── Keys.cpp
│ │ │ ├── commands.h
│ │ │ ├── convert.c
│ │ │ ├── convert.h
│ │ │ ├── version.h
│ │ │ ├── MemoryFree.c
│ │ │ ├── MemoryFree.h
│ │ │ ├── ringbuffer.c
│ │ │ ├── ringbuffer.h
│ │ │ ├── GSwifi_const.h
│ │ │ ├── base64encoder.c
│ │ │ ├── base64encoder.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── HardwareSerialX.h
│ │ │ ├── HardwareSerialX.cpp
│ │ │ └── version.c
│ │ ├── upload.sh
│ │ ├── build.sh
│ │ └── check_flash_size.rb
│ ├── ir-receive
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── build.sh
│ │ └── src
│ │ │ ├── env.h
│ │ │ ├── pins.h
│ │ │ ├── IrCtrl.h
│ │ │ ├── const.h
│ │ │ ├── timer.c
│ │ │ ├── timer.h
│ │ │ ├── IrCtrl.cpp
│ │ │ ├── IrPacker.c
│ │ │ ├── IrPacker.h
│ │ │ ├── MemoryFree.c
│ │ │ ├── MemoryFree.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── Makefile
│ │ │ └── ir.ino
│ ├── json
│ │ ├── nanotap.h
│ │ ├── pins.h
│ │ ├── .gitignore
│ │ ├── IRKitJSONParser.c
│ │ ├── IRKitJSONParser.h
│ │ └── Makefile
│ ├── led
│ │ ├── build.sh
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ └── src
│ │ │ ├── pins.h
│ │ │ ├── timer.c
│ │ │ ├── timer.h
│ │ │ ├── FullColorLed.h
│ │ │ ├── FullColorLed.cpp
│ │ │ ├── Makefile
│ │ │ └── led.ino
│ ├── morsify
│ │ ├── CRC8.c
│ │ ├── CRC8.h
│ │ ├── Keys.h
│ │ ├── .gitignore
│ │ ├── GSwifi_const.h
│ │ ├── Makefile
│ │ └── test.cpp
│ ├── erase-eeprom
│ │ ├── src
│ │ │ ├── .gitignore
│ │ │ └── erase.ino
│ │ ├── build.sh
│ │ ├── serial.sh
│ │ └── upload.sh
│ ├── gainspan-serial
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── build.sh
│ │ └── src
│ │ │ ├── pins.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── ringbuffer.c
│ │ │ ├── ringbuffer.h
│ │ │ ├── HardwareSerialX.cpp
│ │ │ ├── HardwareSerialX.h
│ │ │ ├── Makefile
│ │ │ └── gainspan-serial.ino
│ ├── gainspan-tcertadd
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ ├── build.sh
│ │ └── src
│ │ │ ├── pins.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── ringbuffer.c
│ │ │ ├── ringbuffer.h
│ │ │ ├── HardwareSerialX.h
│ │ │ ├── HardwareSerialX.cpp
│ │ │ └── Makefile
│ ├── initialize-eeprom
│ │ ├── serial.sh
│ │ ├── src
│ │ │ ├── .gitignore
│ │ │ ├── log.h
│ │ │ ├── GSwifi.h
│ │ │ ├── cert.h
│ │ │ ├── const.h
│ │ │ ├── pins.h
│ │ │ ├── timer.c
│ │ │ ├── timer.h
│ │ │ ├── GSwifi.cpp
│ │ │ ├── IrPacker.c
│ │ │ ├── IrPacker.h
│ │ │ ├── convert.c
│ │ │ ├── convert.h
│ │ │ ├── version.c
│ │ │ ├── version.h
│ │ │ ├── MemoryFree.c
│ │ │ ├── MemoryFree.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── ringbuffer.c
│ │ │ ├── ringbuffer.h
│ │ │ ├── FullColorLed.h
│ │ │ ├── GSwifi_const.h
│ │ │ ├── base64encoder.c
│ │ │ ├── base64encoder.h
│ │ │ ├── FullColorLed.cpp
│ │ │ ├── HardwareSerialX.h
│ │ │ ├── HardwareSerialX.cpp
│ │ │ ├── env.h
│ │ │ └── initialize.ino
│ │ ├── upload.sh
│ │ └── build.sh
│ ├── packer-arduino
│ │ ├── src
│ │ │ ├── .gitignore
│ │ │ ├── IrPacker.c
│ │ │ ├── IrPacker.h
│ │ │ ├── MemoryFree.c
│ │ │ ├── MemoryFree.h
│ │ │ ├── pgmStrToRAM.c
│ │ │ ├── pgmStrToRAM.h
│ │ │ ├── env.h
│ │ │ ├── Makefile
│ │ │ └── packer.ino
│ │ ├── build.sh
│ │ ├── serial.sh
│ │ └── upload.sh
│ ├── packer
│ │ ├── .gitignore
│ │ ├── IrPacker.c
│ │ ├── IrPacker.h
│ │ ├── base64encoder.c
│ │ ├── base64encoder.h
│ │ ├── env.h
│ │ ├── Makefile
│ │ ├── utils.h
│ │ ├── pack.cpp
│ │ ├── unpack.cpp
│ │ ├── unpack_sequence.cpp
│ │ ├── pack_sequence.cpp
│ │ ├── print_fixed_binary_search.pl
│ │ └── nanotap.h
│ ├── hardwareserialx
│ │ ├── build.sh
│ │ ├── serial.sh
│ │ ├── upload.sh
│ │ └── src
│ │ │ ├── ringbuffer.c
│ │ │ ├── ringbuffer.h
│ │ │ ├── HardwareSerialX.h
│ │ │ ├── HardwareSerialX.cpp
│ │ │ └── main.ino
│ └── ringbuffer
│ │ ├── .gitignore
│ │ ├── ringbuffer.c
│ │ ├── ringbuffer.h
│ │ ├── Makefile
│ │ ├── test.c
│ │ └── nanotap.h
├── .gitignore
├── src
│ └── IRKit
│ │ ├── MemoryFree.h
│ │ ├── Makefile
│ │ ├── version.c
│ │ ├── version.template
│ │ ├── version.h
│ │ ├── env.h
│ │ ├── convert.h
│ │ ├── CRC8.h
│ │ ├── commands.h
│ │ ├── pgmStrToRAM.h
│ │ ├── MemoryFree.c
│ │ ├── CRC8.c
│ │ ├── base64encoder.h
│ │ ├── pgmStrToRAM.c
│ │ ├── convert.c
│ │ ├── longpressbutton.h
│ │ ├── const.h
│ │ ├── IRKitHTTPHandler.h
│ │ ├── FullColorLed.h
│ │ ├── IRKitJSONParser.h
│ │ ├── timer.h
│ │ ├── longpressbutton.c
│ │ ├── ringbuffer.h
│ │ ├── pins.h
│ │ ├── GSwifi_const.h
│ │ ├── IrPacker.h
│ │ ├── ringbuffer.c
│ │ ├── FullColorLed.cpp
│ │ ├── timer.c
│ │ ├── base64encoder.c
│ │ ├── log.h
│ │ ├── HardwareSerialX.h
│ │ └── IRKitJSONParser.c
├── USBCore.cpp.patch
├── boards.txt.patch
├── bench.pl
├── Makefile
├── hex_to_json.pl
└── hex_to_put.pl
├── .gitignore
├── hardware
├── simulation
│ ├── .gitignore
│ ├── README
│ ├── irled.net
│ ├── irled.asc
│ └── microphone.ASC
├── top.png
├── logo.bmp
├── bottom.png
├── logo-black.bmp
├── schematic.png
├── .gitignore
├── LICENSE
├── export_png_top.sh
├── export_png_bottom.sh
├── Writer.partlist.csv
├── Writer.dri
├── IRKit.dri
├── check_fusionpcb_zip.rb
├── Writer.TXT
├── Writer.gpi
├── IRKit.gpi
├── IRKit.partlist.csv
├── IRKit.TXT
└── partlist2googlespreadsheet.rb
├── case
├── .gitignore
├── IRKit.3dm
├── IRKit.jpg
├── IRKit.stl
├── FactoryJig.3dm
└── LICENSE
├── spec
├── diagrams
│ ├── setup.png
│ ├── ir-learn.png
│ ├── ir-send.png
│ ├── ir-state.png
│ ├── packer.png
│ ├── README
│ ├── Makefile
│ ├── ir-learn.msc
│ ├── ir-send.msc
│ ├── packer.gv
│ ├── ir-state.gv
│ └── setup.msc
└── colors
│ └── README.md
└── scripts
└── release.pl
/firmware/.perl-version:
--------------------------------------------------------------------------------
1 | 5.16.3
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.DS_Store
2 | logs
3 |
--------------------------------------------------------------------------------
/firmware/t/noise-maker/lib/.holder:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/firmware/t/button/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/button/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/test/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/test/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/.gitignore:
--------------------------------------------------------------------------------
1 | *.bin
2 | *.bin.dSYM
3 |
--------------------------------------------------------------------------------
/firmware/t/base64/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/base64/nanotap.h:
--------------------------------------------------------------------------------
1 | ../packer/nanotap.h
--------------------------------------------------------------------------------
/firmware/t/button/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/freememory/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/freememory/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/.gitignore:
--------------------------------------------------------------------------------
1 | *.bak
2 |
--------------------------------------------------------------------------------
/firmware/t/gainspan/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/ir-receive/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/ir-receive/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/json/nanotap.h:
--------------------------------------------------------------------------------
1 | ../ringbuffer/nanotap.h
--------------------------------------------------------------------------------
/firmware/t/json/pins.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/led/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/led/serial.sh:
--------------------------------------------------------------------------------
1 | ../freememory/serial.sh
--------------------------------------------------------------------------------
/firmware/t/led/upload.sh:
--------------------------------------------------------------------------------
1 | ../freememory/upload.sh
--------------------------------------------------------------------------------
/firmware/t/morsify/CRC8.c:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/CRC8.c
--------------------------------------------------------------------------------
/firmware/t/morsify/CRC8.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/CRC8.h
--------------------------------------------------------------------------------
/firmware/t/morsify/Keys.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/Keys.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/noise-maker/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/test/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/base64/serial.sh:
--------------------------------------------------------------------------------
1 | ../freememory/serial.sh
--------------------------------------------------------------------------------
/firmware/t/base64/upload.sh:
--------------------------------------------------------------------------------
1 | ../freememory/upload.sh
--------------------------------------------------------------------------------
/firmware/t/button/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/erase-eeprom/src/.gitignore:
--------------------------------------------------------------------------------
1 | *.dSYM/
2 |
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/env.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/env.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/log.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/log.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/serial.sh:
--------------------------------------------------------------------------------
1 | ../../serial.sh
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/.gitignore:
--------------------------------------------------------------------------------
1 | *.bak
2 |
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/upload.sh:
--------------------------------------------------------------------------------
1 | ../../upload.sh
--------------------------------------------------------------------------------
/firmware/t/ir-receive/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/json/.gitignore:
--------------------------------------------------------------------------------
1 | *.out
2 | *.out.dSYM
3 |
--------------------------------------------------------------------------------
/firmware/t/led/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/led/src/timer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.c
--------------------------------------------------------------------------------
/firmware/t/led/src/timer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/.gitignore:
--------------------------------------------------------------------------------
1 | *.dSYM/
2 |
--------------------------------------------------------------------------------
/firmware/t/packer/.gitignore:
--------------------------------------------------------------------------------
1 | *.dSYM/
2 | *.bin
3 |
--------------------------------------------------------------------------------
/firmware/t/test/src/CRC8.c:
--------------------------------------------------------------------------------
1 | ../../../src/main/CRC8.c
--------------------------------------------------------------------------------
/firmware/t/test/src/CRC8.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/CRC8.h
--------------------------------------------------------------------------------
/firmware/t/test/src/Keys.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/Keys.h
--------------------------------------------------------------------------------
/hardware/simulation/.gitignore:
--------------------------------------------------------------------------------
1 | *.log
2 | *.raw
3 |
--------------------------------------------------------------------------------
/case/.gitignore:
--------------------------------------------------------------------------------
1 | *.igs
2 | *.sat
3 | *.stp
4 | *.zip
5 |
--------------------------------------------------------------------------------
/firmware/t/button/src/timer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.c
--------------------------------------------------------------------------------
/firmware/t/button/src/timer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.h
--------------------------------------------------------------------------------
/firmware/t/erase-eeprom/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/erase-eeprom/serial.sh:
--------------------------------------------------------------------------------
1 | ../freememory/serial.sh
--------------------------------------------------------------------------------
/firmware/t/erase-eeprom/upload.sh:
--------------------------------------------------------------------------------
1 | ../freememory/upload.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/CRC8.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/CRC8.c
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/CRC8.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/CRC8.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/Keys.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/Keys.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/cert.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/cert.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/const.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/const.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/timer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.c
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/timer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.h
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/env.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/env.h
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/env.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/env.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/log.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/log.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/serial.sh:
--------------------------------------------------------------------------------
1 | ../freememory/serial.sh
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/upload.sh:
--------------------------------------------------------------------------------
1 | ../freememory/upload.sh
--------------------------------------------------------------------------------
/firmware/t/packer/IrPacker.c:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/IrPacker.c
--------------------------------------------------------------------------------
/firmware/t/packer/IrPacker.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/IrPacker.h
--------------------------------------------------------------------------------
/firmware/t/ringbuffer/.gitignore:
--------------------------------------------------------------------------------
1 | *.out
2 | *.out.dSYM
3 |
--------------------------------------------------------------------------------
/firmware/t/test/src/Global.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/Global.h
--------------------------------------------------------------------------------
/firmware/t/test/src/Keys.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/main/Keys.cpp
--------------------------------------------------------------------------------
/firmware/t/test/src/convert.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/convert.h
--------------------------------------------------------------------------------
/firmware/t/button/check_flash_size.rb:
--------------------------------------------------------------------------------
1 | ../../check_flash_size.rb
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/build.sh:
--------------------------------------------------------------------------------
1 | ../freememory/build.sh
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/GSwifi.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/GSwifi.cpp
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/GSwifi.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/GSwifi.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/Keys.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/Keys.cpp
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/commands.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/commands.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/convert.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/convert.c
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/convert.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/convert.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/version.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/version.h
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/serial.sh:
--------------------------------------------------------------------------------
1 | ../freememory/serial.sh
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/upload.sh:
--------------------------------------------------------------------------------
1 | ../freememory/upload.sh
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/log.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/log.h
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/IrCtrl.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrCtrl.h
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/const.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/const.h
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/timer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.c
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/timer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.h
--------------------------------------------------------------------------------
/firmware/t/morsify/.gitignore:
--------------------------------------------------------------------------------
1 | *.out
2 | *.out.dSYM
3 | *.o
4 |
--------------------------------------------------------------------------------
/firmware/t/morsify/GSwifi_const.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/GSwifi_const.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/IrCtrl.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrCtrl.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/const.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/const.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/timer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.c
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/timer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.h
--------------------------------------------------------------------------------
/firmware/t/ringbuffer/ringbuffer.c:
--------------------------------------------------------------------------------
1 | ../../src/main/ringbuffer.c
--------------------------------------------------------------------------------
/firmware/t/ringbuffer/ringbuffer.h:
--------------------------------------------------------------------------------
1 | ../../src/main/ringbuffer.h
--------------------------------------------------------------------------------
/firmware/t/base64/base64encoder.c:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/base64encoder.c
--------------------------------------------------------------------------------
/firmware/t/base64/base64encoder.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/base64encoder.h
--------------------------------------------------------------------------------
/firmware/t/freememory/src/MemoryFree.c:
--------------------------------------------------------------------------------
1 | ../../../src/main/MemoryFree.c
--------------------------------------------------------------------------------
/firmware/t/freememory/src/MemoryFree.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/MemoryFree.h
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/check_flash_size.rb:
--------------------------------------------------------------------------------
1 | ../../check_flash_size.rb
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/MemoryFree.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.c
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/MemoryFree.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/ringbuffer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.c
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/ringbuffer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/GSwifi.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/GSwifi.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/cert.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/cert.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/const.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/const.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/pins.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pins.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/timer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/timer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/timer.h
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/IrCtrl.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrCtrl.cpp
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/IrPacker.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.c
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/IrPacker.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.h
--------------------------------------------------------------------------------
/firmware/t/json/IRKitJSONParser.c:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/IRKitJSONParser.c
--------------------------------------------------------------------------------
/firmware/t/json/IRKitJSONParser.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/IRKitJSONParser.h
--------------------------------------------------------------------------------
/firmware/t/led/src/FullColorLed.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/FullColorLed.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/IrCtrl.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrCtrl.cpp
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/IrPacker.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.c
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/IrPacker.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.h
--------------------------------------------------------------------------------
/firmware/t/packer/base64encoder.c:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/base64encoder.c
--------------------------------------------------------------------------------
/firmware/t/packer/base64encoder.h:
--------------------------------------------------------------------------------
1 | ../../src/IRKit/base64encoder.h
--------------------------------------------------------------------------------
/firmware/t/test/src/GSwifi_const.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/GSwifi_const.h
--------------------------------------------------------------------------------
/firmware/t/test/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/main/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/test/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/base64/src/base64encoder.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/base64encoder.h
--------------------------------------------------------------------------------
/firmware/t/freememory/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/main/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/freememory/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/GSwifi_const.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/GSwifi_const.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/base64encoder.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/base64encoder.c
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/base64encoder.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/base64encoder.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/src/ringbuffer.c:
--------------------------------------------------------------------------------
1 | ../../../src/main/ringbuffer.c
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/src/ringbuffer.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/ringbuffer.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/GSwifi.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/GSwifi.cpp
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/IrPacker.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/IrPacker.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/convert.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/convert.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/convert.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/convert.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/version.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/version.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/version.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/version.h
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/MemoryFree.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.c
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/MemoryFree.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.h
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/led/src/FullColorLed.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/FullColorLed.cpp
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/MemoryFree.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.c
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/MemoryFree.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/IrPacker.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.c
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/IrPacker.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/IrPacker.h
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/MemoryFree.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.c
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/MemoryFree.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.h
--------------------------------------------------------------------------------
/hardware/simulation/README:
--------------------------------------------------------------------------------
1 | open .asc file with LTSpice on Windows!
2 |
--------------------------------------------------------------------------------
/firmware/t/base64/src/base64encoder.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/main/base64encoder.cpp
--------------------------------------------------------------------------------
/firmware/t/button/src/LongPressButton.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/longpressbutton.h
--------------------------------------------------------------------------------
/firmware/t/button/src/longpressbutton.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/longpressbutton.c
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/ringbuffer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.c
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/ringbuffer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.h
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/ringbuffer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.c
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/ringbuffer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.h
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/HardwareSerialX.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/MemoryFree.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/MemoryFree.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/MemoryFree.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/ringbuffer.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/ringbuffer.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/ringbuffer.h
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/FullColorLed.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/FullColorLed.cpp
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/FullColorLed.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/FullColorLed.h
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.c
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/pgmStrToRAM.h
--------------------------------------------------------------------------------
/case/IRKit.3dm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/case/IRKit.3dm
--------------------------------------------------------------------------------
/case/IRKit.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/case/IRKit.jpg
--------------------------------------------------------------------------------
/case/IRKit.stl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/case/IRKit.stl
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/HardwareSerialX.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.cpp
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/src/HardwareSerialX.h:
--------------------------------------------------------------------------------
1 | ../../../src/main/HardwareSerialX.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/FullColorLed.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/FullColorLed.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/GSwifi_const.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/GSwifi_const.h
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/base64encoder.c:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/base64encoder.c
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/base64encoder.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/base64encoder.h
--------------------------------------------------------------------------------
/firmware/t/packer/env.h:
--------------------------------------------------------------------------------
1 | #ifndef __ENV_H__
2 | #define __ENV_H__
3 |
4 | #endif
5 |
--------------------------------------------------------------------------------
/hardware/top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/hardware/top.png
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/HardwareSerialX.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.cpp
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/HardwareSerialX.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.h
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/HardwareSerialX.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.h
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/src/HardwareSerialX.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/main/HardwareSerialX.cpp
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/FullColorLed.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/FullColorLed.cpp
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/HardwareSerialX.h:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.h
--------------------------------------------------------------------------------
/hardware/logo.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/hardware/logo.bmp
--------------------------------------------------------------------------------
/case/FactoryJig.3dm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/case/FactoryJig.3dm
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/HardwareSerialX.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.cpp
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/HardwareSerialX.cpp:
--------------------------------------------------------------------------------
1 | ../../../src/IRKit/HardwareSerialX.cpp
--------------------------------------------------------------------------------
/hardware/bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/hardware/bottom.png
--------------------------------------------------------------------------------
/hardware/logo-black.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/hardware/logo-black.bmp
--------------------------------------------------------------------------------
/hardware/schematic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/hardware/schematic.png
--------------------------------------------------------------------------------
/spec/diagrams/setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/spec/diagrams/setup.png
--------------------------------------------------------------------------------
/spec/diagrams/ir-learn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/spec/diagrams/ir-learn.png
--------------------------------------------------------------------------------
/spec/diagrams/ir-send.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/spec/diagrams/ir-send.png
--------------------------------------------------------------------------------
/spec/diagrams/ir-state.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/spec/diagrams/ir-state.png
--------------------------------------------------------------------------------
/spec/diagrams/packer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/basuke/device/master/spec/diagrams/packer.png
--------------------------------------------------------------------------------
/firmware/.gitignore:
--------------------------------------------------------------------------------
1 | .build/
2 | **/build-uno/
3 | **/build-leonardo/
4 | TAGS
5 | logs/
6 | docs/
7 | *.log
8 |
--------------------------------------------------------------------------------
/firmware/t/ringbuffer/Makefile:
--------------------------------------------------------------------------------
1 |
2 | test:
3 | gcc -Wall -g -o ./test.out ringbuffer.c test.c
4 | ./test.out
5 |
--------------------------------------------------------------------------------
/spec/diagrams/README:
--------------------------------------------------------------------------------
1 | use graphviz
2 | http://www.graphviz.org/pdf/dotguide.pdf
3 |
4 | dot -Tpng in.gv -o out.png
5 |
--------------------------------------------------------------------------------
/firmware/t/base64/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | g++ -Wall -g -o test_encode.bin test_encode.cpp base64encoder.c
3 | ./test_encode.bin
4 |
--------------------------------------------------------------------------------
/hardware/.gitignore:
--------------------------------------------------------------------------------
1 | *.b\#*
2 | *.s\#*
3 | *.l\#*
4 | *.pro
5 | *.log
6 | *.zip
7 | .DS_Store
8 | eagle.epf
9 | *.scr
10 |
--------------------------------------------------------------------------------
/firmware/t/json/Makefile:
--------------------------------------------------------------------------------
1 | test:
2 | gcc -Wall -g -o ./test.out IRKitJSONParser.c test.c
3 | ./test.out && echo "Success" || echo "Failed"
4 |
--------------------------------------------------------------------------------
/firmware/t/freememory/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -xe
3 |
4 | # remove Arduino IDE build files
5 | rm -rf src/build-uno/
6 | ~/src/ino/bin/ino build -m irkit
7 |
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/env.h:
--------------------------------------------------------------------------------
1 | #ifndef __ENV_H__
2 | #define __ENV_H__
3 |
4 | // use to save IrPacker's tree
5 | #define SAVE_IRPACKER_TREE 1
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -xe
3 |
4 | # remove Arduino IDE build files
5 | rm -rf src/IRKit/build-uno/
6 |
7 | ~/src/ino/bin/ino build -m irkit
8 |
--------------------------------------------------------------------------------
/firmware/t/morsify/Makefile:
--------------------------------------------------------------------------------
1 |
2 | all: build test
3 |
4 | build:
5 | gcc -Wall -c -g -o ./CRC8.o CRC8.c
6 | g++ -Wall -g -o ./test.out test.cpp CRC8.o
7 |
8 | test:
9 | ./test.out
10 |
--------------------------------------------------------------------------------
/firmware/t/base64/base64encode.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 | use MIME::Base64;
5 |
6 | my $binary = "\x2f\xff\x00\xb2\x2f";
7 | my $encoded = encode_base64($binary);
8 | warn $encoded;
9 |
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/Makefile:
--------------------------------------------------------------------------------
1 |
2 | test:
3 | g++ -Wall -g -o .build/test_pack.out IrPacker.cpp test_pack.cpp
4 | ./.build/test_pack.out
5 | g++ -Wall -g -o .build/test_unpack.out IrPacker.cpp test_unpack.cpp
6 | ./.build/test_unpack.out
7 |
--------------------------------------------------------------------------------
/spec/diagrams/Makefile:
--------------------------------------------------------------------------------
1 |
2 | OUT = ir-state.png ir-learn.png ir-send.png packer.png setup.png
3 |
4 | all: $(OUT)
5 |
6 | .SUFFIXES: .png .gv .msc
7 |
8 | .gv.png:
9 | dot -Tpng $< -o $@
10 |
11 | .msc.png:
12 | mscgen -T png -i $<
13 |
--------------------------------------------------------------------------------
/case/LICENSE:
--------------------------------------------------------------------------------
1 | All design files here are licensed under Creative Commons Attribution NonCommercial Share-Alike license.
2 | See http://creativecommons.org/licenses/by-nc-sa/4.0/ for details,
3 | or http://creativecommons.org/licenses/by-nc-sa/4.0/deed.ja for 日本語の翻訳
4 |
--------------------------------------------------------------------------------
/firmware/t/hardwareserialx/src/main.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "HardwareSerialX.h"
3 |
4 | extern volatile uint8_t test;
5 | void setup() {
6 | while (! Serial) ;
7 | // USB serial
8 | Serial1X.begin(115200);
9 | }
10 |
11 | void loop() {
12 | }
13 |
--------------------------------------------------------------------------------
/hardware/LICENSE:
--------------------------------------------------------------------------------
1 | All design files here are licensed under Creative Commons Attribution Share-Alike license.
2 | See http://creativecommons.org/licenses/by-sa/3.0 for details.
3 |
4 | Heavily used Arduino Leonardo (http://arduino.cc/en/Main/ArduinoBoardLeonardo) as reference, thanks http://arduino.cc/ team!
5 |
--------------------------------------------------------------------------------
/hardware/export_png_top.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ "$#" -ne 2 ]; then
4 | echo "usage: $0 file.brd top.png" 1>&2
5 | exit 1
6 | fi
7 |
8 | /Applications/EAGLE-6.5.0/EAGLE.app/Contents/MacOS/EAGLE -C "RATSNEST; DISPLAY NONE; DISPLAY TOP PADS VIAS DIMENSION TPLACE TNAMES; EXPORT IMAGE ${2} MONOCHROME 600" ${1}
9 |
--------------------------------------------------------------------------------
/hardware/export_png_bottom.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ "$#" -ne 2 ]; then
4 | echo "usage: $0 file.brd bottom.png" 1>&2
5 | exit 1
6 | fi
7 |
8 | /Applications/EAGLE-6.5.0/EAGLE.app/Contents/MacOS/EAGLE -C "RATSNEST; DISPLAY NONE; DISPLAY BOTTOM PADS VIAS DIMENSION BPLACE; EXPORT IMAGE ${2} MONOCHROME 600" ${1}
9 |
--------------------------------------------------------------------------------
/firmware/t/erase-eeprom/src/erase.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "EEPROM.h"
3 |
4 | void setup() {
5 | while ( ! Serial ) ; // wait for leonardo
6 |
7 | // write a 0..10, this should invalid crc check
8 | for (int i = 0; i < 10; i++) {
9 | EEPROM.write(i, 0);
10 | }
11 |
12 | Serial.println("erased!");
13 | }
14 |
15 | void loop() {
16 | }
17 |
--------------------------------------------------------------------------------
/spec/diagrams/ir-learn.msc:
--------------------------------------------------------------------------------
1 | msc {
2 | # entities
3 | User, IRKit, Server;
4 |
5 | # space
6 | |||;
7 |
8 | IRKit note Server [label = "Successfully connected"];
9 |
10 | IRKit note IRKit [label = "Enable IR receiver"];
11 |
12 | |||;
13 |
14 | User -> IRKit [label = "Send IR signal"];
15 |
16 | IRKit -> Server [label = "POST /1/p"];
17 | }
18 |
--------------------------------------------------------------------------------
/firmware/t/base64/base64decode.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 | use MIME::Base64;
5 |
6 | my $encoded = shift;
7 | die "usage: perl $0 {base64 encoded string}\nor\nperl $0 {base64 encoded string} | ../packer/unpack_sequence.bin\n" unless $encoded;
8 |
9 | my $decoded = decode_base64($encoded);
10 | print join("", map { sprintf("%02x", ord($_)); } split(//, $decoded));
11 |
12 |
--------------------------------------------------------------------------------
/firmware/t/packer/Makefile:
--------------------------------------------------------------------------------
1 |
2 | test:
3 | g++ -Wall -g -o .build/test.out IrPacker.c test.cpp
4 | ./.build/test.out
5 |
6 | all:
7 | # g++ -Wall -g -o pack.bin IrPacker.c pack.cpp
8 | # g++ -Wall -g -o unpack.bin IrPacker.c unpack.cpp
9 | g++ -Wall -g -o unpack_sequence.bin IrPacker.c unpack_sequence.cpp
10 |
11 | packer:
12 | g++ -Wall -g -o pack_sequence.bin IrPacker.c pack_sequence.cpp base64encoder.c
13 |
14 |
--------------------------------------------------------------------------------
/firmware/t/packer-arduino/src/packer.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "IrPacker.h"
3 |
4 | void setup() {
5 | Serial.begin(115200);
6 |
7 | while ( ! Serial ) ; // wait for leonardo
8 |
9 | int8_t result = irpacker_save( (void*) 169 );
10 | if (result == 0) {
11 | Serial.println("saved!");
12 | }
13 | else {
14 | Serial.println("not saved :(");
15 | }
16 | }
17 |
18 | void loop() {
19 | }
20 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/MemoryFree.h:
--------------------------------------------------------------------------------
1 | // MemoryFree library based on code posted here:
2 | // http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1213583720/15
3 | //
4 | // Extended by Matthew Murdoch to include walking of the free list.
5 |
6 | #ifndef __MEMORY_FREE_H__
7 | #define __MEMORY_FREE_H__
8 |
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | extern int freeMemory();
14 |
15 | #ifdef __cplusplus
16 | }
17 | #endif
18 |
19 | #endif // __MEMORY_FREE_H__
20 |
--------------------------------------------------------------------------------
/firmware/t/freememory/src/Makefile:
--------------------------------------------------------------------------------
1 | BOARD_TAG = uno
2 | ARDUINO_PORT = /dev/cu.usb*
3 | ARDUINO_LIBS =
4 | ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
5 | ARDMK_DIR = ~/proj/Arduino-Makefile
6 | USER_LIB_PATH = ${HOME}/shared/arduino/imote
7 |
8 | include ~/proj/Arduino-Makefile/arduino-mk/Arduino.mk
9 |
10 | ### flymake
11 |
12 | .PHONY: check-syntax
13 | check-syntax:
14 | etags *.{c,h,cpp}
15 | $(CC) -x c++ $(CPPFLAGS) $(CXXFLAGS) -Wall -fsyntax-only $(CHK_SOURCES)
16 |
--------------------------------------------------------------------------------
/spec/colors/README.md:
--------------------------------------------------------------------------------
1 | Full Color LED Spec
2 | ===================
3 |
4 | ## Color/State Map
5 |
6 | * Started, Unconnected : Green
7 | * Connected and Authorized : Blue
8 | * Connected and Non Authorized : Yellow Blink
9 | * Bluetooth -> IR : Blue Blink
10 | * IR -> Bluetooth : Cyan Blink
11 | * Timeout : Red
12 |
13 | ## Available Colors
14 |
15 | * Red
16 | * Green
17 | * Blue
18 | * Cyan
19 | * Magenta
20 | * Yellow
21 | * White
22 | * Off
23 |
--------------------------------------------------------------------------------
/firmware/t/led/src/Makefile:
--------------------------------------------------------------------------------
1 | BOARD_TAG = uno
2 | ARDUINO_PORT = /dev/cu.usb*
3 | ARDUINO_LIBS = SoftwareSerial BGLib
4 | ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
5 | ARDMK_DIR = ~/proj/Arduino-Makefile
6 | USER_LIB_PATH = ${HOME}/shared/arduino/imote
7 |
8 | include ~/proj/Arduino-Makefile/arduino-mk/Arduino.mk
9 |
10 | ### flymake
11 |
12 | .PHONY: check-syntax
13 | check-syntax:
14 | etags *.{c,h,cpp}
15 | $(CC) -x c++ $(CPPFLAGS) $(CXXFLAGS) -Wall -fsyntax-only $(CHK_SOURCES)
16 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/Makefile:
--------------------------------------------------------------------------------
1 | BOARD_TAG = leonardo
2 | ARDUINO_PORT = /dev/cu.usb*
3 | # ARDUINO_LIBS = SoftwareSerial BGLib
4 | ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
5 | ARDMK_DIR = ~/src/github.com/sudar/Arduino-Makefile
6 | USER_LIB_PATH = ../../lib
7 |
8 | include ~/src/github.com/sudar/Arduino-Makefile/Arduino.mk
9 |
10 | ### flymake
11 |
12 | .PHONY: check-syntax
13 | check-syntax:
14 | etags *.{c,h,cpp}
15 | $(CC) -x c++ $(CPPFLAGS) $(CXXFLAGS) -Wall -fsyntax-only $(CHK_SOURCES)
16 |
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/Makefile:
--------------------------------------------------------------------------------
1 | BOARD_TAG = leonardo
2 | ARDUINO_PORT = /dev/cu.usb*
3 | # ARDUINO_LIBS = SoftwareSerial BGLib
4 | ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
5 | ARDMK_DIR = ~/src/github.com/sudar/Arduino-Makefile
6 | USER_LIB_PATH = ../../lib
7 |
8 | include ~/src/github.com/sudar/Arduino-Makefile/Arduino.mk
9 |
10 | ### flymake
11 |
12 | .PHONY: check-syntax
13 | check-syntax:
14 | etags *.{c,h,cpp}
15 | $(CC) -x c++ $(CPPFLAGS) $(CXXFLAGS) -Wall -fsyntax-only $(CHK_SOURCES)
16 |
--------------------------------------------------------------------------------
/hardware/simulation/irled.net:
--------------------------------------------------------------------------------
1 | * F:\IRKIT\DEVICE\HARDWARE\SIMULATION\irled.asc
2 | Q1 c b 0 0 2SD1781K
3 | R1 b in 1.8k
4 | R2 c N002 200
5 | V1 in 0 PULSE(0V 5V 18u 0 0 9u 27u 100) AC 2.5V
6 | V2 out 0 5V
7 | R3 c b 10k
8 | D1 N001 N002 LD271
9 | D2 out N001 LD271
10 | R4 N002 c 200
11 | C1 out 0 4.7u
12 | .model D D
13 | .lib C:\PROGRA~1\LTC\LTSPIC~1\lib\cmp\standard.dio
14 | .model NPN NPN
15 | .model PNP PNP
16 | .lib C:\PROGRA~1\LTC\LTSPIC~1\lib\cmp\standard.bjt
17 | .tran 0.1m
18 | .backanno
19 | .end
20 |
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/Makefile:
--------------------------------------------------------------------------------
1 | BOARD_TAG = leonardo
2 | ARDUINO_PORT = /dev/cu.usb*
3 | # ARDUINO_LIBS = SoftwareSerial BGLib
4 | ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
5 | ARDMK_DIR = ~/proj/Arduino-Makefile
6 | # USER_LIB_PATH = ${HOME}/shared/arduino/imote
7 |
8 | include ~/proj/Arduino-Makefile/arduino-mk/Arduino.mk
9 |
10 | ### flymake
11 |
12 | .PHONY: check-syntax
13 | check-syntax:
14 | # etags *.{c,h,cpp}
15 | $(CC) -x c++ $(CPPFLAGS) $(CXXFLAGS) -Wall -fsyntax-only $(CHK_SOURCES)
16 |
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/Makefile:
--------------------------------------------------------------------------------
1 | BOARD_TAG = leonardo
2 | ARDUINO_PORT = /dev/cu.usb*
3 | # ARDUINO_LIBS = SoftwareSerial BGLib
4 | ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
5 | ARDMK_DIR = ~/proj/Arduino-Makefile
6 | # USER_LIB_PATH = ${HOME}/shared/arduino/imote
7 |
8 | include ~/proj/Arduino-Makefile/arduino-mk/Arduino.mk
9 |
10 | ### flymake
11 |
12 | .PHONY: check-syntax
13 | check-syntax:
14 | # etags *.{c,h,cpp}
15 | $(CC) -x c++ $(CPPFLAGS) $(CXXFLAGS) -Wall -fsyntax-only $(CHK_SOURCES)
16 |
--------------------------------------------------------------------------------
/firmware/t/gainspan-tcertadd/src/Makefile:
--------------------------------------------------------------------------------
1 | BOARD_TAG = leonardo
2 | ARDUINO_PORT = /dev/cu.usb*
3 | # ARDUINO_LIBS = SoftwareSerial BGLib
4 | ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
5 | ARDMK_DIR = ~/proj/Arduino-Makefile
6 | # USER_LIB_PATH = ${HOME}/shared/arduino/imote
7 |
8 | include ~/proj/Arduino-Makefile/arduino-mk/Arduino.mk
9 |
10 | ### flymake
11 |
12 | .PHONY: check-syntax
13 | check-syntax:
14 | # etags *.{c,h,cpp}
15 | $(CC) -x c++ $(CPPFLAGS) $(CXXFLAGS) -Wall -fsyntax-only $(CHK_SOURCES)
16 |
--------------------------------------------------------------------------------
/firmware/t/base64/src/base64.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "base64encoder.h"
3 |
4 | void base64encoded( char encoded ) {
5 | Serial.print( encoded );
6 | }
7 |
8 | void setup() {
9 | Serial.begin(115200);
10 |
11 | // wait for leonardo
12 | while ( ! Serial );
13 |
14 | Serial.println("started");
15 |
16 | uint8_t input[256];
17 | for (uint16_t i=0; i<256; i++) {
18 | input[ i ] = i;
19 | }
20 |
21 | Serial.print("length: "); Serial.println( base64_length(256) );
22 |
23 | base64_encode( input, 256, &base64encoded );
24 | }
25 |
26 | void loop() {
27 | }
28 |
--------------------------------------------------------------------------------
/firmware/t/gainspan/src/version.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | const char version[] = "Tester";
18 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/version.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | const char version[] = "3.0.0.0.g85190b1";
18 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/version.template:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | const char version[] = "__VERSION__";
18 |
--------------------------------------------------------------------------------
/firmware/USBCore.cpp.patch:
--------------------------------------------------------------------------------
1 | --- USBCore.cpp.original 2014-04-02 23:36:34.000000000 +0900
2 | +++ USBCore.cpp 2014-04-02 23:36:51.000000000 +0900
3 | @@ -59,6 +59,8 @@
4 | 'A','r','d','u','i','n','o',' ','E','s','p','l','o','r','a',' '
5 | #elif USB_PID == 0x9208
6 | 'L','i','l','y','P','a','d','U','S','B',' ',' ',' ',' ',' ',' '
7 | +#elif USB_PID == 0x6085
8 | + 'I','R','K','i','t',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '
9 | #else
10 | 'U','S','B',' ','I','O',' ','B','o','a','r','d',' ',' ',' ',' '
11 | #endif
12 | @@ -70,6 +72,8 @@
13 | 'A','r','d','u','i','n','o',' ','L','L','C'
14 | #elif USB_VID == 0x1b4f
15 | 'S','p','a','r','k','F','u','n',' ',' ',' '
16 | +#elif USB_VID == 0x1d50
17 | + 'I','R','K','i','t',' ',' ',' ',' ',' ',' '
18 | #else
19 | 'U','n','k','n','o','w','n',' ',' ',' ',' '
20 | #endif
21 |
--------------------------------------------------------------------------------
/hardware/Writer.partlist.csv:
--------------------------------------------------------------------------------
1 | "Qty";"Value";"Device";"Package";"Parts";"Description";"";
2 | "5";"1k";"RESISTOR-US2012";"SMD2012";"R2, R4, R5, R6, R7";"Generic Registor";"";
3 | "2";"5.1k";"RESISTOR-US2012";"SMD2012";"R1, R3";"Generic Registor";"";
4 | "1";"IRKit ICSP";"PINHD-2X3";"2X03";"ICSP";"PIN HEADER";"";
5 | "1";"IRKit Wifi";"PINHD-2X4";"2X04";"CN1";"PIN HEADER";"";
6 | "1";"JAPANINO-SLIM";"JAPANINO-SLIM";"JAPANINO-SLIM";"IC1";"";"";
7 | "2";"OSG50805C1C";"LED-2012";"LED2012";"LED1, LED2";"Through-hole LED";"";
8 | "1";"SLIDE-SWITCH4/2";"SLIDE-SWITCH4/2";"SLIDE-SWITCH-MCS421N";"SW2";"";"";
9 | "1";"SS12D01G4";"SLIDE-SWITCH1/2";"SS12D01G4";"SW1";"SLIDING SWITCH";"";
10 | "4";"STAND-OFF";"STAND-OFF";"STAND-OFF";"STANDOFF1, STANDOFF2, STANDOFF3, STANDOFF4";"#4 Stand Off";"";
11 | "1";"TTL-232R-3V3";"PINHD-1X6/90";"1X06/90";"JP1";"PIN HEADER";"";
12 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/version.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __VERSION_H__
18 | #define __VERSION_H__
19 |
20 | extern const char version[];
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/firmware/t/test/src/test.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "pgmStrToRAM.h"
3 | #include "CRC8.h"
4 | #include "Keys.h"
5 |
6 | void setup() {
7 | // USB serial
8 | Serial.begin(115200);
9 |
10 | // wait for leonardo
11 | while ( ! Serial );
12 |
13 | Serial.println("start");
14 |
15 | Keys::KeysCRCed data;
16 | memset( (void*)&data, 0, sizeof(data) );
17 | data.security = GSSECURITY_WPA2_PSK;
18 | data.wifi_is_set = true;
19 | data.wifi_was_valid = false;
20 | strcpy( data.ssid, "Rhodos" );
21 | strcpy( data.password, "aaaaaaaaaaaaa" );
22 | strcpy( data.temp_key, "abc" );
23 |
24 | uint8_t crc = crc8( (uint8_t*)&data, sizeof(data) );
25 | Serial.print("crc: 0x"); Serial.println(crc, HEX);
26 |
27 | Serial.print("size: "); Serial.println(sizeof(data));
28 | }
29 |
30 | void loop() {
31 | }
32 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/env.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __ENV_H__
18 | #define __ENV_H__
19 |
20 | #define GS1011MIPS 1
21 | #define GS1011MEPS 2
22 |
23 | #define WIFI_MODULE GS1011MEPS
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/firmware/t/gainspan-serial/src/gainspan-serial.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "pins.h"
3 | #include "pgmStrToRAM.h"
4 | #include "HardwareSerialX.h"
5 |
6 | #define RX_BUFFER_SIZE 64
7 | #define TX_BUFFER_SIZE 64
8 |
9 | void setup() {
10 | // USB serial
11 | Serial.begin(115200);
12 |
13 | // wait for connection
14 | while ( ! Serial ) ;
15 |
16 | pinMode( LDO33_ENABLE, OUTPUT );
17 | digitalWrite( LDO33_ENABLE, HIGH );
18 |
19 | // gainspan
20 | Serial1X.begin(57600);
21 | }
22 |
23 | void loop() {
24 | // gainspan -> usb
25 | if (Serial1X.available()) {
26 | Serial.write(Serial1X.read());
27 | }
28 |
29 | // usb -> gainspan
30 | if (Serial.available()) {
31 | static uint8_t last_character = '0';
32 |
33 | last_character = Serial.read();
34 |
35 | Serial1X.write(last_character);
36 | Serial.write(last_character);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/env.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __ENV_H__
18 | #define __ENV_H__
19 |
20 | // we're going to use saveLimitedAPPassword
21 | #define FACTORY_CHECKER 1
22 | #define SAVE_IRPACKER_TREE 1
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/firmware/t/button/src/button.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "pins.h"
3 | #include "longpressbutton.h"
4 | #include "timer.h"
5 |
6 | struct long_press_button_state_t long_press_button_state;
7 |
8 | void long_pressed() {
9 | Serial.println("long pressed");
10 | }
11 |
12 | // inside ISR, be careful
13 | void on_timer() {
14 | long_press_button_ontimer( &long_press_button_state );
15 | }
16 |
17 | void setup() {
18 | //--- initialize timer
19 |
20 | timer_init( on_timer );
21 | timer_start( TIMER_INTERVAL );
22 |
23 | //--- initialize long press button
24 |
25 | pinMode( CLEAR_BUTTON, INPUT );
26 | long_press_button_state.pin = CLEAR_BUTTON;
27 | long_press_button_state.callback = &long_pressed;
28 | long_press_button_state.threshold_time = 5;
29 |
30 | // USB serial
31 | Serial.begin(115200);
32 |
33 | while (! Serial) ;
34 | }
35 |
36 | void loop() {
37 | delay(100);
38 | Serial.print(".");
39 | }
40 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/convert.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __CONVERT_H__
18 | #define __CONVERT_H__
19 |
20 | #ifdef __cplusplus
21 | extern "C" {
22 | #endif
23 |
24 | extern uint8_t x2i (char c);
25 | extern char i2x (uint8_t x);
26 |
27 | #ifdef __cplusplus
28 | }
29 | #endif
30 |
31 | #endif // __CONVERT_H__
32 |
--------------------------------------------------------------------------------
/firmware/t/freememory/src/freememory.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "MemoryFree.h"
3 | #include "pgmStrToRAM.h"
4 |
5 | void setup() {
6 | Serial.begin(115200);
7 |
8 | // wait for leonardo
9 | while ( ! Serial );
10 |
11 | /* // 2385 */
12 | /* Serial.print("aaa"); Serial.println(freeMemory()); */
13 | /* // 2351 */
14 | /* Serial.print("ffffffffffffffffffffffffffffffff"); Serial.println(freeMemory()); */
15 | /* // 2319 */
16 | /* Serial.print("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); Serial.println(freeMemory()); */
17 |
18 | // 2376
19 | Serial.print(P("aaa")); Serial.println(freeMemory());
20 | Serial.print(P("ffffffffffffffffffffffffffffffff")); Serial.println(freeMemory());
21 | Serial.print(P("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")); Serial.println(freeMemory());
22 |
23 | char cmd1[100];
24 | sprintf(cmd1, P("1:%s"),PB("aaa",1));
25 | Serial.println(cmd1);
26 |
27 | sprintf(cmd1, P("2:%s"),PB("bbb",1));
28 | Serial.println(cmd1);
29 |
30 | }
31 |
32 | void loop() {
33 | }
34 |
--------------------------------------------------------------------------------
/spec/diagrams/ir-send.msc:
--------------------------------------------------------------------------------
1 | msc {
2 | # entities
3 | User, IRKit, Server, TV;
4 |
5 | # space
6 | |||;
7 |
8 | IRKit note Server [label = "Successfully connected"];
9 |
10 | IRKit note IRKit [label = "Start listening on port 80"];
11 |
12 | IRKit => Server [label = "GET /m (longpoll)"];
13 |
14 | |||;
15 |
16 | User note IRKit [label = "IF User and IRKit are in the same Wifi"];
17 |
18 | User => IRKit [label = "POST /messages"];
19 | IRKit -> TV [label = "Send IR signal"];
20 | User << IRKit [label = "200 OK"];
21 |
22 | |||;
23 |
24 | User note IRKit [label = "IF User and IRKit are not in the same Wifi"];
25 |
26 | User => Server [label = "POST /1/messages (body: clientkey=#{clientkey}&deviceid=#{deviceid})"];
27 | User << Server [label = "200 OK"];
28 |
29 | IRKit << Server [label = "Response to \"GET /m\" longpoll: 200 OK, IR signal in body"];
30 | IRKit -> TV [label = "IR signal"];
31 | IRKit => Server [label = "GET /m (longpoll)"];
32 | }
33 |
--------------------------------------------------------------------------------
/hardware/Writer.dri:
--------------------------------------------------------------------------------
1 | Generated by EAGLE CAM Processor 6.5.0
2 |
3 | Drill Station Info File: /Users/mash/proj/irkit/device/hardware/Writer.dri
4 |
5 | Date : 2014/04/04 10:29
6 | Drills : generated
7 | Device : Excellon drill station
8 |
9 | Parameter settings:
10 |
11 | Tolerance Drill + : 0.00 %
12 | Tolerance Drill - : 0.00 %
13 | Rotate : no
14 | Mirror : no
15 | Optimize : yes
16 | Auto fit : yes
17 | OffsetX : 0inch
18 | OffsetY : 0inch
19 | Layers : Drills Holes
20 |
21 | Drill File Info:
22 |
23 | Data Mode : Absolute
24 | Units : 1/10000 Inch
25 |
26 | Drills used:
27 |
28 | Code Size used
29 |
30 | T01 0.0120inch 55
31 | T02 0.0157inch 9
32 | T03 0.0335inch 6
33 | T04 0.0354inch 14
34 | T05 0.0400inch 6
35 | T06 0.0433inch 14
36 | T07 0.1300inch 7
37 |
38 | Total number of drills: 111
39 |
40 | Plotfiles:
41 |
42 | /Users/mash/proj/irkit/device/hardware/Writer.TXT
43 |
--------------------------------------------------------------------------------
/hardware/IRKit.dri:
--------------------------------------------------------------------------------
1 | Generated by EAGLE CAM Processor 6.5.0
2 |
3 | Drill Station Info File: /Users/mash/proj/irkit/device/hardware/IRKit.dri
4 |
5 | Date : 2013/11/11 20:34
6 | Drills : generated
7 | Device : Excellon drill station
8 |
9 | Parameter settings:
10 |
11 | Tolerance Drill + : 0.00 %
12 | Tolerance Drill - : 0.00 %
13 | Rotate : no
14 | Mirror : no
15 | Optimize : yes
16 | Auto fit : yes
17 | OffsetX : 0inch
18 | OffsetY : 0inch
19 | Layers : Drills Holes
20 |
21 | Drill File Info:
22 |
23 | Data Mode : Absolute
24 | Units : 1/10000 Inch
25 |
26 | Drills used:
27 |
28 | Code Size used
29 |
30 | T01 0.0120inch 142
31 | T02 0.0236inch 15
32 | T03 0.0276inch 3
33 | T04 0.0315inch 4
34 | T05 0.0320inch 4
35 | T06 0.0354inch 18
36 | T07 0.0400inch 6
37 | T08 0.1300inch 4
38 |
39 | Total number of drills: 196
40 |
41 | Plotfiles:
42 |
43 | /Users/mash/proj/irkit/device/hardware/IRKit.TXT
44 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/CRC8.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __CRC8_H__
18 | #define __CRC8_H__
19 |
20 | #include
21 |
22 | #define CRC8INIT 0x00
23 | #define CRC8POLY 0x31 // = X^8+X^5+X^4+X^0
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | uint8_t crc8 (uint8_t* data, uint16_t size, uint8_t init);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/hardware/check_fusionpcb_zip.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # -*- coding: utf-8 -*-
3 |
4 | if ARGV.size != 1 then
5 | abort "usage: ruby #{$0} path/to/fusionpcb.zip"
6 | end
7 |
8 | # Top Layer: pcbname.GTL
9 | # Bottom Layer: pcbname.GBL
10 | # Solder Mask Top: pcbname.GTS
11 | # Solder Mask Bottom: pcbname.GBS
12 | # Silk Top: pcbname.GTO
13 | # Silk Bottom: pcbname.GBO
14 | # Drill Drawing: pcbname.TXT
15 | # Board Outline:pcbname.GML/GKO
16 | spec = {
17 | "GTL" => "Top Layer",
18 | "GBL" => "Bottom Layer",
19 | "GTS" => "Solder Mask Top",
20 | "GBS" => "Solder Mask Bottom",
21 | "GTO" => "Silk Top",
22 | "GBO" => "Silk Bottom",
23 | "TXT" => "Drill Drawing",
24 | "GML" => "Board Outline",
25 | }
26 |
27 | # qq: very quiet
28 | # l: list
29 | stdout = `unzip -qql #{ ARGV[0] }`
30 | lines = stdout.split("\n")
31 | # puts stdout
32 |
33 | ok = 1
34 | spec.each_key { |extension|
35 | if ! lines.find {|line| line.match(/\.#{extension}/)}
36 | puts "#{spec[extension]} (#{extension}) not found"
37 | ok = nil
38 | end
39 | }
40 |
41 | if ok
42 | puts "zip file looks fine."
43 | end
44 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/commands.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __COMMANDS_H__
18 | #define __COMMANDS_H__
19 |
20 | #define COMMAND_POST_KEYS 1
21 | #define COMMAND_SETUP 2
22 | #define COMMAND_CONNECT 3
23 | #define COMMAND_CLOSE 4
24 | #define COMMAND_START_POLLING 5
25 | #define COMMAND_POST_DOOR 6
26 | #define COMMAND_SETREGDOMAIN 7
27 |
28 | #define COMMAND_QUEUE_SIZE 8
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/pgmStrToRAM.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __PGMSTRTORAM_H__
18 | #define __PGMSTRTORAM_H__
19 |
20 | #include
21 |
22 | #define P(s) pgmStrToRAM(PSTR(s),0)
23 | #define PB(s,i) pgmStrToRAM(PSTR(s),i)
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | char *pgmStrToRAM(const PROGMEM char *theString, uint8_t index);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/firmware/t/initialize-eeprom/src/initialize.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include
3 | #include "pins.h"
4 | #include "GSwifi.h"
5 | #include "IrPacker.h"
6 | #include "const.h"
7 | #include "FullColorLed.h"
8 | #include "timer.h"
9 |
10 | static FullColorLed color( FULLCOLOR_LED_R, FULLCOLOR_LED_G, FULLCOLOR_LED_B );
11 | static GSwifi gs(&Serial1X);
12 |
13 | void setup() {
14 | //--- initialize timer
15 | timer_init( on_timer );
16 | timer_start( TIMER_INTERVAL );
17 |
18 | //--- initialize full color led
19 |
20 | pinMode(FULLCOLOR_LED_R, OUTPUT);
21 | pinMode(FULLCOLOR_LED_G, OUTPUT);
22 | pinMode(FULLCOLOR_LED_B, OUTPUT);
23 | color.setLedColor( 1, 0, 0, false ); // red: started
24 |
25 | // modify if you want a different password
26 | gs.saveLimitedAPPassword( "0123456789" );
27 |
28 | irpacker_save( (void*) EEPROM_PACKERTREE_OFFSET );
29 |
30 | color.setLedColor( 0, 0, 1, false ); // blue: ready
31 | }
32 |
33 | void loop() {
34 | }
35 |
36 | void software_reset() {
37 | wdt_enable(WDTO_15MS);
38 | while (1) ;
39 | }
40 |
41 | void on_timer(){
42 | color.onTimer();
43 | }
44 |
--------------------------------------------------------------------------------
/firmware/t/packer/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef __UTILS_H__
2 | #define __UTILS_H__
3 |
4 | #include // for va_list
5 |
6 | void setBuffer8( uint8_t *buff, uint16_t num, ... ){
7 | va_list list;
8 | int i;
9 |
10 | va_start( list, num );
11 |
12 | for( i = 0; i < num; ++i ){
13 | buff[i] = (uint8_t)va_arg( list, int );
14 | }
15 |
16 | va_end( list );
17 | }
18 |
19 | void setBuffer16( uint16_t *buff, uint16_t num, ... ){
20 | va_list list;
21 | int i;
22 |
23 | va_start( list, num );
24 |
25 | for( i = 0; i < num; ++i ){
26 | buff[i] = (uint16_t)va_arg( list, int );
27 | }
28 |
29 | va_end( list );
30 | }
31 |
32 | void dump8( const uint8_t *data, uint16_t datasize ) {
33 | uint16_t i;
34 |
35 | printf("{ ");
36 | for (i=0; i= 100)
2 | #include
3 | #else
4 | #include
5 | #endif
6 |
7 | extern unsigned int __heap_start;
8 | extern void *__brkval;
9 |
10 | /*
11 | * The free list structure as maintained by the
12 | * avr-libc memory allocation routines.
13 | */
14 | struct __freelist {
15 | size_t sz;
16 | struct __freelist *nx;
17 | };
18 |
19 | /* The head of the free list structure */
20 | extern struct __freelist *__flp;
21 |
22 | #include "MemoryFree.h"
23 |
24 | /* Calculates the size of the free list */
25 | int freeListSize() {
26 | struct __freelist* current;
27 | int total = 0;
28 |
29 | for (current = __flp; current; current = current->nx) {
30 | total += 2; /* Add two bytes for the memory block's header */
31 | total += (int) current->sz;
32 | }
33 |
34 | return total;
35 | }
36 |
37 | int freeMemory() {
38 | int free_memory;
39 |
40 | if ((int)__brkval == 0) {
41 | free_memory = ((int)&free_memory) - ((int)&__heap_start);
42 | } else {
43 | free_memory = ((int)&free_memory) - ((int)__brkval);
44 | free_memory += freeListSize();
45 | }
46 | return free_memory;
47 | }
48 |
--------------------------------------------------------------------------------
/firmware/boards.txt.patch:
--------------------------------------------------------------------------------
1 | --- boards.txt.original 2013-11-06 14:15:43.000000000 +0900
2 | +++ boards.txt 2013-11-06 14:19:01.000000000 +0900
3 | @@ -167,6 +167,27 @@
4 |
5 | ##############################################################
6 |
7 | +irkit.name=IRKit
8 | +irkit.upload.protocol=avr109
9 | +irkit.upload.maximum_size=28672
10 | +irkit.upload.speed=57600
11 | +irkit.upload.disable_flushing=true
12 | +irkit.bootloader.low_fuses=0xff
13 | +irkit.bootloader.high_fuses=0xd8
14 | +irkit.bootloader.extended_fuses=0xcb
15 | +irkit.bootloader.path=caterina
16 | +irkit.bootloader.file=Caterina-Leonardo.hex
17 | +irkit.bootloader.unlock_bits=0x3F
18 | +irkit.bootloader.lock_bits=0x2F
19 | +irkit.build.mcu=atmega32u4
20 | +irkit.build.f_cpu=16000000L
21 | +irkit.build.vid=0x1d50
22 | +irkit.build.pid=0x6085
23 | +irkit.build.core=arduino
24 | +irkit.build.variant=leonardo
25 | +
26 | +##############################################################
27 | +
28 | esplora.name=Arduino Esplora
29 | esplora.upload.protocol=avr109
30 | esplora.upload.maximum_size=28672
31 | @@ -564,4 +585,3 @@
32 | robotMotor.build.pid=0x8039
33 | robotMotor.build.core=robot
34 | robotMotor.build.variant=robot_motor
35 | -
36 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/CRC8.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include "CRC8.h"
18 |
19 | uint8_t crc8 ( uint8_t *data, uint16_t size, uint8_t init )
20 | {
21 | uint8_t crc, i;
22 |
23 | crc = init;
24 |
25 | while (size--) {
26 | crc ^= *data++;
27 |
28 | for (i=0; i<8; i++) {
29 | if (crc & 0x80) {
30 | crc = (crc<<1) ^ CRC8POLY;
31 | }
32 | else {
33 | crc <<= 1;
34 | }
35 | }
36 | }
37 |
38 | return crc;
39 | }
40 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/base64encoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __BASE64ENCODER_H__
18 | #define __BASE64ENCODER_H__
19 |
20 | #include
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | typedef void (*Base64EncodeCallback)(char);
27 | extern uint16_t base64_length(uint16_t input_length);
28 | extern void base64_encode(const uint8_t *input,
29 | uint16_t input_length,
30 | Base64EncodeCallback callback);
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/pgmStrToRAM.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include
18 |
19 | // largest used in our program
20 | #define PROGMEM_CACHE_SIZE 48
21 |
22 | // rule
23 | // index 0 is for directly using Serial.println(P("hoge"))
24 | // index 1,.. is for passing char* into next function
25 |
26 | // choose different index to use simultaneously
27 | char to_print[2][PROGMEM_CACHE_SIZE];
28 |
29 | char *pgmStrToRAM(const PROGMEM char *theString, uint8_t index) {
30 | strcpy_P( to_print[ index ], theString );
31 | return to_print[index];
32 | }
33 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/convert.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include "Arduino.h"
18 | #include "convert.h"
19 |
20 | uint8_t x2i (char c) {
21 | if (c >= '0' && c <= '9') {
22 | return c - '0';
23 | } else
24 | if (c >= 'A' && c <= 'F') {
25 | return c - 'A' + 10;
26 | } else
27 | if (c >= 'a' && c <= 'f') {
28 | return c - 'a' + 10;
29 | }
30 | return 0;
31 | }
32 |
33 | char i2x (uint8_t x) {
34 | if (x >= 0 && x <= 9) {
35 | return x + '0';
36 | }
37 | else if (x >= 10 && x <= 15) {
38 | return x - 10 + 'a';
39 | }
40 | return 0;
41 | }
42 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/longpressbutton.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __LONGPRESSBUTTON_H__
18 | #define __LONGPRESSBUTTON_H__
19 |
20 | // reverse logic
21 | #define BUTTON_ON LOW
22 | #define BUTTON_OFF HIGH
23 |
24 | struct long_press_button_state_t {
25 | int pin;
26 | uint8_t threshold_time;
27 | volatile uint8_t timer;
28 | void (*callback)();
29 | };
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | void long_press_button_ontimer( struct long_press_button_state_t* state );
36 |
37 | #ifdef __cplusplus
38 | }
39 | #endif
40 |
41 | #endif // __LONGPRESSBUTTON_H__
42 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/const.h:
--------------------------------------------------------------------------------
1 | /** \file const.h */
2 | /*
3 | Copyright (C) 2013-2014 Masakazu Ohtsuka
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 2 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 | #ifndef __CONST_H__
19 | #define __CONST_H__
20 |
21 | /// Buffer shared between IR and Wi-Fi credentials
22 | #define SHARED_BUFFER_SIZE 512
23 |
24 | #define EEPROM_KEYS_OFFSET 0
25 |
26 | // sizeof(KeysShared)
27 | #define EEPROM_INDEPENDENT_OFFSET 134
28 |
29 | // sizeof(KeysShared) + sizeof(KeysIndependent)
30 | #define EEPROM_PACKERTREE_OFFSET 169
31 |
32 | // sizeof(KeysShared) + sizeof(KeysIndependent) + sizeof(tree)
33 | #define EEPROM_LIMITEDAPPASSWORD_OFFSET 505
34 | // length = 10 characters + NULL
35 | #define EEPROM_LIMITEDAPPASSWORD_LENGTH 11
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/spec/diagrams/packer.gv:
--------------------------------------------------------------------------------
1 | digraph packer {
2 | rankdir=TB;
3 |
4 | START [ label = "START", shape = point, fixedsize = false ];
5 | START -> LOOPSTART;
6 |
7 | node [shape=ellipse, fontsize=12];
8 |
9 | LOOPSTART -> IF1;
10 |
11 | IF1 [ label = "If isBytePacking" ];
12 | IF1 -> IF11 [ label = "YES" ];
13 | IF1 -> IF2 [ label = "NO" ];
14 |
15 | IF11 [ label = "If current data fits 0/1" ];
16 | IF11 -> IF111 [ label = "YES" ];
17 | IF11 -> IF112 [ label = "NO" ];
18 |
19 | IF111 [ label = "Write 0 or 1" ];
20 | IF111 -> INDEXPP;
21 |
22 | IF112 [ label = "isBytePacking = 0" ];
23 | IF112 -> LOOPEND;
24 |
25 | IF2 [ label = "If following 3 entries\nlook like a 0/1 pattern" ];
26 | IF2 -> IF21 [ label = "YES" ];
27 | IF2 -> IF22 [ label = "NO" ];
28 |
29 | IF21 [ label = "isBytePacking = 1 &&\nWrite BytePacking header\nindex += xx" ];
30 | IF21 -> INDEXPP;
31 |
32 | IF22 [ label = "If following 2 entries\nlook like 0xFFFF 0x0000 pattern" ];
33 | IF22 -> IF221 [ label = "YES" ];
34 | IF22 -> IF222 [ label = "NO" ];
35 |
36 | IF221 [ label = "Write 0xFF\nindex++" ];
37 | IF221 -> INDEXPP;
38 |
39 | IF222 [ label = "Pack uint16_t -> uint8_t" ];
40 | IF222 -> INDEXPP;
41 |
42 | INDEXPP [ label = "index++" ];
43 | INDEXPP -> LOOPEND;
44 |
45 | LOOPEND;
46 | LOOPEND -> LOOPSTART;
47 | }
48 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/IRKitHTTPHandler.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __IRKITHTTPHANDLER_H__
18 | #define __IRKITHTTPHANDLER_H__
19 |
20 | #include "GSwifi.h"
21 |
22 | // we will start requesting GET /m again after
23 | // recently_posted_timer timeouts, and handler.timer timeouts: 5-10sec
24 | #define SUSPEND_GET_MESSAGES_INTERVAL 5 // [sec]
25 |
26 | extern int8_t irkit_httpclient_post_door();
27 | extern int8_t irkit_httpclient_get_messages();
28 | extern int8_t irkit_httpclient_post_messages();
29 | extern int8_t irkit_httpclient_post_keys();
30 | extern void irkit_httpclient_start_polling(uint8_t delay);
31 | extern void irkit_httpserver_register_handler();
32 | extern void irkit_http_init();
33 | extern void irkit_http_on_timer();
34 | extern void irkit_http_loop();
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/FullColorLed.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __FULLCOLORLED_H__
18 | #define __FULLCOLORLED_H__
19 |
20 | class FullColorLed
21 | {
22 | public:
23 | FullColorLed(int pinR, int pinG, int pinB);
24 | void setLedColor(bool colorR, bool colorG, bool colorB);
25 | void setLedColor(bool colorR, bool colorG, bool colorB, bool blink);
26 | void setLedColor(bool colorR, bool colorG, bool colorB, bool blink, uint8_t blink_timeout);
27 | void off();
28 | void onTimer();
29 |
30 | private:
31 | int pinR_;
32 | int pinG_;
33 | int pinB_;
34 | bool colorR_;
35 | bool colorG_;
36 | bool colorB_;
37 | bool isBlinking_; // defaults to off
38 | volatile bool blinkOn_; // altered inside timer ISR
39 | volatile uint8_t blink_timer_;
40 | };
41 |
42 | #endif // __FULLCOLORLED_H__
43 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/IRKitJSONParser.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __IRKITJSONPARSER_H__
18 | #define __IRKITJSONPARSER_H__
19 |
20 | #include
21 |
22 | #define IrJsonParserDataKeyId 0x01
23 | #define IrJsonParserDataKeyFormat 0x02
24 | #define IrJsonParserDataKeyFreq 0x03
25 | #define IrJsonParserDataKeyData 0x04
26 | #define IrJsonParserDataKeyPass 0x05
27 | #define IrJsonParserDataKeyUnknown 0xFF
28 |
29 | typedef void (*JSONParserStartEnd)();
30 | typedef void (*JSONParserData)(uint8_t key, uint32_t value, char *pass);
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | extern void irkit_json_parse (char letter,
37 | JSONParserStartEnd on_start,
38 | JSONParserData on_data,
39 | JSONParserStartEnd on_end);
40 |
41 | #ifdef __cplusplus
42 | }
43 | #endif
44 |
45 | #endif // __IRKITJSONPARSER_H__
46 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __TIMER_H__
18 | #define __TIMER_H__
19 |
20 | #define TIMER_INTERVAL 200 // [ms]
21 |
22 | // be careful about overflow
23 | #define TIMER_START(a,sec) (a = sec * 5)
24 | #define TIMER_STOP(a) (a = TIMER_OFF)
25 |
26 | // 255: off, 0: dispatch, 00))
31 | #define TIMER_COUNTDOWN(a) (a --)
32 | #define TIMER_TICK(a) if (TIMER_RUNNING(a)) { TIMER_COUNTDOWN(a); }
33 | #define TIMER_FIRED(a) (a == TIMER_FIRE)
34 | #define TIMER_STOPPED(a) (a == TIMER_OFF)
35 |
36 | #ifdef __cplusplus
37 | extern "C" {
38 | #endif
39 |
40 | void timer_init( void (*callback)() );
41 | void timer_start( uint16_t interval_ms );
42 | void timer_stop( void );
43 |
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 |
48 | #endif // __TIMER_H__
49 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/longpressbutton.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include
18 | #include "longpressbutton.h"
19 | #include "timer.h"
20 |
21 | void long_press_button_ontimer( struct long_press_button_state_t* state ) {
22 | static uint8_t button_state = BUTTON_OFF;
23 |
24 | uint8_t next_button_state = digitalRead( state->pin );
25 |
26 | if ((BUTTON_OFF == button_state) &&
27 | (BUTTON_ON == next_button_state)) {
28 | // OFF -> ON
29 | TIMER_START( state->timer, state->threshold_time );
30 | }
31 | else if ((BUTTON_ON == button_state) &&
32 | (BUTTON_ON == next_button_state)) {
33 | // still pressing
34 |
35 | TIMER_TICK( state->timer );
36 |
37 | if (TIMER_FIRED( state->timer )) {
38 | state->callback();
39 |
40 | // fires again after state->threshold_time
41 | button_state = BUTTON_OFF;
42 | return;
43 | }
44 | }
45 |
46 | button_state = next_button_state;
47 | }
48 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/ringbuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __RINGBUFFER_H__
18 | #define __RINGBUFFER_H__
19 |
20 | #include
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | // variable sized ring buffer without malloc
27 |
28 | struct RingBuffer {
29 | char *buf;
30 | uint8_t size;
31 | uint8_t addr_w, addr_r;
32 | };
33 |
34 | extern inline void ring_init (volatile struct RingBuffer *ring, volatile char *area, uint8_t size);
35 | extern inline int8_t ring_put (volatile struct RingBuffer *ring, char dat);
36 | extern inline uint8_t ring_get (volatile struct RingBuffer *ring, char *dat, uint8_t len);
37 | extern inline uint8_t ring_isfull (volatile struct RingBuffer *ring);
38 | extern inline uint8_t ring_isempty (volatile struct RingBuffer *ring);
39 | extern inline uint8_t ring_used (volatile struct RingBuffer *ring);
40 | extern inline void ring_clear (volatile struct RingBuffer *ring);
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif // __RINGBUFFER_H__
47 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/pins.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __PINS_H__
18 | #define __PINS_H__
19 |
20 | #include
21 |
22 | // #define BLE112_TX A3 // pin26 -> BLE112 P0_5 RX
23 | // #define BLE112_RX A4 // pin27 -> BLE112 P0_4 TX
24 | // #define BLE112_RESET A2 // pin25 -> BLE112 !BLE/RST
25 | #define WIFI_TX 1 // D1 pin21
26 | #define WIFI_RX 0 // D0 pin20
27 |
28 | // #define IR_IN 8 // pin12 PB0 ICP1 Counter1 (PCINT0/CLKO/ICP1)
29 | // #define IR_OUT 3 // pin1 PD3 OC2B Timer2 (PCINT19/OC2B/INT1)
30 | #define IR_IN 13 // pin32 PC7 (ICP3/CLK0/OC4A)
31 | #define IR_OUT 10 // pin30 PB6 (PCINT6/OC1B/OC4B/ADC13)
32 |
33 | #define FULLCOLOR_LED_R 6 // pin27 PD7 (T0/OC4D/ADC10)
34 | #define FULLCOLOR_LED_G 9 // pin29 PB5 (PCINT5/OC1A/!OC4B/ADC12)
35 | #define FULLCOLOR_LED_B 8 // pin28 PB4 (PCINT4/ADC11)
36 |
37 | #define LDO33_ENABLE 7 // pin1
38 |
39 | #define MICROPHONE A4 // pin40 (ADC1)PF1
40 | // #define MICROPHONE A2 // v1.1.0's A4 was connnected to Wifi, use A2 on v1.1.0 for testing
41 | #define CLEAR_BUTTON A5 // pin41 (ADC0)PF0
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/firmware/t/morsify/test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "CRC8.h"
5 | #include "Keys.h"
6 |
7 | int main() {
8 | Keys::KeysCRCed data;
9 | memset( (void*)&data, 0, sizeof(data) );
10 | data.security = GSSECURITY_WEP;
11 | data.wifi_is_set = true;
12 | data.wifi_was_valid = false;
13 | strcpy( data.ssid, "001D739F0CB0" );
14 | strcpy( data.password, "abcde" );
15 | strcpy( data.temp_key, "1CB51E381C6A4576A54D6D37279F258C" );
16 |
17 | // security
18 | printf("%d/", data.security);
19 |
20 | // ssid
21 | for (int i=0; i> 4;
24 | // char lower = (letter & 0x0F);
25 | // printf("%x%x", upper, lower);
26 | printf("%02x", letter & 0xFF);
27 | }
28 | printf("/");
29 |
30 | // password
31 | for (int i=0; i> 4;
47 | char lower = (letter & 0x0F);
48 | printf("%x%x", upper, lower);
49 | }
50 | printf("/");
51 |
52 | // regdomain
53 | printf("2/");
54 |
55 | // reserved
56 | printf("/////");
57 |
58 | // crc8
59 | uint8_t crc = crc8( (uint8_t*)&data, sizeof(data) );
60 | {
61 | char upper = (crc & 0xF0) >> 4;
62 | char lower = (crc & 0x0F);
63 | printf("%x%x", upper, lower);
64 | }
65 | printf("\n");
66 |
67 | printf("size: %lu", sizeof(data));
68 | printf("\n");
69 | }
70 |
--------------------------------------------------------------------------------
/spec/diagrams/ir-state.gv:
--------------------------------------------------------------------------------
1 | digraph ir_state {
2 | rankdir=TB;
3 |
4 | START [ label = "START", shape = point, fixedsize = false ];
5 |
6 | node [shape=ellipse, fontsize=12, fixedsize=true, width=1.5, height=0.8];
7 |
8 | DISABLED [ label = "DISABLED (255)" ];
9 | START -> DISABLED [ label = "Power Up", weight = 100 ];
10 |
11 | CONNECTED [ label = "CONNECTED (1)" ];
12 | IDLE [ label = "IDLE (2)" ];
13 | DISABLED -> IDLE [ label = "Successfully connected to Internet and setup HTTP Server" ];
14 | DISABLED -> DISABLED [ label = "Connect failed" ];
15 |
16 | subgraph cluster_learn {
17 | label = "Learn IR";
18 | color=lightgray;
19 | rank=source;
20 |
21 | RECVING [ label = "RECVING (1)" ];
22 | RECVED [ label = "RECVED (2)" ];
23 | RECVED_IDLE [ label = "RECVED_IDLE (3)" ];
24 | READING [ label = "READING (4)" ];
25 |
26 | RECVING -> RECVED [ label = "IR receive buffer overflowed" ];
27 | RECVING -> RECVED [ label = "IR trailer detected" ];
28 |
29 | RECVED -> RECVED_IDLE [ label = "Sent IR data to server on Internet" ];
30 | RECVED_IDLE -> READING [ label = "HTTP client reads data from IRKit" ];
31 |
32 | }
33 | subgraph cluster_send {
34 | label = "Send IR";
35 | color=lightgray;
36 | rank=source;
37 |
38 | WRITING [ label = "WRITING (10)" ];
39 | XMITTING [ label = "XMITTING (11)" ];
40 |
41 | WRITING -> XMITTING [ label = "Finished receiving IR data" ];
42 | }
43 |
44 | IDLE -> IDLE [ label = "Overflow continues" ];
45 | IDLE -> RECVING [ label = "IR receiver detected falling edge", weight = 10 ];
46 | IDLE -> WRITING [ label = "Started receiving IR data", weight = 10 ];
47 |
48 | RECVED_IDLE -> IDLE [ label = "IR receiver detected falling edge" ];
49 | READING -> IDLE [ label = "Reading finished" ];
50 | XMITTING -> IDLE [ label = "All data sent" ];
51 | }
52 |
--------------------------------------------------------------------------------
/hardware/simulation/irled.asc:
--------------------------------------------------------------------------------
1 | Version 4
2 | SHEET 1 880 680
3 | WIRE 208 -208 128 -208
4 | WIRE 256 -208 208 -208
5 | WIRE 368 -208 256 -208
6 | WIRE 256 -192 256 -208
7 | WIRE 128 -128 128 -144
8 | WIRE 128 -32 128 -64
9 | WIRE 160 -32 128 -32
10 | WIRE 368 -16 368 -208
11 | WIRE 160 48 128 48
12 | WIRE 128 80 128 48
13 | WIRE 128 80 80 80
14 | WIRE 128 112 128 80
15 | WIRE 128 128 128 112
16 | WIRE -128 176 -144 176
17 | WIRE -112 176 -128 176
18 | WIRE 0 176 0 80
19 | WIRE 0 176 -32 176
20 | WIRE 48 176 0 176
21 | WIRE 64 176 48 176
22 | WIRE -144 208 -144 176
23 | WIRE 128 256 128 224
24 | WIRE -144 320 -144 288
25 | WIRE 128 320 128 256
26 | WIRE 256 320 256 -128
27 | WIRE 368 320 368 64
28 | FLAG 128 320 0
29 | FLAG -144 320 0
30 | FLAG 368 320 0
31 | FLAG -128 176 in
32 | FLAG 48 176 b
33 | FLAG 128 256 e
34 | FLAG 128 112 c
35 | FLAG 208 -208 out
36 | FLAG 256 320 0
37 | SYMBOL npn 64 128 R0
38 | SYMATTR InstName Q1
39 | SYMATTR Value 2SD1781K
40 | SYMBOL res -16 160 R90
41 | WINDOW 0 0 56 VBottom 2
42 | WINDOW 3 23 61 VTop 2
43 | SYMATTR InstName R1
44 | SYMATTR Value 1.8k
45 | SYMBOL res 144 64 R180
46 | WINDOW 0 36 76 Left 2
47 | WINDOW 3 36 40 Left 2
48 | SYMATTR InstName R2
49 | SYMATTR Value 10
50 | SYMBOL voltage -144 192 R0
51 | WINDOW 123 24 124 Left 2
52 | WINDOW 39 0 0 Left 2
53 | SYMATTR Value2 AC 2.5V
54 | SYMATTR InstName V1
55 | SYMATTR Value PULSE(0V 5V 18u 0 0 9u 27u 100)
56 | SYMBOL voltage 368 -32 R0
57 | WINDOW 123 0 0 Left 2
58 | WINDOW 39 0 0 Left 2
59 | SYMATTR InstName V2
60 | SYMATTR Value 5V
61 | SYMBOL res 96 64 R90
62 | WINDOW 0 0 56 VBottom 2
63 | WINDOW 3 32 56 VTop 2
64 | SYMATTR InstName R3
65 | SYMATTR Value 10k
66 | SYMBOL diode 112 -128 R0
67 | WINDOW 0 38 9 Left 2
68 | WINDOW 3 45 41 Left 2
69 | SYMATTR InstName D1
70 | SYMATTR Value LD271
71 | SYMBOL diode 112 -208 R0
72 | WINDOW 3 44 58 Left 2
73 | WINDOW 0 40 21 Left 2
74 | SYMATTR Value LD271
75 | SYMATTR InstName D2
76 | SYMBOL res 144 -48 R0
77 | SYMATTR InstName R4
78 | SYMATTR Value 10
79 | SYMBOL cap 240 -192 R0
80 | SYMATTR InstName C1
81 | SYMATTR Value 4.7u
82 | TEXT 320 96 Left 2 !.tran 0.1m
83 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/GSwifi_const.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2013 gsfan, MIT License
2 | * Copyright (C) 2013-2014 Masakazu Ohtsuka
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute,
7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8 | * furnished to do so, subject to the following conditions:
9 | *
10 | * The above copyright notice and this permission notice shall be included in all copies or
11 | * substantial portions of the Software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 | */
19 | /** @file
20 | * @brief Gainspan wi-fi module library for Arduino
21 | * GS1011MIC, GS1011MIP, GainSpan WiFi Breakout, etc.
22 | */
23 | #ifndef __GSWIFI_CONST_H__
24 | #define __GSWIFI_CONST_H__
25 |
26 | #define DOMAIN "deviceapi.getirkit.com"
27 |
28 | #define GS_TIMEOUT 20 // [s]
29 | #define GS_TIMEOUT_LONG 50 // [s]
30 | #define GS_TIMEOUT_SHORT 1
31 | #define GS_TIMEOUT_NOWAIT 0
32 |
33 | #define GS_CMD_SIZE 64
34 |
35 | #define GS_MAX_ROUTES 4
36 | #define GS_MAX_PATH_LENGTH 9 // max: "/messages"
37 |
38 | #define ESCAPE 0x1B
39 |
40 | enum GSSECURITY {
41 | GSSECURITY_AUTO = 0,
42 | GSSECURITY_NONE = 0,
43 | GSSECURITY_OPEN = 1,
44 | GSSECURITY_WEP = 2,
45 | GSSECURITY_WPA_PSK = 4,
46 | GSSECURITY_WPA2_PSK = 8,
47 | };
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/hardware/simulation/microphone.ASC:
--------------------------------------------------------------------------------
1 | Version 4
2 | SHEET 1 880 680
3 | WIRE 320 -144 -208 -144
4 | WIRE 128 -112 -112 -112
5 | WIRE 128 0 128 -32
6 | WIRE 160 0 128 0
7 | WIRE 272 0 240 0
8 | WIRE 128 32 128 0
9 | WIRE 272 32 272 0
10 | WIRE 320 48 320 -144
11 | WIRE 352 64 352 -16
12 | WIRE 304 80 272 80
13 | WIRE 416 96 416 -16
14 | WIRE 128 112 32 112
15 | WIRE 160 112 128 112
16 | WIRE 240 112 224 112
17 | WIRE -208 128 -208 -144
18 | WIRE -112 128 -112 -112
19 | WIRE 32 128 32 112
20 | WIRE 448 128 432 128
21 | WIRE 464 128 448 128
22 | WIRE 448 144 448 128
23 | WIRE 240 176 240 112
24 | WIRE 304 176 240 176
25 | WIRE 448 224 448 208
26 | WIRE -208 240 -208 208
27 | WIRE -112 240 -112 208
28 | WIRE 32 240 32 208
29 | WIRE 272 240 272 80
30 | WIRE 320 240 320 208
31 | WIRE 448 336 448 304
32 | FLAG 32 240 0
33 | FLAG -112 240 0
34 | FLAG -208 240 0
35 | FLAG 272 32 0
36 | FLAG 272 240 0
37 | FLAG 320 240 0
38 | FLAG 448 336 0
39 | SYMBOL voltage 32 112 R0
40 | WINDOW 123 0 0 Left 2
41 | WINDOW 39 0 0 Left 2
42 | SYMATTR InstName V1
43 | SYMATTR Value SINE(2.5 0.1 10k)
44 | SYMBOL voltage -112 112 R0
45 | WINDOW 123 0 0 Left 2
46 | WINDOW 39 0 0 Left 2
47 | SYMATTR InstName V2
48 | SYMATTR Value 3.3
49 | SYMBOL voltage -208 112 R0
50 | WINDOW 123 0 0 Left 2
51 | WINDOW 39 0 0 Left 2
52 | SYMATTR InstName V3
53 | SYMATTR Value 5
54 | SYMBOL res 112 16 R0
55 | SYMATTR InstName R1
56 | SYMATTR Value 2k
57 | SYMBOL res 112 -128 R0
58 | SYMATTR InstName R2
59 | SYMATTR Value 1.3k
60 | SYMBOL res 256 -16 R90
61 | WINDOW 0 0 56 VBottom 2
62 | WINDOW 3 32 56 VTop 2
63 | SYMATTR InstName R3
64 | SYMATTR Value 2k
65 | SYMBOL cap 224 96 R90
66 | WINDOW 0 0 32 VBottom 2
67 | WINDOW 3 32 32 VTop 2
68 | SYMATTR InstName C1
69 | SYMATTR Value 1u
70 | SYMBOL Opamps\\LM386 368 128 R0
71 | SYMATTR InstName U1
72 | SYMBOL cap 416 -32 R90
73 | WINDOW 0 0 32 VBottom 2
74 | WINDOW 3 32 32 VTop 2
75 | SYMATTR InstName C2
76 | SYMATTR Value 10u
77 | SYMBOL cap 432 144 R0
78 | SYMATTR InstName C3
79 | SYMATTR Value 0.047u
80 | SYMBOL res 432 208 R0
81 | SYMATTR InstName R4
82 | SYMATTR Value 10
83 | TEXT -240 360 Left 2 !.tran 0 0.001 0
84 |
--------------------------------------------------------------------------------
/spec/diagrams/setup.msc:
--------------------------------------------------------------------------------
1 | msc {
2 | # entities
3 | User, Phone, App, IRKit, Server;
4 |
5 | # space
6 | |||;
7 |
8 | IRKit note IRKit [label = "Powered Off"];
9 |
10 | User -> IRKit [label = "Power On"];
11 | IRKit note IRKit [label = "Not connected to home Wi-Fi access point"];
12 | IRKit note IRKit [label = "Start IRKit's own access point (WPA2) and start HTTP server"];
13 | Phone note Phone [label = "Connected to home Wi-Fi access point"];
14 | Server note Server [label = "All APIs are HTTPS"];
15 |
16 | |||;
17 |
18 | User -> Phone [label = "Launch App"];
19 | Phone -> App [label = "Launches"];
20 |
21 | |||;
22 |
23 | App => Server [label = "POST /1/clients"];
24 | App << Server [label = "clientkey"];
25 |
26 | App => Server [label = "POST /1/devices (body: clientkey=#{clientkey})"];
27 | App << Server [label = "receives devicekey, deviceid"];
28 |
29 | |||;
30 |
31 | User -> App [label = "Input home Wi-Fi's SSID and password"];
32 | User -> Phone [label = "Connect to IRKit's own access point"];
33 | User -> Phone [label = "Relaunch App"];
34 | Phone -> App [label = "Launches"];
35 |
36 | App => IRKit [label = "POST /wifi (body: #{home Wi-Fi's security, SSID, password, devicekey, REGDOMAIN})"];
37 | App << IRKit [label = "200 OK"];
38 |
39 | IRKit note IRKit [label = "Connect to home Wi-Fi"];
40 |
41 | IRKit => Server [label = "POST /door (body: devicekey=#{devicekey}&hostname=#{hostname})"];
42 | IRKit << Server [label = "Door Response (status code: 200)"];
43 |
44 | IRKit note IRKit [label = "Setup successfully finished"];
45 |
46 | |||;
47 |
48 | User -> Phone [label = "Connect to home Wi-Fi access point"];
49 | User -> Phone [label = "Relaunch App"];
50 | Phone -> App [label = "Launches"];
51 |
52 | App => Server [label = "POST /1/door (body: clientkey=#{clientkey}&deviceid=#{deviceid}) (longpoll)"];
53 |
54 | App << Server [label = "200 OK, receives IRKit's hostname"];
55 |
56 | |||;
57 |
58 | App note App [label = "Setup successfully finished"];
59 | }
60 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/IrPacker.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __IRPACKER_H__
18 | #define __IRPACKER_H__
19 |
20 | #include
21 | #include
22 |
23 | #define TREE_SIZE 168
24 |
25 | struct irpacker_t {
26 | volatile uint8_t *buff;
27 | uint16_t length;
28 |
29 | // bitpack
30 | uint8_t val0;
31 | uint8_t val1;
32 | uint8_t bit_index;
33 | uint16_t byte_index;
34 | uint8_t bitpack_length;
35 | };
36 |
37 | typedef void (*IrPackerUnpackCallback)(uint16_t);
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | extern void irpacker_init( volatile struct irpacker_t *state, volatile uint8_t *buff );
44 | extern void irpacker_clear( volatile struct irpacker_t *state );
45 | extern void irpacker_reset( volatile struct irpacker_t *state );
46 | extern void irpacker_pack( volatile struct irpacker_t *state, uint16_t data );
47 | extern void irpacker_packend( volatile struct irpacker_t *state );
48 | extern uint16_t irpacker_safelength( const volatile struct irpacker_t *state );
49 | extern uint16_t irpacker_length( const volatile struct irpacker_t *state );
50 | extern void irpacker_unpack_start( volatile struct irpacker_t *state );
51 | extern uint16_t irpacker_unpack( volatile struct irpacker_t *state );
52 | extern void irpacker_unpack_sequence( volatile struct irpacker_t *state, uint8_t *in, uint16_t length, IrPackerUnpackCallback callback );
53 |
54 | #ifdef __cplusplus
55 | }
56 | #endif
57 |
58 | #endif // __IRPACKER_H__
59 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/ringbuffer.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include "ringbuffer.h"
18 |
19 | inline void ring_init (volatile struct RingBuffer *ring, volatile char *area, uint8_t size) {
20 | ring->buf = area;
21 | ring->size = size;
22 | ring->addr_w = 0;
23 | ring->addr_r = 0;
24 | }
25 |
26 | inline int8_t ring_put (volatile struct RingBuffer *ring, char dat) {
27 | ring->buf[ ring->addr_w ] = dat;
28 | ring->addr_w = (ring->addr_w + 1) % ring->size;
29 | return 0;
30 | }
31 |
32 | inline uint8_t ring_get (volatile struct RingBuffer *ring, char *dat, uint8_t len) {
33 | uint8_t i;
34 |
35 | for (i = 0; i < len; i ++) {
36 | if (ring_isempty(ring)) {
37 | break;
38 | }
39 | dat[i] = ring->buf[ring->addr_r];
40 | ring->addr_r = (ring->addr_r + 1) % ring->size;
41 | }
42 | return i;
43 | }
44 |
45 | inline uint8_t ring_isfull (volatile struct RingBuffer *ring) {
46 | return (ring->addr_w + 1) % ring->size == ring->addr_r;
47 | }
48 |
49 | inline uint8_t ring_isempty (volatile struct RingBuffer *ring) {
50 | return ring->addr_r == ring->addr_w;
51 | }
52 |
53 | inline uint8_t ring_used (volatile struct RingBuffer *ring) {
54 | if (ring->addr_r <= ring->addr_w) {
55 | return ring->addr_w - ring->addr_r;
56 | }
57 | else {
58 | return ring->size - ring->addr_r + ring->addr_w;
59 | }
60 | }
61 |
62 | inline void ring_clear (volatile struct RingBuffer *ring) {
63 | ring->addr_w = 0;
64 | ring->addr_r = 0;
65 | }
66 |
--------------------------------------------------------------------------------
/hardware/Writer.TXT:
--------------------------------------------------------------------------------
1 | %
2 | M48
3 | M72
4 | T01C0.0120
5 | T02C0.0157
6 | T03C0.0335
7 | T04C0.0354
8 | T05C0.0400
9 | T06C0.0433
10 | T07C0.1300
11 | %
12 | T01
13 | X8571Y14594
14 | X9555Y15579
15 | X10067Y15067
16 | X9594Y16996
17 | X9988Y18256
18 | X9594Y18689
19 | X8571Y19280
20 | X11130Y22114
21 | X12390Y21720
22 | X12902Y20815
23 | X13413Y21366
24 | X14398Y21799
25 | X14870Y23335
26 | X13807Y24398
27 | X14949Y24988
28 | X14949Y26681
29 | X14437Y27154
30 | X15539Y27232
31 | X16327Y26720
32 | X13059Y27272
33 | X12114Y27626
34 | X11878Y26642
35 | X11169Y26051
36 | X11996Y25657
37 | X11996Y24713
38 | X10618Y24555
39 | X10618Y23335
40 | X8177Y23492
41 | X8256Y24594
42 | X7902Y25106
43 | X8492Y25815
44 | X9437Y25972
45 | X9476Y27035
46 | X7941Y26642
47 | X7744Y27626
48 | X14713Y19594
49 | X14713Y18492
50 | X14398Y17350
51 | X14949Y16799
52 | X14398Y16327
53 | X13846Y16799
54 | X12665Y17429
55 | X11563Y17390
56 | X12823Y15106
57 | X12350Y14398
58 | X16091Y15539
59 | X17469Y16563
60 | X17980Y16051
61 | X17980Y17823
62 | X17508Y18374
63 | X18138Y19516
64 | X17941Y21091
65 | X16602Y20067
66 | X16091Y18059
67 | X16327Y22193
68 | T02
69 | X15657Y19909
70 | X12705Y19909
71 | X11012Y19161
72 | X7114Y20067
73 | X5972Y18177
74 | X22272Y13256
75 | X22665Y11287
76 | X23138Y11091
77 | X23335Y10461
78 | T03
79 | X8598Y16193
80 | X7598Y16193
81 | X7598Y17193
82 | X7598Y18193
83 | X8598Y18193
84 | X8598Y17193
85 | T04
86 | X12106Y11091
87 | X12106Y10091
88 | X13106Y10091
89 | X13106Y11091
90 | X14106Y11091
91 | X15106Y11091
92 | X15106Y10091
93 | X14106Y10091
94 | X16106Y10091
95 | X16106Y11091
96 | X17106Y11091
97 | X17106Y10091
98 | X18106Y10091
99 | X18106Y11091
100 | T05
101 | X18134Y25260
102 | X19134Y25260
103 | X20134Y25260
104 | X21134Y25260
105 | X22134Y25260
106 | X17134Y25260
107 | T06
108 | X6472Y23508
109 | X6472Y22508
110 | X5472Y22508
111 | X5472Y23508
112 | X5472Y21508
113 | X6472Y21508
114 | X24016Y12787
115 | X24016Y11787
116 | X24016Y10787
117 | X24016Y9787
118 | X25016Y9787
119 | X25016Y10787
120 | X25016Y11787
121 | X25016Y12787
122 | T07
123 | X6563Y8138
124 | X9319Y8138
125 | X21130Y8138
126 | X23886Y8138
127 | X23886Y22705
128 | X23886Y25461
129 | X6563Y25461
130 | M30
131 |
--------------------------------------------------------------------------------
/firmware/t/packer/pack.cpp:
--------------------------------------------------------------------------------
1 | #include "IrPacker.h"
2 | #include
3 | #include
4 | #include
5 |
6 | // Arduino can load from EEPROM, but we can't
7 | void fillTree(IrPacker *packer) {
8 | uint16_t tree[TREE_SIZE] = {
9 | 205, 213, 220, 228, 236, 244, 253, 262,
10 | 271, 280, 290, 300, 311, 322, 333, 345,
11 | 357, 369, 382, 395, 409, 424, 439, 454,
12 | 470, 486, 503, 521, 539, 558, 578, 598,
13 | 619, 640, 663, 686, 710, 735, 761, 787,
14 | 815, 843, 873, 904, 935, 968, 1002, 1037,
15 | 1073, 1111, 1150, 1190, 1232, 1275, 1319, 1366,
16 | 1413, 1463, 1514, 1567, 1622, 1679, 1738, 1798,
17 | 1861, 1927, 1994, 2064, 2136, 2211, 2288, 2368,
18 | 2451, 2537, 2626, 2718, 2813, 2911, 3013, 3119,
19 | 3228, 3341, 3458, 3579, 3704, 3834, 3968, 4107,
20 | 4251, 4400, 4554, 4713, 4878, 5049, 5226, 5408,
21 | 5598, 5794, 5997, 6206, 6424, 6648, 6881, 7122,
22 | 7371, 7629, 7896, 8173, 8459, 8755, 9061, 9379,
23 | 9707, 10047, 10398, 10762, 11139, 11529, 11932, 12350,
24 | 12782, 13230, 13693, 14172, 14668, 15181, 15713, 16263,
25 | 16832, 17421, 18031, 18662, 19315, 19991, 20691, 21415,
26 | 22165, 22940, 23743, 24574, 25434, 26325, 27246, 28200,
27 | 29187, 30208, 31265, 32360, 33492, 34665, 35878, 37134,
28 | 38433, 39779, 41171, 42612, 44103, 45647, 47245, 48898,
29 | 50610, 52381, 54214, 56112, 58076, 60108, 62212, 64390
30 | };
31 | memcpy( packer->tree, tree, sizeof(tree) );
32 | }
33 |
34 | int main(int argc,char *argv[]) {
35 | uint8_t buff[ 100 ];
36 | IrPacker packer( buff );
37 | fillTree( &packer );
38 |
39 | if (argc != 2) {
40 | fprintf(stderr, "usage: pack 64390");
41 | exit(1);
42 | }
43 | char *input_string = argv[1];
44 | uint16_t input;
45 | if ( strnstr(input_string, "0x", 2) == input_string ) {
46 | // if 0x appears in first 2 letters, it's hex
47 | input = (uint16_t) strtol( input_string, NULL, 16 );
48 | }
49 | else {
50 | input = atoi( argv[1] );
51 | }
52 | uint8_t packed = packer.packSingle( input );
53 |
54 | printf( "%d (0x%x) -> %d (0x%x)\n", input, input, packed, packed );
55 | exit(0);
56 | }
57 |
--------------------------------------------------------------------------------
/firmware/t/packer/unpack.cpp:
--------------------------------------------------------------------------------
1 | #include "IrPacker.h"
2 | #include
3 | #include
4 | #include
5 |
6 | // Arduino can load from EEPROM, but we can't
7 | void fillTree(IrPacker *packer) {
8 | uint16_t tree[TREE_SIZE] = {
9 | 205, 213, 220, 228, 236, 244, 253, 262,
10 | 271, 280, 290, 300, 311, 322, 333, 345,
11 | 357, 369, 382, 395, 409, 424, 439, 454,
12 | 470, 486, 503, 521, 539, 558, 578, 598,
13 | 619, 640, 663, 686, 710, 735, 761, 787,
14 | 815, 843, 873, 904, 935, 968, 1002, 1037,
15 | 1073, 1111, 1150, 1190, 1232, 1275, 1319, 1366,
16 | 1413, 1463, 1514, 1567, 1622, 1679, 1738, 1798,
17 | 1861, 1927, 1994, 2064, 2136, 2211, 2288, 2368,
18 | 2451, 2537, 2626, 2718, 2813, 2911, 3013, 3119,
19 | 3228, 3341, 3458, 3579, 3704, 3834, 3968, 4107,
20 | 4251, 4400, 4554, 4713, 4878, 5049, 5226, 5408,
21 | 5598, 5794, 5997, 6206, 6424, 6648, 6881, 7122,
22 | 7371, 7629, 7896, 8173, 8459, 8755, 9061, 9379,
23 | 9707, 10047, 10398, 10762, 11139, 11529, 11932, 12350,
24 | 12782, 13230, 13693, 14172, 14668, 15181, 15713, 16263,
25 | 16832, 17421, 18031, 18662, 19315, 19991, 20691, 21415,
26 | 22165, 22940, 23743, 24574, 25434, 26325, 27246, 28200,
27 | 29187, 30208, 31265, 32360, 33492, 34665, 35878, 37134,
28 | 38433, 39779, 41171, 42612, 44103, 45647, 47245, 48898,
29 | 50610, 52381, 54214, 56112, 58076, 60108, 62212, 64390
30 | };
31 | memcpy( packer->tree, tree, sizeof(tree) );
32 | }
33 |
34 | int main(int argc,char *argv[]) {
35 | uint8_t buff[ 1 ];
36 | IrPacker packer( buff );
37 | fillTree( &packer );
38 |
39 | if (argc != 2) {
40 | fprintf(stderr, "usage: unpack 114");
41 | exit(1);
42 | }
43 | char *input_string = argv[1];
44 | uint8_t input;
45 | if ( strnstr(input_string, "0x", 2) == input_string ) {
46 | // if 0x appears in first 2 letters, it's hex
47 | input = (uint8_t) strtol( input_string, NULL, 16 );
48 | }
49 | else {
50 | input = atoi( argv[1] );
51 | }
52 |
53 | uint16_t unpacked = packer.unpackSingle( input );
54 |
55 | printf( "%d (0x%x) -> %d (0x%x)\n", input, input, unpacked, unpacked );
56 | exit(0);
57 | }
58 |
--------------------------------------------------------------------------------
/hardware/Writer.gpi:
--------------------------------------------------------------------------------
1 | Generated by EAGLE CAM Processor 6.5.0
2 |
3 | Photoplotter Info File: /Users/mash/proj/irkit/device/hardware/Writer.gpi
4 |
5 | Date : 2014/04/04 10:29
6 | Plotfile : /Users/mash/proj/irkit/device/hardware/Writer.GTL
7 | Apertures : generated:
8 | Device : Gerber RS-274-X photoplotter, coordinate format 2.4 inch
9 |
10 | Parameter settings:
11 |
12 | Emulate Apertures : no
13 | Tolerance Draw + : 0.00 %
14 | Tolerance Draw - : 0.00 %
15 | Tolerance Flash + : 0.00 %
16 | Tolerance Flash - : 0.00 %
17 | Rotate : no
18 | Mirror : no
19 | Optimize : yes
20 | Auto fit : yes
21 | OffsetX : 0inch
22 | OffsetY : 0inch
23 |
24 | Plotfile Info:
25 |
26 | Coordinate Format : 2.4
27 | Coordinate Units : Inch
28 | Data Mode : Absolute
29 | Zero Suppression : None
30 | End Of Block : *
31 |
32 | Apertures used:
33 |
34 | Code Shape Size used
35 |
36 | D10 draw 0.0000inch 20
37 | D11 square 0.0472inch 46
38 | D12 rectangle 0.0630inch x 0.0512inch 2
39 | D13 octagon 0.0650inch 14
40 | D14 rectangle 0.0551inch x 0.0945inch 2
41 | D15 draw 0.0142inch 44
42 | D16 round 0.0394inch 1
43 | D17 rectangle 0.0157inch x 0.0531inch 5
44 | D18 rectangle 0.0709inch x 0.0748inch 2
45 | D19 rectangle 0.0827inch x 0.0630inch 2
46 | D20 square 0.0748inch 2
47 | D21 rectangle 0.0748inch x 0.1339inch 2
48 | D22 square 0.0394inch 6
49 | D23 rectangle 0.0551inch x 0.0472inch 4
50 | D24 draw 0.0600inch 6
51 | D25 octagon 0.0535inch 6
52 | D26 round 0.0554inch 14
53 | D27 rectangle 0.0512inch x 0.0630inch 6
54 | D28 draw 0.0100inch 186
55 | D29 round 0.0240inch 55
56 | D30 draw 0.0320inch 2
57 | D31 draw 0.0240inch 20
58 | D32 round 0.0277inch 9
59 | D33 draw 0.0160inch 1469
60 | D34 draw 0.0120inch 7
61 |
62 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/FullColorLed.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include
18 | #include "FullColorLed.h"
19 | #include "timer.h"
20 |
21 | FullColorLed::FullColorLed(int pinR, int pinG, int pinB) :
22 | pinR_(pinR),
23 | pinG_(pinG),
24 | pinB_(pinB),
25 | blinkOn_(0),
26 | isBlinking_(false),
27 | blink_timer_(TIMER_OFF)
28 | {
29 | }
30 |
31 | void FullColorLed::setLedColor(bool colorR, bool colorG, bool colorB) {
32 | setLedColor(colorR, colorG, colorB, false);
33 | }
34 |
35 | void FullColorLed::setLedColor(bool colorR, bool colorG, bool colorB, bool blink) {
36 | colorR_ = colorR;
37 | colorG_ = colorG;
38 | colorB_ = colorB;
39 | isBlinking_ = blink;
40 |
41 | blink_timer_ = TIMER_OFF;
42 | }
43 |
44 | void FullColorLed::setLedColor(bool colorR, bool colorG, bool colorB, bool blink, uint8_t blink_timeout) {
45 | setLedColor( colorR, colorG, colorB, blink );
46 |
47 | TIMER_START(blink_timer_, blink_timeout);
48 | }
49 |
50 | void FullColorLed::off() {
51 | setLedColor( 0, 0, 0, false );
52 | }
53 |
54 | void FullColorLed::onTimer() {
55 | blinkOn_ = ! blinkOn_;
56 |
57 | if ( blinkOn_ || ! isBlinking_ ) {
58 | // not blinking = always on
59 | digitalWrite(pinR_, colorR_);
60 | digitalWrite(pinG_, colorG_);
61 | digitalWrite(pinB_, colorB_);
62 | }
63 | else {
64 | digitalWrite(pinR_, LOW);
65 | digitalWrite(pinG_, LOW);
66 | digitalWrite(pinB_, LOW);
67 | }
68 |
69 | TIMER_TICK(blink_timer_);
70 | if (TIMER_FIRED(blink_timer_)) {
71 | TIMER_STOP(blink_timer_);
72 | isBlinking_ = false;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/firmware/t/packer/unpack_sequence.cpp:
--------------------------------------------------------------------------------
1 | #include "IrPacker.h"
2 | #include
3 | #include
4 | #include
5 |
6 | char sharedbuffer[ 400 ];
7 | extern uint16_t tree[TREE_SIZE];
8 |
9 | // Arduino can load from EEPROM, but we can't
10 | void fill_tree() {
11 | uint16_t tree_[TREE_SIZE] = {
12 | 205, 213, 220, 228, 236, 244, 253, 262,
13 | 271, 280, 290, 300, 311, 322, 333, 345,
14 | 357, 369, 382, 395, 409, 424, 439, 454,
15 | 470, 486, 503, 521, 539, 558, 578, 598,
16 | 619, 640, 663, 686, 710, 735, 761, 787,
17 | 815, 843, 873, 904, 935, 968, 1002, 1037,
18 | 1073, 1111, 1150, 1190, 1232, 1275, 1319, 1366,
19 | 1413, 1463, 1514, 1567, 1622, 1679, 1738, 1798,
20 | 1861, 1927, 1994, 2064, 2136, 2211, 2288, 2368,
21 | 2451, 2537, 2626, 2718, 2813, 2911, 3013, 3119,
22 | 3228, 3341, 3458, 3579, 3704, 3834, 3968, 4107,
23 | 4251, 4400, 4554, 4713, 4878, 5049, 5226, 5408,
24 | 5598, 5794, 5997, 6206, 6424, 6648, 6881, 7122,
25 | 7371, 7629, 7896, 8173, 8459, 8755, 9061, 9379,
26 | 9707, 10047, 10398, 10762, 11139, 11529, 11932, 12350,
27 | 12782, 13230, 13693, 14172, 14668, 15181, 15713, 16263,
28 | 16832, 17421, 18031, 18662, 19315, 19991, 20691, 21415,
29 | 22165, 22940, 23743, 24574, 25434, 26325, 27246, 28200,
30 | 29187, 30208, 31265, 32360, 33492, 34665, 35878, 37134,
31 | 38433, 39779, 41171, 42612, 44103, 45647, 47245, 48898,
32 | 50610, 52381, 54214, 56112, 58076, 60108, 62212, 64390
33 | };
34 | memcpy( tree, tree_, sizeof(tree) );
35 | }
36 |
37 | void on_unpack(uint16_t out) {
38 | // printf( "%d (%04x) ", out, out );
39 | printf( "%d,", out );
40 | }
41 |
42 | int main(int argc,char *argv[]) {
43 | volatile struct irpacker_t packer_state;
44 | irpacker_init( &packer_state, (volatile uint8_t*)sharedbuffer );
45 | fill_tree();
46 | irpacker_unpack_start( &packer_state );
47 |
48 | uint8_t binary[1024];
49 | memset(binary, 0, sizeof(binary));
50 |
51 | uint16_t offset_binary = 0;
52 | char hexstring[3];
53 | while (fgets(hexstring, 3, stdin)) {
54 | if (hexstring[0] == '\n') {
55 | break;
56 | }
57 | // printf("hex: %s %d\n", hexstring, hexstring[0]);
58 | uint8_t letter = strtol( (const char*)hexstring, NULL, 16 );
59 | binary[ offset_binary ++ ] = letter;
60 | }
61 |
62 | irpacker_unpack_sequence( &packer_state, binary, offset_binary, &on_unpack );
63 |
64 | exit(0);
65 | }
66 |
--------------------------------------------------------------------------------
/firmware/t/test/report.txt:
--------------------------------------------------------------------------------
1 | * flash memory
2 | ** base 4270
3 | #include "Arduino.h"
4 | #include "pgmStrToRAM.h"
5 |
6 | void setup() {
7 | // USB serial
8 | Serial.begin(115200);
9 |
10 | // wait for leonardo
11 | while ( ! Serial );
12 | }
13 |
14 | void loop() {
15 | }
16 |
17 | ** overload Serial.print 6452
18 | #include "Arduino.h"
19 | #include "pgmStrToRAM.h"
20 |
21 | void setup() {
22 | // USB serial
23 | Serial.begin(115200);
24 |
25 | // wait for leonardo
26 | while ( ! Serial );
27 |
28 | Serial.print(3);
29 | Serial.print(3.14);
30 | }
31 |
32 | void loop() {
33 | }
34 | ** only Serial.print(float) 6398
35 | #include "Arduino.h"
36 | #include "pgmStrToRAM.h"
37 |
38 | void setup() {
39 | // USB serial
40 | Serial.begin(115200);
41 |
42 | // wait for leonardo
43 | while ( ! Serial );
44 |
45 | Serial.print(3.14);
46 | }
47 |
48 | void loop() {
49 | }
50 | ** only Serial.print(int) 4838
51 | #include "Arduino.h"
52 | #include "pgmStrToRAM.h"
53 |
54 | void setup() {
55 | // USB serial
56 | Serial.begin(115200);
57 |
58 | // wait for leonardo
59 | while ( ! Serial );
60 |
61 | Serial.print(3);
62 | }
63 |
64 | void loop() {
65 | }
66 | ** only Serial.print(char*) 4344
67 | #include "Arduino.h"
68 | #include "pgmStrToRAM.h"
69 |
70 | void setup() {
71 | // USB serial
72 | Serial.begin(115200);
73 |
74 | // wait for leonardo
75 | while ( ! Serial );
76 |
77 | Serial.print("3");
78 | }
79 |
80 | void loop() {
81 | }
82 |
83 | ** only Serial.print(char) 4296
84 | #include "Arduino.h"
85 | #include "pgmStrToRAM.h"
86 |
87 | void setup() {
88 | // USB serial
89 | Serial.begin(115200);
90 |
91 | // wait for leonardo
92 | while ( ! Serial );
93 |
94 | Serial.print('3');
95 | }
96 |
97 | void loop() {
98 | }
99 |
100 | ** sprintf 6666
101 | #include "Arduino.h"
102 | #include "pgmStrToRAM.h"
103 | #include "tinyprint.h"
104 |
105 | void setup() {
106 | // USB serial
107 | Serial.begin(115200);
108 |
109 | // wait for leonardo
110 | while ( ! Serial );
111 |
112 | // Serial.print("3");
113 | tinyprint_int(3);
114 | }
115 |
116 | void loop() {
117 | }
118 | --- tinyprint.cpp
119 | #include "Arduino.h"
120 | #include "tinyprint.h"
121 | #include "pgmStrToRAM.h"
122 |
123 | size_t tinyprint_int(int n) {
124 | // -32767 - 32767
125 | char tmp[7];
126 | sprintf( tmp, P("%d"), n );
127 | return Serial.print( tmp );
128 | }
129 |
--------------------------------------------------------------------------------
/firmware/t/packer/pack_sequence.cpp:
--------------------------------------------------------------------------------
1 | #include "IrPacker.h"
2 | #include
3 | #include
4 | #include
5 | #include "base64encoder.h"
6 |
7 | char sharedbuffer[ 400 ];
8 | extern uint16_t tree[TREE_SIZE];
9 |
10 | // Arduino can load from EEPROM, but we can't
11 | void fill_tree() {
12 | uint16_t tree_[TREE_SIZE] = {
13 | 205, 213, 220, 228, 236, 244, 253, 262,
14 | 271, 280, 290, 300, 311, 322, 333, 345,
15 | 357, 369, 382, 395, 409, 424, 439, 454,
16 | 470, 486, 503, 521, 539, 558, 578, 598,
17 | 619, 640, 663, 686, 710, 735, 761, 787,
18 | 815, 843, 873, 904, 935, 968, 1002, 1037,
19 | 1073, 1111, 1150, 1190, 1232, 1275, 1319, 1366,
20 | 1413, 1463, 1514, 1567, 1622, 1679, 1738, 1798,
21 | 1861, 1927, 1994, 2064, 2136, 2211, 2288, 2368,
22 | 2451, 2537, 2626, 2718, 2813, 2911, 3013, 3119,
23 | 3228, 3341, 3458, 3579, 3704, 3834, 3968, 4107,
24 | 4251, 4400, 4554, 4713, 4878, 5049, 5226, 5408,
25 | 5598, 5794, 5997, 6206, 6424, 6648, 6881, 7122,
26 | 7371, 7629, 7896, 8173, 8459, 8755, 9061, 9379,
27 | 9707, 10047, 10398, 10762, 11139, 11529, 11932, 12350,
28 | 12782, 13230, 13693, 14172, 14668, 15181, 15713, 16263,
29 | 16832, 17421, 18031, 18662, 19315, 19991, 20691, 21415,
30 | 22165, 22940, 23743, 24574, 25434, 26325, 27246, 28200,
31 | 29187, 30208, 31265, 32360, 33492, 34665, 35878, 37134,
32 | 38433, 39779, 41171, 42612, 44103, 45647, 47245, 48898,
33 | 50610, 52381, 54214, 56112, 58076, 60108, 62212, 64390
34 | };
35 | memcpy( tree, tree_, sizeof(tree) );
36 | }
37 |
38 | void encoded(char letter) {
39 | printf( "%c", letter );
40 | }
41 |
42 | int main(int argc,char *argv[]) {
43 | volatile struct irpacker_t packer_state;
44 | irpacker_init( &packer_state, (volatile uint8_t*)sharedbuffer );
45 | fill_tree();
46 |
47 | uint16_t ir[73] = {18031,8755,1190,1190,1190,3341,1190,3341,1190,3341,1190,1190,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,1190,1190,1190,1190,1190,1190,1190,1190,3341,1190,3341,1190,1190,1190,3341,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,1190,3341,1190,3341,1190,3341,1190,3341,1190,3341,1190,65535,0,9379,18031,4400,1190};
48 | for (int i=0; i<73; i++) {
49 | irpacker_pack(&packer_state, ir[i]);
50 | }
51 | irpacker_packend(&packer_state);
52 |
53 | base64_encode( (const uint8_t*)&sharedbuffer[0], irpacker_length(&packer_state), &encoded );
54 |
55 | exit(0);
56 | }
57 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/timer.c:
--------------------------------------------------------------------------------
1 | /*
2 | timer.c,h - timer library, based on FlexiTimer2
3 | Masakazu Ohtsuka
4 |
5 | FlexiTimer2.h - Using timer2 with a configurable resolution
6 | Wim Leers
7 |
8 | Based on MsTimer2
9 | Javier Valencia
10 |
11 | History:
12 | 16/Dec/2011 - Added Teensy/Teensy++ support (bperrybap)
13 | note: teensy uses timer4 instead of timer2
14 | 25/April/10 - Based on MsTimer2 V0.5 (from 29/May/09)
15 |
16 | This library is free software; you can redistribute it and/or
17 | modify it under the terms of the GNU Lesser General Public
18 | License as published by the Free Software Foundation; either
19 | version 2.1 of the License, or (at your option) any later version.
20 |
21 | This library is distributed in the hope that it will be useful,
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 | Lesser General Public License for more details.
25 |
26 | You should have received a copy of the GNU Lesser General Public
27 | License along with this library; if not, write to the Free Software
28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 | */
30 |
31 | #ifdef __AVR__
32 | #include
33 | #else
34 | #error timer library only works on AVR architecture
35 | #endif
36 |
37 | #include "timer.h"
38 |
39 | static uint16_t interval_ms;
40 | static void (*callback)();
41 |
42 | void timer_init( void (*callback_)() ) {
43 | callback = callback_;
44 |
45 | TCCR4B = 0;
46 | TCCR4A = 0;
47 | TCCR4C = 0;
48 | TCCR4D = 0;
49 | TCCR4E = 0;
50 | TCCR4B = (1<= interval_ms) && ! overflowing) {
75 | overflowing = 1;
76 | count = count - interval_ms; // subtract interval to catch missed overflows
77 | // set to 0 if you don't want this.
78 | (*callback)();
79 | overflowing = 0;
80 | }
81 | }
82 |
83 | ISR(TIMER4_OVF_vect) {
84 | _overflow();
85 | }
86 |
--------------------------------------------------------------------------------
/firmware/bench.pl:
--------------------------------------------------------------------------------
1 | #!/bin/env perl
2 | use strict;
3 | use warnings;
4 | use Furl;
5 | use Time::HiRes qw/gettimeofday tv_interval/;
6 |
7 | my $target_ip = shift;
8 | if (! $target_ip || ($target_ip !~ m![0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}!)) {
9 | die "usage: $0 {IRKit ip address, ex:10.0.1.9} {number-of-requests}";
10 | }
11 | my $base = "http://${target_ip}";
12 |
13 | my $number_of_requests = shift;
14 | if (! $number_of_requests) {
15 | die "usage: $0 {IRKit ip address, ex:10.0.1.9} {number-of-requests}";
16 | }
17 |
18 | my $agent = Furl->new(
19 | agent => 'Bench/1.0',
20 | timeout => 20,
21 | headers => [
22 | 'X-Requested-With' => 'Furl',
23 | ],
24 | );
25 |
26 | my $get_message = sub {
27 | print "GET /messages\n";
28 | return $agent->get( "$base/messages" );
29 | };
30 |
31 | my $post_message = sub {
32 | # エアコンオン
33 | print "POST /messages\n";
34 | return $agent->post( "$base/messages", [],
35 | 'message={"freq":38,"format":"raw","data":[6573,3257,867,824,866,825,865,2463,866,826,864,2462,867,825,864,827,863,828,863,2464,866,2462,867,826,864,826,865,826,864,2463,866,2461,868,825,865,826,864,827,864,826,865,826,864,826,865,826,864,826,865,825,866,826,864,826,865,826,864,827,864,2462,867,826,864,826,865,826,864,827,864,827,864,826,864,826,865,2461,868,825,865,826,865,826,864,827,864,2462,867,2461,867,2461,868,2461,867,2461,868,2461,867,2461,868,2461,867,826,864,826,865,2461,866,826,864,827,864,828,863,827,864,826,865,826,865,825,865,826,865,2462,867,2462,866,825,865,826,865,2462,867,825,865,826,865,825,865,826,865,2461,868,825,865,2462,867,2462,867,825,865,826,864,827,864,825,865,826,865,826,865,825,865,826,865,826,864,827,864,826,865,826,864,826,865,2462,867,825,865,827,864,825,864,827,863,827,863,829,863,827,864,827,864,826,865,826,864,826,865,826,865,825,865,827,864,827,864,826,864,827,864,826,864,826,865,826,865,826,864,826,865,826,864,827,864,827,864,826,864,827,864,826,865,2462,867,825,865,2462,867,825,865,826,864,826,865,2463,866,2461,867,826,865,825,865,827,864,2462,867,2461,867]}',
36 | );
37 | };
38 |
39 | my $post_keys = sub {
40 | print "POST /keys\n";
41 | return $agent->post( "$base/keys", [], [] );
42 | };
43 |
44 | my @requests = (
45 | $get_message,
46 | $post_message,
47 | # $post_keys
48 | );
49 |
50 | for my $i (1..$number_of_requests) {
51 | print "[$i] ";
52 | my $time = [gettimeofday];
53 | my $res = $requests[ int(rand scalar @requests) ]();
54 | die $res->status_line unless $res->is_success;
55 | printf( " %d %s\n", $res->code, $res->body );
56 |
57 | # $requests[ 2 ]();
58 | my $elapsed = tv_interval( $time, [gettimeofday] );
59 | printf( " %.2f[s]\n", $elapsed );
60 | }
61 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/base64encoder.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include "base64encoder.h"
18 |
19 | static char encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
20 | 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
21 | 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
22 | 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
23 | 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
24 | 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
25 | 'w', 'x', 'y', 'z', '0', '1', '2', '3',
26 | '4', '5', '6', '7', '8', '9', '+', '/'};
27 |
28 | uint16_t base64_length(uint16_t input_length) {
29 | return ((input_length + 2) / 3) * 4;
30 | }
31 |
32 | void base64_encode(const uint8_t *input,
33 | uint16_t input_length,
34 | Base64EncodeCallback callback) {
35 | uint16_t i;
36 | uint8_t input_a,input_b,input_c;
37 |
38 | for (i = 0; i < input_length;) {
39 |
40 | input_a = input[ i++ ];
41 | callback( encoding_table[ (input_a & 0xFC) >> 2 ] );
42 |
43 | if (i < input_length) {
44 | input_b = input[ i++ ];
45 | callback( encoding_table[ ((input_a & 0x03) << 4) + ((input_b & 0xF0) >> 4) ] );
46 | }
47 | else {
48 | input_b = 0;
49 | callback( encoding_table[ ((input_a & 0x03) << 4) + ((input_b & 0xF0) >> 4) ] );
50 | callback( '=' );
51 | callback( '=' );
52 | break;
53 | }
54 |
55 | if (i < input_length) {
56 | input_c = input[ i++ ];
57 | callback( encoding_table[ ((input_b & 0x0F) << 2) + ((input_c & 0xC0) >> 6) ] );
58 | callback( encoding_table[ input_c & 0x3F ] );
59 | }
60 | else {
61 | input_c = 0;
62 | callback( encoding_table[ ((input_b & 0x0F) << 2) + ((input_c & 0xC0) >> 6) ] );
63 | callback( '=' );
64 | break;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/firmware/Makefile:
--------------------------------------------------------------------------------
1 | # This Makefile is only used to check .lst files
2 |
3 | SOURCEDIR = src/IRKit
4 | BUILDDIR = .build/irkit
5 | CPPSOURCES = $(wildcard $(SOURCEDIR)/*.cpp)
6 | CSOURCES = $(wildcard $(SOURCEDIR)/*.c)
7 | CPPLISTS = $(patsubst %.cpp,$(BUILDDIR)/%.lst,$(CPPSOURCES))
8 | CLISTS = $(patsubst %.c,$(BUILDDIR)/%.lst,$(CSOURCES))
9 |
10 | INO = ~/src/ino/bin/ino
11 |
12 | # Use Arduino-1.0.5 on /Applications/Arduino.app
13 | AVRBIN = /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin
14 | DATASIZE = $(shell $(AVRBIN)/avr-size -B .build/irkit/firmware.hex | tail -n 1 | cut -b 11-15)
15 | VERSION = $(shell git describe --tags --long | sed -e "s/^v//" | sed -e "s/\-/./g")
16 |
17 | build:
18 | $(INO) build -m irkit --ldflags="-Os --gc-sections -Map=.build/irkit/firmware.map"
19 | $(AVRBIN)/avr-nm --size-sort .build/irkit/firmware.elf > .build/irkit/firmware.nm.size.log
20 | $(AVRBIN)/avr-nm --numeric-sort .build/irkit/firmware.elf > .build/irkit/firmware.nm.numeric.log
21 |
22 | version:
23 | sed -e s/__VERSION__/$(VERSION)/ src/IRKit/version.template > src/IRKit/version.c
24 |
25 | upload:
26 | @if [ $(DATASIZE) -gt 28672 ] ; then \
27 | echo "size is $(DATASIZE), NG" ; \
28 | else \
29 | echo "size is $(DATASIZE), OK" ; \
30 | $(INO) upload -m irkit ; \
31 | fi
32 |
33 | serial:
34 | sleep 2
35 | $(INO) serial -b 115200
36 |
37 | # remove Arduino IDE build files
38 | clean:
39 | rm -rf src/IRKit/build-uno/
40 |
41 | $(BUILDDIR)/$(SOURCEDIR)/%.lst : $(SOURCEDIR)/%.cpp
42 | @mkdir -p $(BUILDDIR)/$(SOURCEDIR)
43 | /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -ffunction-sections -fdata-sections -g -Os -w -DUSB_VID=0x1d50 -DUSB_PID=0x6085 -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/leonardo -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/avr-libc -Wa,-aln=$@ -fno-exceptions -o $(subst .lst,.o,$@) -c $<
44 |
45 | $(BUILDDIR)/$(SOURCEDIR)/%.lst : $(SOURCEDIR)/%.c
46 | @mkdir -p $(BUILDDIR)/$(SOURCEDIR)
47 | /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-gcc -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -ffunction-sections -fdata-sections -g -Os -w -DUSB_VID=0x1d50 -DUSB_PID=0x6085 -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/leonardo -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/avr-libc -Wa,-aln=$@ -o $(subst .lst,.o,$@) -c $<
48 |
49 | .PHONY: assembly build version clean
50 | assembly: $(CPPLISTS) $(CLISTS)
51 |
--------------------------------------------------------------------------------
/hardware/IRKit.gpi:
--------------------------------------------------------------------------------
1 | Generated by EAGLE CAM Processor 6.5.0
2 |
3 | Photoplotter Info File: /Users/mash/proj/irkit/device/hardware/IRKit.gpi
4 |
5 | Date : 2013/11/11 20:34
6 | Plotfile : /Users/mash/proj/irkit/device/hardware/IRKit.GTL
7 | Apertures : generated:
8 | Device : Gerber RS-274-X photoplotter, coordinate format 2.4 inch
9 |
10 | Parameter settings:
11 |
12 | Emulate Apertures : no
13 | Tolerance Draw + : 0.00 %
14 | Tolerance Draw - : 0.00 %
15 | Tolerance Flash + : 0.00 %
16 | Tolerance Flash - : 0.00 %
17 | Rotate : no
18 | Mirror : no
19 | Optimize : yes
20 | Auto fit : yes
21 | OffsetX : 0inch
22 | OffsetY : 0inch
23 |
24 | Plotfile Info:
25 |
26 | Coordinate Format : 2.4
27 | Coordinate Units : Inch
28 | Data Mode : Absolute
29 | Zero Suppression : None
30 | End Of Block : *
31 |
32 | Apertures used:
33 |
34 | Code Shape Size used
35 |
36 | D10 draw 0.0000inch 25
37 | D11 square 0.0472inch 74
38 | D12 rectangle 0.0512inch x 0.0630inch 2
39 | D13 rectangle 0.0551inch x 0.0394inch 6
40 | D14 octagon 0.0600inch 6
41 | D15 round 0.0476inch 3
42 | D16 round 0.0740inch 4
43 | D17 rectangle 0.0315inch x 0.0630inch 24
44 | D18 rectangle 0.0630inch x 0.0315inch 12
45 | D19 rectangle 0.0472inch x 0.0217inch 5
46 | D20 rectangle 0.0551inch x 0.0945inch 4
47 | D21 draw 0.0142inch 44
48 | D22 round 0.0394inch 1
49 | D23 rectangle 0.0157inch x 0.0531inch 5
50 | D24 rectangle 0.0709inch x 0.0748inch 2
51 | D25 rectangle 0.0827inch x 0.0630inch 2
52 | D26 square 0.0748inch 2
53 | D27 rectangle 0.0748inch x 0.1339inch 2
54 | D28 rectangle 0.0610inch x 0.0394inch 4
55 | D29 octagon 0.0554inch 18
56 | D30 rectangle 0.0630inch x 0.1063inch 4
57 | D31 square 0.0394inch 6
58 | D32 rectangle 0.0236inch x 0.0866inch 8
59 | D33 round 0.0436inch 2
60 | D34 draw 0.0354inch 1
61 | D35 round 0.0660inch 3
62 | D36 octagon 0.0660inch 1
63 | D37 rectangle 0.0551inch x 0.0472inch 4
64 | D38 draw 0.0100inch 234
65 | D39 round 0.0240inch 142
66 | D40 draw 0.0160inch 1170
67 | D41 draw 0.0240inch 354
68 | D42 draw 0.0320inch 126
69 | D43 draw 0.0500inch 8
70 | D44 round 0.0356inch 13
71 | D45 draw 0.0400inch 14
72 | D46 draw 0.0120inch 3
73 |
74 |
--------------------------------------------------------------------------------
/hardware/IRKit.partlist.csv:
--------------------------------------------------------------------------------
1 | "Qty";"Value";"Device";"Package";"Parts";"Description";"";
2 | "1";"";"PINHD-2X4";"2X04";"CN3";"PIN HEADER";"";
3 | "1";"";"PINHD-2X5";"2X05";"CN2";"PIN HEADER";"";
4 | "1";"0.047uF";"CAPACITOR2012";"SMD2012";"C18";"Generic Capacitor";"";
5 | "11";"0.1uF";"CAPACITOR2012";"SMD2012";"C1, C2, C3, C4, C8, C9, C10, C11, C15, C19, C20";"Generic Capacitor";"";
6 | "1";"1.8k";"RESISTOR-US2012";"SMD2012";"RB1";"Generic Registor";"";
7 | "1";"10";"RESISTOR-US2012";"SMD2012";"R18";"Generic Registor";"";
8 | "3";"10k";"RESISTOR-US2012";"SMD2012";"R1, R9, RB2";"Generic Registor";"";
9 | "2";"10uF";"CAPACITOR-POLPANASONIC_B";"PANASONIC_B";"C12, C17";"Generic Capacitor with Polarity";"";
10 | "2";"10Ω 0.5W";"R3225";"3225";"RC1, RC2";"RESISTOR";"";
11 | "2";"12pF";"CAPACITOR2012";"SMD2012";"C5, C6";"Generic Capacitor";"";
12 | "1";"16MHz CL:10pF";"CRYSTAL-3.2-2.5";"CRYSTAL-3.2-2.5";"XTAL1";"";"";
13 | "2";"1uF";"CAPACITOR2012";"SMD2012";"C7, C16";"Generic Capacitor";"";
14 | "4";"2.2k";"RESISTOR-US2012";"SMD2012";"R2, R6, R10, R15";"Generic Registor";"";
15 | "2";"22";"RESISTOR-US2012";"SMD2012";"R3, R4";"Generic Registor";"";
16 | "1";"220";"RESISTOR-US2012";"SMD2012";"R13";"Generic Registor";"";
17 | "1";"254-ECM6044-RO";"MICELECTRET_SMD";"MIC_SMD_4MM";"MIC";"Omni-directional electret condenser microphone.";"";
18 | "1";"2SD1781KT146Q";"MMUN2211LT1-NPN-SC59-BEC";"SC59-BEC";"T1";"NPN Transistror";"";
19 | "4";"3.3k";"RESISTOR-US2012";"SMD2012";"R5, R7, R11, R14";"Generic Registor";"";
20 | "1";"4.7k";"RESISTOR-US2012";"SMD2012";"R12";"Generic Registor";"";
21 | "2";"4.7uF";"CAPACITOR2012";"SMD2012";"C13, C14";"Generic Capacitor";"";
22 | "2";"5.1k";"RESISTOR-US2012";"SMD2012";"R8, R16";"Generic Registor";"";
23 | "1";"5MMRGBLED";"5MMRGBLED";"LED5MMRGB";"LED2";"";"";
24 | "1";"ATMEGA32U4AU";"ATMEGA32U4AU";"TQFP44-PAD";"IC1";"";"";
25 | "1";"BSS138";"BSS138";"SOT23";"T2";"";"";
26 | "3";"CG0603MLC-05E";"VARISTORCN0603";"CT/CN0603";"V1, V2, V3";"VARISTOR";"";
27 | "1";"EVQPUJ02K";"TACTILE-SWITCHEVQPUJ02K";"TACTILE-SWITCH-EVQPUJ02K";"SW1";"TACTILE SWITCH";"";
28 | "1";"GS1011MXXS";"GS1011MXXS";"GS1011MXXS";"IC4";"";"";
29 | "1";"ICSP";"PINHD-2X3";"2X03";"ICSP";"PIN HEADER";"";
30 | "1";"LED-CAP";"LED-CAP";"LED-CAP";"LEDCAP1";"";"";
31 | "2";"LK-5";"LED-SPACER-LK";"LED-SPACER-LK";"SP1, SP2";"";"";
32 | "1";"LM386M-1/NOPB";"LM386M-1";"SO08";"IC3";"Low Voltage Audio Power Amplifier";"";
33 | "1";"MF-MSMF075-2";"L-EUL1812";"L1812";"F1";"INDUCTOR, European symbol";"";
34 | "1";"PG1112H-TR";"LED-2012";"LED2012";"LED1";"Through-hole LED";"";
35 | "1";"PL-IRM2161";"PL-IRM2161";"IR-RECEIVER";"IR-RECEIVER";"PL-IRM2161-XD1";"";
36 | "4";"STAND-OFF";"STAND-OFF";"STAND-OFF";"STANDOFF1, STANDOFF2, STANDOFF3, STANDOFF4";"#4 Stand Off";"";
37 | "1";"TLV70233DBVT";"TLV702XXSMD";"SOT23-5";"IC2";"TLV702xx";"";
38 | "2";"VSLB3940";"LED-3MM";"LED3MM";"D1, D2";"Through-hole LED";"";
39 | "1";"ZX62-B-5PA(11)";"USB-CONNECTORMICROB";"USB-MICROB";"CN1";"";"";
40 | "4";"flat-head M3 self-tapping";"SCREW";"SCREW-M3";"SCREW1, SCREW2, SCREW3, SCREW4";"";"";
41 |
--------------------------------------------------------------------------------
/firmware/t/noise-maker/src/noise-maker.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "pins.h"
3 | #include "IrCtrl.h"
4 | #include "MemoryFree.h"
5 | #include "pgmStrToRAM.h"
6 | #include "FullColorLed.h"
7 | #include "timer.h"
8 |
9 | volatile char sharedbuffer[ SHARED_BUFFER_SIZE ];
10 | static FullColorLed color( FULLCOLOR_LED_R, FULLCOLOR_LED_G, FULLCOLOR_LED_B );
11 |
12 | void on_timer();
13 | void on_ir_receive();
14 | void on_ir_xmit();
15 | void send();
16 |
17 | void setup() {
18 | Serial.begin(115200);
19 |
20 | //--- initialize timer
21 |
22 | timer_init( on_timer );
23 | timer_start( TIMER_INTERVAL );
24 |
25 | //--- initialize full color led
26 |
27 | pinMode(FULLCOLOR_LED_R, OUTPUT);
28 | pinMode(FULLCOLOR_LED_G, OUTPUT);
29 | pinMode(FULLCOLOR_LED_B, OUTPUT);
30 | color.setLedColor( 1, 0, 0, false ); // red: error
31 |
32 | //--- initialize IR
33 |
34 | pinMode(IR_OUT, OUTPUT);
35 |
36 | // pull-up
37 | pinMode(IR_IN, INPUT);
38 | digitalWrite(IR_IN, HIGH);
39 |
40 | IR_initialize( &on_ir_receive );
41 | IR_state( IR_IDLE );
42 |
43 | color.setLedColor( 1, 1, 0, true ); // yellow blink: sending
44 | }
45 |
46 | void loop() {
47 | IR_loop();
48 |
49 | if (IrCtrl.state == IR_IDLE) {
50 | send();
51 | }
52 | }
53 |
54 | void send() {
55 | // Apple Remote Play/Pause
56 | IR_state( IR_WRITING );
57 | IR_put(0x46E1); IR_put(0x2325); IR_put(0x04CE); IR_put(0x044C);
58 | IR_put(0x04CC); IR_put(0x0D0B); IR_put(0x04CF); IR_put(0x0D09);
59 | IR_put(0x049E); IR_put(0x0D3B); IR_put(0x049E); IR_put(0x047C);
60 | IR_put(0x04CC); IR_put(0x0D0A); IR_put(0x049E); IR_put(0x0D3A);
61 | IR_put(0x049E); IR_put(0x0D3A); IR_put(0x04CE); IR_put(0x0D0A);
62 | IR_put(0x049E); IR_put(0x0D3A); IR_put(0x04CD); IR_put(0x0D0C);
63 | IR_put(0x04CD); IR_put(0x044C); IR_put(0x04CC); IR_put(0x044C);
64 | IR_put(0x04CB); IR_put(0x044D); IR_put(0x049C); IR_put(0x047C);
65 | IR_put(0x04CD); IR_put(0x0D19); IR_put(0x049E); IR_put(0x0D3A);
66 | IR_put(0x04CA); IR_put(0x0451); IR_put(0x049B); IR_put(0x0D3B);
67 | IR_put(0x049D); IR_put(0x047C); IR_put(0x049B); IR_put(0x047E);
68 | IR_put(0x04CB); IR_put(0x044E); IR_put(0x04CB); IR_put(0x044D);
69 | IR_put(0x04CC); IR_put(0x044C); IR_put(0x049B); IR_put(0x047E);
70 | IR_put(0x049A); IR_put(0x047D); IR_put(0x04C9); IR_put(0x044F);
71 | IR_put(0x049A); IR_put(0x0D3C); IR_put(0x049C); IR_put(0x0D3B);
72 | IR_put(0x04CF); IR_put(0x0D08); IR_put(0x049D); IR_put(0x0D3B);
73 | IR_put(0x049C); IR_put(0x0D3E); IR_put(0x049C); IR_put(0xFFFF);
74 | IR_put(0x0000); IR_put(0x25DF); IR_put(0x46AD); IR_put(0x1188);
75 | IR_put(0x049C);
76 |
77 | Serial.println(P("sending"));
78 | IR_xmit();
79 | }
80 |
81 | // inside ISR, be careful
82 | void on_timer() {
83 | color.onTimer(); // 200msec blink
84 |
85 | IR_timer();
86 | }
87 |
88 | void on_ir_receive() {
89 | Serial.println("");
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/firmware/hex_to_json.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 | use JSON;
5 |
6 | my @data = ;
7 | my $message = encode_json({
8 | format => 'raw',
9 | freq => 38,
10 | data => [
11 | map { chomp; hex($_); } @data,
12 | ],
13 | });
14 | warn $message;
15 |
16 | __DATA__
17 | 19AD
18 | 0CB9
19 | 0363
20 | 0338
21 | 0362
22 | 0339
23 | 0361
24 | 099F
25 | 0362
26 | 033A
27 | 0360
28 | 099E
29 | 0363
30 | 0339
31 | 0360
32 | 033B
33 | 035F
34 | 033C
35 | 035F
36 | 09A0
37 | 0362
38 | 099E
39 | 0363
40 | 033A
41 | 0360
42 | 033A
43 | 0361
44 | 033A
45 | 0360
46 | 099F
47 | 0362
48 | 099D
49 | 0364
50 | 0339
51 | 0361
52 | 033A
53 | 0360
54 | 033B
55 | 0360
56 | 033A
57 | 0361
58 | 033A
59 | 0360
60 | 033A
61 | 0361
62 | 033A
63 | 0360
64 | 033A
65 | 0361
66 | 0339
67 | 0362
68 | 033A
69 | 0360
70 | 033A
71 | 0361
72 | 033A
73 | 0360
74 | 033B
75 | 0360
76 | 099E
77 | 0363
78 | 033A
79 | 0360
80 | 033A
81 | 0361
82 | 033A
83 | 0360
84 | 033B
85 | 0360
86 | 033B
87 | 0360
88 | 033A
89 | 0360
90 | 033A
91 | 0361
92 | 099D
93 | 0364
94 | 0339
95 | 0361
96 | 033A
97 | 0361
98 | 033A
99 | 0360
100 | 033B
101 | 0360
102 | 099E
103 | 0363
104 | 099D
105 | 0363
106 | 099D
107 | 0364
108 | 099D
109 | 0363
110 | 099D
111 | 0364
112 | 099D
113 | 0363
114 | 099D
115 | 0364
116 | 099D
117 | 0363
118 | 033A
119 | 0360
120 | 033A
121 | 0361
122 | 099D
123 | 0362
124 | 033A
125 | 0360
126 | 033B
127 | 0360
128 | 033C
129 | 035F
130 | 033B
131 | 0360
132 | 033A
133 | 0361
134 | 033A
135 | 0361
136 | 0339
137 | 0361
138 | 033A
139 | 0361
140 | 099E
141 | 0363
142 | 099E
143 | 0362
144 | 0339
145 | 0361
146 | 033A
147 | 0361
148 | 099E
149 | 0363
150 | 0339
151 | 0361
152 | 033A
153 | 0361
154 | 0339
155 | 0361
156 | 033A
157 | 0361
158 | 099D
159 | 0364
160 | 0339
161 | 0361
162 | 099E
163 | 0363
164 | 099E
165 | 0363
166 | 0339
167 | 0361
168 | 033A
169 | 0360
170 | 033B
171 | 0360
172 | 0339
173 | 0361
174 | 033A
175 | 0361
176 | 033A
177 | 0361
178 | 0339
179 | 0361
180 | 033A
181 | 0361
182 | 033A
183 | 0360
184 | 033B
185 | 0360
186 | 033A
187 | 0361
188 | 033A
189 | 0360
190 | 033A
191 | 0361
192 | 099E
193 | 0363
194 | 0339
195 | 0361
196 | 033B
197 | 0360
198 | 0339
199 | 0360
200 | 033B
201 | 035F
202 | 033B
203 | 035F
204 | 033D
205 | 035F
206 | 033B
207 | 0360
208 | 033B
209 | 0360
210 | 033A
211 | 0361
212 | 033A
213 | 0360
214 | 033A
215 | 0361
216 | 033A
217 | 0361
218 | 0339
219 | 0361
220 | 033B
221 | 0360
222 | 033B
223 | 0360
224 | 033A
225 | 0360
226 | 033B
227 | 0360
228 | 033A
229 | 0360
230 | 033A
231 | 0361
232 | 033A
233 | 0361
234 | 033A
235 | 0360
236 | 033A
237 | 0361
238 | 033A
239 | 0360
240 | 033B
241 | 0360
242 | 033B
243 | 0360
244 | 033A
245 | 0360
246 | 033B
247 | 0360
248 | 033A
249 | 0361
250 | 099E
251 | 0363
252 | 0339
253 | 0361
254 | 099E
255 | 0363
256 | 0339
257 | 0361
258 | 033A
259 | 0360
260 | 033A
261 | 0361
262 | 099F
263 | 0362
264 | 099D
265 | 0363
266 | 033A
267 | 0361
268 | 0339
269 | 0361
270 | 033B
271 | 0360
272 | 099E
273 | 0363
274 | 099D
275 | 0363
276 |
--------------------------------------------------------------------------------
/firmware/t/led/src/led.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "pins.h"
3 | #include "FullColorLed.h"
4 | #include "timer.h"
5 |
6 | FullColorLed color( FULLCOLOR_LED_R, FULLCOLOR_LED_G, FULLCOLOR_LED_B );
7 | #define LED_BLINK_INTERVAL 200
8 |
9 | void timerFired() {
10 | Serial.println(".");
11 | color.onTimer();
12 | }
13 |
14 | void setup() {
15 | timer_init( &timerFired );
16 | timer_start( LED_BLINK_INTERVAL );
17 |
18 | pinMode(FULLCOLOR_LED_R, OUTPUT);
19 | pinMode(FULLCOLOR_LED_G, OUTPUT);
20 | pinMode(FULLCOLOR_LED_B, OUTPUT);
21 | color.setLedColor( 1, 1, 1 );
22 |
23 | // USB serial
24 | Serial.begin(115200);
25 |
26 | // wait for leonardo
27 | while ( ! Serial ) ;
28 |
29 | Serial.println("Operations Menu:");
30 | Serial.println("r) R");
31 | Serial.println("g) G");
32 | Serial.println("b) B");
33 | Serial.println("c) C");
34 | Serial.println("m) M");
35 | Serial.println("y) Y");
36 | Serial.println("k) K");
37 | Serial.println("R) R blink");
38 | Serial.println("G) G blink");
39 | Serial.println("B) B blink");
40 | Serial.println("C) C blink");
41 | Serial.println("M) M blink");
42 | Serial.println("Y) Y blink");
43 | Serial.println("Command?");
44 | }
45 |
46 | void loop() {
47 | static uint8_t lastCharacter = '0';
48 |
49 | // check for input from the user
50 | if (Serial.available()) {
51 |
52 | lastCharacter = Serial.read();
53 | Serial.print("0x"); Serial.println( lastCharacter, HEX );
54 |
55 | uint8_t status;
56 | if (lastCharacter == 'k') {
57 | color.off();
58 | }
59 | else if (lastCharacter == 'r') {
60 | color.setLedColor(1,0,0);
61 | }
62 | else if (lastCharacter == 'g') {
63 | color.setLedColor(0,1,0);
64 | }
65 | else if (lastCharacter == 'b') {
66 | color.setLedColor(0,0,1);
67 | }
68 | else if (lastCharacter == 'c') {
69 | color.setLedColor(0,1,1);
70 | }
71 | else if (lastCharacter == 'm') {
72 | color.setLedColor(1,0,1);
73 | }
74 | else if (lastCharacter == 'y') {
75 | color.setLedColor(1,1,0);
76 | }
77 | else if (lastCharacter == 'w') {
78 | color.setLedColor(1,1,1);
79 | }
80 | else if (lastCharacter == 'R') {
81 | color.setLedColor(1,0,0,true,1);
82 | }
83 | else if (lastCharacter == 'G') {
84 | color.setLedColor(0,1,0,true,1);
85 | }
86 | else if (lastCharacter == 'B') {
87 | color.setLedColor(0,0,1,true,1);
88 | }
89 | else if (lastCharacter == 'C') {
90 | color.setLedColor(0,1,1,true,1);
91 | }
92 | else if (lastCharacter == 'M') {
93 | color.setLedColor(1,0,1,true,1);
94 | }
95 | else if (lastCharacter == 'Y') {
96 | color.setLedColor(1,1,0,true,1);
97 | }
98 | else if (lastCharacter == 'W') {
99 | color.setLedColor(1,1,1,true,1);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/firmware/t/packer/print_fixed_binary_search.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 | use Text::Xslate;
5 | use Data::Section::Simple qw/get_data_section/;
6 |
7 | my ($first_value, $multiplier, $reverse) = @ARGV;
8 | die "usage: $0 first_value multiplier"
9 | if (! $first_value || ! $multiplier);
10 |
11 | my @numbers = make_factorial($first_value, $multiplier);
12 | my @mapped_numbers = ($first_value .. ($first_value + scalar @numbers - 1));
13 | die "numbers and mapped_numbers should have the exact same size"
14 | if (scalar @numbers != scalar @mapped_numbers);
15 |
16 | warn "numbers\t@numbers";
17 | warn "mapped_numbers\t@mapped_numbers";
18 |
19 | my $xslate = Text::Xslate->new;
20 | if (! $reverse) {
21 | print make_binary_tree( \@numbers, \@mapped_numbers, 1 );
22 | }
23 | else {
24 | print make_binary_tree( \@mapped_numbers, \@numbers, 1 );
25 | }
26 |
27 | sub make_factorial {
28 | my ($first_value, $multiplier) = @_;
29 | my @ret;
30 | my $count = 0;
31 | push( @ret, $first_value );
32 | while (1) {
33 | my $next = $ret[ -1 ] * $multiplier;
34 | last if $next > 65535;
35 | push( @ret, $next );
36 | }
37 | return map { int($_) } @ret;
38 | }
39 |
40 | # indent_level starts from 0
41 | sub make_binary_tree {
42 | my ($numbers, $mapped_numbers, $indent_level) = @_;
43 |
44 | if (scalar @$numbers == 2) {
45 | my $template = get_data_section('template2.tx');
46 | return $xslate->render_string( $template, {
47 | val1 => $numbers->[ 1 ],
48 | val2 => $mapped_numbers->[ 0 ],
49 | val3 => $mapped_numbers->[ 1 ],
50 | indent => ' ' x $indent_level,
51 | });
52 | }
53 | elsif (scalar @$numbers == 1) {
54 | my $template = get_data_section('template1.tx');
55 | return $xslate->render_string( $template, {
56 | val1 => $mapped_numbers->[ 0 ],
57 | indent => ' ' x $indent_level,
58 | });
59 | }
60 | else {
61 | my $middle_index = int((scalar @$numbers)/2);
62 | my $val2 = $numbers->[ $middle_index ];
63 | my @car = splice( @$numbers, 0, $middle_index );
64 | my @mapped_car = splice( @$mapped_numbers, 0, $middle_index );
65 |
66 | my $template = get_data_section('template_if.tx');
67 | my $next1 = make_binary_tree(\@car, \@mapped_car, $indent_level+1);
68 | my $next2 = make_binary_tree($numbers, $mapped_numbers, $indent_level+1);
69 | return $xslate->render_string( $template, {
70 | val2 => $val2,
71 | next1 => $next1,
72 | next2 => $next2,
73 | indent => ' ' x $indent_level,
74 | });
75 | }
76 | }
77 |
78 | __DATA__
79 |
80 | @@ template1.tx
81 | <: $indent :>ret = <: $val1 :>;
82 | @@ template2.tx
83 | <: $indent :>if (value < <: $val1 :>) {
84 | <: $indent :> ret = <: $val2 :>;
85 | <: $indent :>}
86 | <: $indent :>else {
87 | <: $indent :> ret = <: $val3 :>;
88 | <: $indent :>}
89 | @@ template_if.tx
90 | <: $indent :>if (value < <: $val2 :>) {
91 | <: $next1 | mark_raw :>
92 | <: $indent :>}
93 | <: $indent :>else {
94 | <: $next2 | mark_raw :>
95 | <: $indent :>}
96 |
--------------------------------------------------------------------------------
/firmware/hex_to_put.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 | use JSON;
5 |
6 | my @rows = ;
7 | for my $row (@rows) {
8 | for my $chunk (split(/\s/, $row)) {
9 | print sprintf "IR_put(0x%s);\n", $chunk;
10 | }
11 | }
12 |
13 | __DATA__
14 | 1A67 0CDC 038F 0997 03B9 03A8 0390 03A1 0362 03A0 038D 03A3 0386 03DA 0361 03CF
15 | 0386 03AB 0392 039F 0362 03A1 038C 03A4 0386 03D8 0363 0994 038F 03A2 03B3 03AC
16 | 035F 03A4 0393 039F 03BC 0374 0386 03D9 0361 03CF 0363 03A1 038B 03A4 0386 03D9
17 | 035E 03A5 0390 03CF 0362 03A1 038B 03A5 0385 03DA 0361 03CF 0362 03A3 0383 09CD
18 | 0361 03A4 038E 09C3 0361 0997 0391 09C3 0361 0997 0390 09C4 0361 0997 0386 03DA
19 | 0359 09CB 0361 0997 0390 09C4 0361 0997 038F 09C4 0361 0997 0390 09C4 0361 0997
20 | 038C 099A 0386 03DA 0361 03D0 0361 03A3 0389 03A6 0385 03DA 0361 03D0 0361 03A3
21 | 038C 03D1 035F 03A4 0385 03DA 0362 0995 0386 09CD 0363 03CF 0362 03A2 0384 09CD
22 | 035A 09CC 0364 0996 0385 09CD 0363 03CF 0362 03A2 0384 09CD 0364 0995 038C 03A5
23 | 0385 03DA 0357 09CD 0364 0995 038D 03A4 0386 03D9 0361 03D0 035E 0998 0388 03D8
24 | 0357 09CE 0360 03A4 0386 03D8 0363 0995 0387 09CC 0364 0994 038E 03A4 0390 09C2
25 | 0359 03D9 0363 0995 0387 09CB 0364 03CF 0362 03A2 0385 09CC 0363 03CF 0363 03A1
26 | 0390 03CD 0363 03A2 038B 03A4 0391 09C1 0360 0998 0389 03D8 0362 0995 0387 09CB
27 | 0359 09CE 0363 03CF 0362 03A1 038C 03A4 0391 09C1 0360 0998 0393 09C1 0360 0998
28 | 0395 039E 0386 09CC 0364 0995 0387 09CB 0364 03CF 0362 03A1 03BC 0374 0387 03D7
29 | 0357 09CE 0364 03CE 0363 03A1 038C 03A3 0387 03D8 0362 03CF 0362 03A2 038C 03A4
30 | 0392 039F 0386 09CC 0364 0994 0388 09CB 0365 0994 0388 09CB 0365 0993 0389 09CB
31 | 0358 09CE 0363 03CF 0362 03A1 038D 03A3 0387 03D8 0362 03CF 0362 03A1 038D 03A3
32 | 0393 039F 0386 09CC 0364 0993 0389 09CB 0365 0993 0389 09CB 0365 0993 0388 09CC
33 | 0357 09CE 0364 03CF 0362 03A1 038D 03A3 0386 03D9 0361 03D0 0362 03A0 038E 03A3
34 | 0393 039E 0385 09CD 0364 0994 0387 09CD 0395 0962 0386 09CE 0364 0994 0385 09CF
35 | 0355 09D1 0362 03D0 0367 039B 0389 03A7 0381 03DF 0360 03D1 0361 03A1 0385 03AB
36 | 038C 03A5 037C 09D7 0362 0995 037C 09D8 0362 0995 037A 09DA 0362 0996 0377 09DD
37 | 0353 09D2 0360 03D2 035F 03A4 037A 03B6 0373 03EC 035C 03D5 038C 0378 0377 03B7
38 | 0380 03B3 0370 09E1 035D 099C 0372 09E1 035A 099F 0372 09E0 0357 09A3 0372 09E0
39 | 0346 09E0 0352 03E0 0349 09AE 0379 09DA 0351 03B8 0370 03BD 036F 03EF 034C 09AD
40 | 0377 03E6 0346 09B2 0370 03EF 0349 03E7 0345 09B3 0376 09DD 0347 09B2 036E 03F1
41 | 0342 09E2 034A 09B1 0371 03C1 036A 03F2 0345 03EC 0341 09B7 0373 09DE 0345 09B5
42 | 0371 09B5 036D 03F2 0345 09B5 036B 09E5 0347 09B5 036D 03C5 0368 03F3 0344 03ED
43 | 033E 03F2 0344 03EE 0343 03EE 0340 03C5 036A 03F2 0342 03EE 0344 03EE 0340 03C5
44 | 036E 03EE 033D 09E6 0346 09B6 036A 09E6 0345 09B7 0369 09E7 0345 09B5 033B 0A17
45 | 033E 09E7 0344 03EE 0343 03EF 033F 03C7 0367 03F4 0341 03EF 0343 03EF 0340 03C5
46 | 036E 03EE 033C 09E7 0345 09B8 0362 09EC 0346 09B6 0368 09E8 0345 09B7 036B 09E5
47 | 0340 09E6 0345 03EE 0342 03EF 0340 03C7 0335 0425 0343 09B7 036B 09E5 0345 03ED
48 | 033E 03F3 0344 09B5 036C 09E4 0348 09B4 036B 09E5 0345 03EE 0344 03C5 035D 09EE
49 | 0341 09E5 0348 09B3 0370 03C1 036C 03F1 0347 03E9 0348 03BF 036E 03C1 036C 03F0
50 | 0344 03C0 036B 03F2 034A 09B0 036E 09E3 034D 09AC 0370 09E2 034F 09AB 0370 09E1
51 | 034D 09AB 037C
52 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/log.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #ifndef __LOG_H__
18 | #define __LOG_H__
19 |
20 | #include "Arduino.h"
21 |
22 | // #define MAINLOG
23 | // #define GSLOG
24 | // #define HTTPLOG
25 | // #define IRLOG
26 | // #define KEYLOG
27 |
28 | #ifdef MAINLOG
29 | # define MAINLOG_PRINTLN(a) Serial.println(a)
30 | # define MAINLOG_PRINTLN2(a,b) Serial.println(a,b)
31 | # define MAINLOG_PRINT(a) Serial.print(a)
32 | # define MAINLOG_PRINT2(a,b) Serial.print(a,b)
33 | # define MAINLOG_WRITE(a) Serial.write(a)
34 | #else
35 | # define MAINLOG_PRINTLN(a)
36 | # define MAINLOG_PRINTLN2(a,b)
37 | # define MAINLOG_PRINT(a)
38 | # define MAINLOG_PRINT2(a,b)
39 | # define MAINLOG_WRITE(a)
40 | #endif
41 |
42 | #ifdef GSLOG
43 | # define GSLOG_PRINTLN(a) Serial.println(a)
44 | # define GSLOG_PRINTLN2(a,b) Serial.println(a,b)
45 | # define GSLOG_PRINT(a) Serial.print(a)
46 | # define GSLOG_PRINT2(a,b) Serial.print(a,b)
47 | # define GSLOG_WRITE(a) Serial.write(a)
48 | #else
49 | # define GSLOG_PRINTLN(a)
50 | # define GSLOG_PRINTLN2(a,b)
51 | # define GSLOG_PRINT(a)
52 | # define GSLOG_PRINT2(a,b)
53 | # define GSLOG_WRITE(a)
54 | #endif
55 |
56 | #ifdef HTTPLOG
57 | # define HTTPLOG_PRINTLN(a) Serial.println(a)
58 | # define HTTPLOG_PRINTLN2(a,b) Serial.println(a,b)
59 | # define HTTPLOG_PRINT(a) Serial.print(a)
60 | # define HTTPLOG_PRINT2(a,b) Serial.print(a,b)
61 | # define HTTPLOG_WRITE(a) Serial.write(a)
62 | #else
63 | # define HTTPLOG_PRINTLN(a)
64 | # define HTTPLOG_PRINTLN2(a,b)
65 | # define HTTPLOG_PRINT(a)
66 | # define HTTPLOG_PRINT2(a,b)
67 | # define HTTPLOG_WRITE(a)
68 | #endif
69 |
70 | #ifdef IRLOG
71 | # define IRLOG_PRINTLN(a) Serial.println(a)
72 | # define IRLOG_PRINTLN2(a,b) Serial.println(a,b)
73 | # define IRLOG_PRINT(a) Serial.print(a)
74 | # define IRLOG_PRINT2(a,b) Serial.print(a,b)
75 | # define IRLOG_WRITE(a) Serial.write(a)
76 | #else
77 | # define IRLOG_PRINTLN(a)
78 | # define IRLOG_PRINTLN2(a,b)
79 | # define IRLOG_PRINT(a)
80 | # define IRLOG_PRINT2(a,b)
81 | # define IRLOG_WRITE(a)
82 | #endif
83 |
84 | #ifdef KEYLOG
85 | # define KEYLOG_PRINTLN(a) Serial.println(a)
86 | # define KEYLOG_PRINTLN2(a,b) Serial.println(a,b)
87 | # define KEYLOG_PRINT(a) Serial.print(a)
88 | # define KEYLOG_PRINT2(a,b) Serial.print(a,b)
89 | # define KEYLOG_WRITE(a) Serial.write(a)
90 | #else
91 | # define KEYLOG_PRINTLN(a)
92 | # define KEYLOG_PRINTLN2(a,b)
93 | # define KEYLOG_PRINT(a)
94 | # define KEYLOG_PRINT2(a,b)
95 | # define KEYLOG_WRITE(a)
96 | #endif
97 |
98 | #endif // __LOG_H__
99 |
--------------------------------------------------------------------------------
/firmware/t/base64/test_encode.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "base64encoder.h"
3 | #include "nanotap.h"
4 |
5 | uint8_t decoded[ 4 ];
6 | uint8_t decoded_index = 0;
7 |
8 | void encoded(char letter) {
9 | decoded[ decoded_index ++ ] = letter;
10 | printf( "%c", letter );
11 | }
12 |
13 | void clear() {
14 | memset( decoded, 0, sizeof(decoded) );
15 | decoded_index = 0;
16 | }
17 |
18 | int main() {
19 | ok( 1, "ok" );
20 |
21 | {
22 | uint8_t binary[] = {
23 | 0x8E
24 | };
25 | clear();
26 | base64_encode( binary, 1, &encoded );
27 | printf("\n");
28 |
29 | ok( decoded[ 0 ] == 'j' );
30 | ok( decoded[ 1 ] == 'g' );
31 | ok( decoded[ 2 ] == '=' );
32 | ok( decoded[ 3 ] == '=' );
33 | ok( base64_length(1) == 4 );
34 | }
35 |
36 | {
37 | uint8_t binary[] = {
38 | 0x8E, 0x76
39 | };
40 | clear();
41 | base64_encode( binary, 2, &encoded );
42 | printf("\n");
43 |
44 | ok( decoded[ 0 ] == 'j' );
45 | ok( decoded[ 1 ] == 'n' );
46 | ok( decoded[ 2 ] == 'Y' );
47 | ok( decoded[ 3 ] == '=' );
48 | ok( base64_length(2) == 4 );
49 | }
50 |
51 | {
52 | uint8_t binary[] = {
53 | 0x8E, 0x76, 0x01
54 | };
55 | clear();
56 | base64_encode( binary, 3, &encoded );
57 | printf("\n");
58 |
59 | ok( decoded[ 0 ] == 'j' );
60 | ok( decoded[ 1 ] == 'n' );
61 | ok( decoded[ 2 ] == 'Y' );
62 | ok( decoded[ 3 ] == 'B' );
63 | ok( base64_length(3) == 4 );
64 | }
65 |
66 | {
67 | uint8_t binary[] = {
68 | 0x83,0x6E,0x1,0x48,0x66,0x3,0x40,0x1,0x4B,0x48,0x16,0x34,0x53,0x54,0x66,0x48,0x1,0x4C,0x48,0x22,0x55,0x5D,0x55,0x55,0x40,0x66,0x47,0x4B,0x47,0x1,0x66,0x48,0xC,0x55,0x50,0x4B,0x48,0x1,0x66,0x47,0x12,0x55,0x55,0x40,0x1,0x4B,0x47,0x14,0x55,0x55,0x50,0x1,0x66,0x48,0x18,0x5F,0x55,0xF5,0x1,0x4C,0x47,0x4,0x50,0x1,0x66,0x47,0x4,0x50,0x1,0x4C,0x49,0x6,0x74,0x66,0x47,0x4B,0x47,0x1,0x66,0x48,0x4,0x70,0x4B,0x47,0x1,0x66,0x48,0x6,0x54,0x4C,0x49,0x65,0x48,0x4B,0x47,0x1,0x66,0x48,0x12,0x5F,0x7F,0xC0,0x4C,0x47,0x1,0x66,0x4A,0x3,0x40,0x1,0x47,0x4B,0x3,0x40,0x1,0x66,0x48,0x20,0x57,0xF5,0x5D,0x5F,0x1,0x4B,0x47,0x4,0x50,0x1,0x66,0x47,0x3,0x60,0x1,0x4A,0x47,0xF,0xA,0x0,0x1,0x66,0x47,0x12,0x55,0x55,0xC0,0x1,0x4A,0x47,0xE,0x10,0x10,0x1,0x66,0x47,0x12,0x55,0x55,0xC0,0x1,0x4A,0x47,0xE,0x14,0x10,0x1,0x66,0x47,0xB,0x55,0x40,0x4A,0x66,0x1,0x47,0x66,0x5,0x40,0x1,0x4A,0x47,0xE,0x4,0x10,0x1,0x66,0x47,0x12,0x55,0x55,0xC0,0x1,0x4A,0x47,0xE,0x14,0x10,0x1,0x66,0x47,0xB,0x55,0x40,0x4A,0x66,0x1,0x47,0x66,0x3,0x40,0x1,0x4A,0x66,0x3,0x20,0x1,0x47,0x66,0x3,0x40,0x1,0x4A,0x47,0x4,0x10,0x1,0x66,0x48,0x8,0x7D,0x1,0x4B,0x47,0x4,0x50,0x1,0x66,0x49,0xC,0x5D,0x50,0x1,0x4C,0x47,0x6,0x54,0x1,0x66,0x47,0x8,0x55,0x4B,0x47,0x1,0x66,0x48,0x6,0x54,0x1,0x4C,0x47,0x18,0x55,0x55,0x55,0x1,0x66,0x47,0x10,0x55,0x55,0x1,0x4A,0x47,0x10,0x5,0x4,0x1,0x66,0x47,0x10,0x55,0x55,0x1,0x4A,0x47,0x8,0x5,0x1,0x66,0x48,0x1A,0x5F,0x55,0xF5,0x40,0x1,0x4C,0x47,0x10,0x55,0x55,0x1,0x66,0x48,0xE,0x55,0x54
69 | };
70 | clear();
71 | base64_encode( binary, 0x133, &encoded );
72 | printf("\n");
73 | printf("base64_length: %d -> %d\n", 0x133, base64_length(0x133));
74 | }
75 |
76 | done_testing();
77 | }
78 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/HardwareSerialX.h:
--------------------------------------------------------------------------------
1 | /*
2 | HardwareSerialX.h - Hardware serial library for Wiring, with XON/XOFF software flow control
3 | Copyright (c) 2006 Nicholas Zambetti. All right reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 |
19 | Modified 28 September 2010 by Mark Sproul
20 | Modified 14 August 2012 by Alarus
21 | Modified Nov 2013 by mash
22 | */
23 |
24 | #ifndef HardwareSerialX_h
25 | #define HardwareSerialX_h
26 |
27 | #include
28 |
29 | #include "Stream.h"
30 | #include "ringbuffer.h"
31 |
32 | class HardwareSerialX : public Stream
33 | {
34 | private:
35 | volatile RingBuffer *_rx_buffer;
36 | volatile RingBuffer *_tx_buffer;
37 | volatile uint8_t *_ubrrh;
38 | volatile uint8_t *_ubrrl;
39 | volatile uint8_t *_ucsra;
40 | volatile uint8_t *_ucsrb;
41 | volatile uint8_t *_ucsrc;
42 | volatile uint8_t *_udr;
43 | uint8_t _rxen;
44 | uint8_t _txen;
45 | uint8_t _rxcie;
46 | uint8_t _udrie;
47 | uint8_t _u2x;
48 | bool transmitting;
49 | public:
50 | HardwareSerialX(volatile RingBuffer *rx_buffer, volatile RingBuffer *tx_buffer,
51 | volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
52 | volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
53 | volatile uint8_t *ucsrc, volatile uint8_t *udr,
54 | uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x);
55 | void begin(unsigned long);
56 | void begin(unsigned long, uint8_t);
57 | void end();
58 | virtual int available(void);
59 | virtual int peek(void);
60 | virtual int read(void);
61 | virtual void flush(void);
62 | virtual size_t write(uint8_t);
63 | inline size_t write(unsigned long n) { return write((uint8_t)n); }
64 | inline size_t write(long n) { return write((uint8_t)n); }
65 | inline size_t write(unsigned int n) { return write((uint8_t)n); }
66 | inline size_t write(int n) { return write((uint8_t)n); }
67 | using Print::write; // pull in write(str) and write(buf, size) from Print
68 | operator bool();
69 | };
70 |
71 | // Define config for Serial.begin(baud, config);
72 | #define SERIAL_5N1 0x00
73 | #define SERIAL_6N1 0x02
74 | #define SERIAL_7N1 0x04
75 | #define SERIAL_8N1 0x06
76 | #define SERIAL_5N2 0x08
77 | #define SERIAL_6N2 0x0A
78 | #define SERIAL_7N2 0x0C
79 | #define SERIAL_8N2 0x0E
80 | #define SERIAL_5E1 0x20
81 | #define SERIAL_6E1 0x22
82 | #define SERIAL_7E1 0x24
83 | #define SERIAL_8E1 0x26
84 | #define SERIAL_5E2 0x28
85 | #define SERIAL_6E2 0x2A
86 | #define SERIAL_7E2 0x2C
87 | #define SERIAL_8E2 0x2E
88 | #define SERIAL_5O1 0x30
89 | #define SERIAL_6O1 0x32
90 | #define SERIAL_7O1 0x34
91 | #define SERIAL_8O1 0x36
92 | #define SERIAL_5O2 0x38
93 | #define SERIAL_6O2 0x3A
94 | #define SERIAL_7O2 0x3C
95 | #define SERIAL_8O2 0x3E
96 |
97 | extern HardwareSerialX Serial1X;
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/firmware/t/ringbuffer/test.c:
--------------------------------------------------------------------------------
1 | #include "ringbuffer.h"
2 | #include "nanotap.h"
3 |
4 | int main() {
5 | ok( 1, "ok" );
6 |
7 | {
8 | struct RingBuffer buf_;
9 | struct RingBuffer *buf = &buf_;
10 | char data[65];
11 | ring_init( buf, data, 65 );
12 | ok( ring_used(buf) == 0, "0 used" );
13 | ok( ring_isempty(buf) == 1, "is empty" );
14 |
15 | ring_put(buf, 'a');
16 | ok( ring_used(buf) == 1, "1 used after put" );
17 | ok( ring_isfull(buf) == 0, "not full" );
18 | ok( ring_isempty(buf) == 0, "is empty" );
19 |
20 | char buf2[64];
21 | ring_get(buf, &buf2[0], 1);
22 | ok( buf2[0] == 'a', "get" );
23 | ok( ring_used(buf) == 0, "0 used after get" );
24 | ok( ring_isfull(buf) == 0, "not full" );
25 | ok( ring_isempty(buf) == 1, "is empty" );
26 |
27 | ring_put(buf, 'b');
28 | ring_clear(buf);
29 |
30 | ok( ring_used(buf) == 0, "0 used after clear" );
31 | ok( ring_isfull(buf) == 0, "not full" );
32 | ok( ring_isempty(buf) == 1, "is empty" );
33 |
34 | ring_put(buf, '0'); ring_put(buf, '1'); ring_put(buf, '2'); ring_put(buf, '3');
35 | ring_put(buf, '4'); ring_put(buf, '5'); ring_put(buf, '6'); ring_put(buf, '7');
36 | ring_put(buf, '8'); ring_put(buf, '9'); ring_put(buf, 'a'); ring_put(buf, 'b');
37 | ring_put(buf, 'c'); ring_put(buf, 'd'); ring_put(buf, 'e'); ring_put(buf, 'f');
38 | ring_put(buf, '0'); ring_put(buf, '1'); ring_put(buf, '2'); ring_put(buf, '3');
39 | ring_put(buf, '4'); ring_put(buf, '5'); ring_put(buf, '6'); ring_put(buf, '7');
40 | ring_put(buf, '8'); ring_put(buf, '9'); ring_put(buf, 'a'); ring_put(buf, 'b');
41 | ring_put(buf, 'c'); ring_put(buf, 'd'); ring_put(buf, 'e'); ring_put(buf, 'f');
42 | ring_put(buf, '0'); ring_put(buf, '1'); ring_put(buf, '2'); ring_put(buf, '3');
43 | ring_put(buf, '4'); ring_put(buf, '5'); ring_put(buf, '6'); ring_put(buf, '7');
44 | ring_put(buf, '8'); ring_put(buf, '9'); ring_put(buf, 'a'); ring_put(buf, 'b');
45 | ring_put(buf, 'c'); ring_put(buf, 'd'); ring_put(buf, 'e'); ring_put(buf, 'f');
46 | ring_put(buf, '0'); ring_put(buf, '1'); ring_put(buf, '2'); ring_put(buf, '3');
47 | ring_put(buf, '4'); ring_put(buf, '5'); ring_put(buf, '6'); ring_put(buf, '7');
48 | ring_put(buf, '8'); ring_put(buf, '9'); ring_put(buf, 'a'); ring_put(buf, 'b');
49 | ring_put(buf, 'c'); ring_put(buf, 'd'); ring_put(buf, 'e'); ring_put(buf, 'f');
50 | ok( ring_used(buf) == 64, "64 used after 64 puts" );
51 | ok( ring_isfull(buf) == 1, "is full" );
52 | ok( ring_isempty(buf) == 0, "is empty" );
53 |
54 | // dropped feature to protect buffer from overflow
55 | // ok( ring_put(buf, 'x') == -1, "can't put into full" );
56 |
57 | uint8_t fetched = ring_get(buf, &buf2[0], 64);
58 | ok( buf2[0] == '0', "get 1" );
59 | ok( buf2[1] == '1', "get 2" );
60 | ok( buf2[2] == '2', "get 3" );
61 | ok( buf2[3] == '3', "get 4" );
62 | ok( fetched == 64, "fetched all" );
63 |
64 | ok( ring_used(buf) == 0, "0 used after all get" );
65 | ok( ring_isfull(buf) == 0, "not full again" );
66 | ok( ring_isempty(buf) == 1, "is empty" );
67 | }
68 |
69 | done_testing();
70 | }
71 |
--------------------------------------------------------------------------------
/hardware/IRKit.TXT:
--------------------------------------------------------------------------------
1 | %
2 | M48
3 | M72
4 | T01C0.0120
5 | T02C0.0236
6 | T03C0.0276
7 | T04C0.0315
8 | T05C0.0320
9 | T06C0.0354
10 | T07C0.0400
11 | T08C0.1300
12 | %
13 | T01
14 | X8689Y11602
15 | X8689Y11957
16 | X8689Y12311
17 | X8689Y12665
18 | X8689Y13020
19 | X7232Y14161
20 | X6917Y14713
21 | X7557Y15406
22 | X7552Y15721
23 | X7587Y16091
24 | X8413Y16524
25 | X9280Y16248
26 | X9280Y17075
27 | X10185Y17350
28 | X10579Y18059
29 | X10854Y17744
30 | X10972Y17311
31 | X12232Y16524
32 | X12075Y15421
33 | X12232Y14909
34 | X11681Y13689
35 | X12469Y13098
36 | X12267Y12838
37 | X12469Y12587
38 | X13256Y12587
39 | X13453Y12838
40 | X13256Y13098
41 | X13728Y11406
42 | X15343Y13217
43 | X15067Y14280
44 | X15067Y15500
45 | X15028Y17035
46 | X15067Y17941
47 | X15067Y19161
48 | X15067Y20382
49 | X13728Y20067
50 | X13492Y20382
51 | X14240Y22311
52 | X11661Y22296
53 | X11484Y21563
54 | X11489Y20815
55 | X10977Y19673
56 | X12311Y18374
57 | X10972Y15382
58 | X10579Y15343
59 | X9988Y15264
60 | X9752Y15461
61 | X9476Y15264
62 | X9201Y15461
63 | X8610Y15579
64 | X8492Y15146
65 | X8256Y14949
66 | X7587Y14988
67 | X7587Y17272
68 | X7557Y17926
69 | X8413Y17626
70 | X9594Y18413
71 | X8335Y19634
72 | X8020Y19634
73 | X7705Y19555
74 | X7705Y20264
75 | X8020Y20303
76 | X8335Y20343
77 | X8492Y20736
78 | X7980Y21406
79 | X7980Y22429
80 | X8965Y22075
81 | X9437Y22547
82 | X10697Y22626
83 | X10697Y23305
84 | X11839Y24890
85 | X11839Y25736
86 | X11917Y26209
87 | X11770Y26627
88 | X11164Y26105
89 | X9949Y27070
90 | X9437Y26051
91 | X8728Y26091
92 | X8413Y25579
93 | X7980Y25106
94 | X8217Y24634
95 | X8020Y23571
96 | X7980Y26051
97 | X8098Y26642
98 | X7862Y27626
99 | X8920Y27626
100 | X10987Y27646
101 | X12045Y27601
102 | X12547Y27626
103 | X12547Y26957
104 | X13728Y26996
105 | X14437Y27114
106 | X16524Y24358
107 | X17587Y26602
108 | X18886Y27547
109 | X21996Y27547
110 | X21799Y23650
111 | X21839Y20618
112 | X22744Y20382
113 | X22744Y19161
114 | X22744Y17941
115 | X22744Y16720
116 | X22744Y15500
117 | X22744Y14280
118 | X22272Y13374
119 | X22508Y12665
120 | X23413Y11287
121 | X21209Y14280
122 | X21209Y15500
123 | X21209Y16720
124 | X21209Y17941
125 | X21209Y19161
126 | X19673Y19161
127 | X19673Y17941
128 | X19673Y16720
129 | X19673Y15500
130 | X19673Y14280
131 | X18138Y14280
132 | X18138Y15500
133 | X18138Y16720
134 | X18138Y17941
135 | X18138Y19161
136 | X18138Y20382
137 | X19673Y20382
138 | X18138Y21957
139 | X16602Y20382
140 | X16602Y19161
141 | X16602Y17941
142 | X16602Y16720
143 | X16602Y15500
144 | X16602Y14280
145 | X17665Y12980
146 | X18571Y12705
147 | X19122Y12665
148 | X19083Y12272
149 | X16012Y11091
150 | X16012Y10106
151 | X10224Y13728
152 | X6130Y18925
153 | X5146Y17823
154 | X6760Y20343
155 | X6957Y21012
156 | T02
157 | X5146Y19437
158 | X5151Y18758
159 | X6012Y16312
160 | X5657Y15224
161 | X5170Y14742
162 | X9949Y11209
163 | X10303Y10776
164 | X10657Y11209
165 | X10643Y10293
166 | X11012Y9757
167 | X14791Y9949
168 | X18531Y11720
169 | X20736Y12665
170 | X21051Y25776
171 | X21799Y25776
172 | T03
173 | X21327Y7744
174 | X22327Y7744
175 | X20327Y7744
176 | T04
177 | X9949Y7350
178 | X9398Y8138
179 | X8846Y7350
180 | X8295Y8138
181 | T05
182 | X13708Y8267
183 | X14674Y8008
184 | X15775Y8008
185 | X16741Y8267
186 | T06
187 | X24016Y9787
188 | X25016Y9787
189 | X25016Y10787
190 | X24016Y10787
191 | X24016Y11787
192 | X25016Y11787
193 | X25016Y12787
194 | X24016Y12787
195 | X6315Y12957
196 | X6315Y13957
197 | X5315Y13957
198 | X5315Y12957
199 | X5315Y11957
200 | X6315Y11957
201 | X6315Y10957
202 | X5315Y10957
203 | X5315Y9957
204 | X6315Y9957
205 | T07
206 | X6472Y21508
207 | X5472Y21508
208 | X5472Y22508
209 | X5472Y23508
210 | X6472Y23508
211 | X6472Y22508
212 | T08
213 | X6563Y8138
214 | X6563Y25461
215 | X23886Y25461
216 | X23886Y8138
217 | M30
218 |
--------------------------------------------------------------------------------
/firmware/t/ir-receive/src/ir.ino:
--------------------------------------------------------------------------------
1 | #include "Arduino.h"
2 | #include "pins.h"
3 | #include "IrCtrl.h"
4 | #include "pgmStrToRAM.h"
5 | #include "MemoryFree.h"
6 | #include "timer.h"
7 | #include "IrPacker.h"
8 |
9 | volatile char sharedbuffer[ SHARED_BUFFER_SIZE ];
10 | extern uint16_t tree[TREE_SIZE];
11 |
12 | void onReceivedIR() {
13 | Serial.println(P("received!!"));
14 | IR_dump();
15 | }
16 |
17 | void setup() {
18 | // USB serial
19 | Serial.begin(115200);
20 |
21 | // wait for connection
22 | while ( ! Serial ) ;
23 |
24 | timer_init( &onTimer );
25 | timer_start( TIMER_INTERVAL );
26 |
27 | // pull-up
28 | pinMode(IR_IN, INPUT);
29 | digitalWrite(IR_IN, HIGH);
30 |
31 | // output
32 | pinMode(IR_OUT, OUTPUT);
33 | digitalWrite(IR_OUT, LOW);
34 |
35 | // disable 3.3V
36 | pinMode( LDO33_ENABLE, OUTPUT );
37 | digitalWrite( LDO33_ENABLE, LOW );
38 |
39 | IR_initialize( &onReceivedIR );
40 | IR_state(IR_IDLE);
41 |
42 | printGuide();
43 | }
44 |
45 | // inside ISR, be careful
46 | void onTimer() {
47 | IR_timer();
48 | }
49 |
50 | void printGuide() {
51 | Serial.println(P("Operations Menu:"));
52 | Serial.println(P("d) Dump IrCtrl data"));
53 | Serial.println(P("h) Help (this)"));
54 | Serial.println(P("s) Send"));
55 | Serial.println(P("Command?"));
56 | }
57 |
58 | void loop() {
59 | static uint8_t writeCount = 1;
60 | static uint8_t lastCharacter = '0';
61 |
62 | IR_loop();
63 |
64 | // check for input from the user
65 | if (Serial.available()) {
66 |
67 | lastCharacter = Serial.read();
68 | Serial.print(P("last character: 0x")); Serial.println( lastCharacter, HEX );
69 | Serial.print(P("free memory: 0x")); Serial.println( freeMemory(), HEX );
70 |
71 | uint8_t status;
72 | if (lastCharacter == 'd') {
73 | IR_dump();
74 | Serial.print("t:"); Serial.println(tree[0]); Serial.println(tree[1]);
75 | }
76 | else if (lastCharacter == 'h') {
77 | printGuide();
78 | }
79 | else if (lastCharacter == 's') {
80 | Serial.println(P("writing"));
81 | // Apple Remote Play/Pause
82 | IR_state( IR_WRITING );
83 | IR_put(0x46E1); IR_put(0x2325); IR_put(0x04CE); IR_put(0x044C);
84 | IR_put(0x04CC); IR_put(0x0D0B); IR_put(0x04CF); IR_put(0x0D09);
85 | IR_put(0x049E); IR_put(0x0D3B); IR_put(0x049E); IR_put(0x047C);
86 | IR_put(0x04CC); IR_put(0x0D0A); IR_put(0x049E); IR_put(0x0D3A);
87 | IR_put(0x049E); IR_put(0x0D3A); IR_put(0x04CE); IR_put(0x0D0A);
88 | IR_put(0x049E); IR_put(0x0D3A); IR_put(0x04CD); IR_put(0x0D0C);
89 | IR_put(0x04CD); IR_put(0x044C); IR_put(0x04CC); IR_put(0x044C);
90 | IR_put(0x04CB); IR_put(0x044D); IR_put(0x049C); IR_put(0x047C);
91 | IR_put(0x04CD); IR_put(0x0D19); IR_put(0x049E); IR_put(0x0D3A);
92 | IR_put(0x04CA); IR_put(0x0451); IR_put(0x049B); IR_put(0x0D3B);
93 | IR_put(0x049D); IR_put(0x047C); IR_put(0x049B); IR_put(0x047E);
94 | IR_put(0x04CB); IR_put(0x044E); IR_put(0x04CB); IR_put(0x044D);
95 | IR_put(0x04CC); IR_put(0x044C); IR_put(0x049B); IR_put(0x047E);
96 | IR_put(0x049A); IR_put(0x047D); IR_put(0x04C9); IR_put(0x044F);
97 | IR_put(0x049A); IR_put(0x0D3C); IR_put(0x049C); IR_put(0x0D3B);
98 | IR_put(0x04CF); IR_put(0x0D08); IR_put(0x049D); IR_put(0x0D3B);
99 | IR_put(0x049C); IR_put(0x0D3E); IR_put(0x049C); IR_put(0xFFFF);
100 | IR_put(0x0000); IR_put(0x25DF); IR_put(0x46AD); IR_put(0x1188);
101 | IR_put(0x049C);
102 |
103 | Serial.println(P("sending"));
104 | delay(100);
105 | IR_xmit();
106 | IR_dump();
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/firmware/t/packer/nanotap.h:
--------------------------------------------------------------------------------
1 | #ifndef NANOTAP_H_
2 | #define NANOTAP_H_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #ifdef __GNUC__
9 | #define NANOTAP_DECLARE static __attribute__((__used__))
10 | #else
11 | #define NANOTAP_DECLARE static
12 | #endif
13 |
14 | #ifdef __cplusplus
15 | #define NANOTAP_INLINE inline
16 | #else
17 | #define NANOTAP_INLINE __inline__
18 | #endif
19 |
20 | static int TEST_COUNT = 0;
21 |
22 | /**
23 | * This simply evaluates any expression ("$got eq $expected" is just a
24 | * simple example) and uses that to determine if the test succeeded or
25 | * failed. A true expression passes, a false one fails. Very simple.
26 | */
27 | NANOTAP_INLINE NANOTAP_DECLARE void ok(int x, const char *msg) {
28 | printf("%s %d - %s\n", (x ? "ok" : "not ok"), ++TEST_COUNT, msg ? msg : "");
29 | }
30 |
31 | /**
32 | * display diagnostics message.
33 | */
34 | NANOTAP_INLINE NANOTAP_DECLARE void diag(const char *msg) {
35 | fprintf(stderr, "# %s\n", msg ? msg : "");
36 | }
37 | /**
38 | * display note message.
39 | */
40 | NANOTAP_INLINE NANOTAP_DECLARE void note(const char *msg) {
41 | fprintf(stdout, "# %s\n", msg ? msg : "");
42 | }
43 |
44 | /**
45 | * contains_string() searches for $substring in $string.
46 | */
47 | NANOTAP_INLINE NANOTAP_DECLARE void contains_string(const char *string, const char *substring, const char *msg) {
48 | ok(strstr(string, substring) != NULL, msg);
49 | }
50 |
51 | /**
52 | * If you don’t know how many tests you’re going to run, you can issue
53 | * the plan when you’re done running tests.
54 | */
55 | NANOTAP_INLINE NANOTAP_DECLARE void done_testing() {
56 | printf("1..%d\n", TEST_COUNT);
57 | exit(0);
58 | }
59 |
60 | #ifdef __cplusplus
61 | // you can use more convinient stuff if you are using c++.
62 |
63 | #include
64 | #include
65 |
66 | /**
67 | * shorthand for std::string
68 | */
69 | inline NANOTAP_DECLARE void diag(const std::string &msg) {
70 | diag(msg.c_str());
71 | }
72 |
73 | /**
74 | * flexible is() based on C++ template.
75 | */
76 | template
77 | inline NANOTAP_DECLARE void is(T got, T expected, const char *msg) {
78 | if (got == expected) {
79 | ok(true, msg);
80 | } else {
81 | ok(false, msg);
82 | std::cout << " # got : " << got << std::endl;
83 | std::cout << " # expected : " << expected << std::endl;
84 | }
85 | }
86 |
87 | template
88 | inline NANOTAP_DECLARE void is(T got, T expected) {
89 | is(got, expected, "");
90 | }
91 |
92 | inline NANOTAP_DECLARE void is(const std::string& got, const char *expected, const char *msg) {
93 | is(got, std::string(expected), msg);
94 | }
95 |
96 | inline NANOTAP_DECLARE void is(const char* got, const std::string & expected, const char *msg) {
97 | is(std::string(got), expected, msg);
98 | }
99 |
100 | template
101 | inline NANOTAP_DECLARE void is(T got, U expected) {
102 | is(got, std::string(expected), NULL);
103 | }
104 |
105 | /**
106 | * shorthand for lazy person
107 | */
108 | inline NANOTAP_DECLARE void ok(int x) {
109 | ok(x, "");
110 | }
111 |
112 | /**
113 | * shorthand for std::string
114 | */
115 | inline NANOTAP_DECLARE void contains_string(const std::string &str, const char *substr, const char *msg) {
116 | contains_string(str.c_str(), substr, msg);
117 | }
118 |
119 | #include
120 |
121 | /**
122 | * test binary string
123 | */
124 | inline NANOTAP_DECLARE void is_binary(const std::string &got, const std::string& expected, const char *msg) {
125 | if (got.size() != expected.size()) {
126 | ok(0, msg);
127 | std::stringstream ss;
128 | ss << "Expected " << expected.size() << " bytes chars, but got " << got.size() << " bytes chars";
129 | diag(ss.str());
130 | return;
131 | }
132 | for (size_t i=0; i
5 | #include
6 | #include
7 |
8 | #ifdef __GNUC__
9 | #define NANOTAP_DECLARE static __attribute__((__used__))
10 | #else
11 | #define NANOTAP_DECLARE static
12 | #endif
13 |
14 | #ifdef __cplusplus
15 | #define NANOTAP_INLINE inline
16 | #else
17 | #define NANOTAP_INLINE __inline__
18 | #endif
19 |
20 | static int TEST_COUNT = 0;
21 | static int FAIL_COUNT = 0;
22 |
23 | /**
24 | * This simply evaluates any expression ("$got eq $expected" is just a
25 | * simple example) and uses that to determine if the test succeeded or
26 | * failed. A true expression passes, a false one fails. Very simple.
27 | */
28 | NANOTAP_INLINE NANOTAP_DECLARE void ok(int x, const char *msg) {
29 | if (!x) {
30 | FAIL_COUNT++;
31 | }
32 | printf("%s %d - %s\n", (x ? "ok" : "not ok"), ++TEST_COUNT, msg ? msg : "");
33 | }
34 |
35 | /**
36 | * display diagnostics message.
37 | */
38 | NANOTAP_INLINE NANOTAP_DECLARE void diag(const char *msg) {
39 | fprintf(stderr, "# %s\n", msg ? msg : "");
40 | }
41 | /**
42 | * display note message.
43 | */
44 | NANOTAP_INLINE NANOTAP_DECLARE void note(const char *msg) {
45 | fprintf(stdout, "# %s\n", msg ? msg : "");
46 | }
47 |
48 | /**
49 | * contains_string() searches for $substring in $string.
50 | */
51 | NANOTAP_INLINE NANOTAP_DECLARE void contains_string(const char *string, const char *substring, const char *msg) {
52 | ok(strstr(string, substring) != NULL, msg);
53 | }
54 |
55 | /**
56 | * If you don’t know how many tests you’re going to run, you can issue
57 | * the plan when you’re done running tests.
58 | */
59 | NANOTAP_INLINE NANOTAP_DECLARE void done_testing() {
60 | printf("1..%d\n", TEST_COUNT);
61 | exit(FAIL_COUNT == 0 ? 0 : 1);
62 | }
63 |
64 | #ifdef __cplusplus
65 | // you can use more convinient stuff if you are using c++.
66 |
67 | #include
68 | #include
69 |
70 | /**
71 | * shorthand for std::string
72 | */
73 | inline NANOTAP_DECLARE void diag(const std::string &msg) {
74 | diag(msg.c_str());
75 | }
76 |
77 | /**
78 | * flexible is() based on C++ template.
79 | */
80 | template
81 | inline NANOTAP_DECLARE void is(T got, T expected, const char *msg) {
82 | if (got == expected) {
83 | ok(true, msg);
84 | } else {
85 | ok(false, msg);
86 | std::cout << " # got : " << got << std::endl;
87 | std::cout << " # expected : " << expected << std::endl;
88 | }
89 | }
90 |
91 | template
92 | inline NANOTAP_DECLARE void is(T got, T expected) {
93 | is(got, expected, "");
94 | }
95 |
96 | inline NANOTAP_DECLARE void is(const std::string& got, const char *expected, const char *msg) {
97 | is(got, std::string(expected), msg);
98 | }
99 |
100 | inline NANOTAP_DECLARE void is(const char* got, const std::string & expected, const char *msg) {
101 | is(std::string(got), expected, msg);
102 | }
103 |
104 | template
105 | inline NANOTAP_DECLARE void is(T got, U expected) {
106 | is(got, std::string(expected), NULL);
107 | }
108 |
109 | /**
110 | * shorthand for lazy person
111 | */
112 | inline NANOTAP_DECLARE void ok(int x) {
113 | ok(x, "");
114 | }
115 |
116 | /**
117 | * shorthand for std::string
118 | */
119 | inline NANOTAP_DECLARE void contains_string(const std::string &str, const char *substr, const char *msg) {
120 | contains_string(str.c_str(), substr, msg);
121 | }
122 |
123 | #include
124 |
125 | /**
126 | * test binary string
127 | */
128 | inline NANOTAP_DECLARE void is_binary(const std::string &got, const std::string& expected, const char *msg) {
129 | if (got.size() != expected.size()) {
130 | ok(0, msg);
131 | std::stringstream ss;
132 | ss << "Expected " << expected.size() << " bytes chars, but got " << got.size() << " bytes chars";
133 | diag(ss.str());
134 | return;
135 | }
136 | for (size_t i=0; i {
13 | access_token => 'github access token'
14 | });
15 |
16 | my $user_name = 'irkit';
17 | my $repo_name = 'device';
18 |
19 | my $build_script = "$FindBin::Bin/../firmware/build.sh";
20 | my $hexfile = "$FindBin::Bin/../firmware/.build/irkit/firmware.hex";
21 | my $zipfile = "$FindBin::Bin/../firmware/.build/irkit/firmware.zip";
22 | my $tags_endpoint = sub { return "https://api.github.com/repos/$user_name/$repo_name/tags"; };
23 | my $releases_endpoint = sub { return "https://api.github.com/repos/$user_name/$repo_name/releases"; };
24 | my $upload_assets_endpoint = sub {
25 | my $id = shift;
26 | return "https://uploads.github.com/repos/$user_name/$repo_name/releases/$id/assets?name=firmware.zip";
27 | };
28 | my $client = Furl->new( agent => 'IRKitReleaser/1.0' );
29 |
30 | main();
31 |
32 | sub main {
33 | print "fetching newest tag name\n";
34 | my $newest_tag_name = fetch_newest_tag_name();
35 | print "newest tag name is $newest_tag_name\n";
36 |
37 | print "fetching newest release name\n";
38 | my $newest_release_name = fetch_newest_release_name();
39 | if ($newest_release_name) {
40 | print "newest release name is $newest_release_name\n";
41 | }
42 | else {
43 | print "no releases\n";
44 | }
45 |
46 | if ($newest_release_name && ($newest_tag_name eq $newest_release_name)) {
47 | die "newest tag == newest release\n".
48 | "run `git push --tags origin master` before creating a release\n";
49 | }
50 |
51 | print "release tag: $newest_tag_name ? Ctrl+C to abort\n";
52 | getc();
53 |
54 | print "building firmware.hex\n";
55 | build();
56 |
57 | print "zipping firmware.hex -> firmware.zip\n";
58 | zip( $hexfile => $zipfile );
59 |
60 | print "creating a release from $newest_tag_name\n";
61 | my $release_info = create_release( $newest_tag_name );
62 | print "created release id: $release_info->{ id }\n";
63 |
64 | print "uploading firmware.zip\n";
65 | upload_asset( $release_info->{ id } => $zipfile );
66 | print "successfully uploaded firmware.zip\n";
67 |
68 | my $command = "open \"https://github.com/$user_name/$repo_name/releases\"";
69 | qx{ $command };
70 | }
71 |
72 | sub fetch_newest_tag_name {
73 | my $res = $client->get( $tags_endpoint->() );
74 | die $res->status_line unless $res->is_success;
75 |
76 | my $tags = decode_json( $res->content );
77 | return $tags->[ 0 ]{ name };
78 | }
79 |
80 | sub fetch_newest_release_name {
81 | my $res = $client->get( $releases_endpoint->() );
82 | die $res->status_line unless $res->is_success;
83 |
84 | my $releases = decode_json( $res->content );
85 | return $releases->[ 0 ]{ name };
86 | }
87 |
88 | sub build {
89 | local $CWD = "$FindBin::Bin/../firmware";
90 |
91 | my $command = "$build_script";
92 | my $stdout = qx{ $command };
93 | if ($? != 0) {
94 | die "$command failed with exit code: $?";
95 | }
96 | print $stdout;
97 | }
98 |
99 | sub zip {
100 | my ($infile, $outfile) = @_;
101 |
102 | my $zip = Archive::Zip->new;
103 | $zip->addFile( $infile, file($infile)->basename )
104 | or die "failed to add $infile";
105 |
106 | unless ($zip->writeToFileNamed( $outfile ) == AZ_OK) {
107 | die "zip write failed";
108 | }
109 | return $outfile;
110 | }
111 |
112 | sub create_release {
113 | my $tag_name = shift;
114 |
115 | my $body = "https://github.com/$user_name/$repo_name/commits/$tag_name";
116 |
117 | my $res = $client->post( $releases_endpoint->(), [
118 | 'Content-Type' => 'application/x-www-form-urlencoded',
119 | 'Authorization' => "token $config->{ access_token }",
120 | ], encode_json({
121 | tag_name => $tag_name,
122 | name => $tag_name,
123 | body => "see $body",
124 | }) );
125 | die $res->status_line unless $res->is_success;
126 |
127 | return decode_json( $res->content );
128 | }
129 |
130 | sub upload_asset {
131 | my ($release_id, $zipfile_path) = @_;
132 |
133 | my $res = $client->post( $upload_assets_endpoint->( $release_id ), [
134 | 'Content-Type' => 'application/zip',
135 | 'Authorization' => "token $config->{ access_token }",
136 | ], file($zipfile_path)->openr );
137 | die $res->status_line unless $res->is_success;
138 |
139 | return decode_json( $res->content );
140 | }
141 |
--------------------------------------------------------------------------------
/firmware/src/IRKit/IRKitJSONParser.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2013-2014 Masakazu Ohtsuka
3 |
4 | This program is free software: you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation, either version 2 of the License, or
7 | (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 | #include "IRKitJSONParser.h"
18 |
19 | void irkit_json_parse (char letter,
20 | JSONParserStartEnd on_start,
21 | JSONParserData on_data,
22 | JSONParserStartEnd on_end) {
23 | static uint8_t current_token;
24 | static uint32_t data;
25 | static uint8_t data_exists;
26 | static uint8_t first_letter_of_key;
27 | static uint8_t is_key;
28 | static char pass[10];
29 | static uint8_t pass_index;
30 | static uint8_t before_colon;
31 |
32 | // special case only json parser (don't try to reuse this)
33 | // non-nested Object with following possible keys
34 | // (check only the first 2 letters to identify key)
35 | // - ID
36 | // - FOrmat
37 | // - FReq
38 | // - DAta
39 | // - Pass
40 | switch (letter) {
41 | case '{':
42 | is_key = 0;
43 | before_colon = 1;
44 | on_start();
45 | break;
46 | case '}':
47 | if (data_exists) {
48 | on_data(current_token, data, pass);
49 | }
50 | on_end();
51 | break;
52 | case '"':
53 | if ( (! is_key) && before_colon ) {
54 | // detected JSON Object's key
55 | is_key = 1;
56 | first_letter_of_key = 0;
57 | current_token = IrJsonParserDataKeyUnknown;
58 | }
59 | else {
60 | is_key = 0;
61 | }
62 | break;
63 | case ':':
64 | data = 0;
65 | data_exists = 0;
66 | pass_index = 0;
67 | before_colon = 0;
68 | break;
69 | case '0':
70 | case '1':
71 | case '2':
72 | case '3':
73 | case '4':
74 | case '5':
75 | case '6':
76 | case '7':
77 | case '8':
78 | case '9':
79 | case 'X':
80 | if ( (current_token == IrJsonParserDataKeyId) ||
81 | (current_token == IrJsonParserDataKeyFreq) ||
82 | (current_token == IrJsonParserDataKeyData) ) {
83 | if (data_exists) {
84 | data *= 10;
85 | }
86 | data += (letter - '0');
87 | data_exists = 1;
88 | }
89 | else if (current_token == IrJsonParserDataKeyPass) {
90 | if (pass_index > 9) {
91 | return;
92 | }
93 | pass[ pass_index ] = letter;
94 | pass_index ++;
95 | data_exists = 1;
96 | }
97 | break;
98 | case ',':
99 | case ']':
100 | if (data_exists) {
101 | on_data(current_token, data, pass);
102 | data = 0;
103 | data_exists = 0;
104 | }
105 | before_colon = 1;
106 | break;
107 | default:
108 | break;
109 | }
110 |
111 | if (is_key && (letter != '"')) {
112 | if (! first_letter_of_key) {
113 | // save key's first letter
114 | first_letter_of_key = letter;
115 | }
116 | else if (current_token == IrJsonParserDataKeyUnknown) {
117 | // - id
118 | // - format
119 | // - freq
120 | // - data
121 | // - pass
122 | if (first_letter_of_key == 'i' && letter == 'd') {
123 | current_token = IrJsonParserDataKeyId;
124 | }
125 | else if (first_letter_of_key == 'f' && letter == 'o') {
126 | current_token = IrJsonParserDataKeyFormat;
127 | }
128 | else if (first_letter_of_key == 'f' && letter == 'r') {
129 | current_token = IrJsonParserDataKeyFreq;
130 | }
131 | else if (first_letter_of_key == 'd' && letter == 'a') {
132 | current_token = IrJsonParserDataKeyData;
133 | }
134 | else if (first_letter_of_key == 'p' && letter == 'a') {
135 | current_token = IrJsonParserDataKeyPass;
136 | }
137 | }
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/hardware/partlist2googlespreadsheet.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # -*- coding: utf-8 -*-
3 |
4 | require "google_drive"
5 | require "pit"
6 | require "csv"
7 |
8 | class PartSheet
9 |
10 | attr_reader :spreadsheet
11 |
12 | def initialize(spreadsheet)
13 | @spreadsheet = spreadsheet
14 | end
15 |
16 | def url
17 | @spreadsheet.human_url
18 | end
19 |
20 | def self.open(username, password, title)
21 | session = GoogleDrive.login(username, password)
22 | spreadsheet = session.spreadsheet_by_title(title)
23 | new(spreadsheet)
24 | end
25 |
26 | def merge_csv( csv_string )
27 | csv_keys = []
28 | worksheet = @spreadsheet.worksheets.first
29 | spreadsheet_rows = worksheet.list.to_hash_array
30 |
31 | def update_row_id( worksheet, row_id, row_data )
32 | if worksheet.list[ row_id ][ "Used" ] != "1"
33 | puts "update row[ #{row_id + 2} ] Part: #{ row_data["Parts"]}?"
34 | puts " before: Used=#{ worksheet.list[ row_id ][ "Used" ] }"
35 | puts " after: Used=1"
36 | puts "(Y/n)"
37 | input = STDIN.gets.chomp
38 | if input != "n"
39 | worksheet.list[ row_id ][ "Used" ] = "1"
40 | end
41 | end
42 |
43 | row_data.each do |key,value|
44 | if key && ! key.empty? && ( worksheet.list[ row_id ][ key ] != value )
45 | puts "updating row[ #{row_id} ][ #{key} ] = #{value}"
46 | worksheet.list[ row_id ][ key ] = value
47 | end
48 | end
49 | end
50 |
51 | csv = CSV.new( csv_string, {
52 | headers: :first_row,
53 | return_headers: true,
54 | })
55 | csv.each do |csv_row|
56 | if csv_row.header_row?
57 | # nil terminated
58 | csv_keys = csv_row.fields
59 | csv_keys.select! {|key| key && ! key.empty? }
60 |
61 | # update keys if new ones appear
62 | newlistkeys = worksheet.list.keys | csv_keys
63 | if worksheet.list.keys.length != newlistkeys.length
64 | worksheet.list.keys = newlistkeys
65 | puts "updated header row"
66 | end
67 |
68 | next
69 | end
70 |
71 | found = spreadsheet_rows.index { |r|
72 | (csv_row.field("Value") == r["Value"]) &&
73 | (csv_row.field("Parts") == r["Parts"])
74 | }
75 |
76 | if found != nil
77 | # update
78 | puts "found row[ #{found} ]"
79 | update_row_id( worksheet, found, csv_row )
80 | else
81 |
82 | found_similar = spreadsheet_rows.index { |r|
83 | (csv_row.field("Parts") == r["Parts"]) ||
84 | ((csv_row.field("Device") == r["Device"]) && (csv_row.field("Value") == r["Value"]))
85 | }
86 |
87 | if found_similar != nil
88 | found_row = worksheet.list[found_similar]
89 | puts "update row[ #{found_similar + 2} ] Part: #{ found_row["Parts"]}?"
90 | puts " before: Value=#{ found_row["Value"] } Device=#{ found_row["Device"] } Parts=#{ found_row["Parts"] }"
91 | puts " after: Value=#{ csv_row["Value"] } Device=#{ csv_row["Device"] } Parts=#{ csv_row["Parts"] }"
92 | puts "(Y/n)"
93 | input = STDIN.gets.chomp
94 | if input != "n"
95 | update_row_id( worksheet, found_similar, csv_row )
96 | next
97 | end
98 | end
99 |
100 | new_row = {}
101 | new_row[ "Used" ] = "1"
102 | csv_row.each do |key,value|
103 | new_row[ key ] = value if (key && ! key.empty?)
104 | end
105 |
106 | puts "insert Part: #{ new_row["Parts"]} ?"
107 | puts " Value=#{ new_row["Value"] } Device=#{ new_row["Device"] } Parts=#{ new_row["Parts"] }"
108 | puts "(Y/n)"
109 | input = STDIN.gets.chomp
110 | if input != "n"
111 | worksheet.list.push( new_row )
112 | puts "created new row: #{new_row}"
113 | next
114 | end
115 | end
116 | end
117 |
118 | puts "saving..."
119 | worksheet.save
120 | puts "saved!"
121 | end
122 |
123 | end
124 |
125 | def main
126 | if ARGV.size < 2 then
127 | abort "usage: 1st, File -> Export -> BOM -> List type (values), Output format (CSV) -> Save\nruby #{$0} spreadsheet-title semi-collon-separated-csvfile"
128 | end
129 | title = ARGV[ 0 ]
130 | semicollon_csv_file = ARGV[ 1 ]
131 |
132 | config = Pit.get( "partlist2googlespreadsheet - #{title}",
133 | :require => {
134 | "username" => "your email in google spreadsheet for #{title}",
135 | "password" => "your password in google spreadsheet for #{title}",
136 | }
137 | )
138 | sheet = PartSheet.open( config["username"], config["password"], title )
139 |
140 | puts "writing spreadsheet at URL: #{sheet.url}"
141 |
142 | csv = IO.read( semicollon_csv_file ).gsub( /\";/, "\"," )
143 |
144 | sheet.merge_csv( csv )
145 | end
146 |
147 | main()
148 |
--------------------------------------------------------------------------------