Testovani HardwareSerial
This commit is contained in:
parent
42a0dd9681
commit
52d1833802
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"terminal.integrated.env.windows": {
|
"terminal.integrated.env.windows": {
|
||||||
"PATH": "C:\\Users\\PBRY\\.platformio\\penv\\Scripts;C:\\Users\\PBRY\\.platformio\\penv;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;i:\\MyProjects\\Kicad\\BOM\";C:\\Users\\PBRY\\AppData\\Local\\Programs\\Fiddler;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Users\\PBRY\\.dnx\\bin;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\;C:\\Program Files (x86)\\Atmel\\sam-ba_2.12;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;i:\\MyProjects\\Kicad\\BOM\";C:\\Users\\PBRY\\AppData\\Local\\Programs\\Fiddler;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin",
|
"PATH": "C:\\Users\\PBRY\\.platformio\\penv\\Scripts;C:\\Users\\PBRY\\.platformio\\penv;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\nodejs\\;\"C:\\Program Files\\TortoiseSVN\\bin\\\";C:\\Users\\PBRY\\.dnx\\bin;\"C:\\Program Files\\Microsoft DNX\\Dnvm\\\";\"C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\\";\"C:\\Program Files\\Intel\\WiFi\\bin\\\";\"C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\\";i:\\MyProjects\\Kicad\\BOM;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\PBRY\\AppData\\Roaming\\npm;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Python27\\;C:\\Python27\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\python27;C:\\Program Files\\TortoiseSVN\\bin\\;%USERPROFILE%\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Users\\PBRY\\AppData\\Local\\Programs\\Git\\cmd;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\nodejs\\;\"C:\\Program Files\\TortoiseSVN\\bin\\\";C:\\Users\\PBRY\\.dnx\\bin;\"C:\\Program Files\\Microsoft DNX\\Dnvm\\\";\"C:\\Program Files (x86)\\Atmel\\sam-ba_2.12\\drv\\\";\"C:\\Program Files\\Intel\\WiFi\\bin\\\";\"C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\\";i:\\MyProjects\\Kicad\\BOM;C:\\Users\\PBRY\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\PBRY\\AppData\\Roaming\\npm",
|
||||||
"PLATFORMIO_CALLER": "vscode"
|
"PLATFORMIO_CALLER": "vscode"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ board = esp12e
|
|||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.flash_mode = dio
|
board_build.flash_mode = dio
|
||||||
;upload_port = com25
|
;upload_port = com25
|
||||||
upload_port = finger.local
|
upload_port = 192.168.1.200 ;finger.local
|
||||||
;upload_port = /dev/ttyUSB0
|
;upload_port = /dev/ttyUSB0
|
||||||
upload_speed = 230400
|
upload_speed = 230400
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
@ -72,7 +72,9 @@
|
|||||||
|
|
||||||
#define CORS_DEBUG
|
#define CORS_DEBUG
|
||||||
|
|
||||||
#define TX_PIN 1
|
//#define TX_PIN 1
|
||||||
#define RX_PIN 3
|
#define TX_PIN 14
|
||||||
|
//#define RX_PIN 3
|
||||||
|
#define RX_PIN 12
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
17
src/vsp.ino
17
src/vsp.ino
@ -157,7 +157,11 @@ void setserialport(int32_t speed, int32_t databits, int32_t parity, int32_t stop
|
|||||||
// delay(200);
|
// delay(200);
|
||||||
SP.end();
|
SP.end();
|
||||||
delay(10); // 100
|
delay(10); // 100
|
||||||
SP.begin(spd, (SerialConfig)serialMode);
|
#if (TX_PIN != 1) || (RX_PIN != 3)
|
||||||
|
SP.begin(spd);
|
||||||
|
#else
|
||||||
|
SP.begin(spd, (SerialConfig)serialMode);
|
||||||
|
#endif
|
||||||
delay(10); // 100
|
delay(10); // 100
|
||||||
SP.flush();
|
SP.flush();
|
||||||
serial_tx = 0;
|
serial_tx = 0;
|
||||||
@ -168,7 +172,11 @@ void setserialport(int32_t speed, int32_t databits, int32_t parity, int32_t stop
|
|||||||
void sputchar(uint8_t c)
|
void sputchar(uint8_t c)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if (TX_PIN != 1) || (RX_PIN != 3)
|
||||||
|
if (1)
|
||||||
|
#else
|
||||||
if (fromNet.empty() && SP.availableForWrite())
|
if (fromNet.empty() && SP.availableForWrite())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
SP.write(c);
|
SP.write(c);
|
||||||
++serial_tx;
|
++serial_tx;
|
||||||
@ -375,8 +383,15 @@ void vsp_loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// testovani, zda neposlat nejaka data do serioveho rozhrani
|
// testovani, zda neposlat nejaka data do serioveho rozhrani
|
||||||
|
|
||||||
|
#if (TX_PIN != 1) || (RX_PIN != 3)
|
||||||
|
if (!fromNet.empty())
|
||||||
|
{
|
||||||
|
len = 1;
|
||||||
|
#else
|
||||||
if (!fromNet.empty() && (len = SP.availableForWrite()))
|
if (!fromNet.empty() && (len = SP.availableForWrite()))
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
size_t will_copy = (len < sizeof(sbuf)) ? len : sizeof(sbuf);
|
size_t will_copy = (len < sizeof(sbuf)) ? len : sizeof(sbuf);
|
||||||
will_copy = fromNet.read((char *)sbuf, will_copy);
|
will_copy = fromNet.read((char *)sbuf, will_copy);
|
||||||
SP.write(sbuf, will_copy);
|
SP.write(sbuf, will_copy);
|
||||||
|
Loading…
Reference in New Issue
Block a user