Добавлен проекта UsbTitle
This commit is contained in:
parent
c711cb180a
commit
a7aa3be11d
0
Rmodule/nrf24l01/nRF24L01.h
Normal file → Executable file
0
Rmodule/nrf24l01/nRF24L01.h
Normal file → Executable file
0
Rmodule/nrf24l01/nrf24l01.c
Normal file → Executable file
0
Rmodule/nrf24l01/nrf24l01.c
Normal file → Executable file
0
Rmodule/nrf24l01/nrf24l01registers.h
Normal file → Executable file
0
Rmodule/nrf24l01/nrf24l01registers.h
Normal file → Executable file
0
Rmodule/spi/spi.c
Normal file → Executable file
0
Rmodule/spi/spi.c
Normal file → Executable file
0
Rmodule/spi/spi.h
Normal file → Executable file
0
Rmodule/spi/spi.h
Normal file → Executable file
0
Smodule/Smodule.aps
Normal file → Executable file
0
Smodule/Smodule.aps
Normal file → Executable file
0
Smodule/default/Makefile
Normal file → Executable file
0
Smodule/default/Makefile
Normal file → Executable file
0
Smodule/main.c
Normal file → Executable file
0
Smodule/main.c
Normal file → Executable file
0
Smodule/nrf24l01/nRF24L01.h
Normal file → Executable file
0
Smodule/nrf24l01/nRF24L01.h
Normal file → Executable file
0
Smodule/nrf24l01/nrf24l01.c
Normal file → Executable file
0
Smodule/nrf24l01/nrf24l01.c
Normal file → Executable file
0
Smodule/nrf24l01/nrf24l01registers.h
Normal file → Executable file
0
Smodule/nrf24l01/nrf24l01registers.h
Normal file → Executable file
0
Smodule/res/strings.h
Normal file → Executable file
0
Smodule/res/strings.h
Normal file → Executable file
0
Smodule/smodule.aws
Normal file → Executable file
0
Smodule/smodule.aws
Normal file → Executable file
0
Smodule/spi/spi.c
Normal file → Executable file
0
Smodule/spi/spi.c
Normal file → Executable file
0
Smodule/spi/spi.h
Normal file → Executable file
0
Smodule/spi/spi.h
Normal file → Executable file
0
Smodule/uart/uart.c
Normal file → Executable file
0
Smodule/uart/uart.c
Normal file → Executable file
0
Smodule/uart/uart.h
Normal file → Executable file
0
Smodule/uart/uart.h
Normal file → Executable file
0
Smodule/uart/uart_addon.c
Normal file → Executable file
0
Smodule/uart/uart_addon.c
Normal file → Executable file
0
Smodule/uart/uart_addon.h
Normal file → Executable file
0
Smodule/uart/uart_addon.h
Normal file → Executable file
78
UsbTitle/UsbTitle.ino
Executable file
78
UsbTitle/UsbTitle.ino
Executable file
@ -0,0 +1,78 @@
|
|||||||
|
#include <DigiUSB.h>
|
||||||
|
#include <EEPROM.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
}
|
1
UsbTitle/eeprom.bat
Executable file
1
UsbTitle/eeprom.bat
Executable file
@ -0,0 +1 @@
|
|||||||
|
avrdude -C../etc/avrdude.conf -cstk500v1 -pt85 -PCOM19 -b19200 -e -Ueeprom:w:eeprom0.hex:i
|
17
UsbTitle/eeprom0.hex
Executable file
17
UsbTitle/eeprom0.hex
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
:20000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
:20002000000000000000000000006300000100007E306D79335B5F707F7B000000090000E0
|
||||||
|
:200040000077004E004F475E37003C000E00760067000000003E0000003B000000000008C0
|
||||||
|
:20006000007D1F0D3D6F0000170438000600151D007305000F1C00000000000000000000A0
|
||||||
|
:20008000000000000000000000000000000000000000000000000000000000000000000080
|
||||||
|
:2000A000000000000000000000000000000000000000000000000000000000000000000060
|
||||||
|
:2000C000000000000000000000000000000000000000000000000000000000000000000040
|
||||||
|
:2000E000000000000000000000000000000000000000000000000000000000000000000020
|
||||||
|
:20010000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||||
|
:20012000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDF
|
||||||
|
:20014000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBF
|
||||||
|
:20016000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9F
|
||||||
|
:20018000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F
|
||||||
|
:2001A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F
|
||||||
|
:2001C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F
|
||||||
|
:2001E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1F
|
||||||
|
:00000001FF
|
Loading…
Reference in New Issue
Block a user