Skip to content

Safe bindings to Numworks' Epsilon App Development Kit

Notifications You must be signed in to change notification settings

AquaEBM/eadk_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eadk_rs

Safe bindings to Numworks' Epsilon App Development Kit.

How to create and install a custom app for your Numworks Calculator

  • In your terminal, create a new Rust binary project with cargo:
cargo new --bin <your_app_name>
cd <your_app_name>
  • You might want to add this crate as a dependency in the newly created Cargo.toml file:
# Cargo.toml
[package]

# ...

[dependencies]

# ...
eadk = { git = "https://github.com/AquaEBM/eadk_rs.git" }
  • Copy the icon.nwi file at the root of this repository to the src directory of your project.

  • Then copy the following example code into src/main.rs:

//! Template Epsilon App
#![no_std]
#![no_main]

use eadk::{ion::*, kandinsky::*};

#[used]
#[link_section = ".rodata.eadk_app_name"]
/// null-terminated string used as the app's name
static APP_NAME: [u8; 14] = *b"YOUR_APP_NAME\0";

#[used]
#[link_section = ".rodata.eadk_api_level"]
/// API level of the app, always zero
static API_LEVEL: u32 = 0;

#[used]
#[link_section = ".rodata.eadk_app_icon"]
/// Bytes of an LZ4-compressed RGB565 55x56 pixels image.
static ICON: [u8; 4250] = *include_bytes!("icon.nwi");

#[no_mangle]
fn main() {

    const COL: Color = Color::from_rgb([248, 180, 48]);
    const BG_COL: Color = Color::from_rgb([78, 78, 78]);

    fill_rect( Rect { point: Point { x: 0, y: 18 }, w: 320, h: 222 }, BG_COL);

    let string = b"HELLO NUMWORKS\0";

    // draw "HELLO NUMWORKS" on the center of the screen.
    unsafe {
        draw_string_unchecked(
            string.as_ptr(),
            Point {
                x: 160 - (string.len() - 1) as i16 * 3,
                y: 129,
            },
            false,
            COL,
            BG_COL,
        )
    };

    // Exit the app when the back button is pressed
    while !KeyboardState::scan().key_down(Key::Back) {}
}

use core::panic::PanicInfo;

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
    // Freeze on panic
    loop {}
}
  • Then, build your app:
cargo rustc build -r --target=thumbv7em-none-eabihf -- -Clink-arg=--relocatable -Clink-arg=-no-gc-sections
  • Finally, connect your calculator via USB to your device, and follow the instructions in this website to upload it. The file you need to upload is exactly:
target/thumbv7em-none-eabihf/release/<your_app_name>

About

Safe bindings to Numworks' Epsilon App Development Kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages