Initial commit
This commit is contained in:
@@ -44,8 +44,8 @@ build_flags =
|
||||
build_src_filter =
|
||||
${common.src_filter}
|
||||
+<pico*.c>
|
||||
upload_protocol = uf2
|
||||
upload_port = /run/media/max/RPI-RP2
|
||||
upload_protocol = picotool
|
||||
;; upload_port = /run/media/max/RPI-RP2
|
||||
lib_deps = /home/max/repos/uclisp/
|
||||
extra_scripts = pre:extra_script.py
|
||||
|
||||
|
||||
@@ -19,11 +19,10 @@ const char *platform_get_text() {
|
||||
printf("> ");
|
||||
line = NULL;
|
||||
getline(&line, &line_len, stdin);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
void platform_repl_complete() {
|
||||
free(line);
|
||||
|
||||
line = NULL;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ void pico_getline() {
|
||||
int chr;
|
||||
char *end = &buffer[0];
|
||||
bool done = false;
|
||||
|
||||
printf("> ");
|
||||
fflush(stdout);
|
||||
|
||||
while (!done) {
|
||||
while((chr = getchar_timeout_us(0)) != PICO_ERROR_TIMEOUT)
|
||||
{
|
||||
@@ -33,10 +37,21 @@ void pico_getline() {
|
||||
}
|
||||
|
||||
chr = chr & 0xFF;
|
||||
*end = chr;
|
||||
end++;
|
||||
|
||||
printf("%c", chr);
|
||||
// Treat both backspace and DEL as backspace. It's unclear why to
|
||||
// me, but they are appearing swapped for me in `screen` with the
|
||||
// pico.
|
||||
if (chr == '\b' || chr == '\x7f') {
|
||||
if (end > buffer) {
|
||||
end--;
|
||||
printf("\b \b");
|
||||
}
|
||||
} else {
|
||||
*end = chr;
|
||||
end++;
|
||||
printf("%c", chr);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
(gpio-write 0 1)
|
||||
(sleep-millis 100)
|
||||
(gpio-write 0 0)
|
||||
(sleep-millis 100)
|
||||
(setq led-pin 1)
|
||||
(setq on 1)
|
||||
(setq off 0)
|
||||
(setq blink-delay 100)
|
||||
|
||||
(defun blink ()
|
||||
(gpio-write led-pin on)
|
||||
(sleep-millis blink-delay)
|
||||
(gpio-write led-pin off)
|
||||
(sleep-millis blink-delay))
|
||||
|
||||
(while (quote t)
|
||||
(blink))
|
||||
|
||||
(setq n 0)
|
||||
|
||||
(while 1
|
||||
(printl n)
|
||||
(setq n (+ n 1)))
|
||||
|
||||
Reference in New Issue
Block a user