aboutsummaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-30 16:44:04 -0700
committerChristian Cunningham <cc@localhost>2022-03-30 16:44:04 -0700
commit90227ef8d65052622d09698dc80a27cd67f4bc0a (patch)
tree3df4be896d39d10b3bb63d9e068fce4a8ab4a7a7 /usr
parent72a403ce29627ad6fb603c366b239ba8c9e5131e (diff)
More example stuff
Diffstat (limited to 'usr')
-rw-r--r--usr/cxx.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/usr/cxx.cpp b/usr/cxx.cpp
index 0c41cca..2240d25 100644
--- a/usr/cxx.cpp
+++ b/usr/cxx.cpp
@@ -1,24 +1,28 @@
extern "C" {
-#include <drivers/uart.h>
+#include <graphics/lfb.h>
+#include <usr/string.h>
};
-class TestClass {
+class Substation {
public:
- unsigned long value;
- TestClass(unsigned long v) {
- value = v;
- }
- void increment() {
- value++;
- }
- void increment(unsigned long v) {
- value += v;
+ unsigned long temperature;
+ unsigned long critical_temperature;
+ unsigned long current_production;
+ unsigned long max_production;
+ unsigned long current_load;
+ Substation(unsigned long ct, unsigned long mp) {
+ temperature = 0;
+ current_production = 0;
+ current_load = 0;
+ critical_temperature = ct;
+ max_production = mp;
}
};
extern "C" void cpp_demo(unsigned long v)
{
- TestClass tc = TestClass(v);
- tc.increment();
- uart_hexn(tc.value);
+ Substation s = Substation(120000+10*v, 95000000 - 23*v);
+ char str[14];
+ char* start = ulong_to_string(s.max_production, str);
+ draw_string(0, 15, start);
}