Naereen/A-JavaScript-interpreter-for-the-NumWorks-calculator

For the four missing functions from eadk.h, try to bypass this limitation by using SVC calls?

Closed this issue · 1 comments

By some C code like this:

// See: https://yaya-cout.github.io/Nwagyu/reference/apps/syscalls.html
// FIXME: experimental use of svcall.h
#include "svcall.h"

void SVC_ATTRIBUTES setBlinking(uint16_t periodInMilliseconds,  float dutyCycle) {
  SVC_RETURNING_VOID(SVC_LED_SET_BLINKING)
}

and then

  // SVC call to SVC_LED_SET_BLINKING = 36
  // See: https://github.com/numworks/epsilon/blob/9072ab80a16d4c15222699f73896282a65eecd54/ion/src/device/shared/drivers/svcall.h#L82
  // asm("svc 36");

  // // See: https://github.com/numworks/epsilon/blob/9072ab80a16d4c15222699f73896282a65eecd54/ion/src/shared/exam_mode.cpp#L14
  // const uint16_t blinkPeriod = 1000;  // in ms
  // const float blinkDutyCycle = 0.1f;
  // setBlinking(blinkPeriod, blinkDutyCycle);

we could maybe simulate the missing functions from eadk.h:

bool eadk_battery_is_charging();
uint32_t eadk_battery_level();
float eadk_battery_voltage();
bool eadk_usb_is_plugged();
``

See <https://yaya-cout.github.io/Nwagyu/reference/apps/syscalls.html> for more information.

Fixed!