Skip to content

Commit

Permalink
upgrade picoruby && add io_rp2040.{h|c}
Browse files Browse the repository at this point in the history
  • Loading branch information
hasumikin committed Nov 19, 2023
1 parent 568e003 commit 6f7b856
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
16 changes: 16 additions & 0 deletions include/io_rp2040.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef IO_RP2040_DEFINED_H_
#define IO_RP2040_DEFINED_H_

#ifdef __cplusplus
extern "C" {
#endif

void mrbc_io_rp2040_init(void);

#ifdef __cplusplus
}
#endif

#endif /* IO_RP2040_DEFINED_H_ */


2 changes: 1 addition & 1 deletion lib/picoruby
Submodule picoruby updated 129 files
28 changes: 28 additions & 0 deletions src/io_rp2040.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <stdlib.h>

#include <mrubyc.h>

#include "../lib/picoruby/mrbgems/picoruby-io-console/src/hal/hal.h"

void
c_raw_bang(mrb_vm *vm, mrb_value *v, int argc)
{
// TODO
SET_RETURN(v[0]);
}

void
c_cooked_bang(mrb_vm *vm, mrb_value *v, int argc)
{
// TODO
SET_RETURN(v[0]);
}

void
mrbc_io_rp2040_init(void)
{
mrbc_class *class_IO = mrbc_define_class(0, "IO", mrbc_class_object);
mrbc_define_method(0, class_IO, "raw!", c_raw_bang);
mrbc_define_method(0, class_IO, "cooked!", c_cooked_bang);
}

2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "../include/sounder.h"

/* ruby */
#include "../include/io_rp2040.h"
/* ext */
#include "../build/mrb/object-ext.c"
/* tasks */
Expand Down Expand Up @@ -97,6 +98,7 @@ main(void)
board_init();
/* PicoRuby */
mrbc_init(memory_pool, MEMORY_SIZE);
mrbc_io_rp2040_init();
prk_init_picoruby();
/* TinyUSB */
tusb_init();
Expand Down

0 comments on commit 6f7b856

Please sign in to comment.