Skip to content

Commit

Permalink
PSRAM initialization on examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Feb 25, 2024
1 parent 702b560 commit ae74f19
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 9 additions & 2 deletions examples/full_example/full_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

#include <rishka.h>

rishka_virtual_machine vm;

void setup() {
// Begin serial communication at 115200 baud rate
Serial.begin(115200);
Expand All @@ -41,6 +39,15 @@ void setup() {
while(true);
}

if(!psramInit()) {
// If PSRAM initialization fails,
// print error message and halt execution
Serial.println("Cannot initialize PSRAM.");
while(true);
}

// Create a Rishka VM
rishka_virtual_machine vm;
// Initialize Rishka virtual machine
rishka_vm_initialize(&vm);

Expand Down
12 changes: 10 additions & 2 deletions examples/shell_example/shell_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ void setup() {
while(true);
}

// Initialize Rishka virtual machine
rishka_vm_initialize(&vm);
if(!psramInit()) {
// If PSRAM initialization fails,
// print error message and halt execution
Serial.println("Cannot initialize PSRAM.");
while(true);
}

// Print prompt
Serial.print("> ");
}
Expand All @@ -56,6 +61,9 @@ void loop() {
// Echo input back to serial port
Serial.print(input);

// Initialize Rishka virtual machine
rishka_vm_initialize(&vm);

// Attempt to load specified file into Rishka virtual machine
if(!rishka_vm_loadfile(&vm, input.c_str())) {
// If loading file fails, print error message and return
Expand Down

0 comments on commit ae74f19

Please sign in to comment.