Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/esp ws #406

Merged
merged 9 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
./tool_services/gate/TinyJSON/tiny-json.h
./tool_services/gate/TinyJSON/tiny-json.c
./tool_services/pipe/WS/native/mongoose
./tool_services/pipe/WS/ESP32_IDF/mongoose
./tool_services/pipe/WS/ARDUINO/WebSockets
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@
/examples/projects/SAMD21XPLAINED/bootloader/firmware/luos_bootloader_samd21j18a.X/build/
/examples/projects/SAMD21XPLAINED/bootloader/firmware/luos_bootloader_samd21j18a.X/.generated_files/
/examples/projects/SAMD21XPLAINED/bootloader/firmware/luos_bootloader_samd21j18a.X/dist/
/tool_services/pipe/WS/native/mongoose


2 changes: 1 addition & 1 deletion examples/projects/ESP32/button/src/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Blink Example
/* button Example

This example code is in the Public Domain (or CC0 licensed, at your option.)

Expand Down
15 changes: 15 additions & 0 deletions examples/projects/ESP32/gate_serialcom/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

list(APPEND EXTRA_COMPONENT_DIRS "../../../../network/robus/HAL/ESP32")
list(APPEND EXTRA_COMPONENT_DIRS "../../../../tool_services/gate")
list(APPEND EXTRA_COMPONENT_DIRS "../../../../tool_services/pipe/SERIAL/ESP32_IDF")
list(APPEND EXTRA_COMPONENT_DIRS "src")

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})
project(${ProjectId})


128 changes: 128 additions & 0 deletions examples/projects/ESP32/gate_serialcom/node_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/******************************************************************************
* @file node_config.h
* @brief This file allow you to use standard preprocessor definitions to
* configure your project, Luos and Luos HAL libraries
*
* # Introduction
* This file is for the luos user. You may here configure your project and
* define your custom Luos service and custom Luos command for your product
*
* Luos libraries offer a minimal standard configuration to optimize
* memory usage. In some case you have to modify standard value to fit
* with your need concerning among of data transiting through the network
* or network speed for example
*
* Luos libraries can be use with a lot a MCU family. Luos compagny give you
* a default configuration, for specific MCU family, in robus_hal_config.h.
* This configuration can be modify here to fit with you design by
* preprocessor definitions of MCU Hardware needs
*
* # Usage
* This file should be place a the root folder of your project and include
* where build flag preprocessor definitions are define in your IDE
* -include node_config.h
*
* @author Luos
* @version 0.0.0
******************************************************************************/
#ifndef _NODE_CONFIG_H_
#define _NODE_CONFIG_H_

/*******************************************************************************
* PROJECT DEFINITION
*******************************************************************************/

/*******************************************************************************
* LUOS LIBRARY DEFINITION
*******************************************************************************
* Define | Default Value | Description
* :---------------------|------------------------------------------------------
* MAX_SERVICE_NUMBER | 5 | Service number in the node
* MSG_BUFFER_SIZE | 3*SIZE_MSG_MAX (405 Bytes) | Size in byte of the Luos buffer TX and RX
* MAX_MSG_NB | 2*MAX_SERVICE_NUMBER | Message number in Luos buffer
* NBR_PORT | 2 | PTP Branch number Max 8
* NBR_RETRY | 10 | Send Retry number in case of NACK or collision
******************************************************************************/

#define MSG_BUFFER_SIZE 1024
#define PIPE_SERIAL_BAUDRATE 115200
#define DEFAULTBAUDRATE 500000

/*******************************************************************************
* LUOS HAL LIBRARY DEFINITION
*******************************************************************************
* Define | Description
* :-----------------------|-----------------------------------------------
* MCUFREQ | Put your the MCU frequency (value in Hz)
* TIMERDIV | Timer divider clock (see your clock configuration)
* USE_CRC_HW | define to 0 if there is no Module CRC in your MCU
* USE_TX_IT | define to 1 to not use DMA transfers for Luos Tx
*
* PORT_CLOCK_ENABLE | Enable clock for port
* PTPx | A,B,C,D etc. PTP Branch Pin/Port/IRQ
* TX_LOCK_DETECT | Disable by default use if not busy flag in USART Pin/Port/IRQ
* RX_EN | Rx enable for driver RS485 always on Pin/Port
* TX_EN | Tx enable for driver RS485 Pin/Port
* COM_TX | Tx USART Com Pin/Port/Alternate
* COM_RX | Rx USART Com Pin/Port/Alternate
* PINOUT_IRQHANDLER | Callback function for Pin IRQ handler

* LUOS_COM_CLOCK_ENABLE | Enable clock for USART
* LUOS_COM | USART number
* LUOS_COM_IRQ | USART IRQ number
* LUOS_COM_IRQHANDLER | Callback function for USART IRQ handler

* LUOS_DMA_CLOCK_ENABLE | Enable clock for DMA
* LUOS_DMA | DMA number
* LUOS_DMA_CHANNEL | DMA channel (depending on MCU DMA may need special config)

* LUOS_TIMER_CLOCK_ENABLE | Enable clock for Timer
* LUOS_TIMER | Timer number
* LUOS_TIMER_IRQ | Timer IRQ number
* LUOS_TIMER_IRQHANDLER | Callback function for Timer IRQ handler
******************************************************************************/

/*******************************************************************************
* FLASH CONFIGURATION FOR APP WITH BOOTLOADER
********************************************************************************
* Define | Default Value | Description
* :---------------------|------------------------------------------------------
* BOOT_START_ADDRESS | FLASH_BASE = 0x8000000 | Start address of Bootloader in flash
* SHARED_MEMORY_ADDRESS | 0x0800C000 | Start address of shared memory to save boot flag
* APP_START_ADDRESS | 0x0800C800 | Start address of application with bootloader
* APP_END_ADDRESS | FLASH_BANK1_END=0x0801FFFF | End address of application with bootloader
******************************************************************************/

/*******************************************************************************
* GATE SERIAL COM DEFINITION
*******************************************************************************
* Define | Default Value | Description
* :-------------------------|------------------------------------------------------
* MAX_RTB_ENTRY | 40 | max number entry in routing table
* GATE_BUFF_SIZE | 1024 | Json receive buffer size
* PIPE_TX_BUFFER_SIZE | 1024 | Receive pipe buffer size
* PIPE_RX_BUFFER_SIZE | 2048 | Transmit pipe buffer size
* INIT_TIME | 150 | Wait init time before first detection
******************************************************************************/
#define MAX_RTB_ENTRY 40
#define GATE_BUFF_SIZE 2048
#define PIPE_RX_BUFFER_SIZE 2048
#define PIPE_TX_BUFFER_SIZE 4096

/*******************************************************************************
* OTHER GATE PARAMETERS
*******************************************************************************
* Define | Default Value | Description
* :--------------|------------------------------------------------------
* INIT_TIME | 150 | Wait init time before first detection
* ******************************************************************************/

/*******************************************************************************
* OTHER PIPE PARAMETERS
*******************************************************************************
* Define | Default Value | Description
* :--------------------|----------------------------------------------------
* PIPE_CONFIG | none | To Modify pipe config
* ******************************************************************************/

#endif /* _NODE_CONFIG_H_ */
44 changes: 44 additions & 0 deletions examples/projects/ESP32/gate_serialcom/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp32dev

[env]
lib_ldf_mode =off
lib_extra_dirs =
$PROJECT_DIR/../../../../../
$PROJECT_DIR/../../../../tool_services/
platform = espressif32
framework = espidf
build_unflags = -Os
build_flags =
-include node_config.h
-DLUOSHAL=ESP32
-DGATEFORMAT=TinyJSON
-DPIPEMODE=SERIAL
-DPIPEHAL=ESP32_IDF
-O1
lib_deps =
luos_engine@^2.7.0
Gate
Pipe

[env:esp32dev]
board = esp32dev
debug_tool = esp-prog
debug_init_break = tbreak setup

[env:esp32-c3-devkitm-1]
board = esp32-c3-devkitm-1




Loading