Seeed-Studio / JavaScript_for_RePhone

14 stars 9 forks source link

Support I2C, etc #2

Closed csholmq closed 1 month ago

csholmq commented 8 years ago

Just like Lua for RePhone, it would be nice if JS for RePhone also supported e.g. I2C. From the source code it seems like it's already in place. Just needs a JS command mapping if I'm not mistaken.

E.g.

void js_init_i2c(struct v7* v7)
{
    v7_val_t i2c = v7_create_object(v7);
    v7_set(v7, v7_get_global(v7), "i2c", 3, 0, i2c);
    v7_set_method(v7, i2c, "setup", i2c_setup);
    v7_set_method(v7, i2c, "send", i2c_send);
    v7_set_method(v7, i2c, "recv", i2c_recv);
    v7_set_method(v7, i2c, "txrx", i2c_txrx);
}

Ping @WayenWeng

WayenWeng commented 8 years ago

Hi sir, The format is right, and you can do a test. Thx!