code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/interrupt_char.h
C
apache-2.0
1,459
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2015 Daniel Campora * 2018 Tobias Badertscher * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation fil...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/mpirq.c
C
apache-2.0
5,257
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the So...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/mpirq.h
C
apache-2.0
3,022
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * i...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/pyexec.c
C
apache-2.0
26,617
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * i...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/pyexec.h
C
apache-2.0
2,300
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2018 Ayke van Laethem * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the ...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/semihosting.c
C
apache-2.0
4,611
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2018 Ayke van Laethem * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the ...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/semihosting.h
C
apache-2.0
2,183
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2021 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the ...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/stdout_helpers.c
C
apache-2.0
2,288
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013-2019 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/runtime/sys_stdio_mphal.c
C
apache-2.0
6,119
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/timeutils/timeutils.c
C
apache-2.0
6,948
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/timeutils/timeutils.h
C
apache-2.0
4,637
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2017 Linaro Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the So...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/upytesthelper/upytesthelper.c
C
apache-2.0
4,492
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2017 Linaro Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the So...
YifuLiu/AliOS-Things
components/py_engine/engine/shared/upytesthelper/upytesthelper.h
C
apache-2.0
1,609
#!/usr/bin/env python3 """ This is a middle-processor for MicroPython source files. It takes the output of the C preprocessor, has the option to change it, then feeds this into the C compiler. It currently has the ability to reorder static hash tables so they are actually hashed, resulting in faster lookup times at ...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/cc1
Python
apache-2.0
8,667
#!/bin/bash if which nproc > /dev/null; then MAKEOPTS="-j$(nproc)" else MAKEOPTS="-j$(sysctl -n hw.ncpu)" fi ######################################################################################## # general helper functions function ci_gcc_arm_setup { sudo apt-get install gcc-arm-none-eabi libnewlib-arm...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/ci.sh
Shell
apache-2.0
20,268
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2020 Damien P. George # Copyright (c) 2020 Jim Mussared # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated document...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/codeformat.py
Python
apache-2.0
6,320
#!/bin/sh # # This script generates statistics (build size, speed) for successive # revisions of the code. It checks out git commits one an a time, compiles # various ports to determine their size, and runs pystone on the unix port. # Results are collected in the output file. # # Note: you will need to copy this file ...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/codestats.sh
Shell
apache-2.0
5,304
# Reads in a text file, and performs the necessary escapes so that it # can be #included as a static string like: # static const char string_from_textfile[] = # #include "build/textfile.h" # ; # This script simply prints the escaped string straight to stdout from __future__ import print_function import sys ...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/file2h.py
Python
apache-2.0
1,126
#!/bin/sh echo "MicroPython change log" for t in $(git tag | grep -v v1.0-rc1 | sort -rV); do echo '' echo '========' echo '' git show -s --format=%cD `git rev-list $t --max-count=1` echo '' git tag -l $t -n9999 done
YifuLiu/AliOS-Things
components/py_engine/engine/tools/gen-changelog.sh
Shell
apache-2.0
243
# This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2016 Rami Ali # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without res...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/gen-cpydiff.py
Python
apache-2.0
8,890
""" Generate documentation for pyboard API from C files. """ import os import argparse import re import markdown # given a list of (name,regex) pairs, find the first one that matches the given line def re_match_first(regexs, line): for name, regex in regexs: match = re.match(regex, line) if match:...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/gendoc.py
Python
apache-2.0
17,076
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2014-2019 Damien P. George # Copyright (c) 2017 Paul Sokolovsky # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated ...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/haasboard.py
Python
apache-2.0
26,216
# Reads the USB VID and PID from the file specified by sys.argv[1] and then # inserts those values into the template file specified by sys.argv[2], # printing the result to stdout from __future__ import print_function import sys import re import string config_prefix = "MICROPY_HW_USB_" needed_keys = ("USB_PID_CDC_MS...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/insert-usb-ids.py
Python
apache-2.0
1,249
#!/usr/bin/env python # # Create frozen modules structure for MicroPython. # # Usage: # # Have a directory with modules to be frozen (only modules, not packages # supported so far): # # frozen/foo.py # frozen/bar.py # # Run script, passing path to the directory above: # # ./make-frozen.py frozen > frozen.c # # Include ...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/make-frozen.py
Python
apache-2.0
2,291
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2019 Damien P. George # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/makemanifest.py
Python
apache-2.0
12,921
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2020 Damien P. George # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/metrics.py
Python
apache-2.0
7,146
#!/usr/bin/env python3 import sys from mpremote import main sys.exit(main.main())
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpremote/mpremote.py
Python
apache-2.0
84
# empty
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpremote/mpremote/__init__.py
Python
apache-2.0
8
import sys, time try: import select, termios except ImportError: termios = None select = None import msvcrt, signal class ConsolePosix: def __init__(self): self.infd = sys.stdin.fileno() self.infile = sys.stdin.buffer.raw self.outfile = sys.stdout.buffer.raw self.o...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpremote/mpremote/console.py
Python
apache-2.0
5,125
""" MicroPython Remote - Interaction and automation tool for MicroPython MIT license; Copyright (c) 2019-2021 Damien P. George This program provides a set of utilities to interact with and automate a MicroPython device over a serial connection. Commands supported are: mpremote -- auto-det...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpremote/mpremote/main.py
Python
apache-2.0
15,680
import io, os, re, serial, struct, time from errno import EPERM from .console import VT_ENABLED try: from .pyboard import Pyboard, PyboardError, stdout_write_bytes, filesystem_command except ImportError: import sys sys.path.append(os.path.dirname(__file__) + "/../..") from pyboard import Pyboard, Pybo...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpremote/mpremote/pyboardextended.py
Python
apache-2.0
16,259
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2016-2019 Damien P. George # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"),...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpy-tool.py
Python
apache-2.0
36,613
#!/usr/bin/env python3 # # This tool converts binary resource files passed on the command line # into a Python source file containing data from these files, which can # be accessed using standard pkg_resources.resource_stream() function # from micropython-lib: # https://github.com/micropython/micropython-lib/tree/maste...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpy_bin2res.py
Python
apache-2.0
497
#!/usr/bin/env python3 import argparse import os import os.path argparser = argparse.ArgumentParser(description="Compile all .py files to .mpy recursively") argparser.add_argument("-o", "--out", help="output directory (default: input dir)") argparser.add_argument("--target", help="select MicroPython target config") ar...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpy_cross_all.py
Python
apache-2.0
1,364
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2019 Damien P. George # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/mpy_ld.py
Python
apache-2.0
36,566
#!/usr/bin/env python3 # # This file is part of the MicroPython project, http://micropython.org/ # # The MIT License (MIT) # # Copyright (c) 2014-2021 Damien P. George # Copyright (c) 2017 Paul Sokolovsky # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated ...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/pyboard.py
Python
apache-2.0
26,157
#!/usr/bin/env python # This file is part of the OpenMV project. # Copyright (c) 2013/2014 Ibrahim Abdelkader <i.abdalkader@gmail.com> # This work is licensed under the MIT license, see the file LICENSE for # details. """This module implements enough functionality to program the STM32F4xx over DFU, without requiring d...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/pydfu.py
Python
apache-2.0
20,109
#!/usr/bin/env python3 import os, sys from glob import glob from re import sub import argparse def escape(s): s = s.decode() lookup = { "\0": "\\0", "\t": "\\t", "\n": '\\n"\n"', "\r": "\\r", "\\": "\\\\", '"': '\\"', } return '""\n"{}"'.format("".join(...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/tinytest-codegen.py
Python
apache-2.0
4,224
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Add by HaaS # version = 1.1.1 import os, sys, re, codecs, time, json import argparse import inspect from ymodemfile import YModemfile import logging logging.basicConfig(level=logging.INFO, format='%(filename)s[line:%(lineno)d]: %(message)s') try:...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/transymodem.py
Python
apache-2.0
11,942
#!/usr/bin/env python3 # Microsoft UF2 # # The MIT License (MIT) # # Copyright (c) Microsoft Corporation # # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without re...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/uf2conv.py
Python
apache-2.0
10,694
# # upip - Package manager for MicroPython # # Copyright (c) 2015-2018 Paul Sokolovsky # # Licensed under the MIT license. # import sys import gc import uos as os import uerrno as errno import ujson as json import uzlib import upip_utarfile as tarfile gc.collect() debug = False index_urls = ["https://micropython.org...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/upip.py
Python
apache-2.0
8,673
import uctypes # http://www.gnu.org/software/tar/manual/html_node/Standard.html TAR_HEADER = { "name": (uctypes.ARRAY | 0, uctypes.UINT8 | 100), "size": (uctypes.ARRAY | 124, uctypes.UINT8 | 11), } DIRTYPE = "dir" REGTYPE = "file" def roundup(val, align): return (val + align - 1) & ~(align - 1) class ...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/upip_utarfile.py
Python
apache-2.0
2,371
#!/usr/bin/env python3 import re import subprocess import sys verbosity = 0 # Show what's going on, 0 1 or 2. suggestions = 1 # Set to 0 to not include lengthy suggestions in error messages. def verbose(*args): if verbosity: print(*args) def very_verbose(*args): if verbosity > 1: print(*...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/verifygitlog.py
Python
apache-2.0
3,756
#! /usr/bin/env python # -*- coding: utf-8 -*- # Add by HaaS # version = 1.1.1 """ MIT License Copyright (c) 2018 Alex Woo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, in...
YifuLiu/AliOS-Things
components/py_engine/engine/tools/ymodemfile.py
Python
apache-2.0
19,883
""" Copyright (C) 2015-2020 Alibaba Group Holding Limited The driver for AP3216C chip, The AP3216C is an integrated ALS & PS module that includes a digital ambient light sensor [ALS], a proximity sensor [PS], and an IR LED in a single package. """ from micropython import const from driver import I2C from utime import ...
YifuLiu/AliOS-Things
components/py_engine/framework/ap3216c.py
Python
apache-2.0
12,470
# -*- coding: UTF-8 -*- import _linkkit as _lk import ujson """ 阿里云物联网平台提供安全可靠的设备连接通信能力,支持设备数据采集上云,规则引擎流转数据和云端数据下发设备端。此外,也提供方便快捷的设备管理能力,支持物模型定义,数据结构化存储,和远程调试、监控、运维。 基于iot模块可以简单快速的使用阿里云物联网平台能力。 iot模块的主要实现是一个Device 类,通过它的构造函数获取device实例,就可以轻松设置相关回调函数和调用相关方法。阿里云物联网平台中涉及三个基本概念如下: - 属性(prop) 云端/设备端数据互通的通道,云端通过改变pr...
YifuLiu/AliOS-Things
components/py_engine/framework/iot.py
Python
apache-2.0
10,913
# -*- coding: UTF-8 -*- """ The driver for mpu6050 chip, it is a temperature and humidity sensor. """ from micropython import const from driver import I2C from utime import sleep_ms import math MPU_SELF_TESTX_REG = const(0X0D) #自检寄存器X MPU_SELF_TESTY_REG = const(0X0E) #自检寄存器Y MPU_SELF_TESTZ_REG = const(0X0F) #自检...
YifuLiu/AliOS-Things
components/py_engine/framework/mpu6050.py
Python
apache-2.0
10,046
# -*- coding: UTF-8 -*- import netmgr as nm import time _wifi_connected = False def singleton(cls, *args, **kw): instances = {} def getinstance(): if cls not in instances: instances[cls] = cls(*args, **kw) nm.init() return instances[cls] return getinstance def _o...
YifuLiu/AliOS-Things
components/py_engine/framework/network.py
Python
apache-2.0
4,101
# -*- coding: UTF-8 -*- """ The driver for qmc5883 chip """ from driver import I2C from utime import sleep_ms import math QMC5883L_ADDR = 0x0D; x_max = 0; x_min = 0; z_min = 0; y_max = 0; y_min = 0; z_max = 0; addr = 0; mode = 0; rate = 0; g_range = 0; oversampling = 0; INT16_MIN = (-32767-1) INT16_MAX = 32767 # ...
YifuLiu/AliOS-Things
components/py_engine/framework/qmc5883.py
Python
apache-2.0
8,651
from micropython import const import utime import framebuf from driver import SPI from driver import GPIO # register definitions SET_SCAN_DIR = const(0xc0) LOW_COLUMN_ADDRESS = const(0x00) HIGH_COLUMN_ADDRESS = const(0x10) SET_PAGE_ADDRESS = const(0xB0) SET_CONTRAST = const(0x81) SET_ENTIRE_ON = const(0xa4) SET_NORM_I...
YifuLiu/AliOS-Things
components/py_engine/framework/sh1106.py
Python
apache-2.0
7,928
# -*- coding: UTF-8 -*- """ The driver for Si7006 chip, it is a temperature and humidity sensor. """ from driver import I2C from utime import sleep_ms # The register address in Si7006 controller. Si7006_MEAS_REL_HUMIDITY_MASTER_MODE = 0xE5 Si7006_MEAS_REL_HUMIDITY_NO_MASTER_MODE = 0xF5 Si7006_MEAS_TEMP_MASTER_MO...
YifuLiu/AliOS-Things
components/py_engine/framework/si7006.py
Python
apache-2.0
3,267
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ''' @File : speech_utils.py @Description: file description @Date : 2021/05/17 11:43:06 @Author : guoliang.wgl @version : 1.0 ''' import math import http import json import time from audio import Player,Snd import uos toneDir = "/sdcard/re...
YifuLiu/AliOS-Things
components/py_engine/framework/speech_utils.py
Python
apache-2.0
7,047
# -*- coding: UTF-8 -*- """ The driver for spl06 chip, it is a temperature and humidity sensor. """ from driver import I2C from utime import sleep_ms import math EEPROM_CHIP_ADDRESS = 0x77; class spl06Error(Exception): def __init__(self, value=0, msg="spl06 common error"): self.value = value sel...
YifuLiu/AliOS-Things
components/py_engine/framework/spl06.py
Python
apache-2.0
12,412
""" Copyright (c) 2020, 2021 Russ Hughes This file incorporates work covered by the following copyright and permission notice and is licensed under the same terms: The MIT License (MIT) Copyright (c) 2019 Ivan Belokobylskiy Permission is hereby granted, free of charge, to any person obtaining a copy of this softwar...
YifuLiu/AliOS-Things
components/py_engine/framework/st7789py.py
Python
apache-2.0
36,749
import time from umqtt.robust import MQTTClient def sub_cb(topic, msg): print((topic, msg)) c = MQTTClient("umqtt_client", "localhost") # Print diagnostic messages when retries/reconnects happens c.DEBUG = True c.set_callback(sub_cb) # Connect to server, requesting not to clean session for this # client. If the...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.robust/example_sub_robust.py
Python
apache-2.0
1,615
import sys # Remove current dir from sys.path, otherwise setuptools will peek up our # module instead of system's. sys.path.pop(0) from setuptools import setup sys.path.append("..") import sdist_upip setup( name="micropython-umqtt.robust", version="1.0.1", description='Lightweight MQTT client for MicroPy...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.robust/setup.py
Python
apache-2.0
719
import utime from . import simple class MQTTClient(simple.MQTTClient): DELAY = 2 DEBUG = False def delay(self, i): utime.sleep(self.DELAY) def log(self, in_reconnect, e): if self.DEBUG: if in_reconnect: print("mqtt reconnect: %r" % e) else: ...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.robust/umqtt/robust.py
Python
apache-2.0
1,046
from umqtt.simple import MQTTClient # Test reception e.g. with: # mosquitto_sub -t foo_topic def main(server="localhost"): c = MQTTClient("umqtt_client", server) c.connect() c.publish(b"foo_topic", b"hello") c.disconnect() if __name__ == "__main__": main()
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.simple/example_pub.py
Python
apache-2.0
282
import time import ubinascii import machine from umqtt.simple import MQTTClient from machine import Pin # Many ESP8266 boards have active-low "flash" button on GPIO0. button = Pin(0, Pin.IN) # Default MQTT server to connect to SERVER = "192.168.1.35" CLIENT_ID = ubinascii.hexlify(machine.unique_id()) TOPIC = b"led" ...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.simple/example_pub_button.py
Python
apache-2.0
706
import time from umqtt.simple import MQTTClient # Publish test messages e.g. with: # mosquitto_pub -t foo_topic -m hello # Received messages from subscriptions will be delivered to this callback def sub_cb(topic, msg): print((topic, msg)) def main(server="localhost"): c = MQTTClient("umqtt_client", server) ...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.simple/example_sub.py
Python
apache-2.0
796
from umqtt.simple import MQTTClient from machine import Pin import ubinascii import machine import micropython # ESP8266 ESP-12 modules have blue, active-low LED on GPIO2, replace # with something else if needed. led = Pin(2, Pin.OUT, value=1) # Default MQTT server to connect to SERVER = "192.168.1.35" CLIENT_ID = u...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.simple/example_sub_led.py
Python
apache-2.0
1,135
import sys # Remove current dir from sys.path, otherwise setuptools will peek up our # module instead of system's. sys.path.pop(0) from setuptools import setup sys.path.append("..") import sdist_upip setup( name="micropython-umqtt.simple", version="1.3.4", description="Lightweight MQTT client for MicroPy...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.simple/setup.py
Python
apache-2.0
700
import usocket as socket import ustruct as struct from ubinascii import hexlify class MQTTException(Exception): pass class MQTTClient: def __init__( self, client_id, server, port=0, user=None, password=None, keepalive=0, ssl=False, ssl_...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/umqtt.simple/umqtt/simple.py
Python
apache-2.0
6,479
all: # This target prepares snapshot of all dependency modules, for # self-contained install deps: upip_gzip.py upip_utarfile.py upip_gzip.py: ../gzip/gzip.py cp $^ $@ upip_utarfile.py: ../utarfile/utarfile.py cp $^ $@ clean: rm upip_*.py
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/upip/Makefile
Makefile
apache-2.0
245
# This script performs bootstrap installation of upip package manager from PyPI # All the other packages can be installed using it. if [ -z "$TMPDIR" ]; then cd /tmp else cd $TMPDIR fi # Remove any stale old version rm -rf micropython-upip-* wget -nd -rH -l1 -D files.pythonhosted.org https://pypi.org/project/...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/upip/bootstrap_upip.sh
Shell
apache-2.0
536
import sys # Remove current dir from sys.path, otherwise setuptools will peek up our # module instead of system's. sys.path.pop(0) from setuptools import setup sys.path.append("..") import sdist_upip setup( name="micropython-upip", version="1.2.4", description="Simple package manager for MicroPython.", ...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/upip/setup.py
Python
apache-2.0
854
# # upip - Package manager for MicroPython # # Copyright (c) 2015-2018 Paul Sokolovsky # # Licensed under the MIT license. # import sys import gc import uos as os import uerrno as errno import ujson as json import uzlib import upip_utarfile as tarfile gc.collect() debug = False install_path = None cleanup_files = []...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/upip/upip.py
Python
apache-2.0
8,229
import uctypes # http://www.gnu.org/software/tar/manual/html_node/Standard.html TAR_HEADER = { "name": (uctypes.ARRAY | 0, uctypes.UINT8 | 100), "size": (uctypes.ARRAY | 124, uctypes.UINT8 | 11), } DIRTYPE = "dir" REGTYPE = "file" def roundup(val, align): return (val + align - 1) & ~(align - 1) class ...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/upip/upip_utarfile.py
Python
apache-2.0
2,371
import sys # Remove current dir from sys.path, otherwise setuptools will peek up our # module instead of system's. sys.path.pop(0) from setuptools import setup sys.path.append("..") import sdist_upip setup( name="micropython-upysh", version="0.6.1", description="Minimalistic file shell using native Pytho...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/upysh/setup.py
Python
apache-2.0
745
import sys import os class LS: def __repr__(self): self.__call__() return "" def __call__(self, path="."): l = os.listdir(path) l.sort() for f in l: st = os.stat("%s/%s" % (path, f)) if st[0] & 0x4000: # stat.S_IFDIR print(" <...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/micropython/upysh/upysh.py
Python
apache-2.0
1,589
try: import urequests as requests except ImportError: import requests r = requests.get("http://api.xively.com/") print(r) print(r.content) print(r.text) print(r.content) print(r.json()) # It's mandatory to close response objects as soon as you finished # working with them. On MicroPython platforms without ful...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/python-ecosys/urequests/example_xively.py
Python
apache-2.0
403
import sys # Remove current dir from sys.path, otherwise setuptools will peek up our # module instead of system's. sys.path.pop(0) from setuptools import setup sys.path.append("..") import sdist_upip setup( name="micropython-urequests", version="0.6", description="urequests module for MicroPython", l...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/python-ecosys/urequests/setup.py
Python
apache-2.0
980
import usocket class Response: def __init__(self, f): self.raw = f self.encoding = "utf-8" self._cached = None def close(self): if self.raw: self.raw.close() self.raw = None self._cached = None @property def content(self): if se...
YifuLiu/AliOS-Things
components/py_engine/micropython-lib/python-ecosys/urequests/urequests.py
Python
apache-2.0
3,191
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "aiagent_engine.h" #include "py/builtin.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/runtime.h" #include "ulog/ulog.h" #define LOG_TAG "MOD_AIAGENT" extern const mp_obj_type_t aiagent_type; #define AIAGENT_CHECK_PARAMS() ...
YifuLiu/AliOS-Things
components/py_engine/modules/aiagent/aiagent.c
C
apache-2.0
5,065
#include <stdio.h> #include <stdlib.h> #include <string.h> #if MICROPY_PY_AIAGENT #include "py/builtin.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/runtime.h" #include "ulog/ulog.h" extern const mp_obj_type_t aiagent_type; // this is the actual C-structure for our new object STATIC const mp_rom_map_e...
YifuLiu/AliOS-Things
components/py_engine/modules/aiagent/modaiagent.c
C
apache-2.0
795
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "py/builtin.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/runtime.h" #if MICROPY_PY_ALIYUNIOT extern const mp_obj_type_t linksdk_device_type; extern const mp_obj_type_t linksdk_gateway_type; STATIC const mp_rom_map_elem_t linksdk_local...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/modaliyunIoT.c
C
apache-2.0
875
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aos/kernel.h" #include "aiot_dm_api.h" #include "aiot_mqtt_api.h" #include "py/obj.h" #include "py_defines.h" #include "stdint.h" /* device active info report */ #define APPLICATION "soundbox" // product of application // #define MODULE_NAME ao...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot.h
C
apache-2.0
6,391
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aiot_devinfo_api.h" #include "aiot_mqtt_api.h" #include "aiot_state_api.h" #include "aiot_sysdep_api.h" #ifdef AOS_COMP_KV #include "aos/kv.h" #endif #include "module_aiot.h" #include "py_defines.h" #define MOD_STR "AIOT_ACTINFO" int32_t pyamp...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot_activeinfo.c
C
apache-2.0
3,918
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aiot_dm_api.h" #include "aiot_mqtt_api.h" #include "aiot_state_api.h" #include "aiot_sysdep_api.h" #ifdef AOS_COMP_KV #include "aos/kv.h" #endif #include "module_aiot.h" #include "py/mperrno.h" #include "py/mpstate.h" #include "py/runtime.h" #in...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot_device.c
C
apache-2.0
47,590
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aiot_dynreg_api.h" #include "aiot_mqtt_api.h" #include "aiot_state_api.h" #include "aiot_sysdep_api.h" #include "module_aiot.h" #include "py/runtime.h" #include "py_defines.h" // #include "be_inl.h" #define MOD_STR "AIOT_DYNREG" /* 位于portfiles...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot_dynreg.c
C
apache-2.0
6,812
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aiot_mqtt_api.h" #include "aiot_state_api.h" #include "aiot_subdev_api.h" #include "aiot_sysdep_api.h" #ifdef AOS_COMP_KV #include "aos/kv.h" #endif #include "module_aiot.h" #include "py/mperrno.h" #include "py/runtime.h" #include "py_defines.h"...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot_gateway.c
C
apache-2.0
37,701
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aiot_dm_api.h" #include "aiot_mqtt_api.h" #include "aiot_state_api.h" #include "aiot_subdev_api.h" #include "aiot_sysdep_api.h" #ifdef AOS_COMP_KV #include "aos/kv.h" #endif #include "py_defines.h" // #include "be_inl.h" #include "module_aiot.h"...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot_mqtt.c
C
apache-2.0
14,609
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aiot_mqtt_api.h" #include "aiot_ntp_api.h" #include "aiot_state_api.h" #include "aiot_sysdep_api.h" #include "module_aiot.h" #include "py/runtime.h" #include "py_defines.h" #define MOD_STR "AIOT_NTP" /* ntp timestamp */ // extern int64_t pyamp...
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot_ntp.c
C
apache-2.0
5,932
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include "aiot_state_api.h" #include "aiot_sysdep_api.h" #include "aiot_dynreg_api.h" #include "aiot_mqtt_api.h" #include "module_aiot.h" #include "aiot_state_api.h" #include "aiot_sysdep_api.h" #include "aiot_mqtt_api.h" #include "aiot_mqtt_upload_api....
YifuLiu/AliOS-Things
components/py_engine/modules/aliyunIoT/module_aiot_upload.c
C
apache-2.0
8,131
list(APPEND MICROPY_DEF_MODULES_PORT MICROPY_PY_AUDIO=1) # Collect audio micropython port source if(ESP_PLATFORM) list(APPEND MICROPY_SOURCE_MODULES_PORT ${MICROPY_MODULES_PORT_DIR}/audio/esp32/modaudio.c) list(APPEND MICROPY_SOURCE_MODULES_PORT ${MICROPY_MODULES_PORT_DIR}/audio/esp32/audio_player.c) lis...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/CMakeLists.txt
CMake
apache-2.0
4,788
#include <stdio.h> #include <stdlib.h> #include <string.h> #if MICROPY_PY_AUDIO #include "py/builtin.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/runtime.h" #include "ulog/ulog.h" #include "utility.h" #include "uvoice_init.h" #include "uvoice_player.h" #include "uvoice_event.h" #include "uvoice_types.h...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/aos/audio_player.c
C
apache-2.0
22,422
#include <stdio.h> #include <stdlib.h> #include <string.h> #if MICROPY_PY_AUDIO #include "py/builtin.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/runtime.h" #include "ulog/ulog.h" #include "uvoice_init.h" #include "uvoice_recorder.h" #include "uvoice_types.h" #define LOG_TAG "UVOICE_RECORDER" extern ...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/aos/audio_recorder.c
C
apache-2.0
9,713
#include <stdio.h> #include <stdlib.h> #include <string.h> #if MICROPY_PY_AUDIO #include "py/builtin.h" #include "py/obj.h" #include "py/runtime.h" #include "ulog/ulog.h" extern int audio_install_codec_driver(); static bool is_uvoice_inited = false; #define LOG_TAG "uvoice_snd" bool get_uvoice_state() { return...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/aos/audio_snd.c
C
apache-2.0
2,427
#include <stdio.h> #include <stdlib.h> #include <string.h> #if MICROPY_PY_AUDIO #include "py/builtin.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/runtime.h" #include "py/stackctrl.h" #include "ulog/ulog.h" #include "utility.h" #include "uvoice_alios.h" #include "uvoice_event.h" #include "uvoice_init.h"...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/aos/audio_tts.c
C
apache-2.0
8,815
#include <stdio.h> #include <stdlib.h> #include <string.h> #if MICROPY_PY_AUDIO #include "py/builtin.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/runtime.h" #include "ulog/ulog.h" extern const mp_obj_type_t uvoice_snd_type; extern const mp_obj_type_t uvoice_player_type; extern const mp_obj_type_t uvoi...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/aos/modaudio.c
C
apache-2.0
1,168
/* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to de...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/esp32/audio_player.c
C
apache-2.0
15,749
/* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to de...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/esp32/audio_recorder.c
C
apache-2.0
11,062
#include <stdio.h> #include <stdlib.h> #include <string.h> #if MICROPY_PY_AUDIO #include "py/builtin.h" #include "py/obj.h" #include "py/runtime.h" #define LOG_TAG "audio_snd" void audio_snd_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { } STATIC mp_obj_t audio_snd_new(const mp_obj_type_t...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/esp32/audio_snd.c
C
apache-2.0
1,295
/* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to de...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/esp32/modaudio.c
C
apache-2.0
5,101
/* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to de...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/esp32/modaudio.h
C
apache-2.0
1,325
/* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to de...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/esp32/vfs_stream.c
C
apache-2.0
15,562
/* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to de...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/esp32/vfs_stream.h
C
apache-2.0
2,996
list(APPEND MICROPY_DEF_MODULES_PORT MICROPY_PY_AUDIO=1) # Collect audio micropython port source list(APPEND MICROPY_SOURCE_MODULES_PORT ${MICROPY_MODULES_PORT_DIR}/audio/esp32/modaudio.c) list(APPEND MICROPY_SOURCE_MODULES_PORT ${MICROPY_MODULES_PORT_DIR}/audio/esp32/audio_player.c) list(APPEND MICROPY_SOURCE_MODUL...
YifuLiu/AliOS-Things
components/py_engine/modules/audio/modaudio.cmake
CMake
apache-2.0
3,649
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include "modble.h" #include "bluetooth/addr.h" #include "ulog/ulog.h" #define LOG_TAG "BT_GATTS_ADAPTER" size_t g_attr_num = 0; gatt_attr_t *g_attrs_list = NULL; int bt_gatts_adapter_update_u...
YifuLiu/AliOS-Things
components/py_engine/modules/ble/bt_gatts_adapter.c
C
apache-2.0
12,951
/* * Copyright (C) 2015-2019 Alibaba Group Holding Limited */ #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include "ulog/ulog.h" #include "modble.h" #define LOG_TAG "BT_HOST_ADAPTER" static void bt_host_adapter_adv_data_destroy(ad_data_t *ad_data, int ad_num); static int bt_host_adapter_event_callb...
YifuLiu/AliOS-Things
components/py_engine/modules/ble/bt_host_adapter.c
C
apache-2.0
7,406