diff --git a/Rmodule/nrf24l01/nRF24L01.h b/Rmodule/nrf24l01/nRF24L01.h old mode 100644 new mode 100755 diff --git a/Rmodule/nrf24l01/nrf24l01.c b/Rmodule/nrf24l01/nrf24l01.c old mode 100644 new mode 100755 diff --git a/Rmodule/nrf24l01/nrf24l01registers.h b/Rmodule/nrf24l01/nrf24l01registers.h old mode 100644 new mode 100755 diff --git a/Rmodule/spi/spi.c b/Rmodule/spi/spi.c old mode 100644 new mode 100755 diff --git a/Rmodule/spi/spi.h b/Rmodule/spi/spi.h old mode 100644 new mode 100755 diff --git a/Smodule/Smodule.aps b/Smodule/Smodule.aps old mode 100644 new mode 100755 diff --git a/Smodule/default/Makefile b/Smodule/default/Makefile old mode 100644 new mode 100755 diff --git a/Smodule/main.c b/Smodule/main.c old mode 100644 new mode 100755 diff --git a/Smodule/nrf24l01/nRF24L01.h b/Smodule/nrf24l01/nRF24L01.h old mode 100644 new mode 100755 diff --git a/Smodule/nrf24l01/nrf24l01.c b/Smodule/nrf24l01/nrf24l01.c old mode 100644 new mode 100755 diff --git a/Smodule/nrf24l01/nrf24l01registers.h b/Smodule/nrf24l01/nrf24l01registers.h old mode 100644 new mode 100755 diff --git a/Smodule/res/strings.h b/Smodule/res/strings.h old mode 100644 new mode 100755 diff --git a/Smodule/smodule.aws b/Smodule/smodule.aws old mode 100644 new mode 100755 diff --git a/Smodule/spi/spi.c b/Smodule/spi/spi.c old mode 100644 new mode 100755 diff --git a/Smodule/spi/spi.h b/Smodule/spi/spi.h old mode 100644 new mode 100755 diff --git a/Smodule/uart/uart.c b/Smodule/uart/uart.c old mode 100644 new mode 100755 diff --git a/Smodule/uart/uart.h b/Smodule/uart/uart.h old mode 100644 new mode 100755 diff --git a/Smodule/uart/uart_addon.c b/Smodule/uart/uart_addon.c old mode 100644 new mode 100755 diff --git a/Smodule/uart/uart_addon.h b/Smodule/uart/uart_addon.h old mode 100644 new mode 100755 diff --git a/UsbTitle/UsbTitle.ino b/UsbTitle/UsbTitle.ino new file mode 100755 index 0000000..81ce109 --- /dev/null +++ b/UsbTitle/UsbTitle.ino @@ -0,0 +1,78 @@ +#include +#include +#include "LedControl.h" + +/* + Now we need a LedControl to work with. + pin 2 is connected to the DataIn + pin 1 is connected to the CLK + pin 0 is connected to LOAD + We have only a single MAX72XX. + */ + +LedControl lc=LedControl(2,1,0,1); + +void setup() { + DigiUSB.begin(); + /* + The MAX72XX is in power-saving mode on startup, + we have to do a wakeup call + */ + lc.shutdown(0,false); + /* Set the brightness to a medium values */ + lc.setIntensity(0,0); + /* and clear the display */ + lc.clearDisplay(0); + delay(1000); +} + +void loop() { + byte lastRead; + byte lastCmd = 0xFF; + byte value; + DigiUSB.refresh(); + while (true) { // loop forever + if (DigiUSB.available()) { + // something to read + lastRead = DigiUSB.read(); + if (lastRead >= 0x20 && lastRead<=0x7F){ + if (lastCmd == 0xFF){ // Если ранее команд не было, значит считываем команду + lastCmd = lastRead; + }else{ // команда есть, операнд считали, выполняем + if (lastCmd >=0x41 && lastCmd <=0x48){ // команда установки в сегменте нужного кода ABCDEFGH + value = EEPROM.read(lastRead); + lc.setRow(0, 7-(lastCmd-0x41), value+0x80); + }else if (lastCmd >=0x61 && lastCmd <=0x68){ // команда установки в сегменте нужного кода abcdefgh + value = EEPROM.read(lastRead); + lc.setRow(0, 7-(lastCmd-0x61), value); + }else if (lastCmd == 0x69){ // команда яркости i 0..9abcdef + if (lastRead >=0x30 && lastRead <= 0x39){ + lc.setIntensity(0, lastRead-0x30); + }else if (lastRead >=0x61 && lastRead <= 0x66){ + lc.setIntensity(0, lastRead-0x57); + } + }else if (lastCmd == 0x6C){ // команда количества разрядов l 0..7 + if (lastRead >=0x30 && lastRead <= 0x37){ + lc.setScanLimit(0, lastRead-0x30); + } + }else if (lastCmd == 0x78){ // команда очистки экрана x0 + if (lastRead == 0x30){ + lc.clearDisplay(0); + } + }else if (lastCmd == 0x73){ // команда s0..1 + if (lastRead == 0x30){ + lc.shutdown(0,false); + }else{ + lc.shutdown(0,true); + } + } + lastCmd = 0xFF; + } + }else{ + lastCmd = 0xFF; + } + } + // refresh the usb port for 10 milliseconds + DigiUSB.delay(10); + } +} diff --git a/UsbTitle/eeprom.bat b/UsbTitle/eeprom.bat new file mode 100755 index 0000000..4e9acc2 --- /dev/null +++ b/UsbTitle/eeprom.bat @@ -0,0 +1 @@ +avrdude -C../etc/avrdude.conf -cstk500v1 -pt85 -PCOM19 -b19200 -e -Ueeprom:w:eeprom0.hex:i \ No newline at end of file diff --git a/UsbTitle/eeprom0.hex b/UsbTitle/eeprom0.hex new file mode 100755 index 0000000..263c7a0 --- /dev/null +++ b/UsbTitle/eeprom0.hex @@ -0,0 +1,17 @@ +:20000000000000000000000000000000000000000000000000000000000000000000000000 +:20002000000000000000000000006300000100007E306D79335B5F707F7B000000090000E0 +:200040000077004E004F475E37003C000E00760067000000003E0000003B000000000008C0 +:20006000007D1F0D3D6F0000170438000600151D007305000F1C00000000000000000000A0 +:20008000000000000000000000000000000000000000000000000000000000000000000080 +:2000A000000000000000000000000000000000000000000000000000000000000000000060 +:2000C000000000000000000000000000000000000000000000000000000000000000000040 +:2000E000000000000000000000000000000000000000000000000000000000000000000020 +:20010000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +:20012000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDF +:20014000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBF +:20016000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9F +:20018000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F +:2001A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F +:2001C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F +:2001E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1F +:00000001FF