├── .gitattributes ├── .gitignore ├── .readthedocs.yaml ├── README.md ├── docs ├── Doxyfile ├── Makefile ├── _ext │ ├── gen_include.py │ └── link_roles.py ├── _include │ ├── _dirent_api.h │ ├── _statvfs_api.h │ ├── _stdio_api.h │ ├── _stdlib_api.h │ └── _time_api.h ├── _static │ ├── .empty │ ├── Logicrom_Spark_lte_g.png │ ├── Logicrom_Spark_lte_g_board.png │ ├── Logicrom_Spark_lte_g_overview.png │ ├── arduino-ide-board-manager.png │ ├── arduino-ide-flash-menu.png │ ├── arduino-ide-flash-upload.png │ ├── arduino-ide-logicrom-flasher-progress.png │ ├── arduino-ide-prefs.png │ ├── arduino-ide-select-logicrom-flasher-port.png │ ├── arduino-ide-select-logicrom-flasher.png │ ├── platformio-ide-advance-installation.png │ ├── platformio-ide-code-build-arduino.png │ ├── platformio-ide-code-build-logicrom.png │ ├── platformio-ide-code-build.png │ ├── platformio-ide-code-sample-arduino.png │ ├── platformio-ide-code-sample-logicrom.png │ ├── platformio-ide-code-sample.png │ ├── platformio-ide-embedded-menu.png │ ├── platformio-ide-flash-core-progress.png │ ├── platformio-ide-flash-core.png │ ├── platformio-ide-logicrom-finish.png │ ├── platformio-ide-logicrom-search.png │ ├── platformio-ide-new-project.png │ ├── platformio-ide-platform-install.png │ ├── platformio-ide-platforms-page.png │ ├── platformio-ide-project-config-arduino.png │ ├── platformio-ide-project-config-logicrom.png │ ├── platformio-ide-project-config.png │ ├── platformio-ide-project-tasks.png │ ├── platformio-ide-vscode-pkg-installer.png │ └── platformio-ide-vscode-welcome.png ├── _templates │ ├── .empty │ └── layout.html ├── book │ ├── COPYRIGHT.rst │ ├── api │ │ ├── crypto │ │ │ ├── aes.rst │ │ │ ├── base64.rst │ │ │ ├── crc.rst │ │ │ ├── hmac.rst │ │ │ ├── index.rst │ │ │ ├── md5.rst │ │ │ └── sha.rst │ │ ├── drivers │ │ │ ├── dhtxx.rst │ │ │ ├── ds18x20.rst │ │ │ ├── index.rst │ │ │ └── onewire.rst │ │ ├── index.rst │ │ ├── net │ │ │ ├── bsd_socket.rst │ │ │ ├── gsm_gprs.rst │ │ │ ├── index.rst │ │ │ ├── modem.rst │ │ │ ├── ril.rst │ │ │ ├── ril │ │ │ │ ├── ril.rst │ │ │ │ └── stk.rst │ │ │ └── socket.rst │ │ ├── peri │ │ │ ├── adc.rst │ │ │ ├── audio.rst │ │ │ ├── bluetooth.rst │ │ │ ├── bt_classic.rst │ │ │ ├── bt_le.rst │ │ │ ├── display.rst │ │ │ ├── gnss │ │ │ │ ├── gnss_hardware.rst │ │ │ │ ├── gps_driver.rst │ │ │ │ └── gps_lib.rst │ │ │ ├── gpio.rst │ │ │ ├── gps.rst │ │ │ ├── i2c.rst │ │ │ ├── imu.rst │ │ │ ├── index.rst │ │ │ ├── pwm.rst │ │ │ ├── sdmmc.rst │ │ │ ├── spi.rst │ │ │ ├── spifs.rst │ │ │ ├── uart.rst │ │ │ └── usb.rst │ │ ├── proto │ │ │ ├── httpc.rst │ │ │ ├── index.rst │ │ │ ├── modbus.rst │ │ │ ├── mqtt.rst │ │ │ └── ntpc.rst │ │ ├── storage │ │ │ ├── filesystem.rst │ │ │ ├── index.rst │ │ │ ├── param.rst │ │ │ └── storage.rst │ │ ├── system │ │ │ ├── command_proc.rst │ │ │ ├── fota.rst │ │ │ ├── index.rst │ │ │ ├── libtime.rst │ │ │ ├── logicrom.rst │ │ │ ├── messageq.rst │ │ │ ├── os │ │ │ │ ├── os_api.rst │ │ │ │ ├── task_timer.rst │ │ │ │ └── timers.rst │ │ │ ├── rdbg.rst │ │ │ ├── rtos.rst │ │ │ ├── syscall.rst │ │ │ └── syscall │ │ │ │ ├── dirent.rst │ │ │ │ ├── ioctl.rst │ │ │ │ ├── statvfs.rst │ │ │ │ ├── stdio.rst │ │ │ │ ├── termios.rst │ │ │ │ └── time.rst │ │ └── utils │ │ │ └── index.rst │ ├── bugs.rst │ ├── example.rst │ ├── flash │ │ ├── application.rst │ │ ├── core.rst │ │ └── core_reflash.rst │ ├── flashing.rst │ ├── hw │ │ └── index.rst │ ├── quick_start.rst │ └── quick_start │ │ ├── arduino.rst │ │ ├── logicrom.rst │ │ ├── setup_arduino.rst │ │ └── setup_platformio.rst ├── conf.py ├── index.rst ├── make.bat └── requirements.txt ├── include ├── arpa │ └── inet.h ├── audio.h ├── circbuf.h ├── command.h ├── console.h ├── crypto │ ├── aes.h │ ├── arc4.h │ ├── base64.h │ ├── crc.h │ ├── des.h │ ├── hmac.h │ ├── md5.h │ └── sha.h ├── driver │ ├── dht.h │ ├── ds18b20.h │ └── onewire.h ├── filter.h ├── fota.h ├── gpsdriver.h ├── gpslib.h ├── hw │ ├── adc.h │ ├── bluetooth.h │ ├── bluetooth_le.h │ ├── display.h │ ├── gnss.h │ ├── gpio.h │ ├── i2c.h │ ├── imu_sensor.h │ ├── iomux.h │ ├── keypad.h │ ├── pwm.h │ ├── sdmmc.h │ ├── spi.h │ └── usb.h ├── int64str.h ├── lib.h ├── libtime.h ├── modem.h ├── msgq.h ├── net │ └── sockets.h ├── netdb.h ├── network.h ├── opdatabase.h ├── os_api.h ├── param.h ├── plat │ ├── def_adc.h │ ├── def_gpio.h │ ├── def_i2c.h │ ├── def_pwm.h │ └── def_spi.h ├── private │ └── linker_list.h ├── proto │ ├── httpc.h │ ├── modbus.h │ ├── mqttclient.h │ ├── ntpc.h │ └── xmodem.h ├── remotedbg.h ├── ril │ ├── ril.h │ └── ril_stk.h ├── spifs.h ├── storage.h ├── sys │ ├── dirent.h │ ├── ioctl.h │ ├── socket.h │ ├── statvfs.h │ └── termios.h ├── task_timer.h ├── timer.h └── utils.h ├── lib ├── asr160x │ ├── app_linker.ld │ ├── liblogicromasr.a │ ├── liblogicromasr_debug.a │ └── pack │ │ ├── ASR1601 │ │ ├── flasher.img │ │ └── preboot.img │ │ ├── ASR1603 │ │ ├── flasher.img │ │ └── preboot.img │ │ ├── download.json │ │ ├── flashinfo_16M.bin │ │ ├── flashinfo_8M.bin │ │ ├── partition_16M.bin │ │ └── partition_8M.bin ├── mtk │ ├── liblogicrom.a │ ├── liblogicrom_debug.a │ ├── liblogicromnbiot.a │ ├── liblogicromnbiot_debug.a │ ├── linkerscript.ld │ ├── linkerscript_common.lds │ └── linkerscript_nbiot.ld ├── rda8910 │ ├── app_flashimg.ld │ ├── core_config.json │ ├── fdl1.img │ ├── fdl2.img │ ├── fota8910.xml │ ├── hal_config.h │ ├── liblogicrom4g.a │ └── liblogicrom4g_debug.a └── rda8955 │ ├── empty.lod │ ├── librda_logicrom.a │ ├── librda_logicrom_debug.a │ └── linkerscript.ld ├── package.json ├── template └── main.c.tmpl └── tools ├── FOTA_Generator.exe ├── GFH_Generator.exe ├── rda8910 ├── linux │ ├── dtools │ └── lib │ │ ├── libQt5Core.so.5 │ │ ├── libQt5Network.so.5 │ │ ├── libQt5Qml.so.5 │ │ ├── libQt5SerialPort.so.5 │ │ ├── libQt5Xml.so.5 │ │ ├── libicudata.so.55 │ │ ├── libicui18n.so.55 │ │ ├── libicuuc.so.55 │ │ └── librdasign.so ├── pacgen.py └── win32 │ ├── Qt5Core.dll │ ├── Qt5Network.dll │ ├── Qt5Qml.dll │ ├── Qt5SerialPort.dll │ ├── Qt5Xml.dll │ ├── dtools.exe │ ├── rdasign.dll │ └── rdasign.lib └── rda8955 ├── linux ├── genfota └── libfotasdk.so └── win32 ├── fotasdk.dll └── genfota.exe /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bat eol=crlf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | docs/_build 2 | docs/xml 3 | docs/inc 4 | __pycache__/ 5 | .vscode/ 6 | .project 7 | make.sh 8 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the OS, Python version and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.12" 13 | 14 | # Build documentation in the docs/ directory with Sphinx 15 | sphinx: 16 | configuration: docs/conf.py 17 | 18 | # Optionally build your docs in additional formats such as PDF 19 | formats: 20 | - pdf 21 | - epub 22 | 23 | # Optionally set the version of Python and requirements required to build your docs 24 | python: 25 | install: 26 | - requirements: docs/requirements.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Logicrom OpenCPU SDK for Wireless IoT 2 | 3 | OpenCPU Software development kit for Logicrom IoT Platform 4 | 5 | [![PlatformIO Registry](https://badges.registry.platformio.org/packages/waybyte/tool/framework-logicromsdk.svg)](https://registry.platformio.org/tools/waybyte/framework-logicromsdk) 6 | [![Documentation Status](https://readthedocs.org/projects/logicromsdk/badge/?version=latest)](https://docs.logicrom.com) 7 | [![Github Issues](https://img.shields.io/github/issues/waybyte/logicromsdk.svg)](http://github.com/waybyte/logicromsdk/issues) 8 | [![Github Releases](https://img.shields.io/github/release/waybyte/logicromsdk.svg)](https://github.com/waybyte/logicromsdk/releases) 9 | 10 | 11 | ## Installation Guide 12 | - [PlatformIO IDE](https://docs.logicrom.com/en/latest/book/quick_start/setup_platformio.html) 13 | - [Arduino IDE](https://docs.logicrom.com/en/latest/book/quick_start/setup_arduino.html) 14 | 15 | ## Resources 16 | 17 | * [Documentation](https://docs.logicrom.com) - Logicrom OpenCPU SDK documentation for latest version 18 | * [SDK Examples](https://docs.logicrom.com/en/latest/book/example.html) 19 | 20 | # Supported Modules 21 | 22 | | Name | Vendor | SoC/Chipset | Supported Peripherals | APP RAM / ROM | 23 | |-------------------|----------|-------------|----------------------------------------------------|-----------------| 24 | | EC200U-XX-YY [^1] | Quectel | RDA8910 | UART, USB, SPI, I2C, ADC, LCD, BT [^2], GNSS [^3] | 500 KB / 1 MB | 25 | | EC600U-XX-YY [^1] | Quectel | RDA8910 | | 500 KB / 1 MB | 26 | | EC600U-XX-YY [^1] | Quectel | RDA8910 | | 500 KB / 1 MB | 27 | | EG915U-XX-YY [^1] | Quectel | RDA8910 | | 500 KB / 1 MB | 28 | | N58-CA | Neoway | RDA8910 | | 500 KB / 1 MB | 29 | | N716-CA | Neoway | RDA8910 | | 500 KB / 1 MB | 30 | | EC100N-XX-XX | Quectel | ASR1603 | UART, USB, SPI, I2C, ADC | 512 KB / 1 MB | 31 | | EC200N-CN-AA | Quectel | ASR1603 | | 512 KB / 512 KB | 32 | | EC600N-CN-AA | Quectel | ASR1603 | | 512 KB / 1 MB | 33 | | EG912Y-EU-YY | Quectel | ASR1603 | | 512 KB / 1 MB | 34 | | EG915N-EU-YY | Quectel | ASR1603 | | 512 KB / 512 KB | 35 | | EC100Y-CN-YY | Quectel | ASR1601 | UART, USB, SPI, I2C, ADC | 512 KB / 512 KB | 36 | | EC100S-CN-YY | Quectel | ASR1601 | | 512 KB / 1 MB | 37 | | EC600S-CN-YY | Quectel | ASR1601 | | 512 KB / 1 MB | 38 | | AC7670C | SIMCOM | ASR1601 | | 512 KB / 1 MB | 39 | | MC20, MC60, MC20U | Quectel | MT2503 | UART, USB, SPI, I2C, ADC, GNSS | 94 KB / 256 KB | 40 | | SIM868[^4] | SIMCOM | MT2503 | | 94 KB / 256 KB | 41 | | M66, M26, M56 | Quectel | MT6261 | UART, USB, SPI, I2C, ADC | 94 KB / 256 KB | 42 | | SIM800[^4] | SIMCOM | MT6261 | | 94 KB / 256 KB | 43 | | MC65 | Quectel | RDA8955 | UART, USB, SPI, I2C, ADC, GNSS [^3], LCD | 1 MB / 576 KB | 44 | | M590 | Neoway | RDA8955 | | 1 MB / 576 KB | 45 | | A9, A9G | AiThinker| RDA8955 | | 1 MB / 576 KB | 46 | 47 | [^1]: XX can be CN/AU/EU, YY can be AA/AB/AC 48 | 49 | [^2]: Currely only GATT Server supported and used for console purpose only 50 | 51 | [^3]: Supported on module with GNSS 52 | 53 | [^4]: IMEI need to be configured when core is flashed for first time, use AT+EGMR=1,7,"imei" 54 | 55 | > DFOTA is supported for LTE modules and RDA8955 chipset 56 | 57 | 58 | # License & Credits 59 | 60 | For complete list of third-party library licenses used in Logicrom OpenCPU SDK visit: [Copyright & Licenses](https://docs.logicrom.com/en/latest/book/COPYRIGHT.html) 61 | 62 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/_ext/link_roles.py: -------------------------------------------------------------------------------- 1 | #based on https://protips.readthedocs.io/link-roles.html 2 | #some part taken from esp-idf extension link-roles.py 3 | 4 | import os 5 | import subprocess 6 | from docutils import nodes 7 | 8 | def get_github_rev(): 9 | path = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode('utf-8') 10 | try: 11 | tag = subprocess.check_output(['git', 'describe', '--exact-match'], stderr=subprocess.DEVNULL).strip().decode('utf-8') 12 | except subprocess.CalledProcessError: 13 | tag = None 14 | if tag: 15 | return tag 16 | return path 17 | 18 | def setup(app): 19 | app.add_role('github', autolink('https://github.com/%s')) 20 | app.add_role('header_src_file', autolink('https://github.com/waybyte/logicromsdk/blob/%s/%s')) 21 | return {'parallel_read_safe': True, 'parallel_write_safe': True, 'version': '1.0'} 22 | 23 | def autolink(pattern): 24 | def role(name, rawtext, text, lineno, inliner, options={}, content=[]): 25 | rev = get_github_rev() 26 | url = pattern % (rev,text,) 27 | node = nodes.reference(rawtext, text, refuri=url, **options) 28 | return [node], [] 29 | return role 30 | 31 | -------------------------------------------------------------------------------- /docs/_include/_dirent_api.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @enum _dtype_e 3 | * File type flags for d_type 4 | */ 5 | enum _dtype_e { 6 | DT_UNKNOWN = 0,/**< The file type could not be determined */ 7 | DT_FIFO = 1, /**< FIFO File type */ 8 | DT_CHR = 2, /**< Special file type: Character device */ 9 | DT_DIR = 4, /**< Directory */ 10 | DT_BLK = 6, /**< Special file type: Block device */ 11 | DT_REG = 8, /**< Regular File type */ 12 | DT_LNK = 10, /**< File is a symbolic link */ 13 | DT_SOCK = 12, /**< File is a UNIX domain socket */ 14 | }; 15 | 16 | /** 17 | * Directory entry structure 18 | */ 19 | struct dirent { 20 | ino_t d_ino; /**< inode number (Unused) */ 21 | off_t d_off; /**< offset to the next dirent (unused) */ 22 | unsigned long d_reclen; /**< length of this record */ 23 | unsigned char d_type; /**< type of file @ref _dtype_e */ 24 | char d_name[256];/**< filename */ 25 | }; 26 | 27 | /** 28 | * Directory stream pointer type 29 | */ 30 | typedef void DIR; 31 | 32 | /** 33 | * @brief Open a directory 34 | * @param name [in] Directory path to open 35 | * @return a pointer to the directory stream. On error, NULL is returned, and errno is set appropriately. 36 | */ 37 | DIR *opendir(const char *name); 38 | 39 | /** 40 | * @brief Read a directory 41 | * @param dirp [in] directory stream provided by @ref opendir 42 | * @return On success, a pointer to a dirent structure. (This structure may be statically allocated; do not attempt to free it.) 43 | */ 44 | struct dirent *readdir(DIR *dirp); 45 | 46 | /** 47 | * @brief return current location in directory stream. This function may not supported by all filesystem drivers 48 | * @param dirp [in] directory stream provided by @ref opendir 49 | * @return On success, function returns the current location in the directory stream. On error, -1 is returned, and errno is set appropriately 50 | */ 51 | long telldir(DIR *dirp); 52 | 53 | /** 54 | * @brief reset directory stream. This function may not supported by all filesystem drivers 55 | * @param dirp [in] directory stream provided by @ref opendir 56 | */ 57 | void rewinddir(DIR *dirp); 58 | 59 | /** 60 | * @brief set the position of the next @ref readdir call in the directory stream. This function may not supported by all filesystem drivers 61 | * @param dirp [in] directory stream provided by @ref opendir 62 | * @param loc [in] a value returned by a previous call to @ref telldir 63 | */ 64 | void seekdir(DIR *dirp, long loc); 65 | 66 | /** 67 | * @brief Close a directory 68 | * @param dirp [in] directory stream provided by @ref opendir 69 | * @return 0 on success. On error, -1 is returned, and errno is set appropriately. 70 | */ 71 | int closedir(DIR *dirp); 72 | -------------------------------------------------------------------------------- /docs/_include/_statvfs_api.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @enum _f_flag_e 3 | * Definitions for the flag in `f_flag' 4 | */ 5 | enum _f_flag_e { 6 | ST_RDONLY = 1, /**< Mount read-only */ 7 | ST_NOSUID = 2, /**< Ignore suid and sgid bits */ 8 | ST_NODEV = 4, /**< Disallow access to device special files. */ 9 | ST_NOEXEC = 8, /**< Disallow program execution. */ 10 | ST_SYNCHRONOUS = 16, /**< Writes are synced at once. */ 11 | ST_MANDLOCK = 64, /**< Allow mandatory locks on an FS. */ 12 | ST_WRITE = 128, /**< Write on file/directory/symlink. */ 13 | ST_APPEND = 256, /**< Append-only file. */ 14 | ST_IMMUTABLE = 512, /**< Immutable file. */ 15 | ST_NOATIME = 1024, /**< Do not update access times. */ 16 | ST_NODIRATIME = 2048, /**< Do not update directory access times. */ 17 | ST_RELATIME = 4096 /**< Update atime relative to mtime/ctime. */ 18 | }; 19 | 20 | /** 21 | * @brief Filesystem information structure 22 | * 23 | */ 24 | struct statvfs { 25 | unsigned long f_bsize; /* Filesystem block size */ 26 | unsigned long f_frsize; /* Fragment size */ 27 | fsblkcnt_t f_blocks; /* Size of fs in f_frsize units */ 28 | fsblkcnt_t f_bfree; /* Number of free blocks */ 29 | fsblkcnt_t f_bavail; /* Number of free blocks for unprivileged users */ 30 | fsfilcnt_t f_files; /* Number of inodes */ 31 | fsfilcnt_t f_ffree; /* Number of free inodes */ 32 | fsfilcnt_t f_favail; /* Number of free inodes for unprivileged users */ 33 | unsigned long f_fsid; /* Filesystem ID */ 34 | unsigned long f_flag; /* Mount flags */ 35 | unsigned long f_namemax; /* Maximum filename length */ 36 | }; 37 | 38 | /** 39 | * Get filesystem statistics 40 | * The function returns information about a mounted filesystem 41 | * @param path pathname of any file within the mounted filesystem 42 | * @param buf a pointer to a @ref statvfs structure 43 | * @return On success, zero is returned. On error, -1 is returned, and errno is set appropriately. 44 | */ 45 | int statvfs(const char *path, struct statvfs *buf); 46 | 47 | /** 48 | * Get filesystem statistics 49 | * fstatvfs() returns the same information returned by @ref statvfs() about an open file referenced by descriptor. 50 | * @param fd File descriptor 51 | * @param buf a pointer to a @ref statvfs structure 52 | * @return On success, zero is returned. On error, -1 is returned, and errno is set appropriately. 53 | */ 54 | int fstatvfs(int fd, struct statvfs *buf); 55 | -------------------------------------------------------------------------------- /docs/_include/_stdlib_api.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Allocate memory 3 | * 4 | * @param size size in bytes 5 | * @return on success a pointer to newly allocated memory, NULL on error 6 | */ 7 | void *malloc(size_t size); 8 | 9 | /** 10 | * @brief Release an allocated memory 11 | * 12 | * @param ptr pointer to memory 13 | */ 14 | void free(void *ptr); 15 | 16 | /** 17 | * @brief allocates memory for an array of @a nmemb elements of @a size bytes each 18 | * and returns a pointer to the allocated memory. The memory is set to zero. 19 | * 20 | * @param nmemb number of element 21 | * @param size element size 22 | * @return on success a pointer to newly allocated memory, NULL on error 23 | */ 24 | void *calloc(size_t nmemb, size_t size); 25 | 26 | /** 27 | * @brief changes the size of the memory block pointed to by @a ptr to @a size bytes 28 | * 29 | * @param ptr pointer to previously allocated memory 30 | * @param size new size 31 | * @return on success a pointer to newly allocated memory, NULL on error 32 | */ 33 | void *realloc(void *ptr, size_t size); 34 | -------------------------------------------------------------------------------- /docs/_include/_time_api.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Time structure 3 | * 4 | */ 5 | struct timeval { 6 | time_t tv_sec; /**< seconds */ 7 | suseconds_t tv_usec; /**< and microseconds */ 8 | }; 9 | 10 | /** 11 | * @brief process time details structure 12 | * 13 | */ 14 | struct tms { 15 | clock_t tms_utime; /**< user time */ 16 | clock_t tms_stime; /**< system time */ 17 | clock_t tms_cutime; /**< user time of children */ 18 | clock_t tms_cstime; /**< system time of children */ 19 | }; 20 | 21 | /** 22 | * @brief Get system time 23 | * 24 | * @param tv Timeval structure to fill 25 | * @param tz Timezone structure to fill (unused) 26 | * @return 0 on success, -1 on error 27 | */ 28 | int gettimeofday(struct timeval *tv, struct timezone *tz); 29 | 30 | /** 31 | * @brief Set system time 32 | * 33 | * @param tv Time to set 34 | * @param tz timezone (unused) 35 | * @return 0 on success, -1 on error 36 | */ 37 | int settimeofday(const struct timeval *tv, const struct timezone *tz); 38 | 39 | /** 40 | * @brief get process times 41 | * 42 | * @param buf pointer to time structure @ref tms 43 | * @return On success, clock value in microseconds, On error -1 is returned 44 | */ 45 | clock_t times(struct tms *buf); 46 | 47 | /** 48 | * @brief sleep for a specified number of seconds 49 | * 50 | * @param seconds duration in seconds 51 | * @return always return 0 52 | */ 53 | unsigned int sleep(unsigned int seconds); 54 | 55 | /** 56 | * @brief suspend execution for microsecond intervals 57 | * 58 | * @note No task yield occurs 59 | * 60 | * @param usec duration in seconds 61 | * @return always return 0 62 | */ 63 | int usleep(useconds_t usec); 64 | 65 | -------------------------------------------------------------------------------- /docs/_static/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/.empty -------------------------------------------------------------------------------- /docs/_static/Logicrom_Spark_lte_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/Logicrom_Spark_lte_g.png -------------------------------------------------------------------------------- /docs/_static/Logicrom_Spark_lte_g_board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/Logicrom_Spark_lte_g_board.png -------------------------------------------------------------------------------- /docs/_static/Logicrom_Spark_lte_g_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/Logicrom_Spark_lte_g_overview.png -------------------------------------------------------------------------------- /docs/_static/arduino-ide-board-manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/arduino-ide-board-manager.png -------------------------------------------------------------------------------- /docs/_static/arduino-ide-flash-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/arduino-ide-flash-menu.png -------------------------------------------------------------------------------- /docs/_static/arduino-ide-flash-upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/arduino-ide-flash-upload.png -------------------------------------------------------------------------------- /docs/_static/arduino-ide-logicrom-flasher-progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/arduino-ide-logicrom-flasher-progress.png -------------------------------------------------------------------------------- /docs/_static/arduino-ide-prefs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/arduino-ide-prefs.png -------------------------------------------------------------------------------- /docs/_static/arduino-ide-select-logicrom-flasher-port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/arduino-ide-select-logicrom-flasher-port.png -------------------------------------------------------------------------------- /docs/_static/arduino-ide-select-logicrom-flasher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/arduino-ide-select-logicrom-flasher.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-advance-installation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-advance-installation.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-code-build-arduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-code-build-arduino.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-code-build-logicrom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-code-build-logicrom.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-code-build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-code-build.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-code-sample-arduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-code-sample-arduino.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-code-sample-logicrom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-code-sample-logicrom.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-code-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-code-sample.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-embedded-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-embedded-menu.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-flash-core-progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-flash-core-progress.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-flash-core.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-flash-core.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-logicrom-finish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-logicrom-finish.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-logicrom-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-logicrom-search.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-new-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-new-project.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-platform-install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-platform-install.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-platforms-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-platforms-page.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-project-config-arduino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-project-config-arduino.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-project-config-logicrom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-project-config-logicrom.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-project-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-project-config.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-project-tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-project-tasks.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-vscode-pkg-installer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-vscode-pkg-installer.png -------------------------------------------------------------------------------- /docs/_static/platformio-ide-vscode-welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_static/platformio-ide-vscode-welcome.png -------------------------------------------------------------------------------- /docs/_templates/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waybyte/logicromsdk/72f60a27f45c292bc3b75994775f61949fc03da2/docs/_templates/.empty -------------------------------------------------------------------------------- /docs/book/COPYRIGHT.rst: -------------------------------------------------------------------------------- 1 | Copyrights and Licenses 2 | ======================= 3 | 4 | Software Copyrights 5 | ------------------- 6 | 7 | All original source code in this repository is Copyright (C) 2021-2024 Waybyte Solutions. This source code is licensed under MIT as described in the file LICENSE. 8 | 9 | Additional third party copyrighted code is included under the following licenses. 10 | 11 | Where source code headers specify Copyright & License information, this information takes precedence over the summaries made here. 12 | 13 | Firmware Components 14 | ^^^^^^^^^^^^^^^^^^^ 15 | 16 | These third party libraries included into the application (firmware) produced by Logicrom OpenCPU SDK. 17 | 18 | * `LittleFS `_ library written by ARM Limited and released under the `BSD 3-clause license `_. 19 | 20 | * `Int64String `_ library written by djGrrr and released under the `MIT license `__. 21 | 22 | * `PicoHTTPParser `_ library written by Kazuho Oku, Tokuhiro Matsuno, Daisuke Murase, Shigeo Mitsunari and released under the MIT license. 23 | 24 | * `heatshrink `_ library written by Scott Vokes and released under the `ISC license `_. 25 | 26 | * `SimpleKalmanFilter `_ library written by Denys Sene and released under the `MIT license `__. 27 | 28 | * `OneWire `_ library originally written by Jim Studt and later maintained by Paul Stoffregen, is released uder `custom license `_. 29 | 30 | * `Tiny AES `_ library, released under `Unlicense `_. 31 | 32 | * `Fusion `_ library, Copyright 2021 x-io Technologies and released under `MIT License `__. 33 | 34 | * `MQTT Client `_ library, Copyright jiejie and released under `Apache License 2.0 `_. 35 | 36 | * `SPIFFS `_ library, Copyright (c) 2013-2017 Peter Andersson, is licensed under `MIT license `__. 37 | 38 | 39 | Documentation 40 | ^^^^^^^^^^^^^ 41 | 42 | * HTML version of the `Logicrom OpenCPU SDK `_ uses the `Sphinx RTD theme `_, which is Copyright (c) 2013-2018 Dave Snider, Read the Docs, Inc. & contributors, licensed under `MIT license `__. 43 | 44 | -------------------------------------------------------------------------------- /docs/book/api/crypto/aes.rst: -------------------------------------------------------------------------------- 1 | AES Encryption API 2 | ================== 3 | 4 | .. include:: /inc/aes.inc 5 | -------------------------------------------------------------------------------- /docs/book/api/crypto/base64.rst: -------------------------------------------------------------------------------- 1 | Base64 Utility APIs 2 | =================== 3 | 4 | .. include:: /inc/base64.inc 5 | -------------------------------------------------------------------------------- /docs/book/api/crypto/crc.rst: -------------------------------------------------------------------------------- 1 | CRC checksum APIs 2 | ================= 3 | 4 | .. include:: /inc/crc.inc 5 | -------------------------------------------------------------------------------- /docs/book/api/crypto/hmac.rst: -------------------------------------------------------------------------------- 1 | HMAC Hash API 2 | ============= 3 | 4 | .. include:: /inc/hmac.inc 5 | -------------------------------------------------------------------------------- /docs/book/api/crypto/index.rst: -------------------------------------------------------------------------------- 1 | Cryptography API 2 | ================ 3 | 4 | List of available Cryptography and checksum utility functions 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | AES 10 | MD5 11 | SHA 12 | HMAC 13 | CRC 14 | Base64 15 | -------------------------------------------------------------------------------- /docs/book/api/crypto/md5.rst: -------------------------------------------------------------------------------- 1 | MD5 APIs 2 | ======== 3 | 4 | .. include:: /inc/md5.inc 5 | -------------------------------------------------------------------------------- /docs/book/api/crypto/sha.rst: -------------------------------------------------------------------------------- 1 | SHA Hash API 2 | ============ 3 | 4 | .. include:: /inc/sha.inc 5 | -------------------------------------------------------------------------------- /docs/book/api/drivers/dhtxx.rst: -------------------------------------------------------------------------------- 1 | DHT Sensor API 2 | ============== 3 | 4 | DHT Temperature and Humidity sensor library optimized for GSM module. 5 | 6 | .. include:: /inc/dht.inc 7 | 8 | -------------------------------------------------------------------------------- /docs/book/api/drivers/ds18x20.rst: -------------------------------------------------------------------------------- 1 | DS18x20 Temperature Sensor API 2 | ============================== 3 | 4 | OneWire temperature sensor library. Supported Sensors: 5 | 6 | * DS18B20 7 | * DS18S20 8 | * DS1822 9 | 10 | .. include:: /inc/ds18b20.inc 11 | 12 | -------------------------------------------------------------------------------- /docs/book/api/drivers/index.rst: -------------------------------------------------------------------------------- 1 | Drivers 2 | ======= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | OneWire 8 | DS18x20 Sensor 9 | DHT Sensor 10 | -------------------------------------------------------------------------------- /docs/book/api/drivers/onewire.rst: -------------------------------------------------------------------------------- 1 | OneWire API 2 | =========== 3 | 4 | OneWire driver optimized for GSM module. 5 | 6 | .. include:: /inc/onewire.inc 7 | 8 | -------------------------------------------------------------------------------- /docs/book/api/index.rst: -------------------------------------------------------------------------------- 1 | API Reference Guide 2 | =================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | System 8 | Peripherals 9 | Network API 10 | Protocols 11 | Drivers 12 | Storage 13 | Utilities 14 | Cryptography 15 | -------------------------------------------------------------------------------- /docs/book/api/net/bsd_socket.rst: -------------------------------------------------------------------------------- 1 | BSD Socket API 2 | ============== 3 | 4 | .. include:: /inc/socket.inc 5 | 6 | -------------------------------------------------------------------------------- /docs/book/api/net/gsm_gprs.rst: -------------------------------------------------------------------------------- 1 | GSM & GPRS API 2 | ============== 3 | 4 | API Reference 5 | ------------- 6 | 7 | .. include:: /inc/network.inc 8 | 9 | -------------------------------------------------------------------------------- /docs/book/api/net/index.rst: -------------------------------------------------------------------------------- 1 | Network API 2 | =========== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | GSM & GPRS API 8 | RAW Socket API 9 | BSD Socket API 10 | Modem Interface APIs 11 | Radio Interface Layer (RIL) 12 | -------------------------------------------------------------------------------- /docs/book/api/net/modem.rst: -------------------------------------------------------------------------------- 1 | Modem Interface APIs 2 | ==================== 3 | 4 | .. include:: /inc/modem.inc 5 | -------------------------------------------------------------------------------- /docs/book/api/net/ril.rst: -------------------------------------------------------------------------------- 1 | Radio Interface Layer - RIL 2 | =========================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | RIL API 8 | SIM Toolkit Interface 9 | 10 | -------------------------------------------------------------------------------- /docs/book/api/net/ril/ril.rst: -------------------------------------------------------------------------------- 1 | RIL API 2 | ======= 3 | 4 | .. include:: /inc/ril.inc 5 | 6 | -------------------------------------------------------------------------------- /docs/book/api/net/ril/stk.rst: -------------------------------------------------------------------------------- 1 | SIM Toolkit Interface 2 | ===================== 3 | 4 | .. include:: /inc/ril_stk.inc 5 | 6 | -------------------------------------------------------------------------------- /docs/book/api/net/socket.rst: -------------------------------------------------------------------------------- 1 | Logicrom Socket API 2 | =================== 3 | 4 | Application Example 5 | ------------------- 6 | 7 | .. raw:: html 8 | 9 |

TCP Client Socket Example

10 |

SSL Client Socket Example

11 |

SSL Client with client certificates

12 | 13 | .. include:: /inc/sockets.inc 14 | 15 | -------------------------------------------------------------------------------- /docs/book/api/peri/adc.rst: -------------------------------------------------------------------------------- 1 | Analog to Digital Converter 2 | =========================== 3 | 4 | .. |br| raw:: html 5 | 6 |
7 | 8 | There are 10-bit analog ports available on GSM modules based on MT6261 or 9 | MT2503. Input voltage range from 0-2.8v gives digital output of 0-1023. On 10 | RDA8955 based modules, Input voltage range is from 0-1.8v gives digital 11 | output of 0 - 1023. 12 | 13 | However analog ports on NBIoT module are 12-but and input voltage range 14 | from 0-1.4v with digital output of 0-4095. 15 | 16 | Example Usage 17 | ------------- 18 | 19 | .. code-block:: c 20 | 21 | #include 22 | 23 | /* init ADC */ 24 | adc_config(ADC_CH0); 25 | 26 | /* ADC Read raw */ 27 | raw_value = adc_read(ADC_CH0); 28 | 29 | /* ADC Read voltage in millivolts */ 30 | mv_value = adc_read_mv(ADC_CH0); 31 | 32 | Application Example 33 | ------------------- 34 | 35 | .. raw:: html 36 | 37 |

waybyte/example-adc

38 | 39 | 40 | 4G LTE Module ADC Channel Mapping 41 | --------------------------------- 42 | 43 | +--------------+-----------+-----------+----------+----------+----------+----------+ 44 | | ADC Channel | EC600U | EC200U | N58 | N716 | L610 | EG915U | 45 | +==============+===========+===========+==========+==========+==========+==========+ 46 | | ADC CH 0 | Pin 19 | Pin 45 | Pin 89 | Pin 31 | Pin 45 | Pin 24 | 47 | +--------------+-----------+-----------+----------+----------+----------+----------+ 48 | | ADC CH 1 | Pin 20 | Pin 44 | Pin 88 | Pin 30 | Pin 44 | Pin 2 | 49 | +--------------+-----------+-----------+----------+----------+----------+----------+ 50 | | ADC CH 2 | Pin 133 | Pin 43 | -- | -- | Pin 43 | -- | 51 | +--------------+-----------+-----------+----------+----------+----------+----------+ 52 | | ADC CH 3 | Pin 114 | -- | -- | -- | -- | -- | 53 | +--------------+-----------+-----------+----------+----------+----------+----------+ 54 | 55 | 56 | GSM/NB-IoT Module ADC Channel Mapping 57 | ------------------------------------- 58 | 59 | RDA8955 based modules 60 | ^^^^^^^^^^^^^^^^^^^^^ 61 | 62 | +--------------+------------+------------+----------+ 63 | | ADC Channel | M590 Pin | MC65 Pin | A9 Pin | 64 | +==============+============+============+==========+ 65 | | ADC CH 0 | Pin 16 | Pin 6 | Pin 15 | 66 | +--------------+------------+------------+----------+ 67 | | ADC CH 1 | Pin 17 | Pin 47 | Pin 16 | 68 | +--------------+------------+------------+----------+ 69 | 70 | 71 | MT2503/MT6261/MT2625 based modules 72 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 73 | 74 | +--------------+------------------+-----------+-----------------+-----------+------------+------------+ 75 | | ADC Channel | MC20U Pin | M56 Pin | MC60 Pin | M66 Pin | BC20 Pin | SIM868 | 76 | | | | | |br| MC20 Pin | | | Pin | 77 | +==============+==================+===========+=================+===========+============+============+ 78 | | ADC CH 0 | Pin 6 | Pin 61 | Pin 6 | Pin 9 | Pin 6 | Pin 38 | 79 | +--------------+------------------+-----------+-----------------+-----------+------------+------------+ 80 | | ADC CH 1 | Pin 47 | Pin 12 | Pin 47 | Pin 16 | Pin 54 | -- | 81 | +--------------+------------------+-----------+-----------------+-----------+------------+------------+ 82 | | ADC CH 2 | Pin 66 | Pin 3 | Pin 30 | Pin 28 | -- | -- | 83 | +--------------+------------------+-----------+-----------------+-----------+------------+------------+ 84 | | ADC CH 3 | Pin 30 | Pin 2 | Pin 29 | Pin 29 | -- | -- | 85 | +--------------+------------------+-----------+-----------------+-----------+------------+------------+ 86 | | ADC CH 4 | Pin 29 | Pin 13 | -- | -- | -- | -- | 87 | +--------------+------------------+-----------+-----------------+-----------+------------+------------+ 88 | | ADC CH 5 | -- | Pin 33 | -- | -- | -- | -- | 89 | +--------------+------------------+-----------+-----------------+-----------+------------+------------+ 90 | 91 | 92 | .. include:: /inc/adc.inc 93 | 94 | .. note:: Please refer header file for actual number of channels available for respective board. 95 | 96 | .. include:: /inc/def_adc.inc 97 | -------------------------------------------------------------------------------- /docs/book/api/peri/audio.rst: -------------------------------------------------------------------------------- 1 | Audio APIs 2 | ========== 3 | 4 | .. note:: Audio interface is currently only supported on RDA8910 chipset. 5 | 6 | Example Usage 7 | ------------- 8 | 9 | .. code-block:: c 10 | 11 | #include 12 | 13 | /* Play an MP3 file from sdcard */ 14 | audio_file_play("/sd/file.mp3", AUDIO_PLAY_LOCAL, NULL); 15 | 16 | /* Play an MP3 file from sdcard during call */ 17 | audio_file_play("/sd/file.mp3", AUDIO_PLAY_VOICE, NULL); 18 | 19 | /* set volume */ 20 | audio_set_volume(100); 21 | 22 | /* play DTMF tone */ 23 | audio_play_dtmf("1234", 500, false, NULL); 24 | 25 | /* Record from MIC */ 26 | audio_record_start("/fs/record.amr", AUDIO_REC_TYPE_MIC, AUDIO_QUALITY_MEDIUM, 5000, NULL); 27 | 28 | /* Record voice call */ 29 | audio_record_start("/fs/call_record.amr", AUDIO_REC_TYPE_VOICE, AUDIO_QUALITY_MEDIUM, 0, NULL); 30 | 31 | 32 | .. Application Example 33 | .. ------------------- 34 | .. TODO 35 | 36 | API Reference 37 | ------------- 38 | 39 | .. include:: /inc/audio.inc 40 | -------------------------------------------------------------------------------- /docs/book/api/peri/bluetooth.rst: -------------------------------------------------------------------------------- 1 | Bluetooth 2 | ========= 3 | 4 | RDA8910 5 | ------- 6 | 7 | On the RDA8910 chipset, BT 4.2 dual mode is available. However, Logicrom currently only 8 | supports BLE mode of operation as a GATT server and GATT client for connecting other external 9 | BLE devices. 10 | 11 | BLE server can be used either in command line interface mode or as a Bluetooth serial port. 12 | When using in BLE serial port mode, a device file is created with the name ``/dev/blehost0`` 13 | which supports standard IO calls similar to UART. Refer to the :doc:`UART API ` for 14 | more information. 15 | 16 | The SDK offers GATT client interface APIs to facilitate interaction with external BLE devices. 17 | These APIs enable various operations, including: 18 | 19 | - **Search**: Discover available BLE devices in the vicinity. 20 | 21 | - **Find Services**: Identify services offered by the connected BLE device. 22 | 23 | - **Find Characteristics and Descriptors**: Explore specific characteristics and associated descriptors within the discovered services. 24 | 25 | - **Read/Write Characteristic**: Retrieve information from or send data to the identified characteristics. 26 | 27 | BLE API Reference 28 | ----------------- 29 | 30 | .. toctree:: 31 | :maxdepth: 2 32 | 33 | Bluetooth LE 34 | 35 | 36 | MT2503/MT6261 37 | ------------- 38 | 39 | On MediaTek GSM chipset, BT3.0 with EDR can work in BT host and client mode. Currently, only 40 | the SPP profile is supported by the SDK. BT host supports command line interface mode and 41 | BT serial (SPP) mode. In BT serial mode, a device file with the name ``/dev/bthost0`` is 42 | created to use Bluetooth host as a standard UART interface. Refer to the :doc:`UART API ` 43 | for more information. 44 | 45 | For client mode of operation, device files are created under ``/dev/btclient/`` after 46 | Bluetooth device search is performed. The application can initiate pairing, and standard IO operation 47 | can then be performed via system calls. 48 | 49 | 50 | Bluetooth API Reference 51 | ----------------------- 52 | 53 | .. toctree:: 54 | :maxdepth: 2 55 | 56 | Bluetooth Classic 57 | 58 | 59 | .. note:: Some ASR1603 based module has Bluetooth hardware support but it is not currently supported by Logicrom OpenCPU SDK. 60 | 61 | 62 | Example Usage 63 | ------------- 64 | 65 | .. code-block:: c 66 | 67 | #include 68 | 69 | /* 70 | * For 4G Modules 71 | * 72 | * Initialize BT in BLE mode, with CLI enable 73 | */ 74 | bt_device_init(BT_LE, "Custom Name", TRUE); 75 | 76 | /* 77 | * For 2G Modules 78 | * 79 | * Initialize BT in classic mode with CLI enable 80 | */ 81 | bt_device_init(BT_CLASSIC, "Custom Name", TRUE); 82 | -------------------------------------------------------------------------------- /docs/book/api/peri/bt_classic.rst: -------------------------------------------------------------------------------- 1 | Bluetooth Classic Mode API Reference 2 | ==================================== 3 | 4 | .. include:: /inc/bluetooth.inc 5 | 6 | -------------------------------------------------------------------------------- /docs/book/api/peri/bt_le.rst: -------------------------------------------------------------------------------- 1 | Bluetooth LE Mode API Reference 2 | =============================== 3 | 4 | .. include:: /inc/bluetooth_le.inc 5 | 6 | -------------------------------------------------------------------------------- /docs/book/api/peri/display.rst: -------------------------------------------------------------------------------- 1 | Display Driver API 2 | ================== 3 | 4 | .. |br| raw:: html 5 | 6 |
7 | 8 | .. note:: Display driver is currently only available on modules based on RDA8910 and RDA8955. 9 | 10 | Application Example 11 | ------------------- 12 | 13 | .. raw:: html 14 | 15 |

waybyte/example-display

16 | 17 | 18 | API Reference 19 | ------------- 20 | 21 | .. include:: /inc/display.inc 22 | -------------------------------------------------------------------------------- /docs/book/api/peri/gnss/gnss_hardware.rst: -------------------------------------------------------------------------------- 1 | GNSS Hardware API 2 | ================= 3 | 4 | .. note:: For A9G, Neoway N58 and Quectel EC200U-CNAA modules only. 5 | 6 | .. include:: /inc/gnss.inc 7 | -------------------------------------------------------------------------------- /docs/book/api/peri/gnss/gps_driver.rst: -------------------------------------------------------------------------------- 1 | GPS Driver Interface API 2 | ======================== 3 | 4 | .. include:: /inc/gpsdriver.inc 5 | 6 | -------------------------------------------------------------------------------- /docs/book/api/peri/gnss/gps_lib.rst: -------------------------------------------------------------------------------- 1 | GPS Library API 2 | =============== 3 | 4 | Commands 5 | -------- 6 | 7 | GPS library exposes two commands to interact with GPS hardware from console. 8 | 9 | 1. GPSINFO 10 | 11 | This command is to get GPS information. This command responds with Following information: 12 | 13 | | Status: active or inactive status of gps hardware 14 | | Time: parsed Time information from NMEA 15 | | Date: parsed Date information from NMEA 16 | | Fix: GPS fix status, 'A' or 'V' 17 | | Sat: Number of visible satellites 18 | | Speed: Current speed, This is filtered data parameter after processing 19 | | Dir: Heading value (filtered) 20 | | PDOP: Current PDOP value 21 | | HDOP: Current HDOP value 22 | | Lat: Latitude value in degree (filtered) 23 | | Long: Longitude value in degree (filtered) 24 | | Alt: Altitude data (filtered) 25 | | ODO: Odometer in meters (calculated) 26 | 27 | To see the above parameters unfiltered, send "raw" argument to GPSINFO command, e.g.: 28 | 29 | ``gpsinfo=raw`` 30 | 31 | 2. GPSCMD 32 | 33 | Send command to GPS hardware. 34 | 35 | Usage Format: 36 | 37 | ``gpscmd=arg`` 38 | 39 | Arg can be following: 40 | 41 | 1. COLDSTART: send cold start command to GPS hardware. 42 | 2. HOTSTART: send hot start command to GPS hardware. 43 | 3. WARMSTART: send warm start command to GPS hardware. 44 | 45 | It is also possible to send raw command to device in place of argument, e.g.: 46 | 47 | ``gpscmd="PMTK353,1,1,1,0,0"`` 48 | 49 | Please make sure to put raw command inside quotes. There is no need to add $ or checksum, it will be added 50 | based on selected driver. 51 | 52 | 53 | .. include:: /inc/gpslib.inc 54 | 55 | -------------------------------------------------------------------------------- /docs/book/api/peri/gps.rst: -------------------------------------------------------------------------------- 1 | GPS Library 2 | =========== 3 | 4 | Logicrom gps library does all the heavy lifting and makes it easy to use 5 | and interface any GNSS module. Features of gps library: 6 | 7 | * Accurate software odometer 8 | * Motion detection based on GPS data 9 | * No position drift after vehicle stops 10 | * Critical events based on user configuration: 11 | 12 | 1. Harsh Acceleration 13 | 2. Harsh Breaking 14 | 3. Harsh turning/cornering 15 | 4. Over speed 16 | 17 | * Vehicle turn notification 18 | * GPS status notification 19 | 20 | GPS Library also provide ready drivers for well known external modules and on-board 21 | GNSS chips. 22 | 23 | Following are the supported chipset or modules: 24 | 25 | 1. Quectel L89 R2.0 IRNSS Module 26 | 27 | 2. Modules compatible with CASIC GNSS recevier protocol 28 | 29 | * Neoway N58 LTE Cat.1 30 | * Neoway G2 31 | * Neoway G7A 32 | * AT6558 33 | 34 | 3. Mediatek MT333x chipset 35 | 36 | * Quectel L86 37 | * Quectel L76 38 | * Quectel MC60 39 | * Quectel MC20 40 | 41 | 4. SIRF Star III type chipset 42 | 43 | 5. STMicro STA8090 based IRNSS modules 44 | 45 | * Quectel L89 46 | 47 | 6. Unicore UC6226/UC6228 type chipset 48 | 49 | * Quectel L76C 50 | * Quectel L26C 51 | * Quectel BC20 (NB-IoT) 52 | * Quectel EC200UCN-AA LTE Cat.1 Module 53 | * Quectel MC65 54 | * Quectel MC25 55 | 56 | 7. GOKE GK9501 chipset 57 | 58 | * AiThinker A9G 59 | 60 | 61 | Application Example 62 | ------------------- 63 | 64 | .. raw:: html 65 | 66 |

waybyte/example-gps

67 | 68 | 69 | API Reference 70 | ------------- 71 | 72 | .. toctree:: 73 | :maxdepth: 1 74 | 75 | GNSS Hardware 76 | GPS Library 77 | GPS Driver 78 | -------------------------------------------------------------------------------- /docs/book/api/peri/i2c.rst: -------------------------------------------------------------------------------- 1 | I2C 2 | === 3 | .. |br| raw:: html 4 | 5 |
6 | 7 | I2C driver provide access to hardware I2C bus controller and currently only support 8 | bus communication in master mode. 9 | 10 | .. note:: MT2503/MT6261 has a buffer limitation of maximum 8 byte read/write in single 11 | transaction. Writing more than 8 byte require multiple read/write operation. 12 | 13 | I2C Driver Usage 14 | ---------------- 15 | 16 | .. code-block:: c 17 | 18 | #include 19 | 20 | /* initialize I2C port */ 21 | i2c_hw_init(I2C_PORT_0, 100); 22 | 23 | /* i2c write */ 24 | i2c_hw_write(I2C_PORT_0, 0x20, write_buf, length); 25 | 26 | /* i2c read */ 27 | i2c_hw_read(I2C_PORT_0, 0x20, read_buf, length); 28 | 29 | /* i2c write then read */ 30 | i2c_hw_writeread(I2C_PORT_0, 0x20, write_buf, wr_len, read_buf, rd_len); 31 | 32 | /* release i2c bus */ 33 | i2c_hw_free(I2C_PORT_0); 34 | 35 | 36 | Application Example 37 | ------------------- 38 | 39 | .. raw:: html 40 | 41 |

waybyte/example-i2c

42 | 43 | 44 | 4G LTE Module I2C Port Mapping 45 | ------------------------------ 46 | 47 | I2C Port 0 48 | ^^^^^^^^^^ 49 | 50 | +---------+-----------+-----------+----------+----------+----------+----------+ 51 | | I2C Pin | EC600U | EC200U | N58 | N716 | L610 | EG915U | 52 | +=========+===========+===========+==========+==========+==========+==========+ 53 | | SCL | Pin 11 | Pin 41 | Pin 59 | Pin 122 | Pin 41 | Pin 103 | 54 | +---------+-----------+-----------+----------+----------+----------+----------+ 55 | | SDA | Pin 12 | Pin 42 | Pin 58 | Pin 121 | Pin 42 | Pin 114 | 56 | +---------+-----------+-----------+----------+----------+----------+----------+ 57 | 58 | I2C Port 1 59 | ^^^^^^^^^^ 60 | 61 | +---------+-----------+-----------+----------+----------+----------+----------+ 62 | | I2C Pin | EC600U | EC200U | N58 | N716 | L610 | EG915U | 63 | +=========+===========+===========+==========+==========+==========+==========+ 64 | | SCL | Pin 57 | Pin 141 | Pin 82 | Pin 71 | Pin 141 | Pin 40 | 65 | +---------+-----------+-----------+----------+----------+----------+----------+ 66 | | SDA | Pin 56 | Pin 142 | Pin 81 | Pin 70 | Pin 142 | Pin 41 | 67 | +---------+-----------+-----------+----------+----------+----------+----------+ 68 | 69 | 70 | 71 | GSM/NB-IoT Module I2C Port Mapping 72 | ---------------------------------- 73 | 74 | RDA8955 based modules provide two I2C ports. Following is the pin mapping: 75 | 76 | I2C Port 0 77 | ^^^^^^^^^^ 78 | 79 | +---------+------------+------------+----------+ 80 | | I2C Pin | M590 Pin | MC65 Pin | A9 Pin | 81 | +=========+============+============+==========+ 82 | | SCL | Pin 23 | Pin 56 | Pin 1 | 83 | +---------+------------+------------+----------+ 84 | | SDA | Pin 24 | Pin 65 | Pin 2 | 85 | +---------+------------+------------+----------+ 86 | 87 | I2C Port 1 88 | ^^^^^^^^^^ 89 | 90 | +---------+----------+----------+--------+ 91 | | I2C Pin | M590 Pin | MC65 Pin | A9 Pin | 92 | +=========+==========+==========+========+ 93 | | SCL | Pin 60 | Pin 35 | Pin 48 | 94 | +---------+----------+----------+--------+ 95 | | SDA | Pin 61 | Pin 36 | Pin 47 | 96 | +---------+----------+----------+--------+ 97 | 98 | 99 | GSM (MT2503, MT6261) and NB-IoT (MT2625) chipset supported modules expose only one 100 | I2C port. Following is the pin mapping for SCL and SDA: 101 | 102 | +---------+-----------+-------------------+-----------+------------+------------+ 103 | | I2C Pin | M56 Pin | MC60 Pin | M66 Pin | BC20 Pin | SIM868 | 104 | | | | |br| MC20(U) Pin | | | Pin | 105 | +=========+===========+===================+===========+============+============+ 106 | | SCL | Pin 24 | Pin 35 | Pin 20 | Pin 58 | Pin 65 | 107 | +---------+-----------+-------------------+-----------+------------+------------+ 108 | | SDA | Pin 23 | Pin 36 | Pin 21 | Pin 63 | Pin 64 | 109 | +---------+-----------+-------------------+-----------+------------+------------+ 110 | 111 | 112 | API Reference 113 | ------------- 114 | 115 | .. include:: /inc/i2c.inc 116 | .. include:: /inc/def_i2c.inc 117 | 118 | -------------------------------------------------------------------------------- /docs/book/api/peri/imu.rst: -------------------------------------------------------------------------------- 1 | IMU Sensor Fusion Interface 2 | =========================== 3 | 4 | Logicrom provides simple sensor fusion library to enable use of accelerometer 5 | and gyroscope sensor. This library can be very helpful in vehicle telematics 6 | to detect events like motion detect, harsh break, harsh acceleration etc. 7 | 8 | API Reference 9 | ------------- 10 | 11 | .. include:: /inc/imu_sensor.inc 12 | 13 | -------------------------------------------------------------------------------- /docs/book/api/peri/index.rst: -------------------------------------------------------------------------------- 1 | Peripherals 2 | =========== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ADC 8 | Audio