├── .clang-format ├── .gitmodules ├── .idea ├── .gitignore ├── .name ├── PicoXTools.iml ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── README.zh.md ├── apps ├── ctr_gpio.c ├── gpio.c ├── gpio_.c ├── lcd.c ├── picprobe │ ├── .DS_Store │ ├── CMakeLists.txt │ ├── include │ │ ├── DAP_config.h │ │ ├── board_debugprobe_config.h │ │ ├── board_example_config.h │ │ └── board_pico_config.h │ ├── readme.md │ └── src │ │ ├── FreeRTOSConfig.h │ │ ├── cdc_uart.c │ │ ├── cdc_uart.h │ │ ├── get_serial.c │ │ ├── get_serial.h │ │ ├── led.c │ │ ├── led.h │ │ ├── main.c │ │ ├── picoprobe_config.h │ │ ├── probe.c │ │ ├── probe.h │ │ ├── probe.pio │ │ ├── probe_oen.pio │ │ ├── sw_dp_pio.c │ │ ├── tusb_config.h │ │ └── usb_descriptors.c └── pwm.c ├── components ├── .DS_Store ├── flashio │ ├── CMakeLists.txt │ └── io.c ├── lr11xx │ ├── .DS_Store │ ├── apps │ │ ├── cad │ │ │ ├── MDK-ARM │ │ │ │ └── lr11xx-sdk_cad.uvprojx │ │ │ ├── README.md │ │ │ ├── main_cad.c │ │ │ ├── main_cad.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── gnss │ │ │ ├── README.md │ │ │ ├── gnss_assisted │ │ │ │ ├── MDK-ARM │ │ │ │ │ └── lr11xx-sdk_gnss_assisted.uvprojx │ │ │ │ ├── gnss_assisted.c │ │ │ │ ├── host.py │ │ │ │ ├── makefile │ │ │ │ │ └── Makefile │ │ │ │ ├── ring_buffer.c │ │ │ │ ├── ring_buffer.h │ │ │ │ ├── utils_stm32l4.c │ │ │ │ └── utils_stm32l4.h │ │ │ ├── gnss_autonomous │ │ │ │ ├── MDK-ARM │ │ │ │ │ └── lr11xx-sdk_gnss_autonomous.uvprojx │ │ │ │ ├── gnss_autonomous.c │ │ │ │ └── makefile │ │ │ │ │ └── Makefile │ │ │ ├── gnss_example_api.h │ │ │ ├── main_gnss.c │ │ │ └── main_gnss.h │ │ ├── per │ │ │ ├── MDK-ARM │ │ │ │ └── lr11xx-sdk_per.uvprojx │ │ │ ├── README.md │ │ │ ├── main_per.c │ │ │ ├── main_per.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── ping_pong │ │ │ ├── MDK-ARM │ │ │ │ └── lr11xx-sdk_ping_pong.uvprojx │ │ │ ├── README.md │ │ │ ├── main_ping_pong.c │ │ │ ├── main_ping_pong.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── spectral_scan │ │ │ ├── MDK-ARM │ │ │ │ └── lr11xx-sdk_spectral_scan.uvprojx │ │ │ ├── README.md │ │ │ ├── main_spectral_scan.c │ │ │ ├── main_spectral_scan.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── spectrum_display │ │ │ ├── MDK-ARM │ │ │ │ └── lr11xx-sdk_spectrum_display.uvprojx │ │ │ ├── README.md │ │ │ ├── curve_plot │ │ │ │ ├── curve_plot.c │ │ │ │ └── curve_plot.h │ │ │ ├── main_spectrum_display.c │ │ │ ├── main_spectrum_display.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── tx_cw │ │ │ ├── MDK-ARM │ │ │ │ └── lr11xx-sdk_tx_cw.uvprojx │ │ │ ├── README.md │ │ │ ├── main_tx_cw.c │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── tx_infinite_preamble │ │ │ ├── MDK-ARM │ │ │ │ └── lr11xx-sdk_tx_infinite_preamble.uvprojx │ │ │ ├── README.md │ │ │ ├── main_tx_infinite_preamble.c │ │ │ └── makefile │ │ │ │ └── Makefile │ │ └── wifi │ │ │ ├── MDK-ARM │ │ │ └── lr11xx-sdk_wifi.uvprojx │ │ │ ├── README.md │ │ │ ├── main_wifi.c │ │ │ ├── main_wifi.h │ │ │ ├── makefile │ │ │ └── Makefile │ │ │ ├── wifi_configuration_base.h │ │ │ ├── wifi_result_printers.c │ │ │ ├── wifi_result_printers.h │ │ │ ├── wifi_scan │ │ │ ├── wifi_scan.c │ │ │ └── wifi_scan.h │ │ │ ├── wifi_scan_country_code │ │ │ ├── wifi_scan_country_code.c │ │ │ └── wifi_scan_country_code.h │ │ │ ├── wifi_scan_country_code_time_limit │ │ │ ├── wifi_scan_country_code_time_limit.c │ │ │ └── wifi_scan_country_code_time_limit.h │ │ │ └── wifi_scan_time_limit │ │ │ ├── wifi_scan_time_limit.c │ │ │ └── wifi_scan_time_limit.h │ └── common │ │ ├── README.md │ │ ├── apps_common.c │ │ ├── apps_common.h │ │ ├── apps_common.mk │ │ ├── apps_configuration.h │ │ ├── apps_utilities.h │ │ ├── apps_version.c │ │ ├── apps_version.h │ │ ├── lr11xx_hal.c │ │ ├── lr11xx_hal_context.h │ │ └── printers │ │ ├── lr11xx_bootloader_types_str.c │ │ ├── lr11xx_bootloader_types_str.h │ │ ├── lr11xx_crypto_engine_types_str.c │ │ ├── lr11xx_crypto_engine_types_str.h │ │ ├── lr11xx_gnss_types_str.c │ │ ├── lr11xx_gnss_types_str.h │ │ ├── lr11xx_radio_types_str.c │ │ ├── lr11xx_radio_types_str.h │ │ ├── lr11xx_system_types_str.c │ │ ├── lr11xx_system_types_str.h │ │ ├── lr11xx_types_str.c │ │ ├── lr11xx_types_str.h │ │ ├── lr11xx_wifi_types_str.c │ │ ├── lr11xx_wifi_types_str.h │ │ ├── lr_fhss_v1_base_types_str.c │ │ ├── lr_fhss_v1_base_types_str.h │ │ └── printers.mk ├── lr11xx_driver │ ├── .DS_Store │ ├── CHANGELOG.md │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── README.md │ ├── lr11xx_bootloader.c │ ├── lr11xx_bootloader.h │ ├── lr11xx_bootloader_types.h │ ├── lr11xx_crypto_engine.c │ ├── lr11xx_crypto_engine.h │ ├── lr11xx_crypto_engine_types.h │ ├── lr11xx_driver_module.cmake │ ├── lr11xx_driver_version.c │ ├── lr11xx_driver_version.h │ ├── lr11xx_gnss.c │ ├── lr11xx_gnss.h │ ├── lr11xx_gnss_types.h │ ├── lr11xx_hal.h │ ├── lr11xx_lr_fhss.c │ ├── lr11xx_lr_fhss.h │ ├── lr11xx_lr_fhss_types.h │ ├── lr11xx_radio.c │ ├── lr11xx_radio.h │ ├── lr11xx_radio_timings.c │ ├── lr11xx_radio_timings.h │ ├── lr11xx_radio_types.h │ ├── lr11xx_regmem.c │ ├── lr11xx_regmem.h │ ├── lr11xx_system.c │ ├── lr11xx_system.h │ ├── lr11xx_system_types.h │ ├── lr11xx_types.h │ ├── lr11xx_wifi.c │ ├── lr11xx_wifi.h │ ├── lr11xx_wifi_types.h │ └── lr_fhss_v1_base_types.h ├── sdio │ ├── CMakeLists.txt │ ├── io.c │ ├── sd_spi.c │ └── sd_spi.h ├── st7735_80x160 │ ├── CMakeLists.txt │ ├── iconfont.h │ ├── lcd.c │ ├── lcd.h │ ├── my_lcd.c │ ├── my_lcd.h │ └── oledfont.h ├── sx126x │ ├── .DS_Store │ ├── apps │ │ ├── cad │ │ │ ├── MDK-ARM │ │ │ │ └── sx126x-sdk_cad.uvprojx │ │ │ ├── README.md │ │ │ ├── main_cad.c │ │ │ ├── main_cad.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── per │ │ │ ├── MDK-ARM │ │ │ │ └── sx126x-sdk_per.uvprojx │ │ │ ├── README.md │ │ │ ├── main_per.c │ │ │ ├── main_per.h │ │ │ └── makefile │ │ │ │ ├── Makefile │ │ │ │ └── build_and_flash.sh │ │ ├── ping_pong │ │ │ ├── MDK-ARM │ │ │ │ └── sx126x-sdk_ping_pong.uvprojx │ │ │ ├── README.md │ │ │ ├── main_ping_pong.c │ │ │ ├── main_ping_pong.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── spectral_scan │ │ │ ├── MDK-ARM │ │ │ │ └── sx126x-sdk_spectral_scan.uvprojx │ │ │ ├── README.md │ │ │ ├── main_spectral_scan.c │ │ │ ├── main_spectral_scan.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── spectrum_display │ │ │ ├── MDK-ARM │ │ │ │ └── sx126x-sdk_spectrum_display.uvprojx │ │ │ ├── README.md │ │ │ ├── curve_plot │ │ │ │ ├── curve_plot.c │ │ │ │ └── curve_plot.h │ │ │ ├── main_spectrum_display.c │ │ │ ├── main_spectrum_display.h │ │ │ └── makefile │ │ │ │ └── Makefile │ │ ├── tx_cw │ │ │ ├── MDK-ARM │ │ │ │ └── sx126x-sdk_tx_cw.uvprojx │ │ │ ├── README.md │ │ │ ├── main_tx_cw.c │ │ │ └── makefile │ │ │ │ └── Makefile │ │ └── tx_infinite_preamble │ │ │ ├── MDK-ARM │ │ │ └── sx126x-sdk_tx_infinite_preamble.uvprojx │ │ │ ├── README.md │ │ │ ├── main_tx_infinite_preamble.c │ │ │ └── makefile │ │ │ └── Makefile │ └── common │ │ ├── README.md │ │ ├── apps_common.c │ │ ├── apps_common.h │ │ ├── apps_common.mk │ │ ├── apps_configuration.h │ │ ├── apps_utilities.h │ │ ├── printers │ │ ├── printers.mk │ │ ├── sx126x_str.c │ │ └── sx126x_str.h │ │ ├── sx126x_hal.c │ │ └── sx126x_hal_context.h └── sx126x_driver │ ├── .DS_Store │ ├── CHANGELOG.md │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── README.md │ ├── lr_fhss_mac.c │ ├── lr_fhss_mac.h │ ├── lr_fhss_v1_base_types.h │ ├── sx126x.c │ ├── sx126x.h │ ├── sx126x_hal.h │ ├── sx126x_lr_fhss.c │ ├── sx126x_lr_fhss.h │ └── sx126x_regs.h ├── config ├── FreeRTOSConfig.h ├── picoprobe_config.h └── tusb_config.h ├── docs ├── FUNCTIONS.md ├── GETTING-STARTED.md ├── GPIO.md ├── JtagArm20Adapter_top.png ├── JtagArmtop.png ├── PicoXTools.png ├── PicoXTools2.png ├── WHATSNEW.md ├── Xfunctions.png ├── cli_cmds.png ├── cmsis_dap.md ├── howto.md ├── images │ ├── clion_en_rtos.jpg │ ├── clion_freertos_info.jpg │ ├── multi_stack.jpg │ ├── vscode_freertos_info.jpg │ ├── vscode_freertos_info2.jpg │ └── 未命名.jpg ├── pinout.png ├── qq_group.jpg ├── realboard.png ├── shell_vi_cc_demo.mp4 ├── web_server.png └── weixin_number.jpg ├── releases └── PicoXTools_uart.elf ├── src ├── .DS_Store ├── bsp │ ├── bsp.h │ ├── tty_uart.c │ ├── tty_uart.h │ └── tty_uart_cc265x.h ├── common │ ├── base_def.h │ ├── ringbuffer.c │ ├── ringbuffer.h │ ├── tty.c │ └── tty.h ├── io.h ├── main.c ├── oled │ ├── raspberry26x32.h │ ├── sh1107_oled.c │ └── ssd1306_font.h ├── pio.h ├── pshell.ld ├── readline │ ├── readln.c │ └── readln.h ├── rtos_hook.c ├── shell │ ├── cmd_list.h │ ├── cmds │ │ ├── cc │ │ │ ├── cc.c │ │ │ ├── cc.h │ │ │ ├── cc_defs.h │ │ │ ├── cc_extrns.h │ │ │ ├── cc_malloc.c │ │ │ ├── cc_malloc.h │ │ │ ├── cc_nops.h │ │ │ ├── cc_ops.h │ │ │ ├── cc_printf.S │ │ │ └── cc_tokns.h │ │ ├── tar.c │ │ ├── tar.h │ │ ├── vi.c │ │ ├── vi.h │ │ ├── xmodem.c │ │ ├── xmodem.h │ │ ├── ymodem.c │ │ └── ymodem.h │ ├── fs_cmd.c │ ├── shell.c │ └── shell.h ├── tests.c ├── tests.h └── utils │ ├── crc16.c │ ├── crc16.h │ ├── db_list.c │ └── db_list.h └── submodule ├── disassembler └── CMakeLists.txt └── littlefs └── CMakeLists.txt /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | # We'll use defaults from the LLVM style, 3 | # but with 4 columns indentation. 4 | BasedOnStyle: LLVM 5 | IndentWidth: 4 6 | --- 7 | Language: Cpp 8 | # Force pointers to the type for C++. 9 | DerivePointerAlignment: false 10 | PointerAlignment: Left 11 | IndentCaseLabels: false 12 | Standard: Cpp11 13 | TabWidth: 4 14 | UseTab: Never 15 | ColumnLimit: 100 16 | ReflowComments: true 17 | SortIncludes: true 18 | MaxEmptyLinesToKeep: 1 19 | --- 20 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "submodule/littlefs/module"] 2 | path = submodule/littlefs/module 3 | url = https://github.com/littlefs-project/littlefs.git 4 | [submodule "submodule/disassembler/module"] 5 | path = submodule/disassembler/module 6 | url = https://github.com/compuphase/ARM-disassembler.git 7 | [submodule "submodule/freertos"] 8 | path = submodule/freertos 9 | url = https://github.com/FreeRTOS/FreeRTOS-Kernel 10 | [submodule "submodule/CMSIS_5"] 11 | path = submodule/CMSIS_5 12 | url = https://github.com/ARM-software/CMSIS_5 13 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # 默认忽略的文件 2 | /shelf/ 3 | /workspace.xml 4 | # 基于编辑器的 HTTP 客户端请求 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | PicoXTools_uart -------------------------------------------------------------------------------- /.idea/PicoXTools.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /apps/gpio.c: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bright on 2023/5/17. 3 | // 4 | /* SDK GPIO interface test. Blink the default LED. */ 5 | 6 | int main() { 7 | int led_pin = PICO_DEFAULT_LED_PIN; 8 | int tic = 1; 9 | int sel_0 = 10; 10 | int sel_1 = 11; 11 | int sel_2 = 12; 12 | int led_a = 16; 13 | int led_b = 17; 14 | int led_c = 18; 15 | int led_d = 19; 16 | 17 | 18 | gpio_init_mask(1< 27 | #include "pico.h" 28 | #include "pico/unique_id.h" 29 | #include "get_serial.h" 30 | 31 | /* C string for iSerialNumber in USB Device Descriptor, two chars per byte + terminating NUL */ 32 | char usb_serial[PICO_UNIQUE_BOARD_ID_SIZE_BYTES * 2 + 1]; 33 | 34 | /* Why a uint8_t[8] array inside a struct instead of an uint64_t an inquiring mind might wonder */ 35 | static pico_unique_board_id_t uID; 36 | 37 | void usb_serial_init(void) 38 | { 39 | pico_get_unique_board_id(&uID); 40 | 41 | for (int i = 0; i < PICO_UNIQUE_BOARD_ID_SIZE_BYTES * 2; i++) 42 | { 43 | /* Byte index inside the uid array */ 44 | int bi = i / 2; 45 | /* Use high nibble first to keep memory order (just cosmetics) */ 46 | uint8_t nibble = (uID.id[bi] >> 4) & 0x0F; 47 | uID.id[bi] <<= 4; 48 | /* Binary to hex digit */ 49 | usb_serial[i] = nibble < 10 ? nibble + '0' : nibble + 'A' - 10; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /apps/picprobe/src/get_serial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2021 Federico Zuccardi Merli 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef GET_SERIAL_H_ 27 | #define GET_SERIAL_H_ 28 | 29 | /* Contains unique serial number string (NUL terminated) after call to init_usb_serial */ 30 | extern char usb_serial[]; 31 | 32 | /* Fills unique_serial with the flash unique id */ 33 | extern void usb_serial_init(void); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /apps/picprobe/src/led.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2021 a-pushkin on GitHub 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "picoprobe_config.h" 30 | 31 | void led_init(void) { 32 | #ifdef PICOPROBE_USB_CONNECTED_LED 33 | gpio_init(PICOPROBE_USB_CONNECTED_LED); 34 | gpio_set_dir(PICOPROBE_USB_CONNECTED_LED, GPIO_OUT); 35 | #endif 36 | #ifdef PICOPROBE_DAP_CONNECTED_LED 37 | gpio_init(PICOPROBE_DAP_CONNECTED_LED); 38 | gpio_set_dir(PICOPROBE_DAP_CONNECTED_LED, GPIO_OUT); 39 | #endif 40 | #ifdef PICOPROBE_DAP_RUNNING_LED 41 | gpio_init(PICOPROBE_DAP_RUNNING_LED); 42 | gpio_set_dir(PICOPROBE_DAP_RUNNING_LED, GPIO_OUT); 43 | #endif 44 | #ifdef PICOPROBE_UART_RX_LED 45 | gpio_init(PICOPROBE_UART_RX_LED); 46 | gpio_set_dir(PICOPROBE_UART_RX_LED, GPIO_OUT); 47 | #endif 48 | #ifdef PICOPROBE_UART_TX_LED 49 | gpio_init(PICOPROBE_UART_TX_LED); 50 | gpio_set_dir(PICOPROBE_UART_TX_LED, GPIO_OUT); 51 | #endif 52 | } 53 | -------------------------------------------------------------------------------- /apps/picprobe/src/led.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2021 a-pushkin on GitHub 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef LED_H 27 | #define LED_H 28 | 29 | void led_init(void); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /apps/picprobe/src/picoprobe_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef PICOPROBE_H_ 27 | #define PICOPROBE_H_ 28 | 29 | #if false 30 | #define picoprobe_info(format,args...) printf(format, ## args) 31 | #else 32 | #define picoprobe_info(format,...) ((void)0) 33 | #endif 34 | 35 | 36 | #if false 37 | #define picoprobe_debug(format,args...) printf(format, ## args) 38 | #else 39 | #define picoprobe_debug(format,...) ((void)0) 40 | #endif 41 | 42 | #if false 43 | #define picoprobe_dump(format,args...) printf(format, ## args) 44 | #else 45 | #define picoprobe_dump(format,...) ((void)0) 46 | #endif 47 | 48 | // TODO tie this up with PICO_BOARD defines in the main SDK 49 | 50 | #include "board_pico_config.h" 51 | //#include "board_debugprobe_config.h" 52 | //#include "board_example_config.h" 53 | 54 | 55 | #define PROTO_DAP_V1 1 56 | #define PROTO_DAP_V2 2 57 | 58 | // Interface config 59 | #ifndef PICOPROBE_DEBUG_PROTOCOL 60 | #define PICOPROBE_DEBUG_PROTOCOL PROTO_DAP_V2 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /apps/picprobe/src/probe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef PROBE_H_ 27 | #define PROBE_H_ 28 | 29 | #if defined(PROBE_IO_RAW) || defined(PROBE_IO_SWDI) 30 | #include "probe.pio.h" 31 | #endif 32 | 33 | #if defined(PROBE_IO_OEN) 34 | #include "probe_oen.pio.h" 35 | #endif 36 | 37 | void probe_set_swclk_freq(uint freq_khz); 38 | 39 | // Bit counts in the range 1..256 40 | void probe_write_bits(uint bit_count, uint32_t data_byte); 41 | uint32_t probe_read_bits(uint bit_count); 42 | void probe_hiz_clocks(uint bit_count); 43 | 44 | void probe_read_mode(void); 45 | void probe_write_mode(void); 46 | 47 | void probe_init(void); 48 | void probe_deinit(void); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /apps/picprobe/src/probe_oen.pio: -------------------------------------------------------------------------------- 1 | ; Output-enable active-low variant of the SWD probe 2 | 3 | ; This program is very similar to the one in probe.pio. The only difference is 4 | ; that here write_cmd and turnaround_cmd are split into two separate routines, 5 | ; whose difference is OEn being high/low. 6 | 7 | ; SWDIO_OEn is pin 0, SWCLK pin 1, SWDIO (out) pin 2, SWDI (in) pin 3. 8 | ; Pin 0 and 1 are sideset pins 9 | 10 | .program probe 11 | .side_set 2 opt 12 | 13 | public turnaround_cmd: 14 | pull 15 | turnaround_bitloop: 16 | nop [1] side 0x1 17 | jmp x-- turnaround_bitloop [1] side 0x3 18 | jmp get_next_cmd 19 | 20 | public write_cmd: 21 | pull 22 | write_bitloop: 23 | out pins, 1 [1] side 0x0 ; Data is output by host on negedge 24 | jmp x-- write_bitloop [1] side 0x2 ; ...and captured by target on posedge 25 | ; Fall through to next command 26 | .wrap_target 27 | public get_next_cmd: 28 | pull side 0x1 ; SWCLK initially low, OEn disabled 29 | out x, 8 ; Get bit count 30 | out pindirs, 1 ; Set SWDIO direction 31 | out pc, 5 ; Go to command routine 32 | 33 | read_bitloop: 34 | nop ; Additional delay on taken loop branch 35 | public read_cmd: 36 | in pins, 1 [1] side 0x3 ; Data is captured by host on posedge 37 | jmp x-- read_bitloop side 0x1 38 | push 39 | .wrap ; Wrap to next command 40 | 41 | 42 | ; Implement probe_gpio_init() and probe_sm_init() methods here - set pins, offsets, sidesets etc 43 | % c-sdk { 44 | 45 | static inline void probe_gpio_init() 46 | { 47 | #if defined(PROBE_PIN_RESET) 48 | // Target reset pin: pull up, input to emulate open drain pin 49 | gpio_pull_up(PROBE_PIN_RESET); 50 | // gpio_init will leave the pin cleared and set as input 51 | gpio_init(PROBE_PIN_RESET); 52 | #endif 53 | // Funcsel pins 54 | pio_gpio_init(pio0, PROBE_PIN_SWDIOEN); 55 | pio_gpio_init(pio0, PROBE_PIN_SWCLK); 56 | pio_gpio_init(pio0, PROBE_PIN_SWDIO); 57 | 58 | // Make sure SWDIO has a pullup on it. Idle state is high 59 | gpio_pull_up(PROBE_PIN_SWDIO); 60 | gpio_pull_up(PROBE_PIN_SWDIOEN); 61 | } 62 | 63 | static inline void probe_sm_init(pio_sm_config* sm_config) { 64 | 65 | // Set SWDIOEN and SWCLK as sideset pins 66 | sm_config_set_sideset_pins(sm_config, PROBE_PIN_SWDIOEN); 67 | 68 | // Set SWDIO offset 69 | sm_config_set_out_pins(sm_config, PROBE_PIN_SWDIO, 1); 70 | sm_config_set_set_pins(sm_config, PROBE_PIN_SWDIO, 1); 71 | sm_config_set_in_pins(sm_config, PROBE_PIN_SWDI); 72 | 73 | // Set SWDIOEN, SWD and SWDIO pins as output to start. This will be set in the sm 74 | pio_sm_set_consecutive_pindirs(pio0, PROBE_SM, PROBE_PIN_OFFSET, 3, true); 75 | 76 | // shift output right, autopull off, autopull threshold 77 | sm_config_set_out_shift(sm_config, true, false, 0); 78 | // shift input right as swd data is lsb first, autopush off 79 | sm_config_set_in_shift(sm_config, true, false, 0); 80 | } 81 | 82 | %} 83 | -------------------------------------------------------------------------------- /apps/picprobe/src/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 43 | 44 | #ifndef CFG_TUSB_OS 45 | #define CFG_TUSB_OS OPT_OS_PICO 46 | #endif 47 | 48 | #ifndef CFG_TUSB_MEM_SECTION 49 | #define CFG_TUSB_MEM_SECTION 50 | #endif 51 | 52 | #ifndef CFG_TUSB_MEM_ALIGN 53 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 54 | #endif 55 | 56 | //-------------------------------------------------------------------- 57 | // DEVICE CONFIGURATION 58 | //-------------------------------------------------------------------- 59 | 60 | #ifndef CFG_TUD_ENDPOINT0_SIZE 61 | #define CFG_TUD_ENDPOINT0_SIZE 64 62 | #endif 63 | 64 | //------------- CLASS -------------// 65 | #define CFG_TUD_HID 1 66 | #define CFG_TUD_CDC 1 67 | #define CFG_TUD_MSC 0 68 | #define CFG_TUD_MIDI 0 69 | #define CFG_TUD_VENDOR 1 70 | 71 | #define CFG_TUD_CDC_RX_BUFSIZE 64 72 | #define CFG_TUD_CDC_TX_BUFSIZE 64 73 | 74 | #define CFG_TUD_VENDOR_RX_BUFSIZE 8192 75 | #define CFG_TUD_VENDOR_TX_BUFSIZE 8192 76 | 77 | #ifndef TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX 78 | #define TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX 1 79 | #endif 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /* _TUSB_CONFIG_H_ */ 86 | -------------------------------------------------------------------------------- /apps/pwm.c: -------------------------------------------------------------------------------- 1 | 2 | #define PWM_PIN_A 8 3 | #define PWM_PIN_B 9 4 | int main() { 5 | gpio_set_function(PWM_PIN_A, GPIO_FUNC_PWM); 6 | gpio_set_function(PWM_PIN_B, GPIO_FUNC_PWM); 7 | // Find out which PWM slice is connected to GPIO 0 (it's slice 0) 8 | uint slice_num = pwm_gpio_to_slice_num(PWM_PIN_A); 9 | 10 | float div = 4.0; 11 | 12 | // Set period of 4 cycles (0 to 3 inclusive) 13 | pwm_set_wrap(slice_num, 3); 14 | // Set channel A output high for one cycle before dropping 15 | pwm_set_chan_level(slice_num, PWM_CHAN_A, 1); 16 | // Set initial B output high for three cycles before dropping 17 | pwm_set_chan_level(slice_num, PWM_CHAN_B, 3); 18 | // Set the PWM running 19 | pwm_set_enabled(slice_num, true); 20 | 21 | while (1) { 22 | int char_v = getchar_timeout_us(0); 23 | if (char_v == 3) break; 24 | if(char_v =='a') {div +=1.0;pwm_set_clkdiv(slice_num,div); 25 | if(char_v =='b') {div -=1.0;pwm_set_clkdiv(slice_num,div); 26 | sleep_ms(500); 27 | } 28 | } -------------------------------------------------------------------------------- /components/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/components/.DS_Store -------------------------------------------------------------------------------- /components/flashio/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(io INTERFACE) 2 | target_include_directories(io INTERFACE ${CMAKE_CURRENT_LIST_DIR}) 3 | target_sources(io INTERFACE 4 | io.c 5 | ) 6 | -------------------------------------------------------------------------------- /components/lr11xx/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/components/lr11xx/.DS_Store -------------------------------------------------------------------------------- /components/lr11xx/apps/cad/README.md: -------------------------------------------------------------------------------- 1 | # LR11XX SDK CAD sample code 2 | 3 | ## Description 4 | 5 | The chip performs the CAD operation in LoRa. Define macro `PACKET_TYPE` to `LR1110_RADIO_PKT_TYPE_LORA` (in file [`../../common/apps_configuration.h`](../../common/apps_configuration.h)) to use this sample code. 6 | 7 | In CAD test, there are 3 kinds of exit mode that can be defined for different use cases. For `CAD_ONLY` mode, once done and whatever the activity on the channel, the chip goes back to STBY_RC mode. For `CAD_RX` mode, if an activity is detected, it stays in RX until a packet is detected or the timer reaches the timeout defined by `CAD_TIMOUT_MS`. For `CAD_LBT` mode, if no activity is detected, it goes to tx mode. This mode is actually a substitue of tx mode, so payload data for transmitting should be preloaded before setting the chip to `CAD_LBT` mode. 8 | 9 | ## Configuration 10 | 11 | Several parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file, refer to [`../../common/README.md`](../../common/README.md) for more details. 12 | 13 | Several parameters can be updated in [`main_cad.h`](main_cad.h) header file: 14 | 15 | | Constant | Comments | 16 | | ----------------- | ----------------------------------------------------------------------------- | 17 | | `CAD_SYMBOL_NUM` | Defines the number of symbols used for the CAD detection | 18 | | `CAD_DETECT_PEAK` | Define the sensitivity of the LoRa modem when trying to correlate to symbols | 19 | | `CAD_DETECT_MIN` | Minimum peak value, meant to filter out case with almost no signal or noise. | 20 | | `CAD_EXIT_MODE` | Defines the action to be performed after a CAD operation | 21 | | `CAD_TIMOUT_MS` | Only used when the CAD is performed with CAD_EXIT_MODE = CAD_RX or CAD_LBT | 22 | -------------------------------------------------------------------------------- /components/lr11xx/apps/gnss/gnss_assisted/host.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from serial import Serial 3 | 4 | 5 | class GnssDateLocBuilder: 6 | EPOCH_TIME = datetime.datetime(1980, 1, 6) 7 | 8 | def __init__(self): 9 | pass 10 | 11 | @staticmethod 12 | def get_delay_due_to_leap_second(): 13 | """Return the delay due to leap second at the time of writing this function...""" 14 | return datetime.timedelta(seconds=18) 15 | 16 | @staticmethod 17 | def date_to_gps_format(date): 18 | delta_since_epoch = date - GnssDateLocBuilder.EPOCH_TIME 19 | return int(delta_since_epoch.total_seconds()) 20 | 21 | @staticmethod 22 | def get_now_gps(): 23 | today = ( 24 | datetime.datetime.utcnow() 25 | + GnssDateLocBuilder.get_delay_due_to_leap_second() 26 | ) 27 | gps_seconds = GnssDateLocBuilder.date_to_gps_format(today) 28 | return gps_seconds 29 | 30 | 31 | if __name__ == "__main__": 32 | from argparse import ArgumentParser 33 | 34 | parser = ArgumentParser() 35 | parser.add_argument( 36 | "port", 37 | help="Virtual COM port where the device is connected", 38 | ) 39 | args = parser.parse_args() 40 | with Serial(args.port, 921600, timeout=1, write_timeout=0) as ser: 41 | date_gps = GnssDateLocBuilder.get_now_gps() 42 | ser.write(f"{date_gps}\n".encode("UTF-8")) 43 | while True: 44 | line = ser.readline().decode("UTF-8") 45 | if line: 46 | print(line, end="") 47 | -------------------------------------------------------------------------------- /components/lr11xx/apps/gnss/gnss_assisted/ring_buffer.c: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file ring_buffer.c 3 | * 4 | * @brief Ring buffer implementation 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #include 36 | #include 37 | 38 | #define MAX_INTERRUPT_FILLED_BUFFER_LENGTH ( 512 ) 39 | volatile static int interrupt_filled_buffer[MAX_INTERRUPT_FILLED_BUFFER_LENGTH] = { }; 40 | volatile static uint16_t index_head = 0; 41 | volatile static uint16_t index_tail = 0; 42 | volatile static bool buffer_overrun = false; 43 | static bool is_enabled = false; 44 | 45 | void ring_buffer_enable( void ) 46 | { 47 | is_enabled = true; 48 | } 49 | 50 | void ring_buffer_disable( void ) 51 | { 52 | is_enabled = false; 53 | } 54 | 55 | bool has_buffer_overrun( ) 56 | { 57 | return buffer_overrun; 58 | } 59 | 60 | void reset_buffer_overrun_flag( ) 61 | { 62 | buffer_overrun = false; 63 | } 64 | 65 | bool append_to_interrupt_buffer( int _char ) 66 | { 67 | if( is_enabled == false ) 68 | { 69 | // If the ring buffer is disabled, attempt to push data is discarded 70 | return false; 71 | } 72 | const uint16_t next_head_index = ( index_head + 1 ) % MAX_INTERRUPT_FILLED_BUFFER_LENGTH; 73 | if( next_head_index != index_tail ) 74 | { 75 | index_head = next_head_index; 76 | interrupt_filled_buffer[index_head] = _char; 77 | return true; 78 | } 79 | else 80 | { 81 | buffer_overrun = true; 82 | return false; 83 | } 84 | } 85 | 86 | bool pop_from_interrupt_buffer( int* _char ) 87 | { 88 | if( index_head != index_tail ) 89 | { 90 | index_tail = ( index_tail + 1 ) % MAX_INTERRUPT_FILLED_BUFFER_LENGTH; 91 | *_char = interrupt_filled_buffer[index_tail]; 92 | return true; 93 | } 94 | else 95 | { 96 | return false; 97 | } 98 | } -------------------------------------------------------------------------------- /components/lr11xx/apps/gnss/gnss_example_api.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file gnss_example_api.h 3 | * 4 | * @brief GNSS Example API scan example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef GNSS_EXAMPLE_API_H 36 | #define GNSS_EXAMPLE_API_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | #include 48 | 49 | /* 50 | * ----------------------------------------------------------------------------- 51 | * --- PUBLIC MACROS ----------------------------------------------------------- 52 | */ 53 | 54 | /* 55 | * ----------------------------------------------------------------------------- 56 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 57 | */ 58 | 59 | /* 60 | * ----------------------------------------------------------------------------- 61 | * --- PUBLIC TYPES ------------------------------------------------------------ 62 | */ 63 | 64 | /* 65 | * ----------------------------------------------------------------------------- 66 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 67 | */ 68 | 69 | void gnss_uart_init( void ); 70 | void gnss_init( const void* context ); 71 | void gnss_call_scan( const void* context ); 72 | const char* gnss_get_example_name( void ); 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif // GNSS_EXAMPLE_API_H 79 | 80 | /* --- EOF ------------------------------------------------------------------ */ 81 | -------------------------------------------------------------------------------- /components/lr11xx/apps/per/README.md: -------------------------------------------------------------------------------- 1 | # LR11XX SDK PER sample code 2 | 3 | ## Description 4 | 5 | The sample code will be used to perform PER test for both LoRa and FSK modem tests. Define macro `PACKET_TYPE` to `LR1110_RADIO_PKT_TYPE_LORA` or `LR1110_RADIO_PKT_TYPE_GFSK` (in file [`../../common/apps_configuration.h`](../../common/apps_configuration.h) to enable each modem in the test. 6 | 7 | In PER test, the devices can be set as a TX device or a RX device. There are also macros to control the compilation. To set device to RX, the macro (`RECEIVER`) has to be set to 1; to set device to TX, set it to 0. If set to RX device mode, this application will automatically start PER test reception to receive packets of `NB_FRAME` times. If set to TX device, it will send packets endlessly after startup. 8 | 9 | ### Payload setting 10 | 11 | The first byte in payload is reserved for a rolling counter, which will be used to detect totally missed packets in PER statistics. Keeping the counter in the first byte will allow the minimum payload size. Receiver will check the rest part of payload to be sure that received packets are not unwanted ones. `per_msg` is an array to hold the content of this part of payload. If `PAYLOAD_LENGTH` (defined in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) is no longer than 1, there will be no payload check as payload will only has the counter. 12 | 13 | ## Configuration 14 | 15 | Several parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file, refer to [`../../common/README.md`](../../common/README.md) for more details. 16 | 17 | Several parameters can be updated in [`main_per.h`](main_per.h) header file: 18 | 19 | | Constant | Comments | 20 | | --------------------- | ----------------------------------------- | 21 | | `RECEIVER` | RX or TX device | 22 | | `RX_TIMEOUT_VALUE` | Timeout value for reception | 23 | | `TX_TO_TX_DELAY_IN_MS`| Time delay between 2 transmitting packets | 24 | | `NB_FRAME` | Amount of packets will be tested for PER | 25 | -------------------------------------------------------------------------------- /components/lr11xx/apps/per/main_per.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file main_per.h 3 | * 4 | * @brief Packet Error Rate (PER) example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef MAIN_PER_H 36 | #define MAIN_PER_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | /* 48 | * ----------------------------------------------------------------------------- 49 | * --- PUBLIC MACROS ----------------------------------------------------------- 50 | */ 51 | 52 | #ifndef RECEIVER 53 | #define RECEIVER 1 54 | #endif 55 | #define TRANSMITTER !RECEIVER 56 | 57 | #if( TRANSMITTER == RECEIVER ) 58 | #error "Please define only Transmitter or Receiver." 59 | #endif 60 | 61 | #ifndef RX_TIMEOUT_VALUE 62 | #define RX_TIMEOUT_VALUE 1000 63 | #endif 64 | 65 | /*! 66 | * @brief Delay in ms between the end of a transmision and the beginning of the next one 67 | */ 68 | #ifndef TX_TO_TX_DELAY_IN_MS 69 | #define TX_TO_TX_DELAY_IN_MS 200 70 | #endif 71 | 72 | /*! 73 | * @brief Number of frames expected on the receiver side 74 | */ 75 | #ifndef NB_FRAME 76 | #define NB_FRAME 20 77 | #endif 78 | 79 | /* 80 | * ----------------------------------------------------------------------------- 81 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 82 | */ 83 | 84 | /* 85 | * ----------------------------------------------------------------------------- 86 | * --- PUBLIC TYPES ------------------------------------------------------------ 87 | */ 88 | 89 | /* 90 | * ----------------------------------------------------------------------------- 91 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 92 | */ 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | 98 | #endif // MAIN_PER_H 99 | 100 | /* --- EOF ------------------------------------------------------------------ */ 101 | -------------------------------------------------------------------------------- /components/lr11xx/apps/ping_pong/README.md: -------------------------------------------------------------------------------- 1 | # LR11xx Ping Pong example 2 | 3 | ## Description 4 | 5 | The application will automatically set the device in Ping-Pong mode. 6 | 7 | The sample code will be used to perform test for both LoRa and FSK modem tests. Define macro `PACKET_TYPE` to `LR1110_RADIO_PKT_TYPE_LORA` or `LR1110_RADIO_PKT_TYPE_GFSK` (in file [`../../common/apps_configuration.h`](../../common/apps_configuration.h)) to enable each modem in the test. 8 | 9 | The application can make device work as master or slave in Ping-Pong test. When starting up, it assumes to be a master and will send 'PING' packets and receive 'PONG' packets alternatively. When a 'PING' packet received, the device switches itself to slave mode, then send 'PONG' packets and expect to receive 'PING' packets. In slave mode, if the device receive a 'non-PING' packet, it will reset to master mode and start the previous process again. 10 | 11 | ## Configuration 12 | 13 | Several parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file, refer to [`../../common/README.md`](../../common/README.md) for more details. 14 | 15 | Several parameters can be updated in [`main_ping_pong.h`](main_ping_pong.h) header file: 16 | 17 | | Constant | Comments | 18 | | ------------------ | --------------------------- | 19 | | `RX_TIMEOUT_VALUE` | timeout value for reception | 20 | -------------------------------------------------------------------------------- /components/lr11xx/apps/ping_pong/main_ping_pong.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file main_ping_pong.h 3 | * 4 | * @brief Ping-pong example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef MAIN_PER_H 36 | #define MAIN_PER_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | #include "apps_common.h" 47 | /* 48 | * ----------------------------------------------------------------------------- 49 | * --- PUBLIC MACROS ----------------------------------------------------------- 50 | */ 51 | 52 | #ifndef RX_TIMEOUT_VALUE 53 | #define RX_TIMEOUT_VALUE 600 54 | #endif 55 | 56 | /* 57 | * ----------------------------------------------------------------------------- 58 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 59 | */ 60 | 61 | /* 62 | * ----------------------------------------------------------------------------- 63 | * --- PUBLIC TYPES ------------------------------------------------------------ 64 | */ 65 | 66 | /* 67 | * ----------------------------------------------------------------------------- 68 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 69 | */ 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif // MAIN_PER_H 76 | 77 | /* --- EOF ------------------------------------------------------------------ */ 78 | -------------------------------------------------------------------------------- /components/lr11xx/apps/spectral_scan/README.md: -------------------------------------------------------------------------------- 1 | # LR11xx Spectral Scan example 2 | 3 | ## Description 4 | 5 | The application implements Spectral-Scan operation by setting the device in `Rx continuous` mode and regularly reading instantaneous RSSI one frequency channel after the other. For each channel, RSSI value is sampled `NB_SCAN` times by using `GetRssiInst` function. The chip is then switched to next channel to repeat the same process. There is 1 statistic for each frequency channel, which is formed as histogram. On terminal screen, the histogram is displayed as an array of numbers following corresponding frequency value. All those statistics then comprise a heat map of electro-magnetic environment. In every histogram statistic, every number represents the height of the histogram column and the order for the array indicates RSSI values ranging from 0dBm to -128dBm. The length of the array depends on the scale of RSSI level, `RSSI_SCALE`. The X-axis represents background electro-magnetic noise level, while Y-axis represents the possibility of the results locating in the level slot. 6 | 7 | Here is an example. Let's say we get a line of "INFO: 2400.000 MHz: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 76 8 0 0 0 0 0" in terminal. We can count that the length of this array is 33, so `RSSI_SCALE = (RSSI_TOP_LEVEL-RSSI_BOTTOM_LEVEL)/(33-1) = (0-(-128))/32 = 4dBm`. This would be equivalent to the histogram below. 8 | 9 | ``` 10 | 0 0 0 0 ... 0 16 76 8 0 0 0 0 0 11 | ^ 12 | | _ 13 | | | | 14 | | | | 15 | | | | 16 | | | | 17 | | _ | | 18 | | | | | | _ 19 | | _____________._._.____| |_| |_| |__________________ 20 | +-------------- ~~~ --------------------------------------> 21 | /0dBm /-8dBm ... /-96dBm /-104dBm/-112dBm/-120dBm/-128dBm 22 | ``` 23 | 24 | The sample code will be used to perform test under both LoRa and FSK modem tests, but there should be no difference if the band-width is the same. Define macro `PACKET_TYPE` to `LR1110_RADIO_PKT_TYPE_LORA` or `LR1110_RADIO_PKT_TYPE_GFSK` (in file [`../../common/apps_configuration.h`](../../common/apps_configuration.h)) to enable each modem in the test. 25 | 26 | ## Configuration 27 | 28 | Several parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file: 29 | 30 | | Constant | Comments | 31 | | ------------------ | ----------------------------| 32 | | `PACKET_TYPE` | Set the modem will be used | 33 | | `LORA_BANDWIDTH` | BandWidth of LoRa packets | 34 | | `FSK_BANDWIDTH` | BandWidth for GFSK packets | 35 | 36 | Several parameters can be updated in [`main_spectral_scan.h`](main_spectral_scan.h) header file: 37 | 38 | | Constant | Comments | 39 | | ----------------------- | ----------------------------------------------- | 40 | | `FREQ_START_HZ` | First channel frequency to do the scan | 41 | | `NB_CHAN` | Number of channels need to scan | 42 | | `NB_SCAN` | Number of scan points for each frequency scan | 43 | | `PACE_S` | Number of seconds between 2 scans in the thread | 44 | | `WIDTH_CHAN_HZ` | Width between each channel | 45 | | `RSSI_TOP_LEVEL_DBM` | Highest RSSI value, default: 0dBm | 46 | | `RSSI_BOTTOM_LEVEL_DBM` | Lowest RSSI value, default: -128dBm | 47 | | `RSSI_SCALE` | RSSI scale for spectral scan display | 48 | -------------------------------------------------------------------------------- /components/lr11xx/apps/spectrum_display/README.md: -------------------------------------------------------------------------------- 1 | # LR11xx Spectrum Display example 2 | 3 | ## Description 4 | 5 | The application implements Spectrum-Display operation by setting the device in `Rx continuous` mode and regularly reading instantaneous RSSI one frequency channel after the other. The spectrum covering all the channels being scanned will be plot on terminal screen. From the start channel frequency, defined by `FREQ_START_HZ`, 1 sample point of RSSI level will be fetched for every frequency channel by using `GetRssiInst` function. After collection of all frequency channel RSSI values, a spectrum curve is drawn on terminal screen. This curve will be refreshed every `PACE_S` second(s) by repeating the processes done before. 6 | 7 | Here is an example of the curve will be displayed on terminal screen. The bottom of the curve represents noise floor around the antenna in frequency band being scanned. The spikes represent which frequency channels have RF activity happening. The frequency frame displayed below x-axis is the frequency band being scanned. Y-axis indicates for RSSI level. 8 | 9 | ``` 10 | ^ 11 | 0| 12 | -4| 13 | -8| 14 | -12| 15 | -16| 16 | . 17 | . 18 | . 19 | -76| 20 | -80| _ 21 | -84| _ | | 22 | -88| _| | | | 23 | -92|_ | | | | _ 24 | -96| | | | | | | | _ 25 | -100| | | | | | | | | 26 | -104| | _ | |_._| |_ _ _| | | 27 | -108| |_._._._._._| |_| |_._| |_._| |_._._._._._._| 28 | -112| 29 | -116| 30 | -120| 31 | -124| 32 | -128| 33 | /dBmx------------------------------------------------------------> 34 | 2400 --> 2406 MHz 35 | ``` 36 | 37 | The plotting function is supported by `VT100` control code. So, to run this demo normally, a terminal like `Tera Term` supporting `VT100` control code is necessary. 38 | 39 | The sample code will be used to perform test under both LoRa and FSK modem tests, but there should be no difference if the band-width is the same. Define macro `PACKET_TYPE` to `LR1110_RADIO_PKT_TYPE_LORA` or `LR1110_RADIO_PKT_TYPE_GFSK` (in file [`../../common/apps_configuration.h`](../../common/apps_configuration.h)) to enable each modem in the test. 40 | 41 | 42 | ## Configuration 43 | 44 | Several parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file: 45 | 46 | | Constant | Comments | 47 | | ------------------ | ----------------------------| 48 | | `PACKET_TYPE` | Set the modem will be used | 49 | | `LORA_BANDWIDTH` | BandWidth of LoRa packets | 50 | | `FSK_BANDWIDTH` | BandWidth for GFSK packets | 51 | 52 | Several parameters can be updated in [`main_spectrum_display.h`](main_spectrum_display.h) header file: 53 | 54 | | Constant | Comments | 55 | | ------------------------ | ----------------------------------------------- | 56 | | `FREQ_START_HZ` | First channel frequency to do the scan | 57 | | `NB_CHAN` | Number of channels need to scan | 58 | | `PACE_S` | Number of seconds between 2 scans in the thread | 59 | | `WIDTH_CHAN_HZ` | Width between each channel | 60 | | `RSSI_TOP_LEVEL_DBM` | Highest RSSI value, default: 0dBm | 61 | | `RSSI_BOTTOM_LEVEL_DBM` | Lowest RSSI value, default: -128dBm | 62 | | `RSSI_SCALE` | RSSI scale for Spectrum-Display display | 63 | -------------------------------------------------------------------------------- /components/lr11xx/apps/spectrum_display/curve_plot/curve_plot.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file curve_plot.h 3 | * 4 | * @brief Curve_plot functions used in Spectrum_display example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef CURVE_PLOT_H 36 | #define CURVE_PLOT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | /* 48 | * ----------------------------------------------------------------------------- 49 | * --- PUBLIC MACROS ----------------------------------------------------------- 50 | */ 51 | 52 | /* 53 | * ----------------------------------------------------------------------------- 54 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 55 | */ 56 | 57 | /* 58 | * ----------------------------------------------------------------------------- 59 | * --- PUBLIC TYPES ------------------------------------------------------------ 60 | */ 61 | 62 | /* 63 | * ----------------------------------------------------------------------------- 64 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 65 | */ 66 | 67 | /*! 68 | * @brief Interface to plot dynamic curve for spectral scan result 69 | * 70 | * @param [in] column Offset of column from home position of the canvas. 71 | * @param [in] row Offset of column from home position of the canvas. 72 | * 73 | */ 74 | void plot_curve( uint8_t column, uint8_t row ); 75 | 76 | /*! 77 | * @brief Interface to create canvas space for curve ploting 78 | * 79 | * @warning This function must be called to create space for ploting and set the home position for plot_curve function. 80 | */ 81 | void create_canvas( void ); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif // CURVE_PLOT_H 88 | 89 | /* --- EOF ------------------------------------------------------------------ */ 90 | -------------------------------------------------------------------------------- /components/lr11xx/apps/tx_cw/README.md: -------------------------------------------------------------------------------- 1 | # LR11xx Tx continuous wave example 2 | 3 | ## Description 4 | 5 | The example will automatically set the device in Tx Continuous-wave mode. 6 | 7 | ## Configuration 8 | 9 | Common parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file, refer to [`../../common/README.md`](../../common/README.md) for more details. 10 | 11 | There is no parameter specific to this example. 12 | -------------------------------------------------------------------------------- /components/lr11xx/apps/tx_infinite_preamble/README.md: -------------------------------------------------------------------------------- 1 | # LR11xx TX infinite preamble example 2 | 3 | ## Description 4 | 5 | The example will automatically configure the device to transmit an infinite preamble. 6 | 7 | ## Configuration 8 | 9 | Common parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file, refer to [`../../common/README.md`](../../common/README.md) for more details. 10 | 11 | There is no parameter specific to this example. 12 | -------------------------------------------------------------------------------- /components/lr11xx/apps/wifi/README.md: -------------------------------------------------------------------------------- 1 | # LR11xx Wi-Fi scan example 2 | 3 | ## Description 4 | 5 | The application executes Wi-Fi Scans in a loop. 6 | The Wi-Fi scans can be the following: 7 | - Wi-Fi passive scan 8 | - Wi-Fi passive scan time limit 9 | - Wi-Fi passive scan country code 10 | - Wi-Fi passive scan country code time limit 11 | 12 | It prints results on the serial line on every scan termination. 13 | Different result format are possible depending on the Wi-Fi scan type selected and configuration. 14 | 15 | ## Configuration 16 | 17 | Several parameters can be updated in [`main_wifi.h`](main_wifi.h) header file. Some are common to all Wi-Fi scan types, and some depends on it: 18 | 19 | ### Parameters common to all Wi-Fi scan types 20 | 21 | | Constant | Comments | 22 | | ------------------------- | ------------------------------------------------------------ | 23 | | `WIFI_DEMO_TO_RUN` | Wi-Fi scan type selection. Must be from `wifi_demo_to_run_t` | 24 | | `WIFI_CHANNEL_MASK` | Wi-Fi channels to scan | 25 | | `WIFI_MAX_RESULTS` | Maximum number of results to scan for | 26 | | `WIFI_MAX_NUMBER_OF_SCAN` | Maximum number of scan to execute. Infinit if set to `0` | 27 | 28 | ### Parameters for Wi-Fi passive scan and Wi-Fi passive scan time limit 29 | 30 | | Constant | Comments | 31 | | -------------------- | ---------------------------------------------------------------------------------------------------- | 32 | | `WIFI_SIGNAL_TYPE` | Wi-Fi signal type to scan for | 33 | | `WIFI_SCAN_MODE` | Wi-Fi scan mode to use | 34 | | `WIFI_RESULT_FORMAT` | Wi-Fi result format to use. Possible values depend on `WIFI_SCAN_MODE` (see doxygen command in-code) | 35 | 36 | ### Parameters for Wi-Fi passive scan and Wi-Fi passive scan country code 37 | 38 | | Constant | Comments | 39 | | -------------------------- | ---------------------------------------------------------- | 40 | | `WIFI_NB_SCAN_PER_CHANNEL` | Number of scan per channel to execute | 41 | | `WIFI_TIMEOUT_PER_SCAN` | Maximum duration of the scan process (ms) | 42 | | `WIFI_ABORT_ON_TIMEOUT` | Abort scan on one channel on detection of preamble timeout | 43 | 44 | ### Parameters for Wi-Fi passive scan time limit and Wi-Fi passive scan country code time limit 45 | 46 | | Constant | Comments | 47 | | ---------------------------------- | -------------------------------------------- | 48 | | `WIFI_TIMEOUT_PER_CHANNEL` | Maximum scan duration spent per channel (ms) | 49 | | `WIFI_TIMEOUT_PER_SCAN_TIME_LIMIT` | Maximum duration of the scan process (ms) | 50 | -------------------------------------------------------------------------------- /components/lr11xx/apps/wifi/wifi_configuration_base.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file wifi_configuration_base.h 3 | * 4 | * @brief Wi-Fi scan configuration 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef WIFI_CONFIGURATION_BASE_H 36 | #define WIFI_CONFIGURATION_BASE_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | #include "lr11xx_wifi_types.h" 48 | 49 | /* 50 | * ----------------------------------------------------------------------------- 51 | * --- PUBLIC MACROS ----------------------------------------------------------- 52 | */ 53 | 54 | /* 55 | * ----------------------------------------------------------------------------- 56 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 57 | */ 58 | 59 | /* 60 | * ----------------------------------------------------------------------------- 61 | * --- PUBLIC TYPES ------------------------------------------------------------ 62 | */ 63 | 64 | typedef struct 65 | { 66 | lr11xx_wifi_channel_mask_t channel_mask; 67 | uint8_t max_result; 68 | } wifi_configuration_scan_base_t; 69 | 70 | /* 71 | * ----------------------------------------------------------------------------- 72 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 73 | */ 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif // WIFI_CONFIGURATION_BASE_H 80 | 81 | /* --- EOF ------------------------------------------------------------------ */ 82 | -------------------------------------------------------------------------------- /components/lr11xx/apps/wifi/wifi_scan/wifi_scan.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file wifi_scan.h 3 | * 4 | * @brief Wi-Fi scan example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef WIFI_SCAN_H 36 | #define WIFI_SCAN_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | #include "lr11xx_wifi_types.h" 48 | #include "wifi_configuration_base.h" 49 | 50 | /* 51 | * ----------------------------------------------------------------------------- 52 | * --- PUBLIC MACROS ----------------------------------------------------------- 53 | */ 54 | 55 | /* 56 | * ----------------------------------------------------------------------------- 57 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 58 | */ 59 | 60 | /* 61 | * ----------------------------------------------------------------------------- 62 | * --- PUBLIC TYPES ------------------------------------------------------------ 63 | */ 64 | 65 | /* 66 | * ----------------------------------------------------------------------------- 67 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 68 | */ 69 | 70 | /** 71 | * @brief Get the example name of the Wi-Fi scan example 72 | */ 73 | const char* wifi_scan_get_example_name( void ); 74 | 75 | /** 76 | * @brief Execute the call to the Wi-Fi scan API 77 | * 78 | * @param context Chip implementation context 79 | */ 80 | void wifi_scan_call_api_scan( const void* context ); 81 | 82 | /** 83 | * @brief Print the configuration of the Wi-Fi scan 84 | */ 85 | void wifi_scan_print_configuration( void ); 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif // WIFI_SCAN_H 92 | 93 | /* --- EOF ------------------------------------------------------------------ */ 94 | -------------------------------------------------------------------------------- /components/lr11xx/apps/wifi/wifi_scan_country_code/wifi_scan_country_code.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file wifi_scan_country_code.h 3 | * 4 | * @brief Wi-Fi scan country code example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef WIFI_SCAN_COUNTRY_CODE_H 36 | #define WIFI_SCAN_COUNTRY_CODE_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | #include "wifi_configuration_base.h" 48 | 49 | /* 50 | * ----------------------------------------------------------------------------- 51 | * --- PUBLIC MACROS ----------------------------------------------------------- 52 | */ 53 | 54 | /* 55 | * ----------------------------------------------------------------------------- 56 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 57 | */ 58 | 59 | /* 60 | * ----------------------------------------------------------------------------- 61 | * --- PUBLIC TYPES ------------------------------------------------------------ 62 | */ 63 | 64 | /* 65 | * ----------------------------------------------------------------------------- 66 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 67 | */ 68 | 69 | /** 70 | * @brief Get the example name of Wi-Fi scan country code example 71 | */ 72 | const char* wifi_scan_country_code_get_example_name( void ); 73 | 74 | /** 75 | * @brief Execute the call to Wi-Fi scan country code API 76 | * 77 | * @param context Chip implementation context 78 | */ 79 | void wifi_scan_country_code_call_api_scan( const void* context ); 80 | 81 | /** 82 | * @brief Print the configuration of the Wi-Fi scan country code example 83 | */ 84 | void wifi_scan_country_code_print_configuration( void ); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif // WIFI_SCAN_COUNTRY_CODE_H 91 | 92 | /* --- EOF ------------------------------------------------------------------ */ 93 | -------------------------------------------------------------------------------- /components/lr11xx/apps/wifi/wifi_scan_country_code_time_limit/wifi_scan_country_code_time_limit.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file wifi_scan_country_code_time_limit.h 3 | * 4 | * @brief Wi-Fi scan country code time limit example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef WIFI_SCAN_COUNTRY_CODE_TIME_LIMIT_H 36 | #define WIFI_SCAN_COUNTRY_CODE_TIME_LIMIT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | #include "wifi_configuration_base.h" 48 | 49 | /* 50 | * ----------------------------------------------------------------------------- 51 | * --- PUBLIC MACROS ----------------------------------------------------------- 52 | */ 53 | 54 | /* 55 | * ----------------------------------------------------------------------------- 56 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 57 | */ 58 | 59 | /* 60 | * ----------------------------------------------------------------------------- 61 | * --- PUBLIC TYPES ------------------------------------------------------------ 62 | */ 63 | 64 | /* 65 | * ----------------------------------------------------------------------------- 66 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 67 | */ 68 | 69 | /** 70 | * @brief Get the name of the Wi-Fi scan country code time limit example 71 | */ 72 | const char* wifi_scan_country_code_time_limit_get_example_name( void ); 73 | 74 | /** 75 | * @brief Execute the call to Wi-Fi scan country code time limit API 76 | * 77 | * @param context Chip implementation context 78 | */ 79 | void wifi_scan_country_code_time_limit_call_api_scan( const void* context ); 80 | 81 | /** 82 | * @brief Print the configuration of the Wi-Fi scan country code time limit example 83 | */ 84 | void wifi_scan_country_code_time_limit_print_configuration( void ); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif // WIFI_SCAN_COUNTRY_CODE_TIME_LIMIT_H 91 | 92 | /* --- EOF ------------------------------------------------------------------ */ 93 | -------------------------------------------------------------------------------- /components/lr11xx/apps/wifi/wifi_scan_time_limit/wifi_scan_time_limit.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file wifi_scan_time_limit.h 3 | * 4 | * @brief Wi-Fi scan time limit example for LR11xx chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef WIFI_SCAN_TIME_LIMIT_H 36 | #define WIFI_SCAN_TIME_LIMIT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | #include "lr11xx_wifi_types.h" 48 | #include "wifi_configuration_base.h" 49 | 50 | /* 51 | * ----------------------------------------------------------------------------- 52 | * --- PUBLIC MACROS ----------------------------------------------------------- 53 | */ 54 | 55 | /* 56 | * ----------------------------------------------------------------------------- 57 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 58 | */ 59 | 60 | /* 61 | * ----------------------------------------------------------------------------- 62 | * --- PUBLIC TYPES ------------------------------------------------------------ 63 | */ 64 | 65 | /* 66 | * ----------------------------------------------------------------------------- 67 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 68 | */ 69 | 70 | /** 71 | * @brief Get the name of the Wi-Fi country code example 72 | */ 73 | const char* wifi_scan_time_limit_get_example_name( void ); 74 | 75 | /** 76 | * @brief Execute the call to the Wi-Fi scan country code API 77 | * 78 | * @param context Chip implementation context 79 | */ 80 | void wifi_scan_time_limit_call_api_scan( const void* context ); 81 | 82 | /** 83 | * @brief Print the configuration of the Wi-Fi scan country code example 84 | */ 85 | void wifi_scan_time_limit_print_configuration( void ); 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif // WIFI_SCAN_TIME_LIMIT_H 92 | 93 | /* --- EOF ------------------------------------------------------------------ */ 94 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_bootloader_types_str.c: -------------------------------------------------------------------------------- 1 | #include "lr11xx_bootloader_types_str.h" 2 | 3 | const char* lr11xx_bootloader_chip_modes_to_str( const lr11xx_bootloader_chip_modes_t value ) 4 | { 5 | switch( value ) 6 | { 7 | case LR11XX_BOOTLOADER_CHIP_MODE_SLEEP: 8 | { 9 | return ( const char* ) "LR11XX_BOOTLOADER_CHIP_MODE_SLEEP"; 10 | } 11 | 12 | case LR11XX_BOOTLOADER_CHIP_MODE_STBY_RC: 13 | { 14 | return ( const char* ) "LR11XX_BOOTLOADER_CHIP_MODE_STBY_RC"; 15 | } 16 | 17 | case LR11XX_BOOTLOADER_CHIP_MODE_STBY_XOSC: 18 | { 19 | return ( const char* ) "LR11XX_BOOTLOADER_CHIP_MODE_STBY_XOSC"; 20 | } 21 | 22 | case LR11XX_BOOTLOADER_CHIP_MODE_FS: 23 | { 24 | return ( const char* ) "LR11XX_BOOTLOADER_CHIP_MODE_FS"; 25 | } 26 | 27 | case LR11XX_BOOTLOADER_CHIP_MODE_RX: 28 | { 29 | return ( const char* ) "LR11XX_BOOTLOADER_CHIP_MODE_RX"; 30 | } 31 | 32 | case LR11XX_BOOTLOADER_CHIP_MODE_TX: 33 | { 34 | return ( const char* ) "LR11XX_BOOTLOADER_CHIP_MODE_TX"; 35 | } 36 | 37 | case LR11XX_BOOTLOADER_CHIP_MODE_LOC: 38 | { 39 | return ( const char* ) "LR11XX_BOOTLOADER_CHIP_MODE_LOC"; 40 | } 41 | 42 | default: 43 | { 44 | return ( const char* ) "Unknown"; 45 | } 46 | } 47 | } 48 | 49 | const char* lr11xx_bootloader_reset_status_to_str( const lr11xx_bootloader_reset_status_t value ) 50 | { 51 | switch( value ) 52 | { 53 | case LR11XX_BOOTLOADER_RESET_STATUS_CLEARED: 54 | { 55 | return ( const char* ) "LR11XX_BOOTLOADER_RESET_STATUS_CLEARED"; 56 | } 57 | 58 | case LR11XX_BOOTLOADER_RESET_STATUS_ANALOG: 59 | { 60 | return ( const char* ) "LR11XX_BOOTLOADER_RESET_STATUS_ANALOG"; 61 | } 62 | 63 | case LR11XX_BOOTLOADER_RESET_STATUS_EXTERNAL: 64 | { 65 | return ( const char* ) "LR11XX_BOOTLOADER_RESET_STATUS_EXTERNAL"; 66 | } 67 | 68 | case LR11XX_BOOTLOADER_RESET_STATUS_SYSTEM: 69 | { 70 | return ( const char* ) "LR11XX_BOOTLOADER_RESET_STATUS_SYSTEM"; 71 | } 72 | 73 | case LR11XX_BOOTLOADER_RESET_STATUS_WATCHDOG: 74 | { 75 | return ( const char* ) "LR11XX_BOOTLOADER_RESET_STATUS_WATCHDOG"; 76 | } 77 | 78 | case LR11XX_BOOTLOADER_RESET_STATUS_IOCD_RESTART: 79 | { 80 | return ( const char* ) "LR11XX_BOOTLOADER_RESET_STATUS_IOCD_RESTART"; 81 | } 82 | 83 | case LR11XX_BOOTLOADER_RESET_STATUS_RTC_RESTART: 84 | { 85 | return ( const char* ) "LR11XX_BOOTLOADER_RESET_STATUS_RTC_RESTART"; 86 | } 87 | 88 | default: 89 | { 90 | return ( const char* ) "Unknown"; 91 | } 92 | } 93 | } 94 | 95 | const char* lr11xx_bootloader_command_status_to_str( const lr11xx_bootloader_command_status_t value ) 96 | { 97 | switch( value ) 98 | { 99 | case LR11XX_BOOTLOADER_CMD_STATUS_FAIL: 100 | { 101 | return ( const char* ) "LR11XX_BOOTLOADER_CMD_STATUS_FAIL"; 102 | } 103 | 104 | case LR11XX_BOOTLOADER_CMD_STATUS_PERR: 105 | { 106 | return ( const char* ) "LR11XX_BOOTLOADER_CMD_STATUS_PERR"; 107 | } 108 | 109 | case LR11XX_BOOTLOADER_CMD_STATUS_OK: 110 | { 111 | return ( const char* ) "LR11XX_BOOTLOADER_CMD_STATUS_OK"; 112 | } 113 | 114 | case LR11XX_BOOTLOADER_CMD_STATUS_DATA: 115 | { 116 | return ( const char* ) "LR11XX_BOOTLOADER_CMD_STATUS_DATA"; 117 | } 118 | 119 | default: 120 | { 121 | return ( const char* ) "Unknown"; 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_bootloader_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR11XX_BOOTLOADER_TYPES_STR_H 2 | #define LR11XX_BOOTLOADER_TYPES_STR_H 3 | #include "lr11xx_bootloader_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char* lr11xx_bootloader_chip_modes_to_str( const lr11xx_bootloader_chip_modes_t value ); 8 | const char* lr11xx_bootloader_reset_status_to_str( const lr11xx_bootloader_reset_status_t value ); 9 | const char* lr11xx_bootloader_command_status_to_str( const lr11xx_bootloader_command_status_t value ); 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif // LR11XX_BOOTLOADER_TYPES_STR_H 14 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_crypto_engine_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR11XX_CRYPTO_ENGINE_TYPES_STR_H 2 | #define LR11XX_CRYPTO_ENGINE_TYPES_STR_H 3 | #include "lr11xx_crypto_engine_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char* lr11xx_crypto_element_to_str( const lr11xx_crypto_element_t value ); 8 | const char* lr11xx_crypto_status_to_str( const lr11xx_crypto_status_t value ); 9 | const char* lr11xx_crypto_lorawan_version_to_str( const lr11xx_crypto_lorawan_version_t value ); 10 | const char* lr11xx_crypto_keys_idx_to_str( const lr11xx_crypto_keys_idx_t value ); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif // LR11XX_CRYPTO_ENGINE_TYPES_STR_H 15 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_gnss_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR11XX_GNSS_TYPES_STR_H 2 | #define LR11XX_GNSS_TYPES_STR_H 3 | #include "lr11xx_gnss_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char* lr11xx_gnss_constellation_to_str( const lr11xx_gnss_constellation_t value ); 8 | const char* lr11xx_gnss_search_mode_to_str( const lr11xx_gnss_search_mode_t value ); 9 | const char* lr11xx_gnss_destination_to_str( const lr11xx_gnss_destination_t value ); 10 | const char* lr11xx_gnss_message_host_status_to_str( const lr11xx_gnss_message_host_status_t value ); 11 | const char* lr11xx_gnss_message_dmc_opcode_to_str( const lr11xx_gnss_message_dmc_opcode_t value ); 12 | const char* lr11xx_gnss_scan_mode_to_str( const lr11xx_gnss_scan_mode_t value ); 13 | const char* lr11xx_gnss_error_code_to_str( const lr11xx_gnss_error_code_t value ); 14 | const char* lr11xx_gnss_freq_search_space_to_str( const lr11xx_gnss_freq_search_space_t value ); 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif // LR11XX_GNSS_TYPES_STR_H 19 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_radio_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR11XX_RADIO_TYPES_STR_H 2 | #define LR11XX_RADIO_TYPES_STR_H 3 | #include "lr11xx_radio_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char* lr11xx_radio_pa_selection_to_str( const lr11xx_radio_pa_selection_t value ); 8 | const char* lr11xx_radio_gfsk_address_filtering_to_str( const lr11xx_radio_gfsk_address_filtering_t value ); 9 | const char* lr11xx_radio_fallback_modes_to_str( const lr11xx_radio_fallback_modes_t value ); 10 | const char* lr11xx_radio_ramp_time_to_str( const lr11xx_radio_ramp_time_t value ); 11 | const char* lr11xx_radio_lora_network_type_to_str( const lr11xx_radio_lora_network_type_t value ); 12 | const char* lr11xx_radio_lora_sf_to_str( const lr11xx_radio_lora_sf_t value ); 13 | const char* lr11xx_radio_lora_bw_to_str( const lr11xx_radio_lora_bw_t value ); 14 | const char* lr11xx_radio_lora_cr_to_str( const lr11xx_radio_lora_cr_t value ); 15 | const char* lr11xx_radio_intermediary_mode_to_str( const lr11xx_radio_intermediary_mode_t value ); 16 | const char* lr11xx_radio_gfsk_crc_type_to_str( const lr11xx_radio_gfsk_crc_type_t value ); 17 | const char* lr11xx_radio_gfsk_dc_free_to_str( const lr11xx_radio_gfsk_dc_free_t value ); 18 | const char* lr11xx_radio_gfsk_pkt_len_modes_to_str( const lr11xx_radio_gfsk_pkt_len_modes_t value ); 19 | const char* lr11xx_radio_gfsk_preamble_detector_to_str( const lr11xx_radio_gfsk_preamble_detector_t value ); 20 | const char* lr11xx_radio_lora_crc_to_str( const lr11xx_radio_lora_crc_t value ); 21 | const char* lr11xx_radio_lora_pkt_len_modes_to_str( const lr11xx_radio_lora_pkt_len_modes_t value ); 22 | const char* lr11xx_radio_lora_iq_to_str( const lr11xx_radio_lora_iq_t value ); 23 | const char* lr11xx_radio_pkt_type_to_str( const lr11xx_radio_pkt_type_t value ); 24 | const char* lr11xx_radio_pa_reg_supply_to_str( const lr11xx_radio_pa_reg_supply_t value ); 25 | const char* lr11xx_radio_rx_duty_cycle_mode_to_str( const lr11xx_radio_rx_duty_cycle_mode_t value ); 26 | const char* lr11xx_radio_gfsk_bw_to_str( const lr11xx_radio_gfsk_bw_t value ); 27 | const char* lr11xx_radio_cad_exit_mode_to_str( const lr11xx_radio_cad_exit_mode_t value ); 28 | const char* lr11xx_radio_gfsk_pulse_shape_to_str( const lr11xx_radio_gfsk_pulse_shape_t value ); 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | #endif // LR11XX_RADIO_TYPES_STR_H 33 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_system_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR11XX_SYSTEM_TYPES_STR_H 2 | #define LR11XX_SYSTEM_TYPES_STR_H 3 | #include "lr11xx_system_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char* lr11xx_system_chip_modes_to_str( const lr11xx_system_chip_modes_t value ); 8 | const char* lr11xx_system_reset_status_to_str( const lr11xx_system_reset_status_t value ); 9 | const char* lr11xx_system_command_status_to_str( const lr11xx_system_command_status_t value ); 10 | const char* lr11xx_system_lfclk_cfg_to_str( const lr11xx_system_lfclk_cfg_t value ); 11 | const char* lr11xx_system_reg_mode_to_str( const lr11xx_system_reg_mode_t value ); 12 | const char* lr11xx_system_infopage_id_to_str( const lr11xx_system_infopage_id_t value ); 13 | const char* lr11xx_system_standby_cfg_to_str( const lr11xx_system_standby_cfg_t value ); 14 | const char* lr11xx_system_tcxo_supply_voltage_to_str( const lr11xx_system_tcxo_supply_voltage_t value ); 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif // LR11XX_SYSTEM_TYPES_STR_H 19 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_types_str.c: -------------------------------------------------------------------------------- 1 | #include "lr11xx_types_str.h" 2 | 3 | const char* lr11xx_status_to_str( const lr11xx_status_t value ) 4 | { 5 | switch( value ) 6 | { 7 | case LR11XX_STATUS_OK: 8 | { 9 | return ( const char* ) "LR11XX_STATUS_OK"; 10 | } 11 | 12 | case LR11XX_STATUS_ERROR: 13 | { 14 | return ( const char* ) "LR11XX_STATUS_ERROR"; 15 | } 16 | 17 | default: 18 | { 19 | return ( const char* ) "Unknown"; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR11XX_TYPES_STR_H 2 | #define LR11XX_TYPES_STR_H 3 | #include "lr11xx_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char* lr11xx_status_to_str( const lr11xx_status_t value ); 8 | #ifdef __cplusplus 9 | } 10 | #endif 11 | #endif // LR11XX_TYPES_STR_H 12 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr11xx_wifi_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR11XX_WIFI_TYPES_STR_H 2 | #define LR11XX_WIFI_TYPES_STR_H 3 | #include "lr11xx_wifi_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char* lr11xx_wifi_channel_to_str( const lr11xx_wifi_channel_t value ); 8 | const char* lr11xx_wifi_datarate_to_str( const lr11xx_wifi_datarate_t value ); 9 | const char* lr11xx_wifi_frame_type_to_str( const lr11xx_wifi_frame_type_t value ); 10 | const char* lr11xx_wifi_mac_origin_to_str( const lr11xx_wifi_mac_origin_t value ); 11 | const char* lr11xx_wifi_signal_type_scan_to_str( const lr11xx_wifi_signal_type_scan_t value ); 12 | const char* lr11xx_wifi_signal_type_result_to_str( const lr11xx_wifi_signal_type_result_t value ); 13 | const char* lr11xx_wifi_mode_to_str( const lr11xx_wifi_mode_t value ); 14 | const char* lr11xx_wifi_result_format_to_str( const lr11xx_wifi_result_format_t value ); 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif // LR11XX_WIFI_TYPES_STR_H 19 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr_fhss_v1_base_types_str.c: -------------------------------------------------------------------------------- 1 | #include "lr_fhss_v1_base_types_str.h" 2 | 3 | const char* lr_fhss_v1_modulation_type_to_str( const lr_fhss_v1_modulation_type_t value ) 4 | { 5 | switch( value ) 6 | { 7 | case LR_FHSS_V1_MODULATION_TYPE_GMSK_488: 8 | { 9 | return ( const char* ) "LR_FHSS_V1_MODULATION_TYPE_GMSK_488"; 10 | } 11 | 12 | default: 13 | { 14 | return ( const char* ) "Unknown"; 15 | } 16 | } 17 | } 18 | 19 | const char* lr_fhss_v1_cr_to_str( const lr_fhss_v1_cr_t value ) 20 | { 21 | switch( value ) 22 | { 23 | case LR_FHSS_V1_CR_5_6: 24 | { 25 | return ( const char* ) "LR_FHSS_V1_CR_5_6"; 26 | } 27 | 28 | case LR_FHSS_V1_CR_2_3: 29 | { 30 | return ( const char* ) "LR_FHSS_V1_CR_2_3"; 31 | } 32 | 33 | case LR_FHSS_V1_CR_1_2: 34 | { 35 | return ( const char* ) "LR_FHSS_V1_CR_1_2"; 36 | } 37 | 38 | case LR_FHSS_V1_CR_1_3: 39 | { 40 | return ( const char* ) "LR_FHSS_V1_CR_1_3"; 41 | } 42 | 43 | default: 44 | { 45 | return ( const char* ) "Unknown"; 46 | } 47 | } 48 | } 49 | 50 | const char* lr_fhss_v1_grid_to_str( const lr_fhss_v1_grid_t value ) 51 | { 52 | switch( value ) 53 | { 54 | case LR_FHSS_V1_GRID_25391_HZ: 55 | { 56 | return ( const char* ) "LR_FHSS_V1_GRID_25391_HZ"; 57 | } 58 | 59 | case LR_FHSS_V1_GRID_3906_HZ: 60 | { 61 | return ( const char* ) "LR_FHSS_V1_GRID_3906_HZ"; 62 | } 63 | 64 | default: 65 | { 66 | return ( const char* ) "Unknown"; 67 | } 68 | } 69 | } 70 | 71 | const char* lr_fhss_v1_bw_to_str( const lr_fhss_v1_bw_t value ) 72 | { 73 | switch( value ) 74 | { 75 | case LR_FHSS_V1_BW_39063_HZ: 76 | { 77 | return ( const char* ) "LR_FHSS_V1_BW_39063_HZ"; 78 | } 79 | 80 | case LR_FHSS_V1_BW_85938_HZ: 81 | { 82 | return ( const char* ) "LR_FHSS_V1_BW_85938_HZ"; 83 | } 84 | 85 | case LR_FHSS_V1_BW_136719_HZ: 86 | { 87 | return ( const char* ) "LR_FHSS_V1_BW_136719_HZ"; 88 | } 89 | 90 | case LR_FHSS_V1_BW_183594_HZ: 91 | { 92 | return ( const char* ) "LR_FHSS_V1_BW_183594_HZ"; 93 | } 94 | 95 | case LR_FHSS_V1_BW_335938_HZ: 96 | { 97 | return ( const char* ) "LR_FHSS_V1_BW_335938_HZ"; 98 | } 99 | 100 | case LR_FHSS_V1_BW_386719_HZ: 101 | { 102 | return ( const char* ) "LR_FHSS_V1_BW_386719_HZ"; 103 | } 104 | 105 | case LR_FHSS_V1_BW_722656_HZ: 106 | { 107 | return ( const char* ) "LR_FHSS_V1_BW_722656_HZ"; 108 | } 109 | 110 | case LR_FHSS_V1_BW_773438_HZ: 111 | { 112 | return ( const char* ) "LR_FHSS_V1_BW_773438_HZ"; 113 | } 114 | 115 | case LR_FHSS_V1_BW_1523438_HZ: 116 | { 117 | return ( const char* ) "LR_FHSS_V1_BW_1523438_HZ"; 118 | } 119 | 120 | case LR_FHSS_V1_BW_1574219_HZ: 121 | { 122 | return ( const char* ) "LR_FHSS_V1_BW_1574219_HZ"; 123 | } 124 | 125 | default: 126 | { 127 | return ( const char* ) "Unknown"; 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/lr_fhss_v1_base_types_str.h: -------------------------------------------------------------------------------- 1 | #ifndef LR_FHSS_V1_BASE_TYPES_STR_H 2 | #define LR_FHSS_V1_BASE_TYPES_STR_H 3 | #include "lr_fhss_v1_base_types.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char *lr_fhss_v1_modulation_type_to_str(const lr_fhss_v1_modulation_type_t value); 8 | const char *lr_fhss_v1_cr_to_str(const lr_fhss_v1_cr_t value); 9 | const char *lr_fhss_v1_grid_to_str(const lr_fhss_v1_grid_t value); 10 | const char *lr_fhss_v1_bw_to_str(const lr_fhss_v1_bw_t value); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif // LR_FHSS_V1_BASE_TYPES_STR_H 15 | -------------------------------------------------------------------------------- /components/lr11xx/common/printers/printers.mk: -------------------------------------------------------------------------------- 1 | # --- The Clear BSD License --- 2 | # Copyright Semtech Corporation 2022. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted (subject to the limitations in the disclaimer 6 | # below) provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of the Semtech corporation nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 17 | # THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 18 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | # NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | 29 | C_SOURCES += \ 30 | $(TOP_DIR)/lr11xx/common/printers/lr11xx_bootloader_types_str.c \ 31 | $(TOP_DIR)/lr11xx/common/printers/lr11xx_crypto_engine_types_str.c \ 32 | $(TOP_DIR)/lr11xx/common/printers/lr11xx_gnss_types_str.c \ 33 | $(TOP_DIR)/lr11xx/common/printers/lr11xx_radio_types_str.c \ 34 | $(TOP_DIR)/lr11xx/common/printers/lr11xx_system_types_str.c \ 35 | $(TOP_DIR)/lr11xx/common/printers/lr11xx_types_str.c \ 36 | $(TOP_DIR)/lr11xx/common/printers/lr11xx_wifi_types_str.c \ 37 | $(TOP_DIR)/lr11xx/common/printers/lr_fhss_v1_base_types_str.c \ 38 | 39 | 40 | C_INCLUDES += \ 41 | -I$(TOP_DIR)/lr11xx/common/printers/ 42 | -------------------------------------------------------------------------------- /components/lr11xx_driver/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/components/lr11xx_driver/.DS_Store -------------------------------------------------------------------------------- /components/lr11xx_driver/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # LR11xx driver changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [v2.1.1] 2022-04-06 8 | 9 | ### Fixed 10 | 11 | * [radio] Order of the parameters in `lr11xx_radio_set_rssi_calibration()` function 12 | 13 | ## [v2.1.0] 2022-03-28 14 | 15 | ### Added 16 | 17 | * [radio] `lr11xx_radio_apply_high_acp_workaround()` function 18 | * [radio] `lr11xx_radio_set_rssi_calibration()` function 19 | * [radio] `LR11XX_RADIO_LORA_BW_200`, `LR11XX_RADIO_LORA_BW_400` and `LR11XX_RADIO_LORA_BW_800` entries to `lr11xx_radio_lora_bw_t` 20 | * [radio] `LR11XX_RADIO_GFSK_PKT_VAR_LEN_SX128X_COMP` entry in `lr11xx_radio_gfsk_pkt_len_modes_t` to support compatibility with SX128x 21 | * [radio] `LR11XX_RADIO_GFSK_DC_FREE_WHITENING_SX128X_COMP` entry in `lr11xx_radio_gfsk_dc_free_t` to support compatibility with SX128x 22 | * [GNSS] `lr1110_gnss_get_consumption` function 23 | * [Wi-Fi] `lr1110_wifi_get_consumption` function 24 | * [Wi-Fi] `lr11xx_wifi_are_scan_mode_result_format_compatible` function 25 | 26 | ### Changed 27 | 28 | * [radio] Call to `lr11xx_radio_apply_high_acp_workaround()` in `lr11xx_radio_set_tx_with_timeout_in_rtc_step()`, `lr11xx_radio_set_rx_with_timeout_in_rtc_step()`, `lr11xx_radio_set_cad()` and `lr11xx_radio_set_tx_infinite_preamble()` (can be removed by defining `LR11XX_DISABLE_HIGH_ACP_WORKAROUND`) 29 | * [Wi-Fi] Define type `lr11xx_wifi_country_code_str_t` for Wi-Fi country code data and update `lr11xx_wifi_extended_full_result_t` and `lr11xx_wifi_country_code_t` to use it. 30 | 31 | ## [v1.0.0] Unreleased 32 | 33 | ### Added 34 | 35 | * [all] Initial version - based on LR1110 driver v7.0.0 36 | -------------------------------------------------------------------------------- /components/lr11xx_driver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # @file 2 | # 3 | # @brief Sets CMake target_sources and target_include_directories 4 | # 5 | # --- The Clear BSD License --- 6 | add_library(lr11xx_driver INTERFACE) 7 | target_include_directories(lr11xx_driver INTERFACE ${CMAKE_CURRENT_LIST_DIR}) 8 | target_sources(lr11xx_driver INTERFACE 9 | lr11xx_bootloader.c 10 | lr11xx_crypto_engine.c 11 | lr11xx_driver_version.c 12 | lr11xx_gnss.c 13 | lr11xx_lr_fhss.c 14 | lr11xx_radio.c 15 | lr11xx_radio_timings.c 16 | lr11xx_regmem.c 17 | lr11xx_system.c 18 | lr11xx_wifi.c 19 | ) 20 | 21 | -------------------------------------------------------------------------------- /components/lr11xx_driver/LICENSE.txt: -------------------------------------------------------------------------------- 1 | License for the code produced by Semtech contained in this project 2 | ------------------------------------------------------------------ 3 | 4 | The Clear BSD License 5 | Copyright Semtech Corporation 2022. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted (subject to the limitations in the disclaimer 9 | below) provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the Semtech corporation nor the 16 | names of its contributors may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 20 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 21 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 22 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 23 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /components/lr11xx_driver/lr11xx_driver_module.cmake: -------------------------------------------------------------------------------- 1 | # @file lr11xx_driver_module.cmake 2 | # 3 | # @brief Defines CMake source files and include directories for this module 4 | # 5 | # --- The Clear BSD License --- 6 | # Copyright Semtech Corporation 2021. All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted (subject to the limitations in the disclaimer 10 | # below) provided that the following conditions are met: 11 | # * Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # * Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # * Neither the name of the Semtech corporation nor the 17 | # names of its contributors may be used to endorse or promote products 18 | # derived from this software without specific prior written permission. 19 | # 20 | # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 21 | # THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 22 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 23 | # NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 24 | # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | 33 | set(LR11XX_DRIVER_MODULE_C_SOURCES 34 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_bootloader.c 35 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_crypto_engine.c 36 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_driver_version.c 37 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_gnss.c 38 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_lr_fhss.c 39 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_radio.c 40 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_radio_timings.c 41 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_regmem.c 42 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_system.c 43 | ${CMAKE_CURRENT_LIST_DIR}/lr11xx_wifi.c 44 | ) 45 | 46 | set(LR11XX_DRIVER_MODULE_C_INCLUDES 47 | ${CMAKE_CURRENT_LIST_DIR}/. 48 | ) 49 | -------------------------------------------------------------------------------- /components/lr11xx_driver/lr11xx_driver_version.c: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file lr11xx_driver_version.c 3 | * 4 | * @brief Placeholder to keep the version of LR11XX driver. 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2021. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | /* 36 | * ----------------------------------------------------------------------------- 37 | * --- DEPENDENCIES ------------------------------------------------------------ 38 | */ 39 | 40 | #include "lr11xx_driver_version.h" 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- PRIVATE MACROS----------------------------------------------------------- 45 | */ 46 | 47 | #define STR_HELPER( x ) #x 48 | #define STR( x ) STR_HELPER( x ) 49 | 50 | #define LR11XX_DRIVER_VERSION_FULL \ 51 | "v" STR( LR11XX_DRIVER_VERSION_MAJOR ) "." STR( LR11XX_DRIVER_VERSION_MINOR ) "." STR( LR11XX_DRIVER_VERSION_PATCH ) 52 | 53 | /* 54 | * ----------------------------------------------------------------------------- 55 | * --- PRIVATE CONSTANTS ------------------------------------------------------- 56 | */ 57 | 58 | /* 59 | * ----------------------------------------------------------------------------- 60 | * --- PRIVATE TYPES ----------------------------------------------------------- 61 | */ 62 | 63 | /* 64 | * ----------------------------------------------------------------------------- 65 | * --- PRIVATE VARIABLES ------------------------------------------------------- 66 | */ 67 | 68 | /* 69 | * ----------------------------------------------------------------------------- 70 | * --- PRIVATE FUNCTIONS DECLARATION ------------------------------------------- 71 | */ 72 | 73 | /* 74 | * ----------------------------------------------------------------------------- 75 | * --- PUBLIC FUNCTIONS DEFINITION --------------------------------------------- 76 | */ 77 | 78 | const char* lr11xx_driver_version_get_version_string( void ) 79 | { 80 | return ( const char* ) LR11XX_DRIVER_VERSION_FULL; 81 | } 82 | 83 | /* 84 | * ----------------------------------------------------------------------------- 85 | * --- PRIVATE FUNCTIONS DEFINITION -------------------------------------------- 86 | */ 87 | 88 | /* --- EOF ------------------------------------------------------------------ */ 89 | -------------------------------------------------------------------------------- /components/lr11xx_driver/lr11xx_driver_version.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file lr11xx_driver_version.h 3 | * 4 | * @brief Placeholder to keep the version of LR11XX driver. 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2021. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef LR11XX_DRIVER_VERSION_H 36 | #define LR11XX_DRIVER_VERSION_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | /* 48 | * ----------------------------------------------------------------------------- 49 | * --- PUBLIC MACROS ----------------------------------------------------------- 50 | */ 51 | 52 | /* 53 | * ----------------------------------------------------------------------------- 54 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 55 | */ 56 | 57 | #define LR11XX_DRIVER_VERSION_MAJOR 2 58 | #define LR11XX_DRIVER_VERSION_MINOR 1 59 | #define LR11XX_DRIVER_VERSION_PATCH 1 60 | 61 | /* 62 | * ----------------------------------------------------------------------------- 63 | * --- PUBLIC TYPES ------------------------------------------------------------ 64 | */ 65 | 66 | /* 67 | * ----------------------------------------------------------------------------- 68 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 69 | */ 70 | 71 | /*! 72 | * @brief Compare version information with current ones 73 | * 74 | * This macro expands to true boolean value if the version information provided in argument is compatible or 75 | * retro-compatible with the version of this code base 76 | */ 77 | #define LR11XX_DRIVER_VERSION_CHECK( x, y, z ) \ 78 | ( x == LR11XX_DRIVER_VERSION_MAJOR && \ 79 | ( y < LR11XX_DRIVER_VERSION_MINOR || \ 80 | ( y == LR11XX_DRIVER_VERSION_MINOR && z <= LR11XX_DRIVER_VERSION_PATCH ) ) ) 81 | 82 | const char* lr11xx_driver_version_get_version_string( void ); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif // LR11XX_DRIVER_VERSION_H 89 | 90 | /* --- EOF ------------------------------------------------------------------ */ 91 | -------------------------------------------------------------------------------- /components/lr11xx_driver/lr11xx_lr_fhss_types.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file lr11xx_lr_fhss_types.h 3 | * 4 | * @brief LR_FHSS types definition for LR11XX 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2021. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef LR11XX_LR_FHSS_TYPES_H 36 | #define LR11XX_LR_FHSS_TYPES_H 37 | 38 | /* 39 | * ----------------------------------------------------------------------------- 40 | * --- DEPENDENCIES ------------------------------------------------------------ 41 | */ 42 | 43 | #include "lr_fhss_v1_base_types.h" 44 | 45 | /* 46 | * ----------------------------------------------------------------------------- 47 | * --- PUBLIC TYPES ------------------------------------------------------------ 48 | */ 49 | 50 | /*! 51 | * @brief LR FHSS parameter structure 52 | */ 53 | typedef struct 54 | { 55 | lr_fhss_v1_params_t lr_fhss_params; //!< Base LR FHSS parameters 56 | int8_t device_offset; //block_size) != 0) 70 | return LFS_ERR_IO; 71 | int lba = block; 72 | char* buf = (char*)buffer; 73 | while (size) { 74 | if (!sd_spi_read(block++, buffer)) 75 | return LFS_ERR_IO; 76 | buf += c->block_size; 77 | size -= c->block_size; 78 | } 79 | return LFS_ERR_OK; 80 | } 81 | 82 | static int fs_hal_prog(const struct lfs_config* c, lfs_block_t block, lfs_off_t off, 83 | const void* buffer, lfs_size_t size) { 84 | if ((size % c->block_size) != 0) 85 | return LFS_ERR_IO; 86 | int lba = block; 87 | char* buf = (char*)buffer; 88 | while (size) { 89 | if (!sd_spi_write(block++, buffer)) 90 | return LFS_ERR_IO; 91 | buf += c->block_size; 92 | size -= c->block_size; 93 | } 94 | return LFS_ERR_OK; 95 | } 96 | 97 | static int fs_hal_erase(const struct lfs_config* c, lfs_block_t block) { 98 | (void)c; 99 | (void)block; 100 | return LFS_ERR_OK; 101 | } 102 | 103 | static int fs_hal_sync(const struct lfs_config* c) { 104 | (void)c; 105 | // nothing to do! 106 | return LFS_ERR_OK; 107 | } 108 | 109 | int fs_fsstat(struct fs_fsstat_t* stat) { 110 | stat->block_count = fs_cfg.block_count; 111 | stat->block_size = fs_cfg.block_size; 112 | stat->blocks_used = lfs_fs_size(&fs_lfs); 113 | #ifndef NDEBUG 114 | stat->text_size = 0; 115 | stat->bss_size = 0; 116 | #endif 117 | return LFS_ERR_OK; 118 | } 119 | -------------------------------------------------------------------------------- /components/sdio/sd_spi.h: -------------------------------------------------------------------------------- 1 | /* sp_sdi.h - SPI routines to access SD card */ 2 | 3 | #ifndef SD_SPI_H 4 | #define SD_SPI_H 5 | 6 | #include 7 | #include 8 | 9 | typedef enum { sdtpUnk, sdtpVer1, sdtpVer2, sdtpHigh } SD_TYPE; 10 | extern SD_TYPE sd_type; 11 | 12 | bool sd_spi_init(void); 13 | int sd_spi_sectors(void); 14 | void sd_spi_term(void); 15 | bool sd_spi_read(uint32_t lba, uint8_t* buff); 16 | bool sd_spi_write(uint32_t lba, const uint8_t* buff); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /components/st7735_80x160/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT TARGET st7735_80x160) 2 | add_library(st7735_80x160 INTERFACE) 3 | 4 | target_sources(st7735_80x160 INTERFACE 5 | ${CMAKE_CURRENT_LIST_DIR}/lcd.c 6 | ${CMAKE_CURRENT_LIST_DIR}/my_lcd.c 7 | ) 8 | 9 | target_link_libraries(st7735_80x160 INTERFACE pico_stdlib hardware_clocks hardware_spi) 10 | target_include_directories(st7735_80x160 INTERFACE ${CMAKE_CURRENT_LIST_DIR}/) 11 | endif() 12 | -------------------------------------------------------------------------------- /components/st7735_80x160/iconfont.h: -------------------------------------------------------------------------------- 1 | #ifndef __ICONFONT_H 2 | #define __ICONFONT_H 3 | 4 | u8 Icon16[]={ 5 | 6 | 0x00,0x00,0x80,0x00,0x80,0x01,0x80,0x07,0x80,0x0F,0x80,0x1E,0x80,0x18,0x80,0x10, 7 | 0x80,0x10,0x80,0x10,0xF0,0x00,0x78,0x00,0xFC,0x00,0x7C,0x00,0x38,0x00,0x00,0x00,/*Title,0*/ 8 | 9 | 0x00,0x00,0xF0,0x01,0xF8,0x07,0xFC,0x0F,0xAC,0x1E,0x06,0x1C,0x12,0x39,0x42,0x38, 10 | 0x02,0x78,0x84,0x7C,0xE4,0x7C,0x08,0x3A,0x10,0x71,0x1C,0x27,0xFA,0x0B,0x00,0x00,/*Artist,1*/ 11 | 12 | 0x00,0x00,0x00,0x0F,0xE0,0x08,0x18,0x08,0xFE,0x3F,0x02,0x20,0x82,0x20,0x42,0x21, 13 | 0x72,0x26,0x2A,0x2A,0x16,0x34,0xF2,0x27,0x02,0x20,0x02,0x20,0xFE,0x3F,0x00,0x00,/*Album,2*/ 14 | 15 | 0x00,0x00,0xFC,0x00,0x86,0x01,0x02,0x03,0x02,0x3E,0x02,0x60,0x02,0x40,0x02,0x40, 16 | 0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40,0x02,0x40,0xFE,0x7F,0x00,0x00,/*Folder,3*/ 17 | 18 | 0x00,0x00,0x00,0x00,0xFC,0x3F,0x04,0x20,0x04,0x20,0xE4,0x27,0x04,0x20,0x04,0x20, 19 | 0xE4,0x27,0x04,0x20,0x04,0x20,0xE4,0x27,0x04,0x20,0x04,0x20,0xFC,0x3F,0x00,0x00,/*File,4*/ 20 | 21 | 0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x13,0x80,0x11,0xC0,0x10,0x78,0x10,0x48,0x10, 22 | 0x48,0x10,0x48,0x10,0x78,0x10,0xC0,0x10,0x80,0x11,0x00,0x13,0x00,0x1E,0x00,0x00,/*Volume,5*/ 23 | 24 | 0x00,0x00,0x00,0x00,0xC0,0x03,0xF8,0x1F,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x10, 25 | 0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0x08,0x10,0xF8,0x1F,0x00,0x00,/*Battery,6*/ 26 | 27 | 0x00,0x00,0x00,0x00,0xB0,0x0D,0xFC,0x3F,0xB4,0x2D,0x04,0x20,0x04,0x2C,0x54,0x2D, 28 | 0x04,0x20,0x54,0x25,0x04,0x20,0x54,0x3D,0x04,0x24,0x04,0x14,0xFC,0x0F,0x00,0x00,/*Year,7*/ 29 | 30 | 0x00,0x00,0x80,0x01,0xD8,0x1B,0xFC,0x3F,0x7C,0x3E,0x18,0x18,0x9C,0x39,0x4E,0x72, 31 | 0x4E,0x72,0x9C,0x39,0x18,0x18,0x7C,0x3E,0xFC,0x3F,0xD8,0x1B,0x80,0x01,0x00,0x00,/*Gear,8*/ 32 | 33 | 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x18,0x00,0x08,0x00,0x0C,0x00,0x04, 34 | 0x00,0x06,0x00,0x02,0x08,0x03,0x18,0x01,0xB0,0x01,0xE0,0x00,0xC0,0x00,0x00,0x00,/*Check,9*/ 35 | 36 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x30,0x00,0xF8,0x3F,0xFC,0x3F, 37 | 0xFC,0x3F,0xF8,0x3F,0x30,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /*LeftArrow,10*/ 38 | 39 | }; 40 | 41 | #endif 42 | 43 | 44 | -------------------------------------------------------------------------------- /components/st7735_80x160/my_lcd.h: -------------------------------------------------------------------------------- 1 | #ifndef __MY_LCD_H 2 | #define __MY_LCD_H 3 | 4 | #include "lcd.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void LCD_ShowPartialChar2(i16 x,i16 y,u16 x_min,u16 x_max,u16 y_min,u16 y_max,u8 num,u8 mode,u16 color); 11 | void LCD_ShowPartialChar(i16 x,i16 y,u16 x_min,u16 x_max,u16 y_min,u16 y_max,u8 num,u8 mode,u16 color); 12 | void LCD_ShowIcon(u16 x,u16 y,u8 index,u8 mode,u16 color); 13 | u16 LCD_ShowStringLn(i16 x,i16 y,u16 x_min,u16 x_max,const u8 *p,u8 mode,u16 color); 14 | void LCD_Scroll_ShowString(u16 x, u16 y, u16 x_min, u16 x_max, u8 *p, u8 mode, u16 color, u16 *sft_val, u32 tick); 15 | void LCD_ShowDimPicture(u16 x1, u16 y1, u16 x2, u16 y2, u8 dim); 16 | void LCD_ShowDimPictureOfs(u16 x1, u16 y1, u16 x2, u16 y2, u8 dim, u16 ofs_x, u16 ofs_y); 17 | void LCD_FillBackground(u16 xsta,u16 ysta,u16 xend,u16 yend,u8 mode,u16 color); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #define ICON16x16_TITLE 0 24 | #define ICON16x16_ARTIST 1 25 | #define ICON16x16_ALBUM 2 26 | #define ICON16x16_FOLDER 3 27 | #define ICON16x16_FILE 4 28 | #define ICON16x16_VOLUME 5 29 | #define ICON16x16_BATTERY 6 30 | #define ICON16x16_YEAR 7 31 | #define ICON16x16_GEAR 8 32 | #define ICON16x16_CHECKED 9 33 | #define ICON16x16_LEFTARROW 10 34 | #define ICON16x16_UNDEF 255 35 | 36 | #endif 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /components/sx126x/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/components/sx126x/.DS_Store -------------------------------------------------------------------------------- /components/sx126x/apps/cad/README.md: -------------------------------------------------------------------------------- 1 | # SX126X SDK CAD sample code 2 | 3 | ## Description 4 | 5 | The chip performs the CAD operation in LoRa. Define macro `PACKET_TYPE` to `SX126X_PKT_TYPE_LORA` (in file (`../../common/apps_configuration.h`)) to use this sample code. 6 | 7 | In CAD test, there are 3 kinds of exit mode that can be defined for different use cases: 8 | 9 | - `CAD_ONLY` mode - once done and whatever the activity on the channel, the chip goes back to STBY_RC mode. 10 | - `CAD_RX` mode - if an activity is detected, it stays in RX until a packet is detected or the timer reaches the timeout defined by `CAD_TIMOUT_MS`. 11 | - `CAD_LBT` mode - if no activity is detected, it goes to tx mode. This mode is actually a substitute to tx mode, so payload data for transmitting should be preloaded before setting the chip to `CAD_LBT` mode. 12 | 13 | By default, the provided makefile will build one binary of each kind. 14 | Any mode can be built independently with the following target names: `cad_only`, `cad_then_receive`, `cad_then_transmitt` 15 | 16 | 17 | ## Configuration 18 | 19 | Several parameters can be updated in `../../common/apps_configuration.h` header file, refer to `../../common/README.md` for more details. 20 | 21 | Several parameters can be updated in `main_cad.h` header file: 22 | 23 | | Constant | Comments | Possible values | Default value | 24 | | ----------------- | ----------------------------------------------------------------------------- | ------------------------------------------- | ---------------- | 25 | | `CAD_SYMBOL_NUM` | Defines the number of symbols used for the CAD detection | 1, 2, 4, 8 or 16 | 2 | 26 | | `CAD_DETECT_PEAK` | Define the sensitivity of the LoRa modem when trying to correlate to symbols | [22-25] | 22 | 27 | | `CAD_DETECT_MIN` | Minimum peak value, meant to filter out case with almost no signal or noise. | 10 | 10 | 28 | | `CAD_EXIT_MODE` | Defines the action to be performed after a CAD operation | Any value of enum `sx126x_cad_exit_modes_t` | `SX126X_CAD_LBT` | 29 | | `CAD_TIMOUT_MS` | Only used when the CAD is performed with CAD_EXIT_MODE = CAD_RX or CAD_LBT | Any value that fits in `uint32_t` | 1000 | 30 | 31 | When compiling with arm-none-eabi-gcc toolchain, all these constant are configurable through command line with the EXTRAFLAGS. 32 | See main [README](../../../README.md). 33 | -------------------------------------------------------------------------------- /components/sx126x/apps/per/README.md: -------------------------------------------------------------------------------- 1 | # SX126X SDK PER sample code 2 | 3 | ## Description 4 | 5 | The sample code will be used to perform PER test for both LoRa and FSK modem tests. Define macro `PACKET_TYPE` to `SX126X_PKT_TYPE_LORA` or `SX126X_PKT_TYPE_GFSK` (in file `../../common/apps_configuration.h`) to enable each modem in the test. 6 | 7 | In PER test, the devices can be set as a TX device or a RX device. 8 | By default the makefile provided in this example will build one binary of each kind named respectively `per_transmitter.bin` and `per_receiver.bin`. You can choose to build independantly either of them by specifying the target `transmitter_target` or `receiver_target` 9 | 10 | To set a device as RX device mode, load per_receiver.bin. The application will automatically start PER test reception to receive packets of `NB_FRAME` times. 11 | To set a device as TX device, load per_transmitter.bin and it will send packets endlessly after startup. 12 | 13 | 14 | ### Payload setting 15 | 16 | The first byte in payload is reserved for a rolling counter, which will be used to detect totally missed packets in PER statistics. Keeping the counter in the first byte will allow the minimum payload size. Receiver will check the rest part of payload to be sure that received packets are not unwanted ones. `per_msg` is an array to hold the content of this part of payload. If `PAYLOAD_LENGTH` (defined in `../../common/apps_configuration.h`) is no longer than 1, there will be no payload check as payload will only has the counter. 17 | 18 | ## Configuration 19 | 20 | Several parameters can be updated in `../../common/apps_configuration.h` header file, refer to `../../common/README.md` for more details. 21 | 22 | Several parameters can be updated in `main_per.h` header file: 23 | 24 | | Constant | Comments | Possible values | Default value | 25 | | --------------------- | ----------------------------------------- | ----------------------------- | ------------- | 26 | | `RX_TIMEOUT_VALUE` | Timeout value for reception | Any value fitting in uint32_t | 1000 | 27 | | `TX_TO_TX_DELAY_IN_MS`| Time delay between 2 transmitting packets | Any value fitting in int32_t | 200 | 28 | | `NB_FRAME` | Amount of packets will be tested for PER | Any value fitting in uint16_t | 20 | 29 | 30 | When compiling with arm-none-eabi-gcc toolchain, all these constant are configurable through command line with the EXTRAFLAGS. 31 | See main [README](../../../README.md). 32 | -------------------------------------------------------------------------------- /components/sx126x/apps/per/main_per.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file main_per.h 3 | * 4 | * @brief Packet Error Rate (PER) example for SX126 chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef MAIN_PER_H 36 | #define MAIN_PER_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | /* 48 | * ----------------------------------------------------------------------------- 49 | * --- PUBLIC MACROS ----------------------------------------------------------- 50 | */ 51 | #ifndef RECEIVER 52 | #define RECEIVER 1 53 | #endif 54 | 55 | #ifndef TRANSMITTER 56 | #define TRANSMITTER !RECEIVER 57 | #endif 58 | 59 | #ifndef RX_TIMEOUT_VALUE 60 | #define RX_TIMEOUT_VALUE 1000 61 | #endif 62 | 63 | /*! 64 | * @brief Delay in ms between the end of a transmision and the beginning of the next one 65 | */ 66 | #ifndef TX_TO_TX_DELAY_IN_MS 67 | #define TX_TO_TX_DELAY_IN_MS 200 68 | #endif 69 | 70 | /*! 71 | * @brief Number of frames expected on the receiver side 72 | */ 73 | #ifndef NB_FRAME 74 | #define NB_FRAME 20 75 | #endif 76 | 77 | /* 78 | * ----------------------------------------------------------------------------- 79 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 80 | */ 81 | 82 | /* 83 | * ----------------------------------------------------------------------------- 84 | * --- PUBLIC TYPES ------------------------------------------------------------ 85 | */ 86 | 87 | /* 88 | * ----------------------------------------------------------------------------- 89 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif // MAIN_PER_H 97 | 98 | /* --- EOF ------------------------------------------------------------------ */ 99 | -------------------------------------------------------------------------------- /components/sx126x/apps/per/makefile/build_and_flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | echo "Cleaning..." 4 | make clean_all > trace.txt 5 | echo "Building transmitter and receiver images" 6 | make >> trace.txt 7 | echo "Flashing Receiver on NODE_L476RG" 8 | cp out/per_receiver.bin /media/$USER/NODE_L476RG 9 | echo "Flashing Transmitter on NODE_L476RG1" 10 | cp out/per_transmitter.bin /media/$USER/NODE_L476RG1 -------------------------------------------------------------------------------- /components/sx126x/apps/ping_pong/README.md: -------------------------------------------------------------------------------- 1 | # SX126x Ping Pong example 2 | 3 | ## Description 4 | 5 | The application will automatically set the device in Ping-Pong mode. 6 | 7 | The sample code will be used to perform test for both LoRa and FSK modem tests. Define macro `PACKET_TYPE` to `SX126X_PKT_TYPE_LORA` or `SX126X_PKT_TYPE_GFSK` (in file (`../../common/apps_configuration.h`)) to enable each modem in the test. 8 | 9 | The application can make device work as master or slave in Ping-Pong test. When starting up, it assumes to be a master and will send 'PING' packets and receive 'PONG' packets alternatively. When a 'PING' packet received, the device switches itself to slave mode, then send 'PONG' packets and expect to receive 'PING' packets. In slave mode, if the device receive a 'non-PING' packet, it will reset to master mode and start the previous process again. 10 | 11 | ## Configuration 12 | 13 | Several parameters can be updated in `../../common/apps_configuration.h` header file, refer to `../../common/README.md` for more details. 14 | 15 | Several parameters can be updated in `main_ping_pong.h` header file: 16 | 17 | | Constant | Comments | Default value | Default value | 18 | | ------------------ | --------------------------- | ---------------------------- | ------------- | 19 | | `RX_TIMEOUT_VALUE` | timeout value for reception | Any value that fits uint32_t | 600 | 20 | 21 | When compiling with arm-none-eabi-gcc toolchain, all these constant are configurable through command line with the EXTRAFLAGS. 22 | See main [README](../../../README.md). 23 | -------------------------------------------------------------------------------- /components/sx126x/apps/ping_pong/main_ping_pong.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file main_ping_pong.h 3 | * 4 | * @brief Ping-pong example for SX126x chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef MAIN_PING_PONG_H 36 | #define MAIN_PING_PONG_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | #include "apps_common.h" 47 | /* 48 | * ----------------------------------------------------------------------------- 49 | * --- PUBLIC MACROS ----------------------------------------------------------- 50 | */ 51 | 52 | #ifndef RX_TIMEOUT_VALUE 53 | #define RX_TIMEOUT_VALUE 600 54 | #endif 55 | 56 | /* 57 | * ----------------------------------------------------------------------------- 58 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 59 | */ 60 | 61 | /* 62 | * ----------------------------------------------------------------------------- 63 | * --- PUBLIC TYPES ------------------------------------------------------------ 64 | */ 65 | 66 | /* 67 | * ----------------------------------------------------------------------------- 68 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 69 | */ 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif // MAIN_PING_PONG_H 76 | 77 | /* --- EOF ------------------------------------------------------------------ */ 78 | -------------------------------------------------------------------------------- /components/sx126x/apps/spectrum_display/curve_plot/curve_plot.h: -------------------------------------------------------------------------------- 1 | /*! 2 | * @file curve_plot.h 3 | * 4 | * @brief Curve_plot functions used in Spectrum_display example for SX126x chip 5 | * 6 | * The Clear BSD License 7 | * Copyright Semtech Corporation 2022. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted (subject to the limitations in the disclaimer 11 | * below) provided that the following conditions are met: 12 | * * Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * * Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * * Neither the name of the Semtech corporation nor the 18 | * names of its contributors may be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 24 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef CURVE_PLOT_H 36 | #define CURVE_PLOT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * ----------------------------------------------------------------------------- 44 | * --- DEPENDENCIES ------------------------------------------------------------ 45 | */ 46 | 47 | /* 48 | * ----------------------------------------------------------------------------- 49 | * --- PUBLIC MACROS ----------------------------------------------------------- 50 | */ 51 | 52 | /* 53 | * ----------------------------------------------------------------------------- 54 | * --- PUBLIC CONSTANTS -------------------------------------------------------- 55 | */ 56 | 57 | /* 58 | * ----------------------------------------------------------------------------- 59 | * --- PUBLIC TYPES ------------------------------------------------------------ 60 | */ 61 | 62 | /* 63 | * ----------------------------------------------------------------------------- 64 | * --- PUBLIC FUNCTIONS PROTOTYPES --------------------------------------------- 65 | */ 66 | 67 | /*! 68 | * @brief Interface to plot dynamic curve for spectral scan result 69 | * 70 | * @param [in] column Offset of column from home position of the canvas. 71 | * @param [in] row Offset of column from home position of the canvas. 72 | * 73 | */ 74 | void plot_curve( uint8_t column, uint8_t row ); 75 | 76 | /*! 77 | * @brief Interface to create canvas space for curve ploting 78 | * 79 | * @warning This function must be called to create space for ploting and set the home position for plot_curve function. 80 | */ 81 | void create_canvas( void ); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif // CURVE_PLOT_H 88 | 89 | /* --- EOF ------------------------------------------------------------------ */ 90 | -------------------------------------------------------------------------------- /components/sx126x/apps/tx_cw/README.md: -------------------------------------------------------------------------------- 1 | # SX126X Tx continuous wave example 2 | 3 | ## Description 4 | 5 | The application will automatically set the device in Tx Continuous-wave mode. 6 | 7 | ## Configuration 8 | 9 | Common parameters can be updated in [`../../common/apps_configuration.h`](../../common/apps_configuration.h) header file, refer to [`../../common/README.md`](../../common/README.md) for more details. 10 | 11 | There is no parameter specific to this example. 12 | -------------------------------------------------------------------------------- /components/sx126x/apps/tx_infinite_preamble/README.md: -------------------------------------------------------------------------------- 1 | # SX126x TX infinite preamble example 2 | 3 | ## Description 4 | 5 | The application will automatically configure the device to transmit an infinite preamble. 6 | 7 | ## Configuration 8 | 9 | The common configuration can be found in [../../common/apps_configuration.h](../../common/apps_configuration.h). 10 | 11 | There is no configuration specific to this example. 12 | -------------------------------------------------------------------------------- /components/sx126x/common/printers/printers.mk: -------------------------------------------------------------------------------- 1 | # --- The Clear BSD License --- 2 | # Copyright Semtech Corporation 2022. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted (subject to the limitations in the disclaimer 6 | # below) provided that the following conditions are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of the Semtech corporation nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 17 | # THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 18 | # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | # NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | 29 | C_SOURCES += \ 30 | ${TOP_DIR}/sx126x/common/printers/sx126x_str.c 31 | 32 | 33 | 34 | C_INCLUDES += \ 35 | -I$(TOP_DIR)/sx126x/common/printers/ 36 | -------------------------------------------------------------------------------- /components/sx126x/common/printers/sx126x_str.h: -------------------------------------------------------------------------------- 1 | #ifndef SX126X_STR_H 2 | #define SX126X_STR_H 3 | #include "sx126x.h" 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | const char *sx126x_status_to_str(const sx126x_status_t value); 8 | const char *sx126x_sleep_cfgs_to_str(const sx126x_sleep_cfgs_t value); 9 | const char *sx126x_standby_cfgs_to_str(const sx126x_standby_cfgs_t value); 10 | const char *sx126x_reg_mod_to_str(const sx126x_reg_mod_t value); 11 | const char *sx126x_fallback_modes_to_str(const sx126x_fallback_modes_t value); 12 | const char *sx126x_tcxo_ctrl_voltages_to_str(const sx126x_tcxo_ctrl_voltages_t value); 13 | const char *sx126x_pkt_type_to_str(const sx126x_pkt_type_t value); 14 | const char *sx126x_ramp_time_to_str(const sx126x_ramp_time_t value); 15 | const char *sx126x_gfsk_pulse_shape_to_str(const sx126x_gfsk_pulse_shape_t value); 16 | const char *sx126x_gfsk_bw_to_str(const sx126x_gfsk_bw_t value); 17 | const char *sx126x_lora_sf_to_str(const sx126x_lora_sf_t value); 18 | const char *sx126x_lora_bw_to_str(const sx126x_lora_bw_t value); 19 | const char *sx126x_lora_cr_to_str(const sx126x_lora_cr_t value); 20 | const char *sx126x_gfsk_preamble_detector_to_str(const sx126x_gfsk_preamble_detector_t value); 21 | const char *sx126x_gfsk_address_filtering_to_str(const sx126x_gfsk_address_filtering_t value); 22 | const char *sx126x_gfsk_pkt_len_modes_to_str(const sx126x_gfsk_pkt_len_modes_t value); 23 | const char *sx126x_gfsk_crc_types_to_str(const sx126x_gfsk_crc_types_t value); 24 | const char *sx126x_gfsk_dc_free_to_str(const sx126x_gfsk_dc_free_t value); 25 | const char *sx126x_lora_pkt_len_modes_to_str(const sx126x_lora_pkt_len_modes_t value); 26 | const char *sx126x_cad_symbs_to_str(const sx126x_cad_symbs_t value); 27 | const char *sx126x_cad_exit_modes_to_str(const sx126x_cad_exit_modes_t value); 28 | const char *sx126x_chip_modes_to_str(const sx126x_chip_modes_t value); 29 | const char *sx126x_cmd_status_to_str(const sx126x_cmd_status_t value); 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif // SX126X_STR_H 34 | -------------------------------------------------------------------------------- /components/sx126x_driver/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/components/sx126x_driver/.DS_Store -------------------------------------------------------------------------------- /components/sx126x_driver/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [2.1.0] - 2022-05-18 8 | 9 | ### Added 10 | 11 | - `sx126x_set_gfsk_pkt_address()` function - configure both GFSK node and brodcast filtering addresses 12 | - `sx126x_handle_rx_done()` function - perform all requested actions when the chip leaves the Rx mode 13 | 14 | ## [2.0.1] - 2021-11-23 15 | 16 | ### Added 17 | 18 | - Support of LR-FHSS (see `sx126x_lr_fhss.c` and `sx126x_lr_fhss.h`) 19 | - `sx126x_get_lora_params_from_header()` function - extracts the LoRa coding rate and CRC configuration from the packet header 20 | - `sx126x_add_registers_to_retention_list()` function - allows to add up to 4 registers to the retention list 21 | - `sx126x_init_retention_list()` - add registers used by workarounds in the driver to the retention list 22 | - `sx126x_cal_img_in_mhz()` - takes frequency interval bounds in MHz for calibration 23 | 24 | ### Changed 25 | 26 | - Revised BSD License changed to the Clear BSD License 27 | - `sx126x_set_lora_symb_nb_timeout` now rounds up to nearest possible number of symbol 28 | - `SX126X_REG_IRQ_POLARITY` is renamed `SX126X_REG_IQ_POLARITY` 29 | - `sx126x_cal_img()` function - takes frequency interval bounds in raw steps 30 | 31 | ## [1.0.0] - 2020-09-24 32 | 33 | ### General 34 | 35 | - Initial version 36 | -------------------------------------------------------------------------------- /components/sx126x_driver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # @file 2 | # 3 | # @brief Sets CMake target_sources and target_include_directories 4 | # 5 | # --- The Clear BSD License --- 6 | add_library(sx126x_driver INTERFACE) 7 | target_include_directories(sx126x_driver INTERFACE ${CMAKE_CURRENT_LIST_DIR}) 8 | target_sources(sx126x_driver INTERFACE 9 | lr_fhss_mac.c 10 | sx126x_lr_fhss.c 11 | sx126x.c 12 | ) 13 | 14 | -------------------------------------------------------------------------------- /components/sx126x_driver/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The Clear BSD License 2 | Copyright Semtech Corporation 2021. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted (subject to the limitations in the disclaimer 6 | below) provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the Semtech corporation nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 17 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 18 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /components/sx126x_driver/README.md: -------------------------------------------------------------------------------- 1 | # SX126X driver 2 | 3 | This package proposes an implementation in C of the driver for **SX126X** radio component. 4 | Please see the [changelog](CHANGELOG.md) for more information. 5 | 6 | ## Structure 7 | 8 | The driver is defined as follows: 9 | 10 | - sx126x.c: implementation of the driver functions 11 | - sx126x.h: declarations of the driver functions 12 | - sx126x_regs.h: definitions of all useful registers (address and fields) 13 | - sx126x_hal.h: declarations of the HAL functions (to be implemented by the user - see below) 14 | - lr_fhss_mac.c: Transceiver-independent LR-FHSS implementation 15 | - sx126x_lr_fhss.c: Transceiver-dependent LR-FHSS implementation 16 | - lr_fhss_mac.h: Transceiver-independent LR-FHSS declarations 17 | - sx126x_lr_fhss.h: Transceiver-dependent LR-FHSS declarations 18 | - lr_fhss_v1_base_types.h: LR-FHSS type interface 19 | 20 | ## HAL 21 | 22 | The HAL (Hardware Abstraction Layer) is a collection of functions the user shall implement to write platform-dependant calls to the host. The list of functions is the following: 23 | 24 | - sx126x_hal_reset 25 | - sx126x_hal_wakeup 26 | - sx126x_hal_write 27 | - sx126x_hal_read 28 | -------------------------------------------------------------------------------- /config/picoprobe_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef PICOPROBE_H_ 27 | #define PICOPROBE_H_ 28 | 29 | #if false 30 | #define picoprobe_info(format,args...) printf(format, ## args) 31 | #else 32 | #define picoprobe_info(format,...) ((void)0) 33 | #endif 34 | 35 | 36 | #if false 37 | #define picoprobe_debug(format,args...) printf(format, ## args) 38 | #else 39 | #define picoprobe_debug(format,...) ((void)0) 40 | #endif 41 | 42 | #if false 43 | #define picoprobe_dump(format,args...) printf(format, ## args) 44 | #else 45 | #define picoprobe_dump(format,...) ((void)0) 46 | #endif 47 | 48 | // TODO tie this up with PICO_BOARD defines in the main SDK 49 | 50 | #include "board_pico_config.h" 51 | //#include "board_debugprobe_config.h" 52 | //#include "board_example_config.h" 53 | 54 | 55 | #define PROTO_DAP_V1 1 56 | #define PROTO_DAP_V2 2 57 | 58 | // Interface config 59 | #ifndef PICOPROBE_DEBUG_PROTOCOL 60 | #define PICOPROBE_DEBUG_PROTOCOL PROTO_DAP_V2 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /config/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 43 | 44 | #ifndef CFG_TUSB_OS 45 | #define CFG_TUSB_OS OPT_OS_PICO 46 | #endif 47 | 48 | #ifndef CFG_TUSB_MEM_SECTION 49 | #define CFG_TUSB_MEM_SECTION 50 | #endif 51 | 52 | #ifndef CFG_TUSB_MEM_ALIGN 53 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 54 | #endif 55 | 56 | //-------------------------------------------------------------------- 57 | // DEVICE CONFIGURATION 58 | //-------------------------------------------------------------------- 59 | 60 | #ifndef CFG_TUD_ENDPOINT0_SIZE 61 | #define CFG_TUD_ENDPOINT0_SIZE 64 62 | #endif 63 | 64 | //------------- CLASS -------------// 65 | #define CFG_TUD_HID 1 66 | #define CFG_TUD_CDC 1 67 | #define CFG_TUD_MSC 0 68 | #define CFG_TUD_MIDI 0 69 | #define CFG_TUD_VENDOR 1 70 | 71 | #define CFG_TUD_CDC_RX_BUFSIZE 64 72 | #define CFG_TUD_CDC_TX_BUFSIZE 64 73 | 74 | #define CFG_TUD_VENDOR_RX_BUFSIZE 8192 75 | #define CFG_TUD_VENDOR_TX_BUFSIZE 8192 76 | 77 | #ifndef TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX 78 | #define TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX 1 79 | #endif 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif /* _TUSB_CONFIG_H_ */ 86 | -------------------------------------------------------------------------------- /docs/GETTING-STARTED.md: -------------------------------------------------------------------------------- 1 | 2 | [here]: https://github.com/ppvision/PicoXTools/releases 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/GPIO.md: -------------------------------------------------------------------------------- 1 | | Function | pico | vgaboard | 2 | | --- | --- | --- | 3 | | UART TX | GPIO 0 (UART0) | GPIO 20 (UART1) | 4 | | UART RX | GPIO 1 (UART0) | GPIO 21 (UART1) | 5 | | SD SPI CS | N/A | GPIO 22 | 6 | | SD SPI MOSI | N/A | GPIO 18 | 7 | | SD SPI MISO | N/A | GPIO 19 | 8 | | SD SPI CLK | N/A | GPIO 5 | 9 | | PIO & DMA | N/A | 1 SM, 2 DMA | 10 | -------------------------------------------------------------------------------- /docs/JtagArm20Adapter_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/JtagArm20Adapter_top.png -------------------------------------------------------------------------------- /docs/JtagArmtop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/JtagArmtop.png -------------------------------------------------------------------------------- /docs/PicoXTools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/PicoXTools.png -------------------------------------------------------------------------------- /docs/PicoXTools2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/PicoXTools2.png -------------------------------------------------------------------------------- /docs/WHATSNEW.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/WHATSNEW.md -------------------------------------------------------------------------------- /docs/Xfunctions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/Xfunctions.png -------------------------------------------------------------------------------- /docs/cli_cmds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/cli_cmds.png -------------------------------------------------------------------------------- /docs/howto.md: -------------------------------------------------------------------------------- 1 | # Multi-threaded RTOS debug 2 | 3 | ## Clion 4 | - 打开RTOS 线程查看器 5 | Settings > Build, Execution, Deployment > Embedded Development > RTOS 6 | ![](images/clion_en_rtos.jpg) 7 | - MacOS 下ArmGNUToolchain gdb放弃了对python的支持,但这是线程查看器必须的功能因此你必须: 8 | 1. 自己编译gdb 打开对python的支持. 9 | 2. 使用第三方的包如xpack (https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/) 10 | - FreeRTOSConfig.h 打开一些定义如: 11 | 1. configUSE_TRACE_FACILITY needs to be set to 1, to display task numbers and queue types. 12 | 2. configRECORD_STACK_HIGH_ADDRESS needs to be set to 1, to display the task stack info 13 | 3. configUSE_TRACE_FACILITY and configGENERATE_RUN_TIME_STATS to collect runtime info (runtime column of the task table) 14 | - 图片 15 | ![](images/clion_freertos_info.jpg) 16 | ![](images/multi_stack.jpg) 17 | 18 | 19 | ## VSCode 20 | ```json 21 | { 22 | "version": "0.2.0", 23 | "configurations": [ 24 | { 25 | "type": "cortex-debug", 26 | "name": "OpenOCD Debug", 27 | "cwd": "${workspaceFolder}", 28 | "executable": "${workspaceFolder}/build/PicoXTools_uart.elf", 29 | "request": "launch", 30 | "interface": "swd", 31 | "servertype": "openocd", 32 | "gdbPath" : "arm-none-eabi-gdb", 33 | "device": "RP2040", 34 | "runToEntryPoint": "main", 35 | "openOCDLaunchCommands": [ 36 | "adapter speed 20000" 37 | ], 38 | "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", 39 | "postRestartCommands": [ 40 | "break main", 41 | "continue" 42 | ], 43 | "configFiles": [ 44 | "interface/cmsis-dap.cfg", 45 | "target/rp2040.cfg" 46 | ], 47 | }, 48 | { //JLINK CONFIG 49 | "request": "launch", 50 | "type": "cortex-debug", 51 | "name": "Debug J-Link", 52 | "cwd": "${workspaceRoot}", 53 | "executable": "${workspaceFolder}/build/PicoXTools_uart.elf", 54 | "serverpath": "/Applications/SEGGER/JLink/JLinkGDBServerCLExe", 55 | "servertype": "jlink", 56 | "armToolchainPath": "/Applications/ARM/bin/", 57 | "device": "RP2040_M0_0", 58 | "interface": "swd", 59 | "serialNumber": "", //If you have more than one J-Link probe, add the serial number here. 60 | // "jlinkscript":"${workspaceRoot}/BSP/SEGGER/K66FN2M0_emPower/Setup/Kinetis_K66_Target.js", 61 | "runToEntryPoint": "main", 62 | "svdFile":"${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" 63 | } 64 | ] 65 | } 66 | ``` 67 | - 图片 68 | ![](images/vscode_freertos_info.jpg) 69 | ![](images/vscode_freertos_info2.jpg) 70 | -------------------------------------------------------------------------------- /docs/images/clion_en_rtos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/images/clion_en_rtos.jpg -------------------------------------------------------------------------------- /docs/images/clion_freertos_info.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/images/clion_freertos_info.jpg -------------------------------------------------------------------------------- /docs/images/multi_stack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/images/multi_stack.jpg -------------------------------------------------------------------------------- /docs/images/vscode_freertos_info.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/images/vscode_freertos_info.jpg -------------------------------------------------------------------------------- /docs/images/vscode_freertos_info2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/images/vscode_freertos_info2.jpg -------------------------------------------------------------------------------- /docs/images/未命名.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/images/未命名.jpg -------------------------------------------------------------------------------- /docs/pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/pinout.png -------------------------------------------------------------------------------- /docs/qq_group.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/qq_group.jpg -------------------------------------------------------------------------------- /docs/realboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/realboard.png -------------------------------------------------------------------------------- /docs/shell_vi_cc_demo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/shell_vi_cc_demo.mp4 -------------------------------------------------------------------------------- /docs/web_server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/web_server.png -------------------------------------------------------------------------------- /docs/weixin_number.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/docs/weixin_number.jpg -------------------------------------------------------------------------------- /releases/PicoXTools_uart.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/releases/PicoXTools_uart.elf -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ppvision/PicoXTools/7d5e96437b8977d7aa6f04ec3d73c09997312ec0/src/.DS_Store -------------------------------------------------------------------------------- /src/bsp/bsp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define MCU_CC2652P 0 4 | #define MCU_RP2040 1 5 | 6 | 7 | #if defined(MCU_RP2040) && MCU_RP2040 8 | #define USE_STD_IN 1 9 | #define init_shell_uart 10 | #else 11 | #define PICO_ERROR_TIMEOUT (-1) 12 | int getchar_timeout_us(uint32_t timeout); 13 | void init_tty_uart(); 14 | #endif -------------------------------------------------------------------------------- /src/bsp/tty_uart.c: -------------------------------------------------------------------------------- 1 | #include "bsp.h" 2 | 3 | #include "tty_uart.h" 4 | 5 | #if defined(MCU_CC2652P) && MCU_CC2652P 6 | #include "tty_uart_cc265x.h" 7 | #endif 8 | 9 | 10 | 11 | 12 | /* 13 | #pragma printflike isr_printf 14 | //int snprintf(char *str, size_t, const char *format, ...) 15 | int isr_printf(const char * format, ...){ 16 | va_list args; 17 | #define LOCAL_BUFF_LEN 128 18 | char buffer[LOCAL_BUFF_LEN]; 19 | va_start(args,format); 20 | int done = vsnprintf (buffer,LOCAL_BUFF_LEN, format, args) ; 21 | va_end(args); 22 | 23 | return _write(1,buffer,done>LOCAL_BUFF_LEN?LOCAL_BUFF_LEN:done); 24 | } 25 | */ 26 | 27 | -------------------------------------------------------------------------------- /src/bsp/tty_uart.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "bsp.h" 3 | 4 | 5 | 6 | 7 | #if defined(USE_STD_IN) && USE_STD_IN 8 | #define tty_fflush(stdout) fflush(stdout) 9 | #define tty_puts(str) puts(str),fflush(stdout) 10 | #define tty_getchar() getchar() 11 | #define tty_putchar(c) putchar(c),fflush(stdout) 12 | #define tty_ungetc(c,stream) ungetc(c,stdin) 13 | #else 14 | void tty_fflush(); 15 | int tty_putchar(int c); 16 | int tty_puts(char* buff); 17 | int tty_getchar(); 18 | void tty_ungetc(int c,FILE *stream); 19 | 20 | uint32_t tty_available(); 21 | void tty_read (uint8_t *buf, size_t len, size_t *ret_len); 22 | void tty_write(uint8_t *buf, size_t len, size_t *ret_len); 23 | #endif 24 | 25 | // typedef void * uart_fd; 26 | // int uart_read(uart_fd fd,void *buff, size_t len, size_t *ret_len); 27 | // int uart_write(uart_fd fd,void *buff, size_t len, size_t *ret_len); 28 | // int uart_write_timeout(uart_fd fd,void *buff, size_t len, size_t *ret_len,uint32_t ms); 29 | // int uart_read_timeout(uart_fd fd,void *buff, size_t len, size_t *ret_len,uint32_t ms); 30 | -------------------------------------------------------------------------------- /src/bsp/tty_uart_cc265x.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ti_drivers_config.h" 3 | 4 | static UART2_Handle uart = NULL; 5 | 6 | void init_tty_uart(){ 7 | UART2_Params params; 8 | UART2_Params_init(¶ms); 9 | params.baudRate = 115200; 10 | params.readMode = UART2_Mode_BLOCKING; //UART2_Mode_BLOCKING 11 | params.writeMode = UART2_Mode_BLOCKING; //UART2_Mode_NONBLOCKING 12 | 13 | // Open the UART 14 | uart = UART2_open(CONFIG_UART2_0, ¶ms); 15 | // Enable receiver, inhibit low power mode 16 | UART2_rxEnable(uart); 17 | } 18 | 19 | 20 | #if 0 21 | 22 | static int unget_have = 0; 23 | static int unget_char = -1; 24 | 25 | int tty_putchar(int c){ 26 | size_t ret_len = 0; 27 | UART2_write(uart, (void *)&c, 1, &ret_len); 28 | return (int)ret_len; 29 | } 30 | 31 | void tty_fflush(){ 32 | fflush(stdout); 33 | } 34 | 35 | int tty_puts(char* buff){ 36 | while(*buff){ 37 | tty_putchar(*buff++); 38 | } 39 | } 40 | 41 | int tty_getchar(){ 42 | int c = 0; 43 | size_t ret_len = 0; 44 | if(unget_have) { 45 | unget_have = 0; 46 | return unget_char; 47 | } 48 | int_fast16_t ret = UART2_read(uart, (void *)&c, 1, &ret_len); 49 | if(ret_len ==1) return c; 50 | printf("UART2_read return:%d\r\n",ret); 51 | return -1; 52 | } 53 | 54 | void tty_ungetc(int c,FILE *stream){ 55 | (void)stream; 56 | unget_have = 1; 57 | unget_char = c; 58 | } 59 | 60 | 61 | int getchar_timeout_us(uint32_t timeout){ 62 | int c = 0; 63 | if(uart) { 64 | size_t ret_len = 0; 65 | size_t b_len = UART2_getRxCount(uart); 66 | if(b_len){ 67 | 68 | } 69 | int_fast16_t ret = UART2_readTimeout(uart, (void *)&c, 1, &ret_len,timeout);//,microsecondsToSysTicks(timeout) 70 | if(ret == UART2_STATUS_SUCCESS) return ret_len?c:-1; 71 | } 72 | return -1; 73 | } 74 | 75 | #endif 76 | 77 | ssize_t _write(int fd, const void *buf, size_t count) 78 | { 79 | (void) fd; /* Not used, avoid warning */ 80 | size_t ret_len = 0; 81 | size_t sent_len = 0; 82 | 83 | if (fd == 1) {//STDOUT_FILENO fileno(stdout) 84 | if(!uart) return -1; 85 | int_fast16_t ret = UART2_STATUS_SUCCESS; 86 | while(sent_len < count){ 87 | ret = UART2_write(uart, buf + sent_len, count - sent_len, &ret_len); 88 | if((UART2_STATUS_EINUSE == ret || UART2_STATUS_EAGAIN == ret || UART2_STATUS_ETIMEOUT==ret) && ret_len == 0) continue; 89 | if(ret_len == 0 && ret != UART2_STATUS_SUCCESS ){ 90 | break; 91 | } 92 | if(ret_len>0){ 93 | sent_len += ret_len; 94 | }else{ 95 | break; 96 | } 97 | } 98 | } 99 | return sent_len; 100 | } 101 | 102 | ssize_t _read(int fd, void *buf, size_t count) 103 | { 104 | ssize_t ret_len = 0; 105 | if (fd == 0){//STDIN_FILENO fileno(stdin) 106 | if(!uart) return -1; 107 | int_fast16_t ret = UART2_read(uart, buf, count, &ret_len); 108 | return (ret_len > 0)? ret_len:-1; 109 | } 110 | return -1; 111 | } -------------------------------------------------------------------------------- /src/common/base_def.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | typedef char buf_t[128]; 3 | 4 | -------------------------------------------------------------------------------- /src/common/ringbuffer.c: -------------------------------------------------------------------------------- 1 | #include "ringbuffer.h" 2 | 3 | void ringbuffer_init(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len) { 4 | ringbuffer->r_ptr = 0; 5 | ringbuffer->w_ptr = 0; 6 | ringbuffer->buf = buf; 7 | ringbuffer->length = len; 8 | } 9 | 10 | uint32_t ringbuffer_size(ringbuffer_t *ringbuffer) { 11 | return ringbuffer->length; 12 | } 13 | 14 | uint32_t ringbuffer_length(ringbuffer_t *ringbuffer) { 15 | uint32_t len; 16 | uint32_t w_ptr = ringbuffer->w_ptr; 17 | uint32_t r_ptr = ringbuffer->r_ptr; 18 | if (r_ptr <= w_ptr) { 19 | len = w_ptr - r_ptr; 20 | } else { 21 | len = w_ptr - r_ptr + ringbuffer->length; 22 | } 23 | return len; 24 | } 25 | 26 | uint32_t ringbuffer_freespace(ringbuffer_t *ringbuffer) { 27 | return (ringbuffer->length - ringbuffer_length(ringbuffer)); 28 | } 29 | 30 | void ringbuffer_read(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len) { 31 | uint32_t k; 32 | uint32_t r_ptr; 33 | r_ptr = ringbuffer->r_ptr; 34 | for (k = 0; k < len; k++) { 35 | buf[k] = ringbuffer->buf[r_ptr]; 36 | r_ptr = (r_ptr + 1) % ringbuffer->length; 37 | } 38 | ringbuffer->r_ptr = r_ptr; 39 | } 40 | 41 | void ringbuffer_write(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len) { 42 | uint32_t k; 43 | uint32_t w_ptr; 44 | w_ptr = ringbuffer->w_ptr; 45 | for (k = 0; k < len; k++) { 46 | ringbuffer->buf[w_ptr] = buf[k]; 47 | w_ptr = (w_ptr + 1) % ringbuffer->length; 48 | } 49 | ringbuffer->w_ptr = w_ptr; 50 | } 51 | 52 | uint8_t ringbuffer_look_at(ringbuffer_t *ringbuffer, uint32_t offset) { 53 | uint32_t r_ptr; 54 | r_ptr = ringbuffer->r_ptr; 55 | r_ptr = (r_ptr + offset) % ringbuffer->length; 56 | return ringbuffer->buf[r_ptr]; 57 | } 58 | 59 | void ringbuffer_look(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len, 60 | uint32_t offset) { 61 | uint32_t k; 62 | uint32_t r_ptr; 63 | r_ptr = ringbuffer->r_ptr; 64 | r_ptr = (r_ptr + offset) % ringbuffer->length; 65 | for (k = 0; k < len; k++) { 66 | buf[k] = ringbuffer->buf[r_ptr]; 67 | r_ptr = (r_ptr + 1) % ringbuffer->length; 68 | } 69 | } 70 | 71 | void ringbuffer_flush(ringbuffer_t *ringbuffer, uint32_t len) { 72 | uint32_t r_ptr; 73 | r_ptr = ringbuffer->r_ptr; 74 | r_ptr = (r_ptr + len) % ringbuffer->length; 75 | ringbuffer->r_ptr = r_ptr; 76 | } 77 | 78 | int ringbuffer_find(ringbuffer_t *ringbuffer, uint8_t ch) { 79 | uint32_t pos = -1; 80 | uint32_t len = ringbuffer_length(ringbuffer); 81 | uint32_t r_ptr; 82 | r_ptr = ringbuffer->r_ptr % ringbuffer->length; 83 | for (int n = 0; n < len; n++) { 84 | if (ringbuffer->buf[r_ptr] == ch) { 85 | pos = n; 86 | break; 87 | } 88 | r_ptr = (r_ptr + 1) % ringbuffer->length; 89 | } 90 | return pos; 91 | } 92 | -------------------------------------------------------------------------------- /src/common/ringbuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef __RINGBUFFER_H 2 | #define __RINGBUFFER_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | uint8_t *buf; 8 | uint32_t length; 9 | uint32_t r_ptr; 10 | uint32_t w_ptr; 11 | } ringbuffer_t; 12 | 13 | /** 14 | * Initialize a ringbuffer with a given alocated buffer. 15 | * 16 | * @param ringbuffer 17 | * @param pbuf pointer to internal buffer 18 | * @param len length of internal buffer 19 | */ 20 | void ringbuffer_init(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len); 21 | 22 | /** 23 | * Return the size of ring buffer. 24 | * 25 | * @param ringbuffer 26 | * @return size of the ringbuffer 27 | */ 28 | uint32_t ringbuffer_size(ringbuffer_t *ringbuffer); 29 | 30 | /** 31 | * Return the length of data in the ring buffer. 32 | * 33 | * @param ringbuffer 34 | * @return size of the ringbuffer 35 | */ 36 | uint32_t ringbuffer_length(ringbuffer_t *ringbuffer); 37 | 38 | /** 39 | * Return the free space of the ring buffer. 40 | * 41 | * @param ringbuffer 42 | * @return size of free space in the ringbuffer 43 | */ 44 | uint32_t ringbuffer_freespace(ringbuffer_t *ringbuffer); 45 | 46 | /** 47 | * Read out data from the ring buffer. 48 | * 49 | * @param ringbuffer 50 | * @param buf buffer to store data read. 51 | * @param len Amount of data to read. 52 | */ 53 | void ringbuffer_read(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len); 54 | 55 | /** 56 | * Write into data from the ring buffer. 57 | * 58 | * @param ringbuffer 59 | * @param buf data to write. 60 | * @param len size of data to write. 61 | */ 62 | void ringbuffer_write(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len); 63 | 64 | /** 65 | * Look a character at the specified position in the ring buffer. 66 | * 67 | * @param ringbuffer 68 | * @param offset position to look at. 69 | * @return a character at the position. 70 | */ 71 | uint8_t ringbuffer_look_at(ringbuffer_t *ringbuffer, uint32_t offset); 72 | 73 | /** 74 | * Look data at the specified position and length in the ring buffer. 75 | * 76 | * @param ringbuffer 77 | * @param buf buffer to copy the looked data. 78 | * @param len length of data to look. 79 | * @param offset position to start to look at. 80 | */ 81 | void ringbuffer_look(ringbuffer_t *ringbuffer, uint8_t *buf, uint32_t len, 82 | uint32_t offset); 83 | 84 | /** 85 | * Flush ring buffer. 86 | * 87 | * @param ringbuffer 88 | * @param len. 89 | */ 90 | void ringbuffer_flush(ringbuffer_t *ringbuffer, uint32_t len); 91 | 92 | /** 93 | * Find a character in the ringbuffer. 94 | * 95 | * @param ringbuffer 96 | * @param ch a character to find. 97 | * @return position where the character in, or -1 if not found. 98 | */ 99 | int ringbuffer_find(ringbuffer_t *ringbuffer, uint8_t ch); 100 | 101 | #endif /* __RINGBUFFER_H */ 102 | -------------------------------------------------------------------------------- /src/common/tty.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Kaluma 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "tty.h" 22 | 23 | #include 24 | #include "ringbuffer.h" 25 | #include "pico/stdlib.h" 26 | 27 | /* 28 | #include "hardware/timer.h" 29 | #include "repl.h" 30 | #include "runtime.h" 31 | #include "system.h" 32 | #include "tusb.h" 33 | */ 34 | 35 | #define TU_ATTR_WEAK __attribute__ ((weak)) 36 | 37 | #define TTY_RX_RINGBUFFER_SIZE 1024 38 | #define ETX 0x03 // Ctrl + C, SIGINT 39 | static unsigned char __tty_rx_buffer[TTY_RX_RINGBUFFER_SIZE]; 40 | static ringbuffer_t __tty_rx_ringbuffer; 41 | 42 | static int use_usb = false; 43 | 44 | void km_tty_init() { 45 | ringbuffer_init(&__tty_rx_ringbuffer, __tty_rx_buffer, 46 | sizeof(__tty_rx_buffer)); 47 | 48 | //tud_cdc_set_wanted_char(ETX); // Crtl + C 49 | } 50 | 51 | 52 | /* 53 | 54 | TU_ATTR_WEAK void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) { 55 | if (wanted_char == ETX) { 56 | tud_cdc_read_flush(); // flush read fifo 57 | } 58 | } 59 | */ 60 | 61 | uint32_t km_tty_available() { 62 | int ch = getchar_timeout_us(0); 63 | while (ch >= 0) { 64 | ringbuffer_write(&__tty_rx_ringbuffer, (uint8_t *)&ch, 1); 65 | ch = getchar_timeout_us(500); 66 | // km_runtime_set_vm_stop(0); 67 | } 68 | return ringbuffer_length(&__tty_rx_ringbuffer); 69 | } 70 | 71 | uint32_t km_tty_read(uint8_t *buf, size_t len) { 72 | if (km_tty_available() >= len) { 73 | ringbuffer_read(&__tty_rx_ringbuffer, buf, len); 74 | return len; 75 | } else { 76 | return 0; 77 | } 78 | } 79 | 80 | /* 81 | uint32_t km_tty_read_sync(uint8_t *buf, size_t len, uint32_t timeout) { 82 | uint32_t sz; 83 | absolute_time_t timeout_ms = delayed_by_ms(get_absolute_time(), timeout); 84 | do { 85 | sz = km_tty_available(); 86 | } while (get_absolute_time() < timeout_ms && sz < len); 87 | if (sz >= len) { 88 | ringbuffer_read(&__tty_rx_ringbuffer, buf, len); 89 | return len; 90 | } else { 91 | return 0; 92 | }91430781MA4R78N052 93 | }*/ 94 | 95 | uint8_t km_tty_getc() { 96 | uint8_t c = 0; 97 | if (km_tty_available()) { 98 | ringbuffer_read(&__tty_rx_ringbuffer, &c, 1); 99 | return c; 100 | } 101 | return (uint8_t)getchar(); 102 | // return c; 103 | } 104 | 105 | void km_tty_putc(char ch) { putchar(ch); } 106 | 107 | /** 108 | * Print formatted string to TTY 109 | */ 110 | void km_tty_printf(const char *fmt, ...) { 111 | va_list ap; 112 | va_start(ap, fmt); 113 | vprintf(fmt, ap); 114 | va_end(ap); 115 | } 116 | -------------------------------------------------------------------------------- /src/common/tty.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017 Kaluma 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | 22 | #ifndef __KM_TTY_H 23 | #define __KM_TTY_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | /** 30 | * Initialize TTY 31 | */ 32 | void km_tty_init(); 33 | 34 | /** 35 | * Check the number of bytes available to read. 36 | * 37 | * @return the number of bytes in TTY read buffer. 38 | */ 39 | uint32_t km_tty_available(); 40 | 41 | /** 42 | * Read bytes from TTY read buffer. 43 | * 44 | * @param buf 45 | * @param len 46 | * @return the number of bytes read 47 | */ 48 | uint32_t km_tty_read(uint8_t *buf, size_t len); 49 | 50 | /** 51 | * Read bytes synchronously from TTY read buffer. 52 | * 53 | * @param buf 54 | * @param len 55 | * @param timeout 56 | * @return the number of bytes read 57 | */ 58 | uint32_t km_tty_read_sync(uint8_t *buf, size_t len, uint32_t timeout); 59 | 60 | /** 61 | * Read a char from TTY 62 | * 63 | * @return char 64 | */ 65 | uint8_t km_tty_getc(); 66 | 67 | /** 68 | * Write a char to TTY 69 | * 70 | * @param ch a character to write 71 | */ 72 | void km_tty_putc(char ch); 73 | 74 | /** 75 | * Write a formatted string to TTY 76 | * 77 | * @param fmt a string format 78 | * @param ... arguments for the format 79 | */ 80 | void km_tty_printf(const char *fmt, ...); 81 | 82 | #endif /* __KM_TTY_H */ 83 | -------------------------------------------------------------------------------- /src/oled/raspberry26x32.h: -------------------------------------------------------------------------------- 1 | #define IMG_WIDTH 26 2 | #define IMG_HEIGHT 32 3 | 4 | static uint8_t raspberry26x32[] = { 0x0, 0x0, 0xe, 0x7e, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7e, 0x1e, 0x0, 0x0, 0x0, 0x80, 0xe0, 0xf8, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf8, 0xe0, 0x80, 0x0, 0x0, 0x1e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x1e, 0x0, 0x0, 0x0, 0x3, 0x7, 0xf, 0x1f, 0x1f, 0x3f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0xf, 0x7, 0x3, 0x0, 0x0}; 5 | -------------------------------------------------------------------------------- /src/oled/ssd1306_font.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | // Vertical bitmaps, A-Z, 0-9. Each is 8 pixels high and wide 8 | // Theses are defined vertically to make them quick to copy to FB 9 | 10 | static uint8_t font[] = { 11 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Nothing 12 | 0x1e, 0x28, 0x48, 0x88, 0x48, 0x28, 0x1e, 0x00, //A 13 | 0xfe, 0x92, 0x92, 0x92, 0x92, 0x92, 0xfe, 0x00, //B 14 | 0x7e, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, //C 15 | 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7e, 0x00, //D 16 | 0xfe, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, //E 17 | 0xfe, 0x90, 0x90, 0x90, 0x90, 0x80, 0x80, 0x00, //F 18 | 0xfe, 0x82, 0x82, 0x82, 0x8a, 0x8a, 0xce, 0x00, //G 19 | 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0xfe, 0x00, //H 20 | 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, //I 21 | 0x84, 0x82, 0x82, 0xfc, 0x80, 0x80, 0x80, 0x00, //J 22 | 0x00, 0xfe, 0x10, 0x10, 0x28, 0x44, 0x82, 0x00, //K 23 | 0xfe, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, //L 24 | 0xfe, 0x40, 0x20, 0x10, 0x20, 0x40, 0xfe, 0x00, //M 25 | 0xfe, 0x40, 0x20, 0x10, 0x08, 0x04, 0xfe, 0x00, //N 26 | 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, //O 27 | 0xfe, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00, //P 28 | 0x7c, 0x82, 0x82, 0x92, 0x8a, 0x86, 0x7e, 0x00, //Q 29 | 0xfe, 0x88, 0x88, 0x88, 0x8c, 0x8a, 0x70, 0x00, //R 30 | 0x62, 0x92, 0x92, 0x92, 0x92, 0x0c, 0x00, 0x00, //S 31 | 0x80, 0x80, 0x80, 0xfe, 0x80, 0x80, 0x80, 0x00, //T 32 | 0xfc, 0x02, 0x02, 0x02, 0x02, 0x02, 0xfc, 0x00, //U 33 | 0xf0, 0x08, 0x04, 0x02, 0x04, 0x08, 0xf0, 0x00, //V 34 | 0xfe, 0x04, 0x08, 0x10, 0x08, 0x04, 0xfe, 0x00, //W 35 | 0x00, 0x82, 0x44, 0x28, 0x28, 0x44, 0x82, 0x00, //X 36 | 0x80, 0x40, 0x20, 0x1e, 0x20, 0x40, 0x80, 0x00, //Y 37 | 0x82, 0x86, 0x9a, 0xa2, 0xc2, 0x82, 0x00, 0x00, //Z 38 | 0x7c, 0x82, 0x82, 0x92, 0x82, 0x82, 0x7c, 0x00, //0 39 | 0x00, 0x00, 0x42, 0xfe, 0x02, 0x00, 0x00, 0x00, //1 40 | 0x0c, 0x92, 0x92, 0x92, 0x92, 0x62, 0x00, 0x00, //2 41 | 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, //3 42 | 0xfc, 0x04, 0x04, 0x1e, 0x04, 0x04, 0x00, 0x00, //4 43 | 0xf2, 0x92, 0x92, 0x92, 0x92, 0x0c, 0x00, 0x00, //5 44 | 0xfc, 0x12, 0x12, 0x12, 0x12, 0x12, 0x0c, 0x00, //6 45 | 0x80, 0x80, 0x80, 0x86, 0x8c, 0xb0, 0xc0, 0x00, //7 46 | 0x6c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, //8 47 | 0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0xfe, 0x00, //9 48 | }; 49 | -------------------------------------------------------------------------------- /src/readline/readln.h: -------------------------------------------------------------------------------- 1 | #ifndef _DREAD_LINE_H 2 | #define _DREAD_LINE_H 3 | #include 4 | #include 5 | #include "tty_uart.h" 6 | 7 | #define ETX 0x03 // Ctrl + C, SIGINT 8 | 9 | 10 | void savehist(); 11 | char* dgreadln(char* buffer, int mnt, char* prom); 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/rtos_hook.c: -------------------------------------------------------------------------------- 1 | #include "FreeRTOS.h" 2 | #include "task.h" 3 | void vApplicationTickHook (void) 4 | { 5 | }; 6 | 7 | void vApplicationStackOverflowHook(TaskHandle_t Task, char *pcTaskName) 8 | { 9 | panic("stack overflow (not the helpful kind) for %s\n", *pcTaskName); 10 | } 11 | 12 | void vApplicationMallocFailedHook(void) 13 | { 14 | panic("Malloc Failed\n"); 15 | }; 16 | -------------------------------------------------------------------------------- /src/shell/cmd_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | int vi(int argc, char* argv[]); -------------------------------------------------------------------------------- /src/shell/cmds/cc/cc.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* SPDX-License-Identifier: GPL-3.0-or-later */ 3 | 4 | /* Copyright (C) 1883 Thomas Edison - All Rights Reserved 5 | * You may use, distribute and modify this code under the 6 | * terms of the BSD 3 clause license, which unfortunately 7 | * won't be written for another century. 8 | * 9 | * SPDX-License-Identifier: BSD-3-Clause 10 | * 11 | * A little flash file system for the Raspberry Pico 12 | * 13 | */ 14 | 15 | #ifndef _C4_ 16 | #define _C4_ 17 | 18 | int cc(int mode, int argc, char* argv[]); 19 | void probe_main(); 20 | #endif 21 | -------------------------------------------------------------------------------- /src/shell/cmds/cc/cc_malloc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void* cc_malloc(int nbytes, int zero); 4 | void cc_free(void* m); 5 | void cc_free_all(void); 6 | -------------------------------------------------------------------------------- /src/shell/cmds/cc/cc_printf.S: -------------------------------------------------------------------------------- 1 | .syntax unified 2 | .cpu cortex-m0plus 3 | .thumb 4 | 5 | .section .text.cc_printf 6 | .global cc_printf 7 | .global cc_exit 8 | .type cc_printf,%function 9 | .thumb_func 10 | 11 | .extern __wrap_printf 12 | .extern __wrap_sprintf 13 | .extern exit_sp 14 | 15 | // int cc_printf(void* stk, int wrds, int prnt); 16 | 17 | cc_printf: 18 | 19 | // r4 parameter block 20 | // r5 parameter block words 21 | // r6 stack save 22 | // r7 0 - printf, 1 - sprintf 23 | 24 | push {r4-r7,lr} // save the top regs 25 | mov r4, r0 // Set up the base and count regs 26 | mov r5, r1 27 | mov r6, sp // Save the stack pointer 28 | mov r7, r2 29 | 30 | // the final stack pointer needs to be 8 byte aligned 31 | lsls r0, r5, #2 // if both on even boundary 32 | mov r1, sp // or both on odd boundary 33 | eors r0, R1 // then we don't need to adjust 34 | lsls r0, #29 35 | lsrs r0, #31 36 | beq l0 37 | sub sp, #4 // align the stack 38 | 39 | l0: lsls r0, r5, #2 // make space for arguments 40 | mov r1, sp 41 | subs r1, r0 42 | mov sp, r1 43 | 44 | l1: mov r0, sp // copy args to the stack 45 | mov r1, r4 46 | mov r2, r5 47 | l2: cmp r2, #0 48 | beq l3 49 | ldm r1!, {r3} 50 | stm r0!, {r3} 51 | subs r2, #1 52 | b l2 53 | 54 | l3: cmp r5, #0 // move up to the 1st 4 words 55 | beq l4 // to r0, r1, r2, and r3 56 | pop {r0} 57 | cmp r5, #1 58 | beq l4 59 | pop {r1} 60 | cmp r5, #2 61 | beq l4 62 | pop {r2} 63 | cmp r5, #3 64 | beq l4 65 | pop {r3} 66 | 67 | l4: cmp r7, 0 68 | bne l5 69 | bl __wrap_sprintf // call SDK's printf 70 | b l6 71 | l5: bl __wrap_printf // call SDK's sprintf 72 | 73 | l6: mov sp, r6 // restore the stack and top regs 74 | pop {r4-r7,pc} 75 | 76 | .type cc_exit,%function 77 | .thumb_func 78 | 79 | // int cc_exit(int rc) 80 | 81 | cc_exit: 82 | ldr r1, esp 83 | ldr r1, [r1, #0] 84 | subs r1,#16 85 | mov sp, r1 86 | pop {r7, pc} 87 | .align 2 88 | esp: .word exit_sp 89 | 90 | -------------------------------------------------------------------------------- /src/shell/cmds/cc/cc_tokns.h: -------------------------------------------------------------------------------- 1 | // clang-format off 2 | enum { 3 | Func = 128, Syscall, 4 | // 130 5 | Main, Glo, Par, Loc, Keyword, Id, Load, Enter, Num, NumF, 6 | // 140 7 | Enum, Char, Int, Float, Struct, Union, Sizeof, Return, Goto, Break, 8 | // 150 9 | Continue, If, DoWhile, While, For, Switch, Case, Default, Else, Label, 10 | // 160 11 | Assign, // operator =, keep Assign as highest priority operator 12 | OrAssign, // |=, ^=, &=, <<=, >>= 13 | XorAssign, 14 | AndAssign, 15 | ShlAssign, 16 | ShrAssign, 17 | AddAssign, // +=, -=, *=, /=, %= 18 | SubAssign, 19 | MulAssign, 20 | DivAssign, 21 | // 170 22 | ModAssign, 23 | Cond, // operator: ? 24 | Lor, // operator: ||, &&, |, ^, & 25 | Lan, 26 | Or, 27 | Xor, 28 | And, 29 | Eq, // operator: ==, !=, >=, <, >, <= 30 | Ne, 31 | Ge, 32 | // 180 33 | Lt, 34 | Gt, 35 | Le, 36 | Shl, // operator: <<, >>, +, -, *, /, % 37 | Shr, 38 | Add, 39 | Sub, 40 | Mul, 41 | Div, 42 | Mod, 43 | // 190 44 | AddF, // float type operators (hidden) 45 | SubF, 46 | MulF, 47 | DivF, 48 | EqF, 49 | NeF, 50 | GeF, 51 | LtF, 52 | GtF, 53 | LeF, 54 | CastF, 55 | Inc, // operator: ++, --, ., ->, [ 56 | Dec, 57 | // 200 58 | Dot, 59 | Arrow, 60 | Bracket 61 | // clang-format on 62 | }; 63 | -------------------------------------------------------------------------------- /src/shell/cmds/tar.h: -------------------------------------------------------------------------------- 1 | #ifndef __TAR_H_ 2 | #define __TAR_H_ 3 | 4 | void tar(int ac, char* av[]); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/shell/cmds/vi.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* SPDX-License-Identifier: GPL-3.0-or-later */ 3 | 4 | #pragma once 5 | 6 | #define VI_VER "0.9.1" 7 | 8 | int vi(int argc, char* argv[]); 9 | -------------------------------------------------------------------------------- /src/shell/cmds/xmodem.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* SPDX-License-Identifier: GPL-3.0-or-later */ 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | typedef int (*xmodem_cb_t)(uint8_t* buf, uint32_t len); 9 | 10 | int xmodemReceive(xmodem_cb_t cb); 11 | 12 | int xmodemTransmit(xmodem_cb_t cb); 13 | -------------------------------------------------------------------------------- /src/shell/cmds/ymodem.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bright on 2023/5/28. 3 | // 4 | 5 | #pragma once 6 | 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | typedef enum { 13 | KM_YMODEM_OK = 0, 14 | KM_YMODEM_ERROR, 15 | KM_YMODEM_ABORT, 16 | KM_YMODEM_TIMEOUT, 17 | KM_YMODEM_DATA, 18 | KM_YMODEM_LIMIT 19 | } km_ymodem_status_t; 20 | 21 | typedef int (*km_ymodem_header_cb)(uint8_t *file_name, size_t file_size); 22 | typedef int (*km_ymodem_packet_cb)(uint8_t *data, size_t len); 23 | typedef void (*km_ymodem_footer_cb)(); 24 | km_ymodem_status_t km_ymodem_receive(km_ymodem_header_cb header_cb, 25 | km_ymodem_packet_cb packet_cb, 26 | km_ymodem_footer_cb footer_cb); 27 | 28 | km_ymodem_status_t ymodem_rx();/*Recv File from tty*/ 29 | 30 | -------------------------------------------------------------------------------- /src/shell/shell.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "db_list.h" 3 | 4 | #define VT_ESC "\033" 5 | #define VT_CLEAR VT_ESC "[H" VT_ESC "[J" 6 | #define VT_BLINK VT_ESC "[5m" 7 | #define VT_BOLD VT_ESC "[1m" 8 | #define VT_NORMAL VT_ESC "[m" 9 | 10 | 11 | 12 | #define VT_GREEN VT_ESC "[32m" 13 | #define VT_RED VT_ESC "[31m" 14 | #define VT_BLUE VT_ESC "[34m" 15 | #define VT_COLOR_END VT_ESC "[39m" 16 | 17 | 18 | #define ADD_CMD(_name,_function, _help_string) \ 19 | cmd_t _var##_function __attribute__((section(".cmd_list"))) = {#_name,_function,_help_string} 20 | 21 | #define CMDDATA __attribute__((section(".cmd_list"))) 22 | 23 | 24 | typedef void (*cmd_func_t)(void); 25 | typedef void (*cmd_func_normal)(int ,char*[]); 26 | 27 | typedef struct { 28 | const char* name; 29 | cmd_func_t func; 30 | const char* descr; 31 | int pass_param; 32 | } cmd_t; 33 | 34 | 35 | typedef void (*shell_command_cb)(int ,char*[]); 36 | struct shell_command_s { 37 | list_node_t node; 38 | const char* name; 39 | const char* descr; 40 | shell_command_cb cb; 41 | }; 42 | 43 | 44 | extern cmd_t cmd_table[]; 45 | 46 | int run_shell(); -------------------------------------------------------------------------------- /src/tests.c: -------------------------------------------------------------------------------- 1 | #if !defined(NDEBUG) || defined(PSHELL_TESTS) 2 | 3 | #include "stdio.h" 4 | 5 | #include "pico/stdlib.h" 6 | 7 | #include "cc.h" 8 | #include "io.h" 9 | #include "tests.h" 10 | 11 | extern char* full_path(char* name); 12 | 13 | void run_tests(int ac, char* av[]) { 14 | lfs_dir_t in_d; 15 | if (fs_dir_open(&in_d, full_path("")) < LFS_ERR_OK) { 16 | printf("can't open directory\n"); 17 | return; 18 | } 19 | for (;;) { 20 | struct lfs_info info; 21 | if (fs_dir_read(&in_d, &info) <= 0) 22 | break; 23 | if (info.type == LFS_TYPE_REG) { 24 | int is_c = 0; 25 | char* cp = strrchr(info.name, '.'); 26 | if (cp) 27 | is_c = strcmp(cp, ".c") == 0; 28 | if (is_c) { 29 | char* t_av[2] = {"cc"}; 30 | t_av[1] = strdup(full_path(info.name)); 31 | printf("cc %s\n", t_av[1]); 32 | if (cc(0, 2, t_av) != 0) { 33 | free(t_av[1]); 34 | break; 35 | } 36 | free(t_av[1]); 37 | } 38 | } 39 | } 40 | fs_dir_close(&in_d); 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_H_ 2 | #define _TEST_H_ 3 | 4 | void run_tests(int ac, char* av[]); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/utils/crc16.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* SPDX-License-Identifier: GPL-3.0-or-later */ 3 | 4 | #include "crc16.h" 5 | 6 | /* CRC16 implementation acording to CCITT standards */ 7 | 8 | static const uint16_t crc16tab[256] = { 9 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 10 | 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 11 | 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 12 | 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 13 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 14 | 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 15 | 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 16 | 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 17 | 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 18 | 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 19 | 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 20 | 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 21 | 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 22 | 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 23 | 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 24 | 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 25 | 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 26 | 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 27 | 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 28 | 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 29 | 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 30 | 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0}; 31 | 32 | uint16_t crc16_ccitt(const void* buf, int len) { 33 | unsigned short crc = 0; 34 | for (int counter = 0; counter < len; counter++) 35 | crc = (crc << 8) ^ crc16tab[((crc >> 8) ^ *(char*)buf++) & 0xFF]; 36 | return crc; 37 | } 38 | -------------------------------------------------------------------------------- /src/utils/crc16.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* SPDX-License-Identifier: GPL-3.0-or-later */ 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | uint16_t crc16_ccitt(const void* buf, int len); 9 | -------------------------------------------------------------------------------- /src/utils/db_list.c: -------------------------------------------------------------------------------- 1 | 2 | #include "db_list.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | void list_init(list_t *list) { 9 | list->head = NULL; 10 | list->tail = NULL; 11 | } 12 | 13 | void list_append(list_t *list, list_node_t *node) { 14 | if (list->tail == NULL && list->head == NULL) { 15 | list->head = node; 16 | list->tail = node; 17 | node->next = NULL; 18 | node->prev = NULL; 19 | } else { 20 | list->tail->next = node; 21 | node->prev = list->tail; 22 | node->next = NULL; 23 | list->tail = node; 24 | } 25 | } 26 | 27 | void list_remove(list_t *list, list_node_t *node) { 28 | if (list->head == node) { 29 | list->head = node->next; 30 | } 31 | if (list->tail == node) { 32 | list->tail = node->prev; 33 | } 34 | if (node->prev != NULL) { 35 | node->prev->next = node->next; 36 | } 37 | if (node->next != NULL) { 38 | node->next->prev = node->prev; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/utils/db_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef struct list_node_s list_node_t; 6 | typedef struct list_s list_t; 7 | 8 | struct list_node_s { 9 | list_node_t *prev; 10 | list_node_t *next; 11 | }; 12 | 13 | struct list_s { 14 | list_node_t *head; 15 | list_node_t *tail; 16 | }; 17 | 18 | void list_init(list_t *list); 19 | void list_append(list_t *list, list_node_t *node); 20 | void list_remove(list_t *list, list_node_t *node); -------------------------------------------------------------------------------- /submodule/disassembler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(disassembler INTERFACE) 2 | target_include_directories(disassembler INTERFACE ${CMAKE_CURRENT_LIST_DIR}/module) 3 | target_sources(disassembler INTERFACE 4 | ${CMAKE_CURRENT_LIST_DIR}/module/armdisasm.c 5 | ${CMAKE_CURRENT_LIST_DIR}/module/armdisasm.h) 6 | 7 | -------------------------------------------------------------------------------- /submodule/littlefs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(littlefs INTERFACE) 2 | target_include_directories(littlefs INTERFACE ${CMAKE_CURRENT_LIST_DIR}/module) 3 | target_sources(littlefs INTERFACE 4 | ${CMAKE_CURRENT_LIST_DIR}/module/lfs.c 5 | ${CMAKE_CURRENT_LIST_DIR}/module/lfs_util.c 6 | ${CMAKE_CURRENT_LIST_DIR}/module/lfs.h 7 | ${CMAKE_CURRENT_LIST_DIR}/module/lfs_util.h) 8 | 9 | --------------------------------------------------------------------------------