Update to v086r04 release.
byuu says:
There will probably be a series of small WIPs as I experiment here.
snes/controller/serial is now snes/controller/uart. Asynchronous serial
communications, typically capped at 57,600 baud.
snes/controller/usart is new. It aims to emulate the SNES connected to
a Teensy++ board, and can easily handle 524,288 baud.
And much more importantly, it's synchronous, so there are no timing
issues anymore. Just bit-bang as fast as you can.
Right now, the USART code is just enough for SNES->PC to transfer data
to ... well, nothing yet.
Unless anyone is actually using the UART stuff, I'll be removing it once
the USART is totally up and running.
No sense maintaining code that is 10x slower, more error prone, and used
by nobody.
Note: this is all thanks to blargg being absolutely amazing.
2012-02-25 08:49:27 +00:00
|
|
|
struct USART : Controller, public library {
|
2015-10-10 02:16:12 +00:00
|
|
|
USART(bool port);
|
|
|
|
~USART();
|
2012-03-10 12:47:19 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
auto enter() -> void;
|
2012-02-25 08:52:42 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
auto quit() -> bool;
|
|
|
|
auto usleep(unsigned milliseconds) -> void;
|
|
|
|
auto readable() -> bool;
|
|
|
|
auto read() -> uint8;
|
|
|
|
auto writable() -> bool;
|
|
|
|
auto write(uint8 data) -> void;
|
2012-02-25 08:52:42 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
auto data() -> uint2;
|
|
|
|
auto latch(bool data) -> void;
|
Update to v086r04 release.
byuu says:
There will probably be a series of small WIPs as I experiment here.
snes/controller/serial is now snes/controller/uart. Asynchronous serial
communications, typically capped at 57,600 baud.
snes/controller/usart is new. It aims to emulate the SNES connected to
a Teensy++ board, and can easily handle 524,288 baud.
And much more importantly, it's synchronous, so there are no timing
issues anymore. Just bit-bang as fast as you can.
Right now, the USART code is just enough for SNES->PC to transfer data
to ... well, nothing yet.
Unless anyone is actually using the UART stuff, I'll be removing it once
the USART is totally up and running.
No sense maintaining code that is 10x slower, more error prone, and used
by nobody.
Note: this is all thanks to blargg being absolutely amazing.
2012-02-25 08:49:27 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool latched;
|
|
|
|
bool data1;
|
|
|
|
bool data2;
|
2012-03-10 12:37:36 +00:00
|
|
|
unsigned counter;
|
Update to v086r04 release.
byuu says:
There will probably be a series of small WIPs as I experiment here.
snes/controller/serial is now snes/controller/uart. Asynchronous serial
communications, typically capped at 57,600 baud.
snes/controller/usart is new. It aims to emulate the SNES connected to
a Teensy++ board, and can easily handle 524,288 baud.
And much more importantly, it's synchronous, so there are no timing
issues anymore. Just bit-bang as fast as you can.
Right now, the USART code is just enough for SNES->PC to transfer data
to ... well, nothing yet.
Unless anyone is actually using the UART stuff, I'll be removing it once
the USART is totally up and running.
No sense maintaining code that is 10x slower, more error prone, and used
by nobody.
Note: this is all thanks to blargg being absolutely amazing.
2012-02-25 08:49:27 +00:00
|
|
|
|
|
|
|
uint8 rxlength;
|
|
|
|
uint8 rxdata;
|
2012-02-25 08:52:42 +00:00
|
|
|
vector<uint8> rxbuffer;
|
Update to v086r04 release.
byuu says:
There will probably be a series of small WIPs as I experiment here.
snes/controller/serial is now snes/controller/uart. Asynchronous serial
communications, typically capped at 57,600 baud.
snes/controller/usart is new. It aims to emulate the SNES connected to
a Teensy++ board, and can easily handle 524,288 baud.
And much more importantly, it's synchronous, so there are no timing
issues anymore. Just bit-bang as fast as you can.
Right now, the USART code is just enough for SNES->PC to transfer data
to ... well, nothing yet.
Unless anyone is actually using the UART stuff, I'll be removing it once
the USART is totally up and running.
No sense maintaining code that is 10x slower, more error prone, and used
by nobody.
Note: this is all thanks to blargg being absolutely amazing.
2012-02-25 08:49:27 +00:00
|
|
|
|
|
|
|
uint8 txlength;
|
|
|
|
uint8 txdata;
|
2012-02-25 08:52:42 +00:00
|
|
|
vector<uint8> txbuffer;
|
|
|
|
|
2012-03-10 12:47:19 +00:00
|
|
|
function<void (
|
|
|
|
function<bool ()>, //quit
|
|
|
|
function<void (unsigned)>, //usleep
|
|
|
|
function<bool ()>, //readable
|
|
|
|
function<uint8 ()>, //read
|
|
|
|
function<bool ()>, //writable
|
|
|
|
function<void (uint8)> //write
|
|
|
|
)> init;
|
2012-02-25 09:12:08 +00:00
|
|
|
function<void ()> main;
|
Update to v086r04 release.
byuu says:
There will probably be a series of small WIPs as I experiment here.
snes/controller/serial is now snes/controller/uart. Asynchronous serial
communications, typically capped at 57,600 baud.
snes/controller/usart is new. It aims to emulate the SNES connected to
a Teensy++ board, and can easily handle 524,288 baud.
And much more importantly, it's synchronous, so there are no timing
issues anymore. Just bit-bang as fast as you can.
Right now, the USART code is just enough for SNES->PC to transfer data
to ... well, nothing yet.
Unless anyone is actually using the UART stuff, I'll be removing it once
the USART is totally up and running.
No sense maintaining code that is 10x slower, more error prone, and used
by nobody.
Note: this is all thanks to blargg being absolutely amazing.
2012-02-25 08:49:27 +00:00
|
|
|
};
|