mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-21 23:29:48 +00:00
[update] removed scope from module rgpio
This commit is contained in:
parent
d0adc9edf7
commit
f47fc30e93
@ -207,7 +207,7 @@ class appTool {
|
|||||||
// GPIO 関連:リロードでGPIOをロックしたままハンドルを失うのを防ぐ
|
// GPIO 関連:リロードでGPIOをロックしたままハンドルを失うのを防ぐ
|
||||||
cleanupGPIO() {
|
cleanupGPIO() {
|
||||||
// this.ugjEmitter.emit('device_stop');//デバイス停止イベント
|
// this.ugjEmitter.emit('device_stop');//デバイス停止イベント
|
||||||
require('@ocoge.club/' + this.gpio_lib).close_all_handle();
|
require(this.gpio_lib).close_all_handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 設定(保存ファイルパスと未保存フラグ)をローカルストレージに保存
|
// 設定(保存ファイルパスと未保存フラグ)をローカルストレージに保存
|
||||||
@ -407,7 +407,7 @@ if (!is_app) {
|
|||||||
case 'nodemailer':
|
case 'nodemailer':
|
||||||
block = 'メール送信';
|
block = 'メール送信';
|
||||||
break;
|
break;
|
||||||
case '@ocoge.club/pigpio':
|
case 'pigpio':
|
||||||
block = 'GPIO';
|
block = 'GPIO';
|
||||||
break;
|
break;
|
||||||
case 'fs':
|
case 'fs':
|
||||||
|
@ -185,7 +185,7 @@ Blockly.Blocks['ugj_gpio_open'] = {
|
|||||||
};
|
};
|
||||||
Blockly.JavaScript['ugj_gpio_open'] = function (block) {
|
Blockly.JavaScript['ugj_gpio_open'] = function (block) {
|
||||||
Blockly.JavaScript.provideFunction_(
|
Blockly.JavaScript.provideFunction_(
|
||||||
'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_lib + `');`]
|
'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`]
|
||||||
);
|
);
|
||||||
var code = `await _pi.gpio_open();\n`; //
|
var code = `await _pi.gpio_open();\n`; //
|
||||||
return code;
|
return code;
|
||||||
@ -565,7 +565,7 @@ Blockly.JavaScript['ugj_serial_open'] = function (block) {
|
|||||||
// var value_tty = Blockly.JavaScript.valueToCode(block, 'tty', Blockly.JavaScript.ORDER_ATOMIC);
|
// var value_tty = Blockly.JavaScript.valueToCode(block, 'tty', Blockly.JavaScript.ORDER_ATOMIC);
|
||||||
var dropdown_baud = block.getFieldValue('baud');
|
var dropdown_baud = block.getFieldValue('baud');
|
||||||
Blockly.JavaScript.provideFunction_(
|
Blockly.JavaScript.provideFunction_(
|
||||||
'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_lib + `');`]
|
'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`]
|
||||||
);
|
);
|
||||||
var code = `await _pi.serial_open('/dev/ttyS0', ${dropdown_baud});\n`;
|
var code = `await _pi.serial_open('/dev/ttyS0', ${dropdown_baud});\n`;
|
||||||
// var code = `await _pi.serial_open('/dev/serial0', ${dropdown_baud});\n`;
|
// var code = `await _pi.serial_open('/dev/serial0', ${dropdown_baud});\n`;
|
||||||
@ -706,7 +706,7 @@ Blockly.Blocks['ugj_i2c_open'] = {
|
|||||||
Blockly.JavaScript['ugj_i2c_open'] = function (block) {
|
Blockly.JavaScript['ugj_i2c_open'] = function (block) {
|
||||||
var value_i2c_address = Blockly.JavaScript.valueToCode(block, 'i2c_address', Blockly.JavaScript.ORDER_ATOMIC);
|
var value_i2c_address = Blockly.JavaScript.valueToCode(block, 'i2c_address', Blockly.JavaScript.ORDER_ATOMIC);
|
||||||
Blockly.JavaScript.provideFunction_(
|
Blockly.JavaScript.provideFunction_(
|
||||||
'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_lib + `');`]
|
'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`]
|
||||||
);
|
);
|
||||||
var code = `await _pi.i2c_open(${apptool.i2c_bus}, ${value_i2c_address});\n`;
|
var code = `await _pi.i2c_open(${apptool.i2c_bus}, ${value_i2c_address});\n`;
|
||||||
return code;
|
return code;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const err_msg = 'AMG8833 is already opened. Please close old connection to use new one.';
|
const err_msg = 'AMG8833 is already opened. Please close old connection to use new one.';
|
||||||
const pig = require(`@ocoge.club/${apptool.gpio_lib}`);
|
const pig = require(`${apptool.gpio_lib}`);
|
||||||
|
|
||||||
let pi = -1;
|
let pi = -1;
|
||||||
let i2c_hand = -1;
|
let i2c_hand = -1;
|
||||||
|
@ -54,7 +54,7 @@ Blockly.defineBlocksWithJsonArray([{
|
|||||||
Blockly.JavaScript['ugj_grideye_init'] = function (block) {
|
Blockly.JavaScript['ugj_grideye_init'] = function (block) {
|
||||||
var dropdown_addr = block.getFieldValue('addr');
|
var dropdown_addr = block.getFieldValue('addr');
|
||||||
// Blockly.JavaScript.provideFunction_(
|
// Blockly.JavaScript.provideFunction_(
|
||||||
// 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_lib + `');`]
|
// 'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`]
|
||||||
// );
|
// );
|
||||||
let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'amg8833', `AMG8833x.js`);
|
let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'amg8833', `AMG8833x.js`);
|
||||||
Blockly.JavaScript.provideFunction_(
|
Blockly.JavaScript.provideFunction_(
|
||||||
|
@ -42,7 +42,7 @@ this.REGISTER_TEMP_DATA = 0xFA;
|
|||||||
this.REGISTER_HUMIDITY_DATA = 0xFD;
|
this.REGISTER_HUMIDITY_DATA = 0xFD;
|
||||||
|
|
||||||
exports.init = async (options) => {
|
exports.init = async (options) => {
|
||||||
this.pig = require(`@ocoge.club/${apptool.gpio_lib}`);
|
this.pig = require(`${apptool.gpio_lib}`);
|
||||||
this.pi = await this.pig._gpiod_start('', '');
|
this.pi = await this.pig._gpiod_start('', '');
|
||||||
|
|
||||||
this.i2cBusNo = (options && options.hasOwnProperty('i2cBusNo')) ? options.i2cBusNo : 1;
|
this.i2cBusNo = (options && options.hasOwnProperty('i2cBusNo')) ? options.i2cBusNo : 1;
|
||||||
|
@ -18,7 +18,7 @@ Blockly.Blocks['ugj_bme280'] = {
|
|||||||
Blockly.JavaScript['ugj_bme280'] = function (block) {
|
Blockly.JavaScript['ugj_bme280'] = function (block) {
|
||||||
var dropdown_addr = block.getFieldValue('addr');
|
var dropdown_addr = block.getFieldValue('addr');
|
||||||
// Blockly.JavaScript.provideFunction_(
|
// Blockly.JavaScript.provideFunction_(
|
||||||
// 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_lib + `');`]
|
// 'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`]
|
||||||
// );
|
// );
|
||||||
// let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'bme280', 'BME280x.js');
|
// let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'bme280', 'BME280x.js');
|
||||||
let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'bme280', `BME280x.js`);
|
let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'bme280', `BME280x.js`);
|
||||||
|
@ -322,7 +322,7 @@ exports.init = async (i2c_bus, i2c_addr, wael = null) => {
|
|||||||
await exports.stop();
|
await exports.stop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pig = require(`@ocoge.club/${apptool.gpio_lib}`);
|
pig = require(`${apptool.gpio_lib}`);
|
||||||
if (pi >= 0) { throw new Error(err_msg); return; }
|
if (pi >= 0) { throw new Error(err_msg); return; }
|
||||||
pi = await pig._gpiod_start('', '');
|
pi = await pig._gpiod_start('', '');
|
||||||
if (i2c_hand >= 0) { throw new Error(err_msg); return; }
|
if (i2c_hand >= 0) { throw new Error(err_msg); return; }
|
||||||
|
@ -33,7 +33,7 @@ Blockly.Blocks['ugj_gesture_init'] = {
|
|||||||
Blockly.JavaScript['ugj_gesture_init'] = function (block) {
|
Blockly.JavaScript['ugj_gesture_init'] = function (block) {
|
||||||
var value_i2c_addr = Blockly.JavaScript.valueToCode(block, 'i2c_addr', Blockly.JavaScript.ORDER_ATOMIC);
|
var value_i2c_addr = Blockly.JavaScript.valueToCode(block, 'i2c_addr', Blockly.JavaScript.ORDER_ATOMIC);
|
||||||
// Blockly.JavaScript.provideFunction_(
|
// Blockly.JavaScript.provideFunction_(
|
||||||
// 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_lib + `');`]
|
// 'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`]
|
||||||
// );
|
// );
|
||||||
let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'paj7620', 'PAJ7620x.js');
|
let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'paj7620', 'PAJ7620x.js');
|
||||||
Blockly.JavaScript.provideFunction_(
|
Blockly.JavaScript.provideFunction_(
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"target_name": "pigpio",
|
|
||||||
"sources": ["pigpio.cpp"],
|
|
||||||
"defines": ["NAPI_DISABLE_CPP_EXCEPTIONS"],
|
|
||||||
"include_dirs": ["<!@(node -p \"require( 'node-addon-api' ).include\")"],
|
|
||||||
"dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"],
|
|
||||||
"libraries": ["-lpigpiod_if2", "-lrt"],
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
module.exports = require('bindings')('pigpio');
|
|
||||||
|
|
||||||
// module.exports.INPUT = 0;
|
|
||||||
// module.exports.OUTPUT = 1;
|
|
||||||
// module.exports.PUD_OFF = 0;
|
|
||||||
// module.exports.PUD_DOWN = 1;
|
|
||||||
// module.exports.PUD_UP = 2;
|
|
||||||
module.exports.PULL_UP = 2;
|
|
||||||
module.exports.PULL_DOWN = 1;
|
|
||||||
module.exports.PULL_NONE = 0;
|
|
||||||
|
|
||||||
|
|
||||||
let pi = -1;
|
|
||||||
let i2c_hand = -1;
|
|
||||||
let ser_hand = -1;
|
|
||||||
module.exports.gpio_open = async () => {
|
|
||||||
if (pi < 0) pi = await module.exports._gpiod_start('', '');
|
|
||||||
return pi;
|
|
||||||
}
|
|
||||||
module.exports.gpio_close = async () => {
|
|
||||||
if (pi >= 0) await module.exports._gpiod_stop(pi);
|
|
||||||
pi = -1;
|
|
||||||
}
|
|
||||||
module.exports.gpio_set_output = async gpio => {
|
|
||||||
if (pi >= 0) return await module.exports._set_mode(pi, gpio, 1);
|
|
||||||
}
|
|
||||||
module.exports.gpio_set_input = async (gpio, mode) => {
|
|
||||||
if (pi >= 0) {
|
|
||||||
let r = await module.exports._set_mode(pi, gpio, 0);
|
|
||||||
if (r == 0)
|
|
||||||
return await module.exports._set_pull_up_down(pi, gpio, mode);
|
|
||||||
else
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports.gpio_read = async gpio => {
|
|
||||||
if (pi >= 0) return await module.exports._gpio_read(pi, gpio);
|
|
||||||
}
|
|
||||||
module.exports.gpio_write = async (gpio, value) => {
|
|
||||||
if (pi >= 0) return await module.exports._gpio_write(pi, gpio, value);
|
|
||||||
}
|
|
||||||
module.exports.servo = async (gpio, pulse_width) => {
|
|
||||||
if (pi >= 0) return await module.exports._set_servo_pulsewidth(pi, gpio, pulse_width);
|
|
||||||
}
|
|
||||||
module.exports.pwm = async (gpio, pwm_frequency, pwm_duty_cycle) => {
|
|
||||||
if (pi >= 0) {
|
|
||||||
await module.exports._set_PWM_frequency(pi, gpio, pwm_frequency);
|
|
||||||
await module.exports._set_PWM_dutycycle(pi, gpio, pwm_duty_cycle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports.serial_open = async (tty, baud) => {
|
|
||||||
if (ser_hand >= 0) await module.exports._serial_close(pi, ser_hand); // 勝手に閉じる
|
|
||||||
ser_hand = await module.exports._serial_open(pi, tty, baud);
|
|
||||||
return ser_hand;
|
|
||||||
}
|
|
||||||
module.exports.serial_close = async () => {
|
|
||||||
if (ser_hand >= 0) await module.exports._serial_close(pi, ser_hand);
|
|
||||||
ser_hand = -1;
|
|
||||||
}
|
|
||||||
module.exports.serial_write = async data => {
|
|
||||||
if (ser_hand >= 0) return await module.exports._serial_write(pi, ser_hand, Buffer.from(data));
|
|
||||||
}
|
|
||||||
module.exports.serial_read = async count => {
|
|
||||||
if (ser_hand >= 0) return new TextDecoder().decode(await module.exports._serial_read(pi, ser_hand, count));
|
|
||||||
// if (ser_hand >= 0) return await module.exports._serial_read(pi, ser_hand, count);//.toString('utf8');
|
|
||||||
}
|
|
||||||
module.exports.i2c_open = async (i2c_bus, i2c_address) => {
|
|
||||||
if (i2c_hand >= 0) await module.exports._i2c_close(pi, i2c_hand); // 勝手に閉じる
|
|
||||||
i2c_hand = await module.exports._i2c_open(pi, i2c_bus, i2c_address);
|
|
||||||
return i2c_hand;
|
|
||||||
}
|
|
||||||
module.exports.i2c_close = async () => {
|
|
||||||
if (i2c_hand >= 0) await module.exports._i2c_close(pi, i2c_hand);
|
|
||||||
i2c_hand = -1;
|
|
||||||
}
|
|
||||||
module.exports.i2c_write_byte_data = async (reg, byte_val) => {
|
|
||||||
if (i2c_hand >= 0) return await module.exports._i2c_write_byte_data(pi, i2c_hand, reg, byte_val);
|
|
||||||
}
|
|
||||||
module.exports.i2c_read_byte_data = async reg => {
|
|
||||||
if (i2c_hand >= 0) return await module.exports._i2c_read_byte_data(pi, i2c_hand, reg);
|
|
||||||
}
|
|
||||||
module.exports.i2c_write_i2c_block_data = async (reg, data) => {
|
|
||||||
if (i2c_hand >= 0) return await module.exports._i2c_write_i2c_block_data(pi, i2c_hand, reg, Buffer.from(data));
|
|
||||||
}
|
|
||||||
module.exports.i2c_read_word_data = async reg => {
|
|
||||||
if (i2c_hand >= 0) return await module.exports._i2c_read_word_data(pi, i2c_hand, reg);
|
|
||||||
}
|
|
||||||
module.exports.i2c_read_device = async count => {
|
|
||||||
if (i2c_hand >= 0) return new TextDecoder().decode(await module.exports._i2c_read_device(pi, i2c_hand, count));
|
|
||||||
// if (i2c_hand >= 0) return await module.exports._i2c_read_device(pi, i2c_hand, count).toString('utf8');
|
|
||||||
}
|
|
||||||
module.exports.i2c_write_device = async data => {
|
|
||||||
if (i2c_hand >= 0) return await module.exports._i2c_write_device(pi, i2c_hand, Buffer.from(data));
|
|
||||||
}
|
|
||||||
// 終了処理
|
|
||||||
module.exports.close_all_handle = () => {
|
|
||||||
module.exports.serial_close();
|
|
||||||
module.exports.i2c_close();
|
|
||||||
module.exports.gpio_close();
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@ocoge.club/pigpio",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"main": "index.js",
|
|
||||||
"private": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"bindings": "^1.5.0",
|
|
||||||
"node-addon-api": "^1.7.1"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,682 +0,0 @@
|
|||||||
/** PIGPIO デーモンを Node.js から利用するモジュール ** */
|
|
||||||
/** 関数名・書式は Python Interface に準拠 ******************* */
|
|
||||||
|
|
||||||
#include <napi.h>
|
|
||||||
#include <pigpiod_if2.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
using namespace Napi;
|
|
||||||
|
|
||||||
// pigpio 初期化
|
|
||||||
Promise _pigpioStart(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 2)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsString() || !info[1].IsString())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string addrStr = info[0].As<String>().Utf8Value();
|
|
||||||
std::string portStr = info[1].As<String>().Utf8Value();
|
|
||||||
deferred.Resolve(Number::New(env, pigpio_start(addrStr.c_str(), portStr.c_str())));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// pigpio 後始末
|
|
||||||
Promise _pigpioStop(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 1)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "IInvalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid aargument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
pigpio_stop(pi);
|
|
||||||
deferred.Resolve(env.Null());
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GPIO 端子のモードを設定
|
|
||||||
Promise _setMode(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int gpio = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int mode = info[2].As<Number>().Uint32Value();
|
|
||||||
|
|
||||||
deferred.Resolve(Number::New(env, set_mode(pi, gpio, mode)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GPIOの内部プルアップ/ダウン抵抗の設定/クリア
|
|
||||||
Promise _setPullUpDown(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int gpio = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int pud = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, set_pull_up_down(pi, gpio, pud)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GPIOの電圧を読む
|
|
||||||
Promise _gpioRead(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 2)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int gpio = info[1].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, gpio_read(pi, gpio)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GPIO の電圧をセットする
|
|
||||||
Promise _gpioWrite(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int gpio = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int value = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, gpio_write(pi, gpio, value)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// サーボパルス幅をセットする
|
|
||||||
Promise _setServoPulsewidth(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int user_gpio = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int pulsewidth = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, set_servo_pulsewidth(pi, user_gpio, pulsewidth)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// PWM周波数を設定する
|
|
||||||
Promise _setPwmFrequency(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int user_gpio = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int frequency = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, set_PWM_frequency(pi, user_gpio, frequency)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// PWMのデューティ比を指定して出力を開始する
|
|
||||||
Promise _setPwmDutycycle(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int user_gpio = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int dutycycle = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, set_PWM_dutycycle(pi, user_gpio, dutycycle)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// シリアルポートを開く
|
|
||||||
Promise _serialOpen(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsString() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
std::string ser_tty = info[1].As<String>().Utf8Value();
|
|
||||||
unsigned int baud = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, serial_open(pi, (char *)ser_tty.c_str(), baud, 0)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// シリアルポートを閉じる
|
|
||||||
Promise _serialClose(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 2)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, serial_close(pi, handle)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// シリアルデバイスからデータを読む
|
|
||||||
Promise _serialRead(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int count = info[2].As<Number>().Uint32Value();
|
|
||||||
|
|
||||||
char buf[count];
|
|
||||||
int rxCount = serial_read(pi, handle, buf, count);
|
|
||||||
auto outBuf = Buffer<char>::Copy(env, buf, rxCount);
|
|
||||||
deferred.Resolve(outBuf);
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// シリアルデバイスにバイト列を書き込む(data: string)
|
|
||||||
Promise _serialWrite(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsBuffer())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
auto buf = info[2].As<Buffer<char>>();
|
|
||||||
|
|
||||||
int count = buf.Length();
|
|
||||||
deferred.Resolve(Number::New(env, serial_write(pi, handle, buf.Data(), count)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// I2Cバスアドレスのデバイスのハンドルを返す
|
|
||||||
Promise _i2cOpen(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int i2c_bus = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int i2c_addr = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_open(pi, i2c_bus, i2c_addr, 0)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
// オープン済みI2Cハンドルを閉じる
|
|
||||||
Promise _i2cClose(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 2)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_close(pi, handle)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// デバイスに1バイトを送る
|
|
||||||
Promise _i2cWriteByte(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int bVal = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_write_byte(pi, handle, bVal)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
// デバイスから1バイトを受け取る
|
|
||||||
Promise _i2cReadByte(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 2)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[0].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_read_byte(pi, handle)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタに1バイトを書き込む
|
|
||||||
Promise _i2cWriteByteData(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 4)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int i2c_reg = info[2].As<Number>().Uint32Value();
|
|
||||||
unsigned int bVal = info[3].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_write_byte_data(pi, handle, i2c_reg, bVal)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタから1バイトを読み込む
|
|
||||||
Promise _i2cReadByteData(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int i2c_reg = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_read_byte_data(pi, handle, i2c_reg)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタに最大32バイトのデータを書き込む。
|
|
||||||
Promise _i2cWriteI2cBlockData(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 4)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsBuffer())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int i2c_reg = info[2].As<Number>().Uint32Value();
|
|
||||||
auto buf = info[3].As<Buffer<char>>();
|
|
||||||
|
|
||||||
unsigned int count = buf.Length();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_write_i2c_block_data(pi, handle, i2c_reg, buf.Data(), count)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタからcountバイトを読み込む。countは1~32。
|
|
||||||
Promise _i2cReadI2cBlockData(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 4)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int i2cReg = info[2].As<Number>().Uint32Value();
|
|
||||||
unsigned int count = info[3].As<Number>().Uint32Value();
|
|
||||||
char buf[count];
|
|
||||||
int rxCount = i2c_read_i2c_block_data(pi, handle, i2cReg, buf, count);
|
|
||||||
auto outBuf = Buffer<char>::Copy(env, buf, rxCount);
|
|
||||||
deferred.Resolve(outBuf);
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタから単一の16ビットワードを読み取る
|
|
||||||
Promise _i2cReadWordData(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int i2c_reg = info[2].As<Number>().Uint32Value();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_read_word_data(pi, handle, i2c_reg)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// I2Cハンドルに関連付けられているデバイスの指定されたレジスタに単一の16ビットワードを書き込む
|
|
||||||
Promise _i2cWriteWordData(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 4)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int i2c_reg = info[2].As<Number>().Uint32Value();
|
|
||||||
unsigned int wVal = info[3].As<Number>().Uint32Value();
|
|
||||||
|
|
||||||
deferred.Resolve(Number::New(env, i2c_write_word_data(pi, handle, i2c_reg, wVal)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// i2c デバイスからデータを受け取る
|
|
||||||
Promise _i2cReadDevice(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
unsigned int count = info[2].As<Number>().Uint32Value();
|
|
||||||
|
|
||||||
char buf[count];
|
|
||||||
int rxCount = i2c_read_device(pi, handle, buf, count);
|
|
||||||
auto outBuf = Buffer<char>::Copy(env, buf, rxCount);
|
|
||||||
deferred.Resolve(outBuf);
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// i2c デバイスにバイト列を送る(data: buffer)
|
|
||||||
Promise _i2cWriteDevice(const CallbackInfo &info)
|
|
||||||
{
|
|
||||||
Env env = info.Env();
|
|
||||||
auto deferred = Napi::Promise::Deferred::New(env);
|
|
||||||
if (info.Length() != 3)
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
TypeError::New(env, "Invalid argument count").Value());
|
|
||||||
}
|
|
||||||
else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsBuffer())
|
|
||||||
{
|
|
||||||
deferred.Reject(
|
|
||||||
Napi::TypeError::New(env, "Invalid argument types").Value());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int pi = info[0].As<Number>().Int32Value();
|
|
||||||
unsigned int handle = info[1].As<Number>().Uint32Value();
|
|
||||||
auto buf = info[2].As<Buffer<char>>();
|
|
||||||
|
|
||||||
unsigned int count = buf.Length();
|
|
||||||
deferred.Resolve(Number::New(env, i2c_write_device(pi, handle, buf.Data(), count)));
|
|
||||||
}
|
|
||||||
return deferred.Promise();
|
|
||||||
}
|
|
||||||
|
|
||||||
Object
|
|
||||||
Init(Env env, Object exports)
|
|
||||||
{
|
|
||||||
exports.Set(String::New(env, "_gpiod_start"), Function::New(env, _pigpioStart));
|
|
||||||
exports.Set(String::New(env, "_gpiod_stop"), Function::New(env, _pigpioStop));
|
|
||||||
exports.Set(String::New(env, "_set_mode"), Function::New(env, _setMode));
|
|
||||||
exports.Set(String::New(env, "_set_pull_up_down"), Function::New(env, _setPullUpDown));
|
|
||||||
exports.Set(String::New(env, "_gpio_read"), Function::New(env, _gpioRead));
|
|
||||||
exports.Set(String::New(env, "_gpio_write"), Function::New(env, _gpioWrite));
|
|
||||||
exports.Set(String::New(env, "_set_servo_pulsewidth"), Function::New(env, _setServoPulsewidth));
|
|
||||||
exports.Set(String::New(env, "_set_PWM_frequency"), Function::New(env, _setPwmFrequency));
|
|
||||||
exports.Set(String::New(env, "_set_PWM_dutycycle"), Function::New(env, _setPwmDutycycle));
|
|
||||||
exports.Set(String::New(env, "_serial_open"), Function::New(env, _serialOpen));
|
|
||||||
exports.Set(String::New(env, "_serial_close"), Function::New(env, _serialClose));
|
|
||||||
exports.Set(String::New(env, "_serial_read"), Function::New(env, _serialRead));
|
|
||||||
exports.Set(String::New(env, "_serial_write"), Function::New(env, _serialWrite));
|
|
||||||
exports.Set(String::New(env, "_i2c_open"), Function::New(env, _i2cOpen));
|
|
||||||
exports.Set(String::New(env, "_i2c_close"), Function::New(env, _i2cClose));
|
|
||||||
exports.Set(String::New(env, "_i2c_write_byte"), Function::New(env, _i2cWriteByte));
|
|
||||||
exports.Set(String::New(env, "_i2c_read_byte"), Function::New(env, _i2cReadByte));
|
|
||||||
exports.Set(String::New(env, "_i2c_write_byte_data"), Function::New(env, _i2cWriteByteData));
|
|
||||||
exports.Set(String::New(env, "_i2c_read_byte_data"), Function::New(env, _i2cReadByteData));
|
|
||||||
exports.Set(String::New(env, "_i2c_write_i2c_block_data"), Function::New(env, _i2cWriteI2cBlockData));
|
|
||||||
exports.Set(String::New(env, "_i2c_read_i2c_block_data"), Function::New(env, _i2cReadI2cBlockData));
|
|
||||||
exports.Set(String::New(env, "_i2c_read_word_data"), Function::New(env, _i2cReadWordData));
|
|
||||||
exports.Set(String::New(env, "_i2c_write_word_data"), Function::New(env, _i2cWriteWordData));
|
|
||||||
exports.Set(String::New(env, "_i2c_write_device"), Function::New(env, _i2cWriteDevice));
|
|
||||||
exports.Set(String::New(env, "_i2c_read_device"), Function::New(env, _i2cReadDevice));
|
|
||||||
return exports;
|
|
||||||
}
|
|
||||||
|
|
||||||
NODE_API_MODULE(pigpio, Init)
|
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@ocoge.club/rgpio",
|
"name": "rgpio",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
142
package-lock.json
generated
142
package-lock.json
generated
@ -9,7 +9,7 @@
|
|||||||
"version": "0.1.11",
|
"version": "0.1.11",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blockly/field-slider": "^4.0.15",
|
"@blockly/field-slider": "^4.0.16",
|
||||||
"@tensorflow-models/blazeface": "^0.0.7",
|
"@tensorflow-models/blazeface": "^0.0.7",
|
||||||
"@tensorflow-models/knn-classifier": "^1.2.4",
|
"@tensorflow-models/knn-classifier": "^1.2.4",
|
||||||
"@tensorflow-models/mobilenet": "^2.1.0",
|
"@tensorflow-models/mobilenet": "^2.1.0",
|
||||||
@ -20,24 +20,23 @@
|
|||||||
"dracula-prism": "^2.1.13",
|
"dracula-prism": "^2.1.13",
|
||||||
"js-beautify": "^1.14.7",
|
"js-beautify": "^1.14.7",
|
||||||
"node-abi": "^3.40.0",
|
"node-abi": "^3.40.0",
|
||||||
"nodemailer": "^6.9.1",
|
"nodemailer": "^6.9.2",
|
||||||
"prismjs": "^1.29.0"
|
"prismjs": "^1.29.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-forge/cli": "^6.1.1",
|
"@electron-forge/cli": "^6.1.1",
|
||||||
"@electron-forge/maker-deb": "^6.1.1",
|
"@electron-forge/maker-deb": "^6.1.1",
|
||||||
"@electron/rebuild": "^3.2.13",
|
"@electron/rebuild": "^3.2.13",
|
||||||
"electron": "^24.2.0"
|
"electron": "^24.3.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@ocoge.club/pigpio": "file:local_modules/pigpio",
|
"rgpio": "file:local_modules/rgpio"
|
||||||
"@ocoge.club/rgpio": "file:local_modules/rgpio"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@blockly/field-slider": {
|
"node_modules/@blockly/field-slider": {
|
||||||
"version": "4.0.15",
|
"version": "4.0.16",
|
||||||
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.15.tgz",
|
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.16.tgz",
|
||||||
"integrity": "sha512-8U1nzWXKMSs0g3r5GD5i1DEWutIJOdTMhQn5kjD0a0447ZlA81d9gePdQuV+puTaesFDGWPcVBvuo4FQhJ2Y5w==",
|
"integrity": "sha512-B1n48CsJdnVBHquYwGijbJizSwDqIN6N6LgI4wCeEt0i2gTSkbOb5qdMkE4znf3Fkv0cEhKghURuteJJHcj6Zg==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8.0.0"
|
"node": ">=8.0.0"
|
||||||
},
|
},
|
||||||
@ -665,40 +664,6 @@
|
|||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ocoge.club/pigpio": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"resolved": "file:local_modules/pigpio",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"dependencies": {
|
|
||||||
"bindings": "^1.5.0",
|
|
||||||
"node-addon-api": "^1.7.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@ocoge.club/pigpio/node_modules/node-addon-api": {
|
|
||||||
"version": "1.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
|
||||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"node_modules/@ocoge.club/rgpio": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"resolved": "file:local_modules/rgpio",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"dependencies": {
|
|
||||||
"bindings": "^1.5.0",
|
|
||||||
"node-addon-api": "^1.7.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@ocoge.club/rgpio/node_modules/node-addon-api": {
|
|
||||||
"version": "1.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
|
||||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"node_modules/@sindresorhus/is": {
|
"node_modules/@sindresorhus/is": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
@ -2131,9 +2096,9 @@
|
|||||||
"integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A=="
|
"integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A=="
|
||||||
},
|
},
|
||||||
"node_modules/electron": {
|
"node_modules/electron": {
|
||||||
"version": "24.2.0",
|
"version": "24.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-24.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-24.3.0.tgz",
|
||||||
"integrity": "sha512-fEYAftYqFhveniWJbEHXjNMWjooFFIuqNj/eEFJkGzycInfBJq/c4E/dew++s6s0YLubxFnjoF2qZiqapLj0gA==",
|
"integrity": "sha512-M7PpfpOzGdLeZPr2xhxXuvJeoXPEHMH40Rtv8BCGleRPolwna9BepAGc0H0F+Uz5kGKOv3xcm99fTurvXUH0nw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -4317,6 +4282,12 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/node-addon-api": {
|
||||||
|
"version": "1.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||||
|
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"node_modules/node-api-version": {
|
"node_modules/node-api-version": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",
|
||||||
@ -4466,9 +4437,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nodemailer": {
|
"node_modules/nodemailer": {
|
||||||
"version": "6.9.1",
|
"version": "6.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.2.tgz",
|
||||||
"integrity": "sha512-qHw7dOiU5UKNnQpXktdgQ1d3OFgRAekuvbJLcdG5dnEo/GtcTHRYM7+UfJARdOFU9WUQO8OiIamgWPmiSFHYAA==",
|
"integrity": "sha512-4+TYaa/e1nIxQfyw/WzNPYTEZ5OvHIDEnmjs4LPmIfccPQN+2CYKmGHjWixn/chzD3bmUTu5FMfpltizMxqzdg==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
@ -5292,6 +5263,17 @@
|
|||||||
"integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==",
|
"integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/rgpio": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "file:local_modules/rgpio",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"node-addon-api": "^1.7.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/rimraf": {
|
"node_modules/rimraf": {
|
||||||
"version": "2.7.1",
|
"version": "2.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||||
@ -6304,9 +6286,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blockly/field-slider": {
|
"@blockly/field-slider": {
|
||||||
"version": "4.0.15",
|
"version": "4.0.16",
|
||||||
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.15.tgz",
|
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.16.tgz",
|
||||||
"integrity": "sha512-8U1nzWXKMSs0g3r5GD5i1DEWutIJOdTMhQn5kjD0a0447ZlA81d9gePdQuV+puTaesFDGWPcVBvuo4FQhJ2Y5w=="
|
"integrity": "sha512-B1n48CsJdnVBHquYwGijbJizSwDqIN6N6LgI4wCeEt0i2gTSkbOb5qdMkE4znf3Fkv0cEhKghURuteJJHcj6Zg=="
|
||||||
},
|
},
|
||||||
"@electron-forge/cli": {
|
"@electron-forge/cli": {
|
||||||
"version": "6.1.1",
|
"version": "6.1.1",
|
||||||
@ -6764,38 +6746,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@ocoge.club/pigpio": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"bindings": "^1.5.0",
|
|
||||||
"node-addon-api": "^1.7.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"node-addon-api": {
|
|
||||||
"version": "1.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
|
||||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@ocoge.club/rgpio": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
|
||||||
"bindings": "^1.5.0",
|
|
||||||
"node-addon-api": "^1.7.1"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"node-addon-api": {
|
|
||||||
"version": "1.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
|
||||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@sindresorhus/is": {
|
"@sindresorhus/is": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
|
||||||
@ -7892,9 +7842,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "24.2.0",
|
"version": "24.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-24.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-24.3.0.tgz",
|
||||||
"integrity": "sha512-fEYAftYqFhveniWJbEHXjNMWjooFFIuqNj/eEFJkGzycInfBJq/c4E/dew++s6s0YLubxFnjoF2qZiqapLj0gA==",
|
"integrity": "sha512-M7PpfpOzGdLeZPr2xhxXuvJeoXPEHMH40Rtv8BCGleRPolwna9BepAGc0H0F+Uz5kGKOv3xcm99fTurvXUH0nw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@electron/get": "^2.0.0",
|
"@electron/get": "^2.0.0",
|
||||||
@ -9540,6 +9490,12 @@
|
|||||||
"semver": "^7.3.5"
|
"semver": "^7.3.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node-addon-api": {
|
||||||
|
"version": "1.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||||
|
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"node-api-version": {
|
"node-api-version": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",
|
||||||
@ -9655,9 +9611,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nodemailer": {
|
"nodemailer": {
|
||||||
"version": "6.9.1",
|
"version": "6.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.2.tgz",
|
||||||
"integrity": "sha512-qHw7dOiU5UKNnQpXktdgQ1d3OFgRAekuvbJLcdG5dnEo/GtcTHRYM7+UfJARdOFU9WUQO8OiIamgWPmiSFHYAA=="
|
"integrity": "sha512-4+TYaa/e1nIxQfyw/WzNPYTEZ5OvHIDEnmjs4LPmIfccPQN+2CYKmGHjWixn/chzD3bmUTu5FMfpltizMxqzdg=="
|
||||||
},
|
},
|
||||||
"nopt": {
|
"nopt": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
@ -10260,6 +10216,14 @@
|
|||||||
"integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==",
|
"integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"rgpio": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"node-addon-api": "^1.7.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"rimraf": {
|
"rimraf": {
|
||||||
"version": "2.7.1",
|
"version": "2.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
|
||||||
|
@ -25,10 +25,10 @@
|
|||||||
"@electron-forge/cli": "^6.1.1",
|
"@electron-forge/cli": "^6.1.1",
|
||||||
"@electron-forge/maker-deb": "^6.1.1",
|
"@electron-forge/maker-deb": "^6.1.1",
|
||||||
"@electron/rebuild": "^3.2.13",
|
"@electron/rebuild": "^3.2.13",
|
||||||
"electron": "^24.2.0"
|
"electron": "^24.3.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@blockly/field-slider": "^4.0.15",
|
"@blockly/field-slider": "^4.0.16",
|
||||||
"@tensorflow-models/blazeface": "^0.0.7",
|
"@tensorflow-models/blazeface": "^0.0.7",
|
||||||
"@tensorflow-models/knn-classifier": "^1.2.4",
|
"@tensorflow-models/knn-classifier": "^1.2.4",
|
||||||
"@tensorflow-models/mobilenet": "^2.1.0",
|
"@tensorflow-models/mobilenet": "^2.1.0",
|
||||||
@ -39,12 +39,11 @@
|
|||||||
"dracula-prism": "^2.1.13",
|
"dracula-prism": "^2.1.13",
|
||||||
"js-beautify": "^1.14.7",
|
"js-beautify": "^1.14.7",
|
||||||
"node-abi": "^3.40.0",
|
"node-abi": "^3.40.0",
|
||||||
"nodemailer": "^6.9.1",
|
"nodemailer": "^6.9.2",
|
||||||
"prismjs": "^1.29.0"
|
"prismjs": "^1.29.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@ocoge.club/pigpio": "file:local_modules/pigpio",
|
"rgpio": "file:local_modules/rgpio"
|
||||||
"@ocoge.club/rgpio": "file:local_modules/rgpio"
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"forge": {
|
"forge": {
|
||||||
|
Loading…
Reference in New Issue
Block a user