├── README.md ├── dist ├── component │ ├── ak8963.js │ ├── m5display.js │ ├── mpu6500.js │ └── mpu9250.js ├── index.js └── m5stack.js ├── docs ├── .nojekyll ├── assets │ ├── css │ │ └── main.css │ ├── images │ │ ├── icons.png │ │ ├── icons@2x.png │ │ ├── widgets.png │ │ └── widgets@2x.png │ └── js │ │ ├── main.js │ │ └── search.js ├── classes │ ├── _src_component_ak8963_.ak8963.html │ ├── _src_component_m5display_.m5display.html │ ├── _src_component_mpu6500_.mpu6500.html │ ├── _src_component_mpu9250_.mpu9250.html │ └── _src_m5stack_.m5stack.html ├── globals.html ├── index.html ├── interfaces │ ├── _node_modules_obniz_obniz_d_.connectoptions.html │ ├── _node_modules_obniz_obniz_d_.obniz.html │ ├── _node_modules_obniz_obniz_d_.obnizconstructor.html │ ├── _node_modules_obniz_obniz_d_.obnizoptions.html │ ├── _node_modules_obniz_obniz_d_.wirednamemap.html │ ├── _node_modules_obniz_obniz_d_.wirednameoptionsmap.html │ ├── _node_modules_obniz_obniz_libs_embeds_display_common_d_.displaycommon.html │ ├── _node_modules_obniz_obniz_libs_embeds_display_d_.display.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_ad_d_.ad.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_i2c_d_.i2c.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_io_d_.io.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_pwm_d_.pwm.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_spi_d_.spi.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_uart_d_.uart.html │ ├── _node_modules_obniz_obniz_libs_protocol_tcp_d_.tcp.html │ ├── _node_modules_obniz_parts_accessory_usb_index_d_.usb.html │ ├── _node_modules_obniz_parts_accessory_usb_index_d_.usboptions.html │ ├── _node_modules_obniz_parts_adconverter_hx711_index_d_.hx711.html │ ├── _node_modules_obniz_parts_adconverter_hx711_index_d_.hx711options.html │ ├── _node_modules_obniz_parts_biological_pulse08_m5stickc_s_index_d_.puls08m5stickcs.html │ ├── _node_modules_obniz_parts_biological_pulse08_m5stickc_s_index_d_.puls08m5stickcsoptions.html │ ├── _node_modules_obniz_parts_ble_2jcie_index_d_.omron_2jcie.html │ ├── _node_modules_obniz_parts_ble_2jcie_index_d_.omron_2jcie_data.html │ ├── _node_modules_obniz_parts_ble_2jcie_index_d_.omron_2jcieoptions.html │ ├── _node_modules_obniz_parts_camera_arducammini_index_d_.arducammini.html │ ├── _node_modules_obniz_parts_camera_arducammini_index_d_.arducamminioptions.html │ ├── _node_modules_obniz_parts_camera_jpegserialcam_index_d_.jpegserialcam.html │ ├── _node_modules_obniz_parts_camera_jpegserialcam_index_d_.jpegserialcamoptions.html │ ├── _node_modules_obniz_parts_colorsensor_s11059_index_d_.s11059.html │ ├── _node_modules_obniz_parts_colorsensor_s11059_index_d_.s11059options.html │ ├── _node_modules_obniz_parts_compasssensor_hmc5883l_index_d_.hmc5883l.html │ ├── _node_modules_obniz_parts_compasssensor_hmc5883l_index_d_.hmc5883loptions.html │ ├── _node_modules_obniz_parts_display_7segmentled_index_d_._7segmentled.html │ ├── _node_modules_obniz_parts_display_7segmentled_index_d_._7segmentledoptions.html │ ├── _node_modules_obniz_parts_display_7segmentled_max7219_index_d_._7segmentled_max7219.html │ ├── _node_modules_obniz_parts_display_7segmentled_max7219_index_d_._7segmentled_max7219options.html │ ├── _node_modules_obniz_parts_display_7segmentledarray_index_d_._7segmentledarray.html │ ├── _node_modules_obniz_parts_display_7segmentledarray_index_d_._7segmentledarrayoptions.html │ ├── _node_modules_obniz_parts_display_matrixled_max7219_index_d_.matrixled_max7219.html │ ├── _node_modules_obniz_parts_display_matrixled_max7219_index_d_.matrixled_max7219options.html │ ├── _node_modules_obniz_parts_display_sainsmarttft18lcd_index_d_.presetcolor.html │ ├── _node_modules_obniz_parts_display_sainsmarttft18lcd_index_d_.sainsmarttft18lcd.html │ ├── _node_modules_obniz_parts_display_sainsmarttft18lcd_index_d_.sainsmarttft18lcdoptions.html │ ├── _node_modules_obniz_parts_display_sharpmemorytft_index_d_.sharpmemorytft.html │ ├── _node_modules_obniz_parts_display_sharpmemorytft_index_d_.sharpmemorytftoptions.html │ ├── _node_modules_obniz_parts_display_st7735s_index_d_.presetcolor.html │ ├── _node_modules_obniz_parts_display_st7735s_index_d_.st7735s.html │ ├── _node_modules_obniz_parts_display_st7735s_index_d_.st7735soptions.html │ ├── _node_modules_obniz_parts_distancesensor_gp2y0a21yk0f_index_d_.gp2y0a21yk0f.html │ ├── _node_modules_obniz_parts_distancesensor_gp2y0a21yk0f_index_d_.gp2y0a21yk0foptions.html │ ├── _node_modules_obniz_parts_distancesensor_hc_sr04_index_d_.hcsr04.html │ ├── _node_modules_obniz_parts_distancesensor_hc_sr04_index_d_.hcsr04options.html │ ├── _node_modules_obniz_parts_gassensor_mq135_index_d_.mq135.html │ ├── _node_modules_obniz_parts_gassensor_mq135_index_d_.mq135options.html │ ├── _node_modules_obniz_parts_gassensor_mq2_index_d_.mq2.html │ ├── _node_modules_obniz_parts_gassensor_mq2_index_d_.mq2options.html │ ├── _node_modules_obniz_parts_gassensor_mq3_index_d_.mq3.html │ ├── _node_modules_obniz_parts_gassensor_mq3_index_d_.mq3options.html │ ├── _node_modules_obniz_parts_gassensor_mq4_index_d_.mq4.html │ ├── _node_modules_obniz_parts_gassensor_mq4_index_d_.mq4options.html │ ├── _node_modules_obniz_parts_gassensor_mq5_index_d_.mq5.html │ ├── _node_modules_obniz_parts_gassensor_mq5_index_d_.mq5options.html │ ├── _node_modules_obniz_parts_gassensor_mq6_index_d_.mq6.html │ ├── _node_modules_obniz_parts_gassensor_mq6_index_d_.mq6options.html │ ├── _node_modules_obniz_parts_gassensor_mq7_index_d_.mq7.html │ ├── _node_modules_obniz_parts_gassensor_mq7_index_d_.mq7options.html │ ├── _node_modules_obniz_parts_gassensor_mq8_index_d_.mq8.html │ ├── _node_modules_obniz_parts_gassensor_mq8_index_d_.mq8options.html │ ├── _node_modules_obniz_parts_gassensor_mq9_index_d_.mq9.html │ ├── _node_modules_obniz_parts_gassensor_mq9_index_d_.mq9options.html │ ├── _node_modules_obniz_parts_gps_gysfdmaxb_index_d_.gysfdmaxb.html │ ├── _node_modules_obniz_parts_gps_gysfdmaxb_index_d_.gysfdmaxbediteddata.html │ ├── _node_modules_obniz_parts_gps_gysfdmaxb_index_d_.gysfdmaxboptions.html │ ├── _node_modules_obniz_parts_grove_grove_3axisaccelerometer_index_d_.grove_3axisaccelerometer.html │ ├── _node_modules_obniz_parts_grove_grove_3axisaccelerometer_index_d_.grove_3axisaccelerometeroptions.html │ ├── _node_modules_obniz_parts_grove_grove_earheartrate_index_d_.grove_earheartrate.html │ ├── _node_modules_obniz_parts_grove_grove_earheartrate_index_d_.grove_earheartrateoptions.html │ ├── _node_modules_obniz_parts_grove_grove_gps_index_d_.grove_gps.html │ ├── _node_modules_obniz_parts_grove_grove_gps_index_d_.grove_gpsediteddata.html │ ├── _node_modules_obniz_parts_grove_grove_gps_index_d_.grove_gpsoptions.html │ ├── _node_modules_obniz_parts_grove_grove_mp3_index_d_.grove_mp3.html │ ├── _node_modules_obniz_parts_grove_grove_mp3_index_d_.grove_mp3options.html │ ├── _node_modules_obniz_parts_gyrosensor_enc03r_module_index_d_.enc03r_module.html │ ├── _node_modules_obniz_parts_gyrosensor_enc03r_module_index_d_.enc03r_moduleoptions.html │ ├── _node_modules_obniz_parts_i2cparts_d_.i2cpartsabstruct.html │ ├── _node_modules_obniz_parts_i2cparts_d_.i2cpartsoptions.html │ ├── _node_modules_obniz_parts_infrared_infraredled_index_d_.infraredled.html │ ├── _node_modules_obniz_parts_infrared_infraredled_index_d_.infraredledoptions.html │ ├── _node_modules_obniz_parts_infrared_irmodule_index_d_.irmodule.html │ ├── _node_modules_obniz_parts_infrared_irmodule_index_d_.irmoduleoptions.html │ ├── _node_modules_obniz_parts_infrared_irsensor_index_d_.irsensor.html │ ├── _node_modules_obniz_parts_infrared_irsensor_index_d_.irsensoroptions.html │ ├── _node_modules_obniz_parts_light_fullcolorled_index_d_.fullcolorled.html │ ├── _node_modules_obniz_parts_light_fullcolorled_index_d_.fullcolorledoptions.html │ ├── _node_modules_obniz_parts_light_led_index_d_.led.html │ ├── _node_modules_obniz_parts_light_led_index_d_.ledoptions.html │ ├── _node_modules_obniz_parts_light_ws2811_index_d_.ws2811.html │ ├── _node_modules_obniz_parts_light_ws2811_index_d_.ws2811options.html │ ├── _node_modules_obniz_parts_light_ws2812_index_d_.ws2812.html │ ├── _node_modules_obniz_parts_light_ws2812_index_d_.ws2812options.html │ ├── _node_modules_obniz_parts_light_ws2812b_index_d_.ws2812b.html │ ├── _node_modules_obniz_parts_light_ws2812b_index_d_.ws2812boptions.html │ ├── _node_modules_obniz_parts_logic_snx4hc595_index_d_.snx4hc595.html │ ├── _node_modules_obniz_parts_logic_snx4hc595_index_d_.snx4hc595options.html │ ├── _node_modules_obniz_parts_memory_24lc256_index_d_._24lc256.html │ ├── _node_modules_obniz_parts_memory_24lc256_index_d_._24lc256options.html │ ├── _node_modules_obniz_parts_movementsensor_ak8963_index_d_.ak8963.html │ ├── _node_modules_obniz_parts_movementsensor_ak8963_index_d_.ak8963options.html │ ├── _node_modules_obniz_parts_movementsensor_button_index_d_.button.html │ ├── _node_modules_obniz_parts_movementsensor_button_index_d_.buttonoptions.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhat.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhat_airwheel.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhat_doubletap.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhat_gesture.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhat_tap.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhat_touch.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhat_xyz.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.flickhatoptions.html │ ├── _node_modules_obniz_parts_movementsensor_hc_sr505_index_d_.hcsr505.html │ ├── _node_modules_obniz_parts_movementsensor_hc_sr505_index_d_.hcsr505options.html │ ├── _node_modules_obniz_parts_movementsensor_joystick_index_d_.joystick.html │ ├── _node_modules_obniz_parts_movementsensor_joystick_index_d_.joystickoptions.html │ ├── _node_modules_obniz_parts_movementsensor_kxr94_2050_index_d_.kxr94_2050.html │ ├── _node_modules_obniz_parts_movementsensor_kxr94_2050_index_d_.kxr94_2050options.html │ ├── _node_modules_obniz_parts_movementsensor_kxsc7_2050_index_d_.kxsc7_2050.html │ ├── _node_modules_obniz_parts_movementsensor_kxsc7_2050_index_d_.kxsc7_2050options.html │ ├── _node_modules_obniz_parts_movementsensor_mpu6050_index_d_.mpu6050.html │ ├── _node_modules_obniz_parts_movementsensor_mpu6050_index_d_.mpu6050options.html │ ├── _node_modules_obniz_parts_movementsensor_mpu6886_index_d_.mpu6886.html │ ├── _node_modules_obniz_parts_movementsensor_mpu6886_index_d_.mpu6886options.html │ ├── _node_modules_obniz_parts_movementsensor_mpu9250_index_d_.mpu9250.html │ ├── _node_modules_obniz_parts_movementsensor_mpu9250_index_d_.mpu9250options.html │ ├── _node_modules_obniz_parts_movementsensor_papirsvz_index_d_.papirsvz.html │ ├── _node_modules_obniz_parts_movementsensor_papirsvz_index_d_.papirsvzoptions.html │ ├── _node_modules_obniz_parts_movementsensor_potentiometer_index_d_.potentiometer.html │ ├── _node_modules_obniz_parts_movementsensor_potentiometer_index_d_.potentiometeroptions.html │ ├── _node_modules_obniz_parts_movementsensor_sh200q_index_d_.sh200q.html │ ├── _node_modules_obniz_parts_movementsensor_sh200q_index_d_.sh200q6options.html │ ├── _node_modules_obniz_parts_moving_dcmotor_index_d_.dcmotor.html │ ├── _node_modules_obniz_parts_moving_dcmotor_index_d_.dcmotoroptions.html │ ├── _node_modules_obniz_parts_moving_pca9685_index_d_.pca9685.html │ ├── _node_modules_obniz_parts_moving_pca9685_index_d_.pca9685options.html │ ├── _node_modules_obniz_parts_moving_servomotor_index_d_.servomotor.html │ ├── _node_modules_obniz_parts_moving_servomotor_index_d_.servomotoroptions.html │ ├── _node_modules_obniz_parts_moving_solenoid_index_d_.solenoid.html │ ├── _node_modules_obniz_parts_moving_solenoid_index_d_.solenoidoptions.html │ ├── _node_modules_obniz_parts_moving_steppermotor_index_d_.steppermotor.html │ ├── _node_modules_obniz_parts_moving_steppermotor_index_d_.steppermotoroptions.html │ ├── _node_modules_obniz_parts_power_axp192_index_d_.axp192.html │ ├── _node_modules_obniz_parts_power_axp192_index_d_.axp192options.html │ ├── _node_modules_obniz_parts_pressuresensor_fsr_40x_index_d_.fsr40x.html │ ├── _node_modules_obniz_parts_pressuresensor_fsr_40x_index_d_.fsr40xoptions.html │ ├── _node_modules_obniz_parts_soilsensor_sen0114_index_d_.sen0114.html │ ├── _node_modules_obniz_parts_soilsensor_sen0114_index_d_.sen0114options.html │ ├── _node_modules_obniz_parts_sound_speaker_index_d_.speaker.html │ ├── _node_modules_obniz_parts_sound_speaker_index_d_.speakeroptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_analogtemperaturesensor_d_.analogtemperaturesensor.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_analogtemperaturesensor_d_.analogtemperaturesensoroptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm35dz_index_d_.lm35dz.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm35dz_index_d_.lm35dzoptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm60_index_d_.lm60.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm60_index_d_.lm60options.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm61_index_d_.lm61.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm61_index_d_.lm61options.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lmt87_index_d_.lmt87.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lmt87_index_d_.lmt87options.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_mcp9700_index_d_.mcp9700.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_mcp9700_index_d_.mcp9700options.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_mcp9701_index_d_.mcp9701.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_mcp9701_index_d_.mcp9701options.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_s8100b_index_d_.s8100b.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_s8100b_index_d_.s8100boptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_s8120c_index_d_.s8120c.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_s8120c_index_d_.s8120coptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_adt7410_index_d_.adt7410.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_adt7410_index_d_.adt7410options.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_am2320_index_d_.am2320.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_am2320_index_d_.am2320ptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_amg8833_index_d_.amg8833.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_amg8833_index_d_.amg8833options.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_bme280_index_d_.bme280.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_bme280_index_d_.bme280options.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_d6t44l_index_d_.d6t44l.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_d6t44l_index_d_.d6t44loptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_dht12_index_d_.dht12.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_dht12_index_d_.dht12options.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_s_5851a_index_d_.s5851a.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_s_5851a_index_d_.s5851aoptions.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_sht31_index_d_.sht31.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_sht31_index_d_.sht31options.html │ ├── _node_modules_obniz_parts_temperaturesensor_spi_adt7310_index_d_.adt7310.html │ ├── _node_modules_obniz_parts_temperaturesensor_spi_adt7310_index_d_.adt7310options.html │ ├── _node_modules_obniz_parts_wireless_rn42_index_d_.rn42.html │ ├── _node_modules_obniz_parts_wireless_rn42_index_d_.rn42config.html │ ├── _node_modules_obniz_parts_wireless_rn42_index_d_.rn42options.html │ ├── _node_modules_obniz_parts_wireless_xbee_index_d_.xbee.html │ ├── _node_modules_obniz_parts_wireless_xbee_index_d_.xbeeconfig.html │ ├── _node_modules_obniz_parts_wireless_xbee_index_d_.xbeeoptions.html │ └── _src_component_mpu6500_.xyz.html └── modules │ ├── _node_modules_obniz_obniz_d_.html │ ├── _node_modules_obniz_obniz_libs_embeds_display_common_d_.html │ ├── _node_modules_obniz_obniz_libs_embeds_display_d_.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_ad_d_.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_common_d_.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_i2c_d_.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_io_d_.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_pwm_d_.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_spi_d_.html │ ├── _node_modules_obniz_obniz_libs_io_peripherals_uart_d_.html │ ├── _node_modules_obniz_obniz_libs_protocol_tcp_d_.html │ ├── _node_modules_obniz_parts_accessory_usb_index_d_.html │ ├── _node_modules_obniz_parts_adconverter_hx711_index_d_.html │ ├── _node_modules_obniz_parts_biological_pulse08_m5stickc_s_index_d_.html │ ├── _node_modules_obniz_parts_ble_2jcie_index_d_.html │ ├── _node_modules_obniz_parts_camera_arducammini_index_d_.html │ ├── _node_modules_obniz_parts_camera_jpegserialcam_index_d_.html │ ├── _node_modules_obniz_parts_colorsensor_s11059_index_d_.html │ ├── _node_modules_obniz_parts_compasssensor_hmc5883l_index_d_.html │ ├── _node_modules_obniz_parts_display_7segmentled_index_d_.html │ ├── _node_modules_obniz_parts_display_7segmentled_max7219_index_d_.html │ ├── _node_modules_obniz_parts_display_7segmentledarray_index_d_.html │ ├── _node_modules_obniz_parts_display_matrixled_max7219_index_d_.html │ ├── _node_modules_obniz_parts_display_sainsmarttft18lcd_index_d_.html │ ├── _node_modules_obniz_parts_display_sharpmemorytft_index_d_.html │ ├── _node_modules_obniz_parts_display_st7735s_index_d_.html │ ├── _node_modules_obniz_parts_distancesensor_gp2y0a21yk0f_index_d_.html │ ├── _node_modules_obniz_parts_distancesensor_hc_sr04_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq135_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq2_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq3_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq4_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq5_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq6_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq7_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq8_index_d_.html │ ├── _node_modules_obniz_parts_gassensor_mq9_index_d_.html │ ├── _node_modules_obniz_parts_gps_gysfdmaxb_index_d_.html │ ├── _node_modules_obniz_parts_grove_grove_3axisaccelerometer_index_d_.html │ ├── _node_modules_obniz_parts_grove_grove_earheartrate_index_d_.html │ ├── _node_modules_obniz_parts_grove_grove_gps_index_d_.html │ ├── _node_modules_obniz_parts_grove_grove_mp3_index_d_.html │ ├── _node_modules_obniz_parts_gyrosensor_enc03r_module_index_d_.html │ ├── _node_modules_obniz_parts_i2cparts_d_.html │ ├── _node_modules_obniz_parts_infrared_infraredled_index_d_.html │ ├── _node_modules_obniz_parts_infrared_irmodule_index_d_.html │ ├── _node_modules_obniz_parts_infrared_irsensor_index_d_.html │ ├── _node_modules_obniz_parts_light_fullcolorled_index_d_.html │ ├── _node_modules_obniz_parts_light_led_index_d_.html │ ├── _node_modules_obniz_parts_light_ws2811_index_d_.html │ ├── _node_modules_obniz_parts_light_ws2812_index_d_.html │ ├── _node_modules_obniz_parts_light_ws2812b_index_d_.html │ ├── _node_modules_obniz_parts_logic_snx4hc595_index_d_.html │ ├── _node_modules_obniz_parts_memory_24lc256_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_ak8963_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_button_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_flickhat_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_hc_sr505_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_joystick_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_kxr94_2050_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_kxsc7_2050_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_mpu6050_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_mpu6886_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_mpu9250_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_papirsvz_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_potentiometer_index_d_.html │ ├── _node_modules_obniz_parts_movementsensor_sh200q_index_d_.html │ ├── _node_modules_obniz_parts_moving_dcmotor_index_d_.html │ ├── _node_modules_obniz_parts_moving_pca9685_index_d_.html │ ├── _node_modules_obniz_parts_moving_servomotor_index_d_.html │ ├── _node_modules_obniz_parts_moving_solenoid_index_d_.html │ ├── _node_modules_obniz_parts_moving_steppermotor_index_d_.html │ ├── _node_modules_obniz_parts_power_axp192_index_d_.html │ ├── _node_modules_obniz_parts_pressuresensor_fsr_40x_index_d_.html │ ├── _node_modules_obniz_parts_soilsensor_sen0114_index_d_.html │ ├── _node_modules_obniz_parts_sound_speaker_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_analogtemperaturesensor_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm35dz_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm60_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lm61_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_lmt87_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_mcp9700_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_mcp9701_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_s8100b_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_analog_s8120c_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_adt7410_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_am2320_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_amg8833_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_bme280_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_d6t44l_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_dht12_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_s_5851a_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_i2c_sht31_index_d_.html │ ├── _node_modules_obniz_parts_temperaturesensor_spi_adt7310_index_d_.html │ ├── _node_modules_obniz_parts_wireless_rn42_index_d_.html │ ├── _node_modules_obniz_parts_wireless_xbee_index_d_.html │ ├── _src_component_ak8963_.html │ ├── _src_component_m5display_.html │ ├── _src_component_mpu6500_.html │ ├── _src_component_mpu9250_.html │ ├── _src_index_.html │ └── _src_m5stack_.html ├── examples ├── html │ ├── button │ │ └── index.html │ ├── display │ │ ├── 3d-cubes │ │ │ ├── 3d-cubes.JPG │ │ │ └── index.html │ │ ├── 3d-sphere │ │ │ └── index.html │ │ ├── browser-camera │ │ │ └── index.html │ │ ├── hello-world │ │ │ └── index.html │ │ └── youtube │ │ │ └── index.html │ ├── parts │ │ └── servo │ │ │ └── index.html │ ├── peripheral │ │ └── i2c │ │ │ └── index.html │ └── sensor │ │ ├── accel │ │ └── index.html │ │ └── gyro │ │ └── index.html └── nodejs │ ├── button │ └── index.js │ ├── display │ └── index.js │ └── sensor │ ├── accel │ └── index.js │ └── gyro │ └── index.js ├── m5stack.js ├── package-lock.json ├── package.json ├── src ├── component │ ├── ak8963.ts │ ├── m5display.ts │ ├── mpu6500.ts │ └── mpu9250.ts ├── index.ts ├── m5stack.ts └── webpack-replace │ └── obniz.js ├── tsconfig.json ├── tslint.json └── webpack.config.js /README.md: -------------------------------------------------------------------------------- 1 | # M5Stack.js 2 | 3 | 4 | ![3d cubes](examples/html/display/3d-cubes/3d-cubes.JPG) 5 | 6 | SDK for controlling [M5Stack](https://m5stack.com/) with [obnizOS](https://obniz.io). 7 | It works on both browser and nodejs. 8 | 9 | 10 | # Usage 11 | 12 | ### HTML 13 | 14 | ```html 15 | 16 | 17 | 18 | 19 | obnizOS on M5Stack 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | buttonA:
28 | 29 | 30 | 52 | 53 | 54 | ``` 55 | 56 | 57 | ### nodejs 58 | 59 | ```javascript 60 | const M5Stack = require("m5stackjs"); 61 | 62 | let m5 = new M5Stack('OBNIZ_ID_HERE'); 63 | 64 | m5.onconnect = async function () { 65 | m5.buttonA.onchange = (state) => { 66 | console.log(state); 67 | } 68 | 69 | const servo = m5.wired("ServoMotor", {signal:2}); 70 | servo.angle(90); 71 | 72 | }; 73 | 74 | ``` 75 | 76 | # Installation 77 | 78 | ### Browser 79 | Add the following script tag to your html 80 | 81 | ```html 82 | 83 | 84 | ``` 85 | 86 | ### Nodejs 87 | Install via npm 88 | 89 | ``` 90 | npm install m5stackjs 91 | ``` 92 | 93 | and import it to js file. 94 | 95 | ```nodejs 96 | const M5Stack = require('m5stackjs'); 97 | ``` 98 | 99 | 100 | # Examples 101 | 102 | Examples is [here](/examples). 103 | 104 | # Document 105 | More details, see [M5Stackjs document](https://obniz.github.io/m5stackjs/classes/_src_m5stack_.m5stack.html) or [obniz document](https://obniz.io/doc/root) -------------------------------------------------------------------------------- /dist/component/ak8963.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | Object.defineProperty(exports, "__esModule", { value: true }); 11 | class Ak8963 { 12 | constructor() { 13 | this.keys = ["gnd", "sda", "scl", "i2c"]; 14 | this.requiredKeys = []; 15 | this.address = 0x0c; 16 | this.commands = { 17 | whoami: 0x00, 18 | whoami_results: 0x48, 19 | }; 20 | } 21 | static info() { 22 | return { 23 | name: "Ak8963", 24 | }; 25 | } 26 | wired(obniz) { 27 | this.obniz = obniz; 28 | // @ts-ignore 29 | obniz.setVccGnd(null, this.params.gnd, "3v"); 30 | this.params.clock = 100000; 31 | this.params.pull = "3v"; 32 | this.params.mode = "master"; 33 | // @ts-ignore 34 | this.i2c = this.obniz.getI2CWithConfig(this.params); 35 | } 36 | whoamiWait() { 37 | return __awaiter(this, void 0, void 0, function* () { 38 | this.i2c.write(this.address, [this.commands.whoami]); 39 | return yield this.i2c.readWait(this.address, 1); 40 | }); 41 | } 42 | char2short(values) { 43 | const buffer = new ArrayBuffer(2); 44 | const dv = new DataView(buffer); 45 | dv.setUint8(0, values[0]); 46 | dv.setUint8(1, values[1]); 47 | return dv.getInt16(0, false); 48 | } 49 | } 50 | exports.Ak8963 = Ak8963; 51 | -------------------------------------------------------------------------------- /dist/component/mpu6500.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | Object.defineProperty(exports, "__esModule", { value: true }); 11 | class Mpu6500 { 12 | constructor() { 13 | this.keys = ["gnd", "sda", "scl", "i2c"]; 14 | this.requiredKeys = []; 15 | this.address = 0x68; 16 | this.commands = { 17 | whoami: 0x75, 18 | whoami_results: 0x71, 19 | int_pin_config: 0x37, 20 | accel_x_h: 0x3b, 21 | accel_x_l: 0x3c, 22 | accel_y_h: 0x3d, 23 | accel_y_l: 0x3e, 24 | accel_z_h: 0x3f, 25 | accel_z_l: 0x40, 26 | gyro_x_h: 0x43, 27 | gyro_x_l: 0x44, 28 | gyro_y_h: 0x45, 29 | gyro_y_l: 0x46, 30 | gyro_z_h: 0x47, 31 | gyro_z_l: 0x48, 32 | }; 33 | this.intPinConfigMask = { 34 | bypass_en: 0b00000010, 35 | }; 36 | this.settingParams = { 37 | accel: { 38 | so: { 39 | "2g": 16384, 40 | "4g": 8192, 41 | "8g": 4096, 42 | "16g": 2048, 43 | }, 44 | m_s2: 9.80665, 45 | g: 1, 46 | }, 47 | gyro: { 48 | so: { 49 | "250dps": 131, 50 | "500dps": 62.5, 51 | "1000dps": 1000, 52 | "2000dps": 16.4, 53 | }, 54 | deg: 1, 55 | rad: 57.295779578552, 56 | }, 57 | }; 58 | this.accel_so = "2g"; 59 | this.gyro_so = "250dps"; 60 | } 61 | static info() { 62 | return { 63 | name: "MPU6500", 64 | }; 65 | } 66 | wired(obniz) { 67 | this.obniz = obniz; 68 | // @ts-ignore 69 | obniz.setVccGnd(null, this.params.gnd, "3v"); 70 | this.params.clock = 100000; 71 | this.params.pull = "3v"; 72 | this.params.mode = "master"; 73 | // @ts-ignore 74 | this.i2c = this.obniz.getI2CWithConfig(this.params); 75 | } 76 | bypassMagnetometerWait() { 77 | return __awaiter(this, void 0, void 0, function* () { 78 | // Enable I2C bypass to access for MPU9250 magnetometer access. 79 | this.i2c.write(this.address, [this.commands.int_pin_config]); 80 | const data = yield this.i2c.readWait(this.address, 1); 81 | data[0] |= this.intPinConfigMask.bypass_en; 82 | this.i2c.write(this.address, [this.commands.int_pin_config, data[0]]); 83 | }); 84 | } 85 | whoamiWait() { 86 | return __awaiter(this, void 0, void 0, function* () { 87 | this.i2c.write(this.address, [this.commands.whoami]); 88 | return yield this.i2c.readWait(this.address, 1); 89 | }); 90 | } 91 | gyroWait() { 92 | return __awaiter(this, void 0, void 0, function* () { 93 | this.i2c.write(this.address, [this.commands.gyro_x_h]); 94 | const data = yield this.i2c.readWait(this.address, 6); 95 | const { gyro } = this.settingParams; 96 | const scale = gyro.deg / gyro.so[this.gyro_so]; 97 | return { 98 | x: this.char2short(data.slice(0, 2)) * scale, 99 | y: this.char2short(data.slice(2, 4)) * scale, 100 | z: this.char2short(data.slice(4, 6)) * scale, 101 | }; 102 | }); 103 | } 104 | accelerationWait() { 105 | return __awaiter(this, void 0, void 0, function* () { 106 | this.i2c.write(this.address, [this.commands.accel_x_h]); 107 | const data = yield this.i2c.readWait(this.address, 6); 108 | const { accel } = this.settingParams; 109 | const scale = accel.m_s2 / accel.so[this.accel_so]; 110 | return { 111 | x: this.char2short(data.slice(0, 2)) * scale, 112 | y: this.char2short(data.slice(2, 4)) * scale, 113 | z: this.char2short(data.slice(4, 6)) * scale, 114 | }; 115 | }); 116 | } 117 | char2short(values) { 118 | const buffer = new ArrayBuffer(2); 119 | const dv = new DataView(buffer); 120 | dv.setUint8(0, values[0]); 121 | dv.setUint8(1, values[1]); 122 | return dv.getInt16(0, false); 123 | } 124 | } 125 | exports.Mpu6500 = Mpu6500; 126 | -------------------------------------------------------------------------------- /dist/component/mpu9250.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | class Mpu9250 { 4 | constructor() { 5 | this.keys = ["gnd", "sda", "scl", "i2c"]; 6 | this.requiredKeys = []; 7 | } 8 | static info() { 9 | return { 10 | name: "MPU9250", 11 | }; 12 | } 13 | wired(obniz) { 14 | this.obniz = obniz; 15 | // @ts-ignore 16 | obniz.setVccGnd(null, this.params.gnd, "3v"); 17 | this.params.clock = 100000; 18 | this.params.pull = "3v"; 19 | this.params.mode = "master"; 20 | // @ts-ignore 21 | this.i2c = this.obniz.getI2CWithConfig(this.params); 22 | // @ts-ignore 23 | this.ak8963 = this.obniz.wired("Ak8963", { i2c: this.i2c }); 24 | // @ts-ignore 25 | this.mpu6500 = this.obniz.wired("MPU6500", { i2c: this.i2c }); 26 | this.mpu6500.bypassMagnetometerWait(); 27 | this.obniz.wait(500); 28 | } 29 | } 30 | exports.Mpu9250 = Mpu9250; 31 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | const m5stack_1 = require("./m5stack"); 3 | module.exports = m5stack_1.M5Stack; 4 | -------------------------------------------------------------------------------- /dist/m5stack.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | const obniz_1 = __importDefault(require("obniz")); 7 | const m5display_1 = require("./component/m5display"); 8 | const ak8963_1 = require("./component/ak8963"); 9 | const mpu6500_1 = require("./component/mpu6500"); 10 | const mpu9250_1 = require("./component/mpu9250"); 11 | // @ts-ignore 12 | obniz_1.default.PartsRegistrate(ak8963_1.Ak8963); 13 | // @ts-ignore 14 | obniz_1.default.PartsRegistrate(mpu6500_1.Mpu6500); 15 | // @ts-ignore 16 | obniz_1.default.PartsRegistrate(mpu9250_1.Mpu9250); 17 | class M5Stack extends obniz_1.default { 18 | constructor(id, options) { 19 | super(id, options); 20 | this.hasIMU = false; 21 | } 22 | _prepareComponents() { 23 | // @ts-ignore 24 | super._prepareComponents(); 25 | const i2cParams = { sda: 21, scl: 22, clock: 100000, pull: "3v", mode: "master" }; 26 | this.m5display = new m5display_1.M5Display(this); 27 | // @ts-ignore 28 | this.m5i2c = this.getI2CWithConfig(i2cParams); 29 | this.buttonA = this.wired("Button", { signal: 39 }); 30 | this.buttonB = this.wired("Button", { signal: 38 }); 31 | this.buttonC = this.wired("Button", { signal: 37 }); 32 | const keys = [ 33 | "m5display", 34 | "buttonA", 35 | "buttonB", 36 | "buttonC", 37 | ]; 38 | for (const key of keys) { 39 | // @ts-ignore 40 | this._allComponentKeys.push(key); 41 | // @ts-ignore 42 | if (this[key] && !this[key]._reset) { 43 | // @ts-ignore 44 | this[key]._reset = () => { 45 | return; 46 | }; 47 | } 48 | } 49 | } 50 | setupIMU() { 51 | // @ts-ignore 52 | this.mpu9250 = this.wired("MPU9250", { i2c: this.m5i2c }); 53 | // @ts-ignore 54 | this._allComponentKeys.push("MPU9250"); 55 | this.hasIMU = true; 56 | } 57 | gyroWait() { 58 | if (!this.hasIMU) { 59 | throw new Error("gyroWait is supported only M5stack gray. If this device is, please call setupIMU()."); 60 | } 61 | return this.mpu9250.mpu6500.gyroWait(); 62 | } 63 | accelerationWait() { 64 | if (!this.hasIMU) { 65 | throw new Error("accelerationWait is supported only M5stack gray. If this device is, please call setupIMU()."); 66 | } 67 | return this.mpu9250.mpu6500.accelerationWait(); 68 | } 69 | } 70 | exports.M5Stack = M5Stack; 71 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obniz/m5stackjs/ff075c71c9a47b892ae6a8a49e8093372df490c1/docs/.nojekyll -------------------------------------------------------------------------------- /docs/assets/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obniz/m5stackjs/ff075c71c9a47b892ae6a8a49e8093372df490c1/docs/assets/images/icons.png -------------------------------------------------------------------------------- /docs/assets/images/icons@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obniz/m5stackjs/ff075c71c9a47b892ae6a8a49e8093372df490c1/docs/assets/images/icons@2x.png -------------------------------------------------------------------------------- /docs/assets/images/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obniz/m5stackjs/ff075c71c9a47b892ae6a8a49e8093372df490c1/docs/assets/images/widgets.png -------------------------------------------------------------------------------- /docs/assets/images/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obniz/m5stackjs/ff075c71c9a47b892ae6a8a49e8093372df490c1/docs/assets/images/widgets@2x.png -------------------------------------------------------------------------------- /docs/interfaces/_node_modules_obniz_parts_i2cparts_d_.i2cpartsabstruct.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | I2cPartsAbstruct | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 63 |

Interface I2cPartsAbstruct

64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |

Hierarchy

72 |
    73 |
  • 74 | I2cPartsAbstruct 75 |
  • 76 |
77 |
78 |
79 | 105 |
106 |
107 | 167 |
168 |

Generated using TypeDoc

169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/interfaces/_node_modules_obniz_parts_memory_24lc256_index_d_._24lc256.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | _24LC256 | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 63 |

Interface _24LC256

64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |

Hierarchy

72 |
    73 |
  • 74 | _24LC256 75 |
  • 76 |
77 |
78 |
79 | 105 |
106 |
107 | 167 |
168 |

Generated using TypeDoc

169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/interfaces/_node_modules_obniz_parts_memory_24lc256_index_d_._24lc256options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | _24LC256Options | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 63 |

Interface _24LC256Options

64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |

Hierarchy

72 |
    73 |
  • 74 | _24LC256Options 75 |
  • 76 |
77 |
78 |
79 | 105 |
106 |
107 | 167 |
168 |

Generated using TypeDoc

169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/interfaces/_node_modules_obniz_parts_movementsensor_kxsc7_2050_index_d_.kxsc7_2050.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | KXSC7_2050 | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 63 |

Interface KXSC7_2050

64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |

Hierarchy

72 |
    73 |
  • 74 | KXSC7_2050 75 |
  • 76 |
77 |
78 |
79 | 105 |
106 |
107 | 167 |
168 |

Generated using TypeDoc

169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/interfaces/_node_modules_obniz_parts_movementsensor_kxsc7_2050_index_d_.kxsc7_2050options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | KXSC7_2050Options | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 63 |

Interface KXSC7_2050Options

64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |

Hierarchy

72 |
    73 |
  • 74 | KXSC7_2050Options 75 |
  • 76 |
77 |
78 |
79 | 105 |
106 |
107 | 167 |
168 |

Generated using TypeDoc

169 |
170 |
171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_embeds_display_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/embeds/display.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/embeds/display.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 | 76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_io_peripherals_ad_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/io_peripherals/ad.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/io_peripherals/ad.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 |
    74 |
  • AD
  • 75 |
76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_io_peripherals_i2c_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/io_peripherals/i2c.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/io_peripherals/i2c.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 |
    74 |
  • I2C
  • 75 |
76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_io_peripherals_io_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/io_peripherals/io.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/io_peripherals/io.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 |
    74 |
  • IO
  • 75 |
76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_io_peripherals_pwm_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/io_peripherals/pwm.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/io_peripherals/pwm.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 |
    74 |
  • PWM
  • 75 |
76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_io_peripherals_spi_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/io_peripherals/spi.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/io_peripherals/spi.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 |
    74 |
  • SPI
  • 75 |
76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_io_peripherals_uart_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/io_peripherals/uart.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/io_peripherals/uart.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 | 76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_node_modules_obniz_obniz_libs_protocol_tcp_d_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "node_modules/obniz/obniz/libs/protocol/tcp.d" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "node_modules/obniz/obniz/libs/protocol/tcp.d"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Interfaces

73 |
    74 |
  • TCP
  • 75 |
76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_src_component_ak8963_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "src/component/ak8963" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "src/component/ak8963"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Classes

73 | 76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_src_component_m5display_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "src/component/m5display" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "src/component/m5display"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Classes

73 | 76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_src_component_mpu9250_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "src/component/mpu9250" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "src/component/mpu9250"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Classes

73 | 76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /docs/modules/_src_index_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "src/index" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "src/index"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | 84 |
85 |
86 | 146 |
147 |

Generated using TypeDoc

148 |
149 |
150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /docs/modules/_src_m5stack_.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | "src/m5stack" | M5Stack.js 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 |
16 | 27 |
28 |
29 | Options 30 |
31 |
32 | All 33 |
    34 |
  • Public
  • 35 |
  • Public/Protected
  • 36 |
  • All
  • 37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 | Menu 46 |
47 |
48 |
49 |
50 |
51 |
52 | 60 |

External module "src/m5stack"

61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |

Index

69 |
70 |
71 |
72 |

Classes

73 | 76 |
77 |
78 |
79 |
80 |
81 | 100 |
101 |
102 | 162 |
163 |

Generated using TypeDoc

164 |
165 |
166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /examples/html/button/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | buttonA:
15 | buttonB:
16 | buttonC:
17 | 18 | 19 | 49 | 50 | -------------------------------------------------------------------------------- /examples/html/display/3d-cubes/3d-cubes.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/obniz/m5stackjs/ff075c71c9a47b892ae6a8a49e8093372df490c1/examples/html/display/3d-cubes/3d-cubes.JPG -------------------------------------------------------------------------------- /examples/html/display/3d-cubes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /examples/html/display/3d-sphere/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 89 | 90 | -------------------------------------------------------------------------------- /examples/html/display/browser-camera/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack with browser camera 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | Need canvas tag support. 17 | 18 | 19 | 20 | 21 | 120 | 121 | -------------------------------------------------------------------------------- /examples/html/display/hello-world/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 47 | 48 | -------------------------------------------------------------------------------- /examples/html/display/youtube/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | youtube stack 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/html/parts/servo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 23 | 24 | -------------------------------------------------------------------------------- /examples/html/peripheral/i2c/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 22 | 23 | -------------------------------------------------------------------------------- /examples/html/sensor/accel/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 |
18 | Accel 19 | X:[m/s^2]
20 | Y:[m/s^2]
21 | Z:[m/s^2] 22 |
23 | 24 | 25 | 26 | 131 | 132 | -------------------------------------------------------------------------------- /examples/html/sensor/gyro/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | obnizOS on M5Stack 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 |
18 | Gyro 19 | X:[deg/s]
20 | Y:[deg/s]
21 | Z:[deg/s] 22 |
23 | 24 | 25 | 26 | 131 | 132 | -------------------------------------------------------------------------------- /examples/nodejs/button/index.js: -------------------------------------------------------------------------------- 1 | const M5Stack = require("m5stackjs"); 2 | 3 | let m5 = new M5Stack('OBNIZ_ID_HERE'); 4 | 5 | console.log("connecting"); 6 | 7 | m5.onconnect = async ()=> { 8 | console.log("connected"); 9 | 10 | m5.buttonA.onchange = (state) => { 11 | console.log("buttonA :" + (state ? "pushed" : "released")); 12 | } 13 | 14 | m5.buttonB.onchange = (state) => { 15 | console.log("buttonB :" + (state ? "pushed" : "released")); 16 | } 17 | 18 | m5.buttonC.onchange = (state) => { 19 | console.log("buttonC :" + (state ? "pushed" : "released")); 20 | } 21 | } -------------------------------------------------------------------------------- /examples/nodejs/display/index.js: -------------------------------------------------------------------------------- 1 | const M5Stack = require("m5stackjs"); 2 | 3 | let m5 = new M5Stack('OBNIZ_ID_HERE'); 4 | 5 | console.log("connecting"); 6 | 7 | m5.onconnect = async ()=> { 8 | console.log("connected"); 9 | await m5.m5display.onWait(); 10 | m5.m5display.print("Hello,world."); 11 | m5.m5display.print("This text show from browser.","yellow"); 12 | m5.m5display.print("こんにちは"); 13 | m5.m5display.print("안녕하세요"); 14 | 15 | 16 | m5.m5display.font('Avenir',30); 17 | m5.m5display.print("Avenir"); 18 | 19 | 20 | m5.m5display.font('Noteworthy',40); 21 | m5.m5display.print("Noteworthy","#FF0000") 22 | 23 | } -------------------------------------------------------------------------------- /examples/nodejs/sensor/accel/index.js: -------------------------------------------------------------------------------- 1 | const M5Stack = require("m5stackjs"); 2 | 3 | let m5 = new M5Stack('OBNIZ_ID_HERE'); 4 | 5 | console.log("connecting"); 6 | m5.onconnect = async function () { 7 | console.log("connected"); 8 | 9 | m5.setupIMU(); 10 | while(1) { 11 | let data = await m5.accelerationWait(); 12 | Object.keys(data).map(function(key, index) { 13 | data[key] = data[key].toFixed(2); 14 | }); 15 | 16 | console.log(data); 17 | } 18 | 19 | }; 20 | -------------------------------------------------------------------------------- /examples/nodejs/sensor/gyro/index.js: -------------------------------------------------------------------------------- 1 | const M5Stack = require("m5stackjs"); 2 | 3 | let m5 = new M5Stack('OBNIZ_ID_HERE'); 4 | 5 | console.log("connecting"); 6 | m5.onconnect = async function () { 7 | console.log("connected"); 8 | 9 | m5.setupIMU(); 10 | while(1) { 11 | let data = await m5.gyroWait(); 12 | Object.keys(data).map(function(key, index) { 13 | data[key] = data[key].toFixed(2); 14 | }); 15 | 16 | console.log(data); 17 | } 18 | 19 | }; 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "m5stackjs", 3 | "version": "0.2.0", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "tsc": "tsc", 8 | "build": "npm run lint && npm run tsc && npm run webpack", 9 | "webpack": "node $NODE_DEBUG_OPTION ./node_modules/webpack/bin/webpack.js && touch ./docs/.nojekyll", 10 | "clean": "rm -rf dist", 11 | "lint": "tslint --fix 'src/**/*.ts'" 12 | }, 13 | "author": "CambrianRobotics inc,", 14 | "homepage": "https://github.com/obniz/m5stackjs", 15 | "license": "MIT", 16 | "dependencies": { 17 | "obniz": "^2.4.0" 18 | }, 19 | "devDependencies": { 20 | "@types/node": "^12.0.8", 21 | "canvas": "^2.6.0", 22 | "ts-loader": "^6.0.2", 23 | "ts-node": "^8.2.0", 24 | "tslint": "^5.17.0", 25 | "typedoc": "^0.15.0", 26 | "typedoc-webpack-plugin": "^1.1.4", 27 | "typescript": "^3.5.1", 28 | "webpack": "^4.33.0", 29 | "webpack-cli": "^3.3.4", 30 | "webpack-node-externals": "^1.7.2" 31 | }, 32 | "browser": { 33 | "obniz": "./src/webpack-replace/obniz.js" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/component/ak8963.ts: -------------------------------------------------------------------------------- 1 | import Obniz = require("obniz"); 2 | import {I2C} from "obniz/obniz/libs/io_peripherals/i2c"; 3 | 4 | export class Ak8963 { 5 | 6 | public static info() { 7 | return { 8 | name: "Ak8963", 9 | }; 10 | } 11 | public keys = ["gnd", "sda", "scl", "i2c"]; 12 | public requiredKeys = []; 13 | private obniz?: Obniz; 14 | 15 | private params: any; 16 | private i2c?: I2C; 17 | 18 | private address = 0x0c; 19 | private commands = { 20 | whoami : 0x00, 21 | whoami_results : 0x48, 22 | }; 23 | 24 | public wired(obniz: Obniz) { 25 | this.obniz = obniz; 26 | 27 | // @ts-ignore 28 | obniz.setVccGnd(null, this.params.gnd, "3v"); 29 | 30 | this.params.clock = 100000; 31 | this.params.pull = "3v"; 32 | this.params.mode = "master"; 33 | 34 | // @ts-ignore 35 | this.i2c = this.obniz.getI2CWithConfig(this.params); 36 | } 37 | 38 | public async whoamiWait() { 39 | this.i2c!.write(this.address, [this.commands.whoami]); 40 | return await this.i2c!.readWait(this.address, 1); 41 | } 42 | 43 | private char2short(values: [number, number]): number { 44 | const buffer = new ArrayBuffer(2); 45 | const dv = new DataView(buffer); 46 | dv.setUint8(0, values[0]); 47 | dv.setUint8(1, values[1]); 48 | return dv.getInt16(0, false ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/component/mpu6500.ts: -------------------------------------------------------------------------------- 1 | import Obniz = require("obniz"); 2 | import {I2C} from "obniz/obniz/libs/io_peripherals/i2c"; 3 | 4 | export type accelScale = "2g" | "4g" | "8g" | "16g"; 5 | export type gyroScale = "250dps" | "500dps" | "1000dps" | "2000dps"; 6 | export interface Xyz {x: number; y: number; z: number; } 7 | 8 | export class Mpu6500 { 9 | 10 | public static info() { 11 | return { 12 | name: "MPU6500", 13 | }; 14 | } 15 | public keys = ["gnd", "sda", "scl", "i2c"]; 16 | public requiredKeys = []; 17 | private obniz?: Obniz; 18 | 19 | private params: any; 20 | private i2c?: I2C; 21 | 22 | private address = 0x68; 23 | 24 | private commands = { 25 | whoami : 0x75, 26 | whoami_results : 0x71, 27 | 28 | int_pin_config : 0x37, 29 | 30 | accel_x_h : 0x3b, 31 | accel_x_l : 0x3c, 32 | accel_y_h : 0x3d, 33 | accel_y_l : 0x3e, 34 | accel_z_h : 0x3f, 35 | accel_z_l : 0x40, 36 | 37 | gyro_x_h: 0x43, 38 | gyro_x_l: 0x44, 39 | gyro_y_h: 0x45, 40 | gyro_y_l: 0x46, 41 | gyro_z_h: 0x47, 42 | gyro_z_l: 0x48, 43 | 44 | }; 45 | 46 | private intPinConfigMask = { 47 | bypass_en : 0b00000010, 48 | }; 49 | 50 | private settingParams = { 51 | accel : { 52 | so : { 53 | "2g" : 16384, // 1 / 16384 ie. 0.061 mg / digit 54 | "4g" : 8192, // 1 / 8192 ie. 0.122 mg / digit 55 | "8g" : 4096, // 1 / 4096 ie. 0.244 mg / digit 56 | "16g" : 2048, // 1 / 2048 ie. 0.488 mg / digit 57 | }, 58 | m_s2 : 9.80665, 59 | g : 1, 60 | }, 61 | gyro : { 62 | so : { 63 | "250dps" : 131, 64 | "500dps" : 62.5, 65 | "1000dps" : 1000, 66 | "2000dps" : 16.4, 67 | }, 68 | deg : 1, 69 | rad : 57.295779578552, // 1 rad/s is 57.295779578552 deg/s 70 | }, 71 | }; 72 | 73 | private accel_so: accelScale = "2g"; 74 | private gyro_so: gyroScale = "250dps"; 75 | 76 | public wired(obniz: Obniz) { 77 | this.obniz = obniz; 78 | 79 | // @ts-ignore 80 | obniz.setVccGnd(null, this.params.gnd, "3v"); 81 | 82 | this.params.clock = 100000; 83 | this.params.pull = "3v"; 84 | this.params.mode = "master"; 85 | 86 | // @ts-ignore 87 | this.i2c = this.obniz.getI2CWithConfig(this.params); 88 | 89 | } 90 | 91 | public async bypassMagnetometerWait() { 92 | // Enable I2C bypass to access for MPU9250 magnetometer access. 93 | this.i2c!.write(this.address, [this.commands.int_pin_config]); 94 | const data = await this.i2c!.readWait(this.address, 1); 95 | 96 | data[0] |= this.intPinConfigMask.bypass_en; 97 | 98 | this.i2c!.write(this.address, [this.commands.int_pin_config, data[0]]); 99 | } 100 | 101 | public async whoamiWait() { 102 | this.i2c!.write(this.address, [this.commands.whoami]); 103 | return await this.i2c!.readWait(this.address, 1); 104 | } 105 | 106 | public async gyroWait(): Promise { 107 | this.i2c!.write(this.address, [this.commands.gyro_x_h]); 108 | const data = await this.i2c!.readWait(this.address, 6) as number[]; 109 | const {gyro} = this.settingParams; 110 | const scale = gyro.deg / gyro.so[this.gyro_so]; 111 | 112 | return { 113 | x : this.char2short(data.slice(0, 2) as [number, number]) * scale, 114 | y : this.char2short(data.slice(2, 4) as [number, number]) * scale, 115 | z : this.char2short(data.slice(4, 6) as [number, number]) * scale, 116 | }; 117 | 118 | } 119 | 120 | public async accelerationWait(): Promise { 121 | this.i2c!.write(this.address, [this.commands.accel_x_h]); 122 | const data = await this.i2c!.readWait(this.address, 6) as number[]; 123 | 124 | const {accel} = this.settingParams; 125 | const scale = accel.m_s2 / accel.so[this.accel_so]; 126 | 127 | return { 128 | x : this.char2short(data.slice(0, 2) as [number, number]) * scale, 129 | y : this.char2short(data.slice(2, 4) as [number, number]) * scale, 130 | z : this.char2short(data.slice(4, 6) as [number, number]) * scale, 131 | }; 132 | 133 | } 134 | 135 | private char2short(values: [number, number]): number { 136 | const buffer = new ArrayBuffer(2); 137 | const dv = new DataView(buffer); 138 | dv.setUint8(0, values[0]); 139 | dv.setUint8(1, values[1]); 140 | return dv.getInt16(0, false ); 141 | } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /src/component/mpu9250.ts: -------------------------------------------------------------------------------- 1 | import Obniz = require("obniz"); 2 | import {I2C} from "obniz/obniz/libs/io_peripherals/i2c"; 3 | import {Ak8963} from "./ak8963"; 4 | import {Mpu6500} from "./mpu6500"; 5 | 6 | export class Mpu9250 { 7 | 8 | public static info() { 9 | return { 10 | name: "MPU9250", 11 | }; 12 | } 13 | public keys = ["gnd", "sda", "scl", "i2c"]; 14 | public requiredKeys = []; 15 | public mpu6500?: Mpu6500; 16 | public ak8963?: Ak8963; 17 | private obniz?: Obniz; 18 | 19 | private params: any; 20 | private i2c?: I2C; 21 | 22 | public wired(obniz: Obniz) { 23 | this.obniz = obniz; 24 | 25 | // @ts-ignore 26 | obniz.setVccGnd(null, this.params.gnd, "3v"); 27 | 28 | this.params.clock = 100000; 29 | this.params.pull = "3v"; 30 | this.params.mode = "master"; 31 | 32 | // @ts-ignore 33 | this.i2c = this.obniz.getI2CWithConfig(this.params); 34 | 35 | // @ts-ignore 36 | this.ak8963 = this.obniz.wired("Ak8963", {i2c: this.i2c}); 37 | 38 | // @ts-ignore 39 | this.mpu6500 = this.obniz.wired("MPU6500", {i2c: this.i2c}); 40 | this.mpu6500!.bypassMagnetometerWait(); 41 | 42 | this.obniz.wait(500); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | 2 | import {M5Stack} from "./m5stack"; 3 | 4 | export = M5Stack; 5 | -------------------------------------------------------------------------------- /src/m5stack.ts: -------------------------------------------------------------------------------- 1 | import Obniz from "obniz"; 2 | 3 | import {Button} from "obniz/parts/MovementSensor/Button"; 4 | import {M5Display} from "./component/m5display"; 5 | 6 | import {I2C} from "obniz/obniz/libs/io_peripherals/i2c"; 7 | import {IO} from "obniz/obniz/libs/io_peripherals/io"; 8 | import {Ak8963} from "./component/ak8963"; 9 | import {Mpu6500, Xyz} from "./component/mpu6500"; 10 | import {Mpu9250} from "./component/mpu9250"; 11 | 12 | // @ts-ignore 13 | Obniz.PartsRegistrate(Ak8963); 14 | // @ts-ignore 15 | Obniz.PartsRegistrate(Mpu6500); 16 | // @ts-ignore 17 | Obniz.PartsRegistrate(Mpu9250); 18 | 19 | export class M5Stack extends Obniz { 20 | 21 | public m5display?: M5Display; 22 | public buttonA?: Button; 23 | public buttonB?: Button; 24 | public buttonC?: Button; 25 | 26 | // auto assign 27 | public io12?: IO; 28 | public io13?: IO; 29 | public io14?: IO; 30 | public io15?: IO; 31 | public io16?: IO; 32 | public io17?: IO; 33 | public io18?: IO; 34 | public io19?: IO; 35 | public io21?: IO; 36 | public io22?: IO; 37 | public io23?: IO; 38 | public io25?: IO; 39 | public io26?: IO; 40 | public io27?: IO; 41 | public io32?: IO; 42 | public io33?: IO; 43 | public io34?: IO; 44 | public io35?: IO; 45 | public io36?: IO; 46 | public io39?: IO; 47 | 48 | public m5i2c?: I2C; 49 | private mpu9250?: Mpu9250; 50 | private hasIMU: boolean = false; 51 | 52 | constructor(id: string, options?: any) { 53 | super(id, options); 54 | 55 | } 56 | 57 | public _prepareComponents() { 58 | 59 | // @ts-ignore 60 | super._prepareComponents(); 61 | 62 | const i2cParams = {sda: 21, scl: 22, clock: 100000, pull: "3v", mode: "master"}; 63 | this.m5display = new M5Display(this); 64 | 65 | // @ts-ignore 66 | this.m5i2c = this.getI2CWithConfig(i2cParams); 67 | 68 | this.buttonA = this.wired("Button", {signal: 39}); 69 | this.buttonB = this.wired("Button", {signal: 38}); 70 | this.buttonC = this.wired("Button", {signal: 37}); 71 | 72 | const keys = [ 73 | "m5display", 74 | "buttonA", 75 | "buttonB", 76 | "buttonC", 77 | ]; 78 | 79 | for (const key of keys) { 80 | // @ts-ignore 81 | this._allComponentKeys.push(key); 82 | 83 | // @ts-ignore 84 | if (this[key] && !this[key]._reset) { 85 | 86 | // @ts-ignore 87 | this[key]._reset = () => { 88 | return; 89 | }; 90 | } 91 | } 92 | 93 | } 94 | 95 | public setupIMU() { 96 | // @ts-ignore 97 | this.mpu9250 = this.wired("MPU9250", {i2c: this.m5i2c}); 98 | // @ts-ignore 99 | this._allComponentKeys.push("MPU9250"); 100 | this.hasIMU = true; 101 | } 102 | 103 | public gyroWait(): Promise { 104 | if (!this.hasIMU) { 105 | throw new Error("gyroWait is supported only M5stack gray. If this device is, please call setupIMU()."); 106 | } 107 | return this.mpu9250!.mpu6500!.gyroWait(); 108 | } 109 | 110 | public accelerationWait(): Promise { 111 | if (!this.hasIMU) { 112 | throw new Error( 113 | "accelerationWait is supported only M5stack gray. If this device is, please call setupIMU().", 114 | ); 115 | } 116 | return this.mpu9250!.mpu6500!.accelerationWait(); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/webpack-replace/obniz.js: -------------------------------------------------------------------------------- 1 | 2 | let obniz; 3 | if (typeof Obniz !== "undefined") { 4 | obniz = Obniz; 5 | } else { 6 | obniz = window.Obniz; 7 | } 8 | 9 | module.exports=obniz; 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "outDir": "./dist", 6 | "strict": true, 7 | "esModuleInterop": true 8 | }, 9 | "include": [ 10 | "./src/**/*.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": {}, 7 | "rules": { 8 | "no-console": [ 9 | false 10 | ], 11 | "interface-name": [false], 12 | "no-bitwise": [false], 13 | "variable-name": false, 14 | "object-literal-sort-keys" : false, 15 | "max-classes-per-file" : false 16 | }, 17 | "rulesDirectory": [], 18 | "linterOptions": { 19 | "exclude": [ 20 | "src/webpack-replace/*.js" 21 | ] 22 | } 23 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const nodeExternals = require("webpack-node-externals"); 3 | const TypedocWebpackPlugin = require("typedoc-webpack-plugin"); 4 | 5 | module.exports = { 6 | // モード値を production に設定すると最適化された状態で、 7 | // development に設定するとソースマップ有効でJSファイルが出力される 8 | mode: "development", // "production" | "development" | "none" 9 | 10 | // メインとなるJavaScriptファイル(エントリーポイント) 11 | entry: "./src/index.ts", 12 | 13 | output: { 14 | path: path.join(__dirname), 15 | filename: "m5stack.js", 16 | pathinfo: false, 17 | library: "M5Stack", 18 | }, 19 | devtool: "none", 20 | 21 | module: { 22 | rules: [{ 23 | // 拡張子 .ts の場合 24 | test: /\.ts$/, 25 | // TypeScript をコンパイルする 26 | use: "ts-loader", 27 | }], 28 | }, 29 | // import 文で .ts ファイルを解決するため 30 | resolve: { 31 | modules: [ 32 | "node_modules", // node_modules 内も対象とする 33 | ], 34 | extensions: [ 35 | ".ts", 36 | ".js", // node_modulesのライブラリ読み込みに必要 37 | ], 38 | }, 39 | externals: [ 40 | nodeExternals({ 41 | modulesFromFile: { 42 | include: ["devDependencies"], 43 | }, 44 | }), 45 | ], 46 | plugins: [ 47 | new TypedocWebpackPlugin({ 48 | out: "./docs", 49 | mode : "modules", 50 | tsconfig : "./tsconfig.json", 51 | name : "M5Stack.js", 52 | exclude : ["**/node_modules/!(obniz)/**/*.*", "**/node_modules/obniz/**/node_modules/**/*.*"], 53 | ignoreCompilerErrors : true, 54 | includeDeclarations : true, 55 | readme : "./README.md" 56 | }), 57 | ], 58 | }; 59 | --------------------------------------------------------------------------------