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) 2014-2018 Paul Sokolovsky
* Copyright (c) 2014-2018 Damien P. George
*
* 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/adapter/esp32/moduos.c | C | apache-2.0 | 9,241 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/modutime.c | C | apache-2.0 | 4,506 |
// Options to control how MicroPython is built for this port,
// overriding defaults in py/mpconfig.h.
// Board-specific definitions
#include "mpconfigboard.h"
#include <stdint.h>
#include <alloca.h>
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
// #include "driver/i2s.h"
// object representation and NLR ha... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/mpconfigport.h | C | apache-2.0 | 13,262 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/mphalport.c | C | apache-2.0 | 6,457 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/mphalport.h | C | apache-2.0 | 4,860 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Jim Mussared
*
* 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 Soft... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/mpnimbleport.c | C | apache-2.0 | 2,687 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
* Copyright (c) 2017 Pycom Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associat... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/mpthreadport.c | C | apache-2.0 | 8,005 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
* Copyright (c) 2017 Pycom Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associat... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/mpthreadport.h | C | apache-2.0 | 1,776 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 "Eric Poulsen" <eric@zyxod.com>
* Copyright (c) 2021 "Tobias Eydam" <tobiaseydam@hotmail.com>
*
* Based on the ESP IDF example code which is Public Domain / CC0
*
* Permission is hereby ... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/network_lan.c | C | apache-2.0 | 11,717 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 "Eric Poulsen" <eric@zyxod.com>
*
* Based on the ESP IDF example code which is Public Domain / CC0
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of t... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/network_ppp.c | C | apache-2.0 | 10,163 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 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
* in the ... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/qstrdefsport.h | C | apache-2.0 | 1,349 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/uart.c | C | apache-2.0 | 3,613 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/uart.h | C | apache-2.0 | 1,661 |
/*
* 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/adapter/esp32/usb.c | C | apache-2.0 | 3,059 |
/*
* 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/adapter/esp32/usb.h | C | apache-2.0 | 1,408 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Patrick Van Oosterwijck
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* ... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/usb_serial_jtag.c | C | apache-2.0 | 3,693 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Patrick Van Oosterwijck
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* ... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/usb_serial_jtag.h | C | apache-2.0 | 1,475 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) Alibaba AIoT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software an... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/utility.c | C | apache-2.0 | 2,160 |
#ifndef PY_OBJ_UTILITY_H
#define PY_OBJ_UTILITY_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "py/builtin.h"
#include "py/gc.h"
#include "py/mperrno.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "py/mpstate.h"
extern void mp_hal_wake_main_task_from_isr();
bool ... | YifuLiu/AliOS-Things | components/py_engine/adapter/esp32/utility.h | C | apache-2.0 | 563 |
cmake_minimum_required(VERSION 3.12)
# Set main target and component locations
set(MICROPY_TARGET micropython)
# Do not compile testCCompiler.c file for cmake
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
# Do not generate -arch option for macOS M... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/CMakeLists.txt | CMake | apache-2.0 | 8,175 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef __AMP_MACHINE_CONFIG_H__
#define __AMP_MACHINE_CONFIG_H__
/* python engine root dir define */
#define MP_FS_ROOT_DIR "/data"
#define MP_FS_EXT_ROOT_DIR "/sdcard"
#define AMP_FS_ROOT_DIR MP_FS_ROOT_DIR "... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/board_config.h | C | apache-2.0 | 614 |
if(NOT MICROPY_FROZEN_MANIFEST)
set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py)
endif()
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/boards/HaaS200/mpconfigboard.cmake | CMake | apache-2.0 | 112 |
#define MICROPY_HW_BOARD_NAME "HaaS200 module"
#define MICROPY_HW_MCU_NAME "HaaS200"
#define MICROPY_SW_VENDOR_NAME "HaaSPython"
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/boards/HaaS200/mpconfigboard.h | C | apache-2.0 | 129 |
if(NOT MICROPY_FROZEN_MANIFEST)
set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py)
endif()
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/boards/HaaSEDUk1/mpconfigboard.cmake | CMake | apache-2.0 | 112 |
#define MICROPY_HW_BOARD_NAME "EDUk1 module"
#define MICROPY_HW_MCU_NAME "EDUk1"
#define MICROPY_SW_VENDOR_NAME "HaaSPython"
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/boards/HaaSEDUk1/mpconfigboard.h | C | apache-2.0 | 125 |
freeze("$(PORT_DIR)/modules")
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
freeze("$(MPY_DIR)/drivers/onewire")
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
include("$(MPY_DIR)/drivers/neopixel/manifest.py")
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/boards/manifest.py | Python | apache-2.0 | 320 |
include("manifest.py")
freeze("$(MPY_LIB_DIR)/python-ecosys/urequests", "urequests.py")
freeze("$(MPY_LIB_DIR)/micropython/upysh", "upysh.py")
freeze("$(MPY_LIB_DIR)/micropython/umqtt.simple", "umqtt/simple.py")
freeze("$(MPY_LIB_DIR)/micropython/umqtt.robust", "umqtt/robust.py")
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/boards/manifest_release.py | Python | apache-2.0 | 283 |
import kv
import netmgr as nm
import _thread
import time
def _connect_wifi():
time.sleep_ms(1000 * 2)
ssid = kv.get('_amp_wifi_ssid')
passwd = kv.get('_amp_wifi_passwd')
if isinstance(ssid, str) and isinstance(passwd, str):
nm.init()
if nm.getStatus() == 5:
pass
else... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/boot.py | Python | apache-2.0 | 723 |
"""
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/adapter/haas/fs/lib/ap3216c/ap3216c.py | Python | apache-2.0 | 13,749 |
import uos as os
import uerrno as errno
import ujson as json
import uzlib
import upip_utarfile as tarfile
import gc
import time
import ussl
import usocket
import kv
import time
file_buf = bytearray(128)
def install_pkg(package_url, install_path):
gzdict_sz = 16 + 15
f1 = url_open(package_url)
if (isinsta... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/appOta.py | Python | apache-2.0 | 3,987 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for CHT8305
Author: HaaS
Date: 2021/09/14
"""
from micropython import const
from utime import sleep_ms
from driver import I2C
CHT8305_REG_TEMP = 0x00
CHT8305_REG_HUMI = 0x01
# The register address in CHT8305 controller.
c... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/cht8305/cht8305.py | Python | apache-2.0 | 4,277 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for CHT8305
Author: HaaS
Date: 2022/05/11
"""
import lvgl as lv
import lvgl_display
print("display_driver init")
if not lv.is_initialized():
#print("lv.init")
lv.init()
if not lvgl_display.is_initialized():
#pr... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/display_driver/display_driver.py | Python | apache-2.0 | 369 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
"""
from driver import I2C
import kv
class HAASEDUK1(object):
def __init__(self):
self.i2cDev = None
# 获取版本号
# 返回值为1,代表k1c
# 返回值为0,代表k1
def getHWID(self):
hwId = -1
result = kv.geti("HAASEDU_NAME")
if (result... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/haaseduk1/haaseduk1.py | Python | apache-2.0 | 1,984 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
HaaS Python's driver for MPU6050
Author: HaaS Python Team
Date: 2022/02/02
"""
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(0X0... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/mpu6050/mpu6050.py | Python | apache-2.0 | 10,409 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for QMC5883l
Author: HaaS
Date: 2021/09/09
"""
from driver import I2C
from utime import sleep_ms
import math
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 = ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/qmc5883/qmc5883.py | Python | apache-2.0 | 8,658 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for QMI8610
Author: HaaS
Date: 2021/09/14
"""
from micropython import const
from driver import I2C
from utime import sleep_ms
import math
M_PI = (3.14159265358979323846)
ONE_G = (9.80665)
FISIMU_STATUS1_CMD_DONE = cons... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/qmi8610/qmi8610.py | Python | apache-2.0 | 25,897 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's driver for QMP6988
Author: HaaS
Date: 2021/09/14
"""
from driver import I2C
from utime import sleep_ms
from micropython import const
import math
QMP6988_CALC_INT = 1
QMP6988_CHIP_ID = const(0x5C)
QMP6988_CHIP_ID_REG ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/qmp6988/qmp6988.py | Python | apache-2.0 | 16,991 |
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/adapter/haas/fs/lib/sh1106/sh1106.py | Python | apache-2.0 | 7,916 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's drive for SI7006
Author: HaaS
Date: 2021/09/09
"""
from driver import I2C
from utime import sleep_ms
# The commands provided by SI7006
Si7006_MEAS_REL_HUMIDITY_MASTER_MODE = 0xE5
Si7006_MEAS_REL_HUMIDITY_NO_MASTER_MODE = 0xF5
... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/si7006/si7006.py | Python | apache-2.0 | 5,698 |
"""
Copyright (C) 2015-2021 Alibaba Group Holding Limited
MicroPython's drive for SPL06
Author: HaaS
Date: 2021/09/09
"""
from driver import I2C
from utime import sleep_ms
import math
EEPROM_CHIP_ADDRESS = 0x77
spl06_dict = {'Ctemp': 0.0, 'Ftemp': 0.0,'pressure': 0.0, 'altitude': 0.0}
class SPL06(obj... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/fs/lib/spl06/spl06.py | Python | apache-2.0 | 12,801 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2014 Damien P. George
* Copyright (c) 2017 Pycom Limited
*
* Permission is hereby granted, free of charge, to any p... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/gccollect.c | C | apache-2.0 | 1,572 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/gccollect.h | C | apache-2.0 | 1,327 |
/*
* Copyright (C) 2018 Alibaba Group Holding Limited
*/
/*
DESCRIPTION
This file provides example entry.
*/
#ifndef PY_ENGINE_EXAMPLE_H
#define PY_ENGINE_EXAMPLE_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct {
int32_t argc;
int8_t **argv;
bool is_repl_mode;
} mpy_thread_ar... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/haas_main.h | C | apache-2.0 | 547 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* 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 th... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/help.c | C | apache-2.0 | 2,044 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include "aos_hal_adc.h"
#include "modmachine.h"
#include "py/mperrno.h"
#include "py/mphal.h"
#include "py/runtime.h"
#include "ulog/ulog.h"
#if MICROPY_PY_MACHINE_ADC
#define LOG_TAG "machine_adc"
#define SAMPLEING_CYCLE 1... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_adc.c | C | apache-2.0 | 4,925 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#if MICROPY_PY_MACHINE_DAC
#include <stdio.h>
#include "aos_hal_dac.h"
#include "modmachine.h"
#include "py/mphal.h"
#include "py/runtime.h"
#include "ulog/ulog.h"
#define LOG_TAG "machine_dac"
#define MDAC_CHECK_PARAMS() ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_dac.c | C | apache-2.0 | 4,179 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include "aos_hal_i2c.h"
#include "extmod/machine_i2c.h"
#include "modmachine.h"
#include "py/mperrno.h"
#include "py/mphal.h"
#include "py/runtime.h"
#include "ulog/ulog.h"
#if MICROPY_PY_MACHINE_I2C
#define LOG_TAG "machine_hw_i2c"
#define MI2C_CHECK... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_hw_i2c.c | C | apache-2.0 | 8,476 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "aos_hal_spi.h"
#include "extmod/machine_spi.h"
#include "modmachine.h"
#include "py/mphal.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "ulog/ulog.h"
#if MICROPY_PY_MACHIN... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_hw_spi.c | C | apache-2.0 | 8,439 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include "extmod/virtpin.h"
#include "modmachine.h"
#include "mphalport.h"
#include "py/mphal.h"
#include "py/runtime.h"
#if MICROPY_PY_MACHINE
#include "aos_hal_gpio.h"
#include "ulog/ulog.h"
#define LOG_TAG ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_pin.c | C | apache-2.0 | 12,628 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include "aos_hal_pwm.h"
#include "modmachine.h"
#include "mphalport.h"
#include "py/mperrno.h"
#include "py/nlr.h"
#include "py/runtime.h"
#include "ulog/ulog.h"
#define LOG_TAG "machine_pwm"
enum {
PWN_CHANNEL_0,
PWN_CHANNE... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_pwm.c | C | apache-2.0 | 6,483 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include "aos_hal_rtc.h"
#include "shared/timeutils/timeutils.h"
#include "modmachine.h"
#include "py/mphal.h"
#include "py/nlr.h"
#include "py/obj.h"
#include "py/runtime.h"
... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_rtc.c | C | apache-2.0 | 3,104 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aos/kernel.h"
#include "py/builtin.h"
#include "py/gc.h"
#include "py/mperrno.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "py/stackctrl.h"
#include "ulog/ulog.h"
#define LO... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_sw_timer.c | C | apache-2.0 | 7,076 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aos_hal_timer.h"
#include "py/builtin.h"
#include "py/gc.h"
#include "py/mperrno.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "py/stackctrl.h"
#include "ulog/ulog.h"
#include... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_timer.c | C | apache-2.0 | 6,544 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include "modmachine.h"
#include "py/mphal.h"
#include "py/runtime.h"
#if 0
#include "driver/gpio.h"
#include "driver/touch_pad.h"
typedef struct _mtp_obj_t {
mp_obj_base_t base;
gpio_num_t gpio_id;
touch_pad_t touchpad_id;
} mtp_obj_t;
ST... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_touchpad.c | C | apache-2.0 | 3,059 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "aos_hal_uart.h"
#include "modmachine.h"
#include "py/mperrno.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "ulog/ulog.h"
#define LOG_TAG "machine_uart"
enum {
UART_NU... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_uart.c | C | apache-2.0 | 12,277 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <string.h>
#include "aos_hal_wdg.h"
#include "py/nlr.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "ulog/ulog.h"
#define LOG_TAG "machine-wdt"
#define DEFAULT_WDT_TIMEOUT (5000)
const mp_obj_type_t machine_wdt_type;
typ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/machine_wdt.c | C | apache-2.0 | 2,638 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#include <aos/errno.h>
#include <aos/kernel.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "amp_task.h"
#include "aos/init.h"
#include "aos/vfs.h"
#include "aos_hal_uart.h"
#include "board.h"
#include "board_mg... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/main.c | C | apache-2.0 | 17,021 |
#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"
#include "ulog/ulog.h"
#define LOG_TAG "MOD_BATTERY"
STATIC mp_obj_t obj_open(size_t n_args, const mp_obj_t *args)
{
LOGD(LOG_TAG, "entern %s; n_args = %d;\n", _... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modbattery.c | C | apache-2.0 | 4,349 |
#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"
#include "ulog/ulog.h"
#define LOG_TAG "MOD_CHARGER"
STATIC mp_obj_t obj_open(size_t n_args, const mp_obj_t *args)
{
LOGD(LOG_TAG, "entern %s; n_args = %d;\n", _... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modcharger.c | C | apache-2.0 | 4,893 |
#include <stdio.h>
#include <string.h>
#include "py/builtin.h"
#include "py/mperrno.h"
#include "py/obj.h"
#include "py/runtime.h"
#if 0
extern const mp_obj_type_t pyb_ipc_type;
// this is the actual C-structure for our new object
typedef struct _pyb_ipc_obj_t
{
// base represents some basic information, like ty... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modipc.c | C | apache-2.0 | 3,368 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2015 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/adapter/haas/modmachine.c | C | apache-2.0 | 12,768 |
#ifndef MICROPY_INCLUDED_HAAS_MODMACHINE_H
#define MICROPY_INCLUDED_HAAS_MODMACHINE_H
#include "py/obj.h"
typedef enum {
// MACHINE_WAKE_IDLE=0x01,
MACHINE_WAKE_SLEEP = 0x02,
MACHINE_WAKE_DEEPSLEEP = 0x04,
SLEEP_WAKEUP_EXT0,
SLEEP_WAKEUP_EXT1,
SLEEP_WAKEUP_TIMER,
SLEEP_WAKEUP_TOUCHPAD,
... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modmachine.h | C | apache-2.0 | 1,634 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aos_network.h"
#include "py/builtin.h"
#include "py/mperrno.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "py/stackctrl.h"
#include "aos_log.h"
#include "utility.h"
#include "aos/kernel.h"
#include "ulog/ulog.h"
#define LOG_TAG "mod_networ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modnetwork.c | C | apache-2.0 | 11,939 |
#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"
#include "ulog/ulog.h"
#define LOG_TAG "MOD_PM"
STATIC mp_obj_t obj_open(size_t n_args, const mp_obj_t *args)
{
LOGD(LOG_TAG, "entern %s; n_args = %d;\n", __func... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modpm.c | C | apache-2.0 | 6,513 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
* and Mnemote Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2016, 2017 Nick Moore @mnemote
*
* Based on extmod/modlwip.c
* Copyright (c) 2013, 2014 Dami... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modsocket.c | C | apache-2.0 | 32,806 |
#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"
#include "ulog/ulog.h"
#define LOG_TAG "MOD_SYSTEMINFO"
// this is the actual C-structure for our new object
typedef struct {
// base represents some basic inform... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modsysteminfo.c | C | apache-2.0 | 6,773 |
import gc
import uos
from flashbdev import bdev
try:
if bdev:
uos.mount(bdev, "/")
except OSError:
import inisetup
vfs = inisetup.setup()
gc.collect()
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modules/_boot.py | Python | apache-2.0 | 174 |
# APA106driver for MicroPython on ESP32
# MIT license; Copyright (c) 2016 Damien P. George
from neopixel import NeoPixel
class APA106(NeoPixel):
ORDER = (0, 1, 2, 3)
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modules/apa106.py | Python | apache-2.0 | 173 |
from esp32 import Partition
bdev = Partition.find(Partition.TYPE_DATA, label="vfs")
bdev = bdev[0] if bdev else None
| YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modules/flashbdev.py | Python | apache-2.0 | 118 |
import uos
from flashbdev import bdev
def check_bootsec():
buf = bytearray(bdev.ioctl(5, 0)) # 5 is SEC_SIZE
bdev.readblocks(0, buf)
empty = True
for b in buf:
if b != 0xFF:
empty = False
break
if empty:
return True
fs_corrupted()
def fs_corrupted():
... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modules/inisetup.py | Python | apache-2.0 | 1,066 |
try:
import usocket as socket
except:
import socket
try:
import ustruct as struct
except:
import struct
# (date(2000, 1, 1) - date(1900, 1, 1)).days * 24*60*60
NTP_DELTA = 3155673600
# The NTP host can be configured at runtime by doing: ntptime.host = 'myhost.org'
host = "pool.ntp.org"
def time():
... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modules/ntptime.py | Python | apache-2.0 | 946 |
from minicv import ML
AI_ENGINE_ALIYUN = 1
AI_ENGINE_NATIVE = 2
class AI:
def __init__(self, type=AI_ENGINE_NATIVE, accessKey=None, accessSecret=None, ossEndpoint=None, ossBucket=None):
self.type = type
self.ml = ML()
if (self.type == AI_ENGINE_ALIYUN):
self.ml.open(self.ml.ML_... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/modules/uai.py | Python | apache-2.0 | 2,033 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2014-2018 Paul Sokolovsky
* Copyright (c) 2014-2018 Damien P. George
*
* 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/adapter/haas/moduos.c | C | apache-2.0 | 28,764 |
/*
* 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/adapter/haas/modutime.c | C | apache-2.0 | 4,639 |
// Options to control how MicroPython is built for this port,
// overriding defaults in py/mpconfig.h.
// Board-specific definitions
#include <stdint.h>
#include <stdlib.h>
#include "mpconfigboard.h"
// object representation and NLR handling
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_A)
#define... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mpconfigport.h | C | apache-2.0 | 14,005 |
#include "mphalport.h"
#include <inttypes.h>
#include <unistd.h>
#include "aos/hal/uart.h"
#include "k_default_config.h"
#include "mpsalport.h"
#include "py/mpconfig.h"
#include "py/mphal.h"
#include "py/mpstate.h"
#include "py/obj.h"
#include "py/objstr.h"
#include "py/ringbuf.h"
#include "py/runtime.h"
#include "py... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mphalport.c | C | apache-2.0 | 7,668 |
#ifndef INCLUDED_MPHALPORT_H
#define INCLUDED_MPHALPORT_H
#include "shared/runtime/interrupt_char.h"
#include "py/ringbuf.h"
#include "py/mpconfig.h"
typedef mp_uint_t cpu_stack_t;
extern ringbuf_t stdin_ringbuf;
extern void mp_hal_set_interrupt_char(int c);
// This macro is used to implement PEP 475 to retry spec... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mphalport.h | C | apache-2.0 | 2,731 |
#include "mpsalport.h"
#include "aos/kernel.h"
#include "py/mperrno.h"
#include "ulog/ulog.h"
#include "k_api.h"
#define LOG_TAG "mp_sal_port"
mp_uint_t mp_sal_get_stack_size()
{
ktask_t *task = krhino_cur_task_get();
return task->stack_size;
}
void *mp_sal_get_stack_addr()
{
ktask_t *task = krhino_cur_... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mpsalport.c | C | apache-2.0 | 2,073 |
#ifndef MICROPY_INCLUDED_SAL_H
#define MICROPY_INCLUDED_SAL_H
#include <stdio.h>
#include "aos/kernel.h"
#include "py/obj.h"
#include "ulog/ulog.h"
#define MP_SAL_THREAD_MIN_STACK_SIZE (1024 * 4)
#define MP_SAL_THREAD_DEFAULT_STACK_SIZE (MP_THREAD_MIN_STACK_SIZE + 1024)
#define MP_SAL_THREAD_PRIORITY (... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mpsalport.h | C | apache-2.0 | 1,094 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mpstdinport.c | C | apache-2.0 | 3,837 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this so... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mpstdinport.h | C | apache-2.0 | 1,699 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
* Copyright (c) 2017 Pycom Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associat... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mpthreadport.c | C | apache-2.0 | 7,579 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
* Copyright (c) 2017 Pycom Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associat... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/mpthreadport.h | C | apache-2.0 | 1,681 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 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
* in the ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/qstrdefsport.h | C | apache-2.0 | 1,349 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* Development of the code in this file was sponsored by Microbric Pty Ltd
*
* The MIT License (MIT)
*
* Copyright (c) Alibaba AIoT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software an... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/utility.c | C | apache-2.0 | 2,159 |
#ifndef PY_OBJ_UTILITY_H
#define PY_OBJ_UTILITY_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "py/builtin.h"
#include "py/gc.h"
#include "py/mperrno.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "py/mpstate.h"
extern void mp_hal_wake_main_task_from_isr();
bool ... | YifuLiu/AliOS-Things | components/py_engine/adapter/haas/utility.h | C | apache-2.0 | 562 |
NAME := pyengine
$(NAME)_MBINS_TYPE := app
$(NAME)_VERSION := 1.0.0
$(NAME)_SUMMARY := python engine
py_build_haas700 := y
py_build_video := y
ROOTDIR := ../../../../..
AOSROOT := $(ROOTDIR)/os/kernel_alios
PYENGINEROOT := $(AOSROOT)/components/python/py_engine
# modules
AUDIO_SRC := \
modules/audio/moduv... | YifuLiu/AliOS-Things | components/py_engine/aos.mk | Makefile | apache-2.0 | 14,865 |
#!/bin/bash
set -e
if [ "$(uname)" == "Darwin" ]; then
os="Darwin"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
os="Linux"
elif ["$(expr substr $(uname -s) 1 10)"=="MINGW32_NT"];then
os="Win32"
fi
echo "os is $os"
if [[ -f $1 ]]; then
# read arguments from file, and choose those arguments w... | YifuLiu/AliOS-Things | components/py_engine/build_cmake.sh | Shell | apache-2.0 | 7,618 |
#!/bin/bash
set -e
driver_libs=("cht8305" "si7006" "sh1106" "haaseduk1" "mpu6050" "qmi8610" "ap3216c" "qmc5883" "qmc6310" "qmp6988" "spl06" "display_driver")
echo "Start to copy HaaS driver libs to prebuild folder ......"
targetBoard=$1
echo "targetBoard=${targetBoard}"
shellPath=$(cd $(dirname ${BASH_SOURCE[0]});... | YifuLiu/AliOS-Things | components/py_engine/build_lib_copy.sh | Shell | apache-2.0 | 1,938 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017-2018 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/drivers/bus/qspi.h | C | apache-2.0 | 2,634 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017-2018 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/drivers/bus/softqspi.c | C | apache-2.0 | 7,390 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016-2018 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/drivers/bus/softspi.c | C | apache-2.0 | 3,929 |
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016-2018 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/drivers/bus/spi.h | C | apache-2.0 | 2,050 |
/*****************************************************************************
*
* cc3000_common.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provi... | YifuLiu/AliOS-Things | components/py_engine/engine/drivers/cc3000/inc/cc3000_common.h | C | apache-2.0 | 13,674 |
/*****************************************************************************
*
* spi.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that t... | YifuLiu/AliOS-Things | components/py_engine/engine/drivers/cc3000/inc/ccspi.h | C | apache-2.0 | 3,456 |
/*****************************************************************************
*
* data_types.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided... | YifuLiu/AliOS-Things | components/py_engine/engine/drivers/cc3000/inc/data_types.h | C | apache-2.0 | 3,022 |
/*****************************************************************************
*
* evnt_handler.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provid... | YifuLiu/AliOS-Things | components/py_engine/engine/drivers/cc3000/inc/evnt_handler.h | C | apache-2.0 | 5,864 |
/*****************************************************************************
*
* hci.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that t... | YifuLiu/AliOS-Things | components/py_engine/engine/drivers/cc3000/inc/hci.h | C | apache-2.0 | 12,275 |
/*****************************************************************************
*
* host_driver_version.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted... | YifuLiu/AliOS-Things | components/py_engine/engine/drivers/cc3000/inc/host_driver_version.h | C | apache-2.0 | 1,992 |
#ifndef __INET_NTOP_H
#define __INET_NTOP_H
char *inet_ntop(int af, const void *addr, char *buf, size_t size);
#endif /* __INET_NTOP_H */
| YifuLiu/AliOS-Things | components/py_engine/engine/drivers/cc3000/inc/inet_ntop.h | C | apache-2.0 | 138 |