moved around the char in/out functions until I was happy with them, no I'm able to output properly, still no inputs, but cloes

This commit is contained in:
Jared Young 2019-11-04 02:57:33 +00:00
parent a4811d429c
commit e05edfb687
3 changed files with 42 additions and 22 deletions

28
.gitignore vendored
View File

@ -1,6 +1,5 @@
# Created by https://www.gitignore.io/api/c,c++,cmake,python,vim
# Created by https://www.gitignore.io/api/c,c++,cmake,python # Edit at https://www.gitignore.io/?templates=c,c++,cmake,python,vim
# Edit at https://www.gitignore.io/?templates=c,c++,cmake,python
### C ### ### C ###
# Prerequisites # Prerequisites
@ -196,7 +195,28 @@ dmypy.json
# Pyre type checker # Pyre type checker
.pyre/ .pyre/
# End of https://www.gitignore.io/api/c,c++,cmake,python
### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# End of https://www.gitignore.io/api/c,c++,cmake,python,vim
testcode/ testcode/
build/ build/

View File

@ -59,8 +59,8 @@ int main()
retro::InitConsole(); retro::InitConsole();
std::string out = "Hello, world.\nEnter \"exit\" to quit.\n"; //std::string out = "Hello, world.\nEnter \"exit\" to quit.\n";
retro::Console::currentInstance->write(out.data(), out.size()); //retro::Console::currentInstance->write(out.data(), out.size());
pyexec_event_repl_init(); pyexec_event_repl_init();
for (;;) { for (;;) {
@ -70,6 +70,7 @@ int main()
} }
} }
/*
std::string in; std::string in;
do do
{ {
@ -77,7 +78,7 @@ int main()
out = "You Entered: " + in; out = "You Entered: " + in;
retro::Console::currentInstance->write(out.data(), out.size()); retro::Console::currentInstance->write(out.data(), out.size());
} while(in != "exit\n"); } while(in != "exit\n");
*/
mp_deinit(); mp_deinit();
return 0; return 0;
@ -93,3 +94,17 @@ extern "C" void gc_collect(void) {
gc_collect_end(); gc_collect_end();
gc_dump_info(); gc_dump_info();
} }
// Receive single character
int mp_hal_stdin_rx_chr(void) {
unsigned char c = 0;
return c;
}
// Send string of given length
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
//int r = write(1, str, len);
retro::Console::currentInstance->write(str, len);
//(void)r;
}

View File

@ -1,5 +1,3 @@
//#include "retro/Console.h"
extern "C" { extern "C" {
#include <unistd.h> #include <unistd.h>
#include "py/mpconfig.h" #include "py/mpconfig.h"
@ -7,16 +5,3 @@ extern "C" {
extern "C" int mp_hal_stdin_rx_chr(void); extern "C" int mp_hal_stdin_rx_chr(void);
extern "C" void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len); extern "C" void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len);
// Receive single character
int mp_hal_stdin_rx_chr(void) {
unsigned char c = 0;
return c;
}
// Send string of given length
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
//int r = write(1, str, len);
//retro::Console::currentInstance->write(str, len);
//(void)r;
}