Finalize AVox CTS support. Now more testing is needed ...

This commit is contained in:
Stephen Anthony 2020-08-02 10:59:41 -02:30
parent c9945e48e5
commit 3fa7dadcba
3 changed files with 19 additions and 6 deletions

View File

@ -33,6 +33,10 @@
Basically, you are now able to put many files that Stella uses inside Basically, you are now able to put many files that Stella uses inside
one ZIP file, and distribute just that file. one ZIP file, and distribute just that file.
* Extended AtariVox support to handle flow control, so that long phrases
are no longer corrupted/cut off. Note that some USB-serial adaptors
don't support this mode, so there may still be issues with those.
* Added option to select the audio device. * Added option to select the audio device.
* Added option to display detected settings info when a ROM is loaded. * Added option to display detected settings info when a ROM is loaded.

View File

@ -28,7 +28,13 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
{ {
mySerialPort = MediaFactory::createSerialPort(); mySerialPort = MediaFactory::createSerialPort();
if(mySerialPort->openPort(portname)) if(mySerialPort->openPort(portname))
myAboutString = " (using serial port \'" + portname + "\')"; {
myCTSFlip = !mySerialPort->isCTS();
if(myCTSFlip)
myAboutString = " (serial port \'" + portname + "\', inverted CTS)";
else
myAboutString = " (serial port \'" + portname + "\')";
}
else else
myAboutString = " (invalid serial port \'" + portname + "\')"; myAboutString = " (invalid serial port \'" + portname + "\')";
@ -50,12 +56,10 @@ bool AtariVox::read(DigitalPin pin)
switch(pin) switch(pin)
{ {
// Pin 2: SpeakJet READY // Pin 2: SpeakJet READY
// CTS (Clear To Send) is connected inverted // CTS (Clear To Send) is sent directly to pin 2
// So CTS = 0 means the buffer is full, which pulls pin 2 high // We also deal with the case where devices send CTS inverted
case DigitalPin::Two: case DigitalPin::Two:
{ return setPin(pin, mySerialPort->isCTS() ^ myCTSFlip);
return setPin(pin, !mySerialPort->isCTS());
}
default: default:
return SaveKey::read(pin); return SaveKey::read(pin);

View File

@ -117,6 +117,11 @@ class AtariVox : public SaveKey
// "close enough". // "close enough".
uInt64 myLastDataWriteCycle{0}; uInt64 myLastDataWriteCycle{0};
// Some USB-Serial adaptors either don't support CTS, or send the signal
// as inverted; we detect that when opening the port, and flip the signal
// when necessary
bool myCTSFlip{false};
// Holds information concerning serial port usage // Holds information concerning serial port usage
string myAboutString; string myAboutString;