diff options
Diffstat (limited to 'usr')
-rw-r--r-- | usr/cxx.cpp | 24 | ||||
-rw-r--r-- | usr/main.c | 4 |
2 files changed, 27 insertions, 1 deletions
diff --git a/usr/cxx.cpp b/usr/cxx.cpp new file mode 100644 index 0000000..0c41cca --- /dev/null +++ b/usr/cxx.cpp @@ -0,0 +1,24 @@ +extern "C" { +#include <drivers/uart.h> +}; + +class TestClass { + public: + unsigned long value; + TestClass(unsigned long v) { + value = v; + } + void increment() { + value++; + } + void increment(unsigned long v) { + value += v; + } +}; + +extern "C" void cpp_demo(unsigned long v) +{ + TestClass tc = TestClass(v); + tc.increment(); + uart_hexn(tc.value); +} @@ -4,10 +4,11 @@ #include <graphics/lfb.h> #include <symbols.h> #include <sys/schedule.h> +#include <usr/cxx.h> +#include <usr/math.h> #include <usr/string.h> #include <usr/timed.h> #include <usr/uart.h> -#include <usr/math.h> static struct SysTimerInfo stime_0 = { .tick_rate = 5000000, @@ -99,4 +100,5 @@ void main(void) //add_thread(consumer, 0, 3); //add_thread(test_super, 0, 4); //subscribe_irq(SYS_TIMER_3_IRQ, gptest, &stime_3); + cpp_demo(53); } |