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

Gate_SerialCom ESP32 project example #351

Merged
merged 5 commits into from
Sep 1, 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
13 changes: 4 additions & 9 deletions examples/projects/ESP32/button/lib/button/library.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{
"name": "Button",
"name": "button",
"keywords": "robus,network,microservice,luos,operating system,os,embedded,communication,service,ST",
"description": "a simple button driver",
"version": "1.0.0",
"authors": {
"name": "Luos",
"url": "https://luos.io"
},
"dependencies": {
"luos/luos_engine": "^2.6.0"
},
"licence": "MIT",
"build": {
"flags": [
"-DREV={1,0,0}"
]
"dependencies": {
"luos_engine": "^2.6.0"
}
}
}
11 changes: 3 additions & 8 deletions examples/projects/ESP32/button_arduino/lib/button/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
"name": "Luos",
"url": "https://luos.io"
},
"dependencies": {
"luos/luos_engine": "^2.6.0"
},
"licence": "MIT",
"build": {
"flags": [
"-DREV={1,0,0}"
]
"dependencies": {
"luos_engine": "^2.6.0"
}
}
}
8 changes: 8 additions & 0 deletions examples/projects/ESP32/gate_serialcom_arduino/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})
project(${ProjectId})
122 changes: 122 additions & 0 deletions examples/projects/ESP32/gate_serialcom_arduino/node_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/******************************************************************************
* @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 MAX_SERVICE_NUMBER 2
#define MSG_BUFFER_SIZE 2048
#define MAX_MSG_NB 40

/*******************************************************************************
* 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_TO_LUOS_BUFFER_SIZE | 1024 | Receive pipe buffer size
* LUOS_TO_PIPE_BUFFER_SIZE | 2048 | Transmit pipe buffer size
******************************************************************************/

#define MAX_RTB_ENTRY 40
#define GATE_BUFF_SIZE 1024
#define PIPE_TO_LUOS_BUFFER_SIZE 1024
#define LUOS_TO_PIPE_BUFFER_SIZE 2048

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

#define PIPE_SERIAL_BAUDRATE 115200

#endif /* _NODE_CONFIG_H_ */
44 changes: 44 additions & 0 deletions examples/projects/ESP32/gate_serialcom_arduino/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 = arduino, espidf
build_unflags = -Os
build_flags =
-include node_config.h
-DLUOSHAL=ESP32
-DGATEFORMAT=TinyJSON
-DPIPEMODE=SERIAL
-DPIPEHAL=ARDUINO
-O1
lib_deps =
luos_engine@^2.6.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




18 changes: 18 additions & 0 deletions examples/projects/ESP32/gate_serialcom_arduino/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Override some defaults to enable Arduino framework
CONFIG_ENABLE_ARDUINO_DEPENDS=y
CONFIG_AUTOSTART_ARDUINO=y
CONFIG_ARDUINO_RUN_CORE1=y
CONFIG_ARDUINO_RUNNING_CORE=1
CONFIG_ARDUINO_EVENT_RUN_CORE1=y
CONFIG_ARDUINO_EVENT_RUNNING_CORE=1
CONFIG_ARDUINO_UDP_RUN_CORE1=y
CONFIG_ARDUINO_UDP_RUNNING_CORE=1
CONFIG_DISABLE_HAL_LOCKS=y
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR=y
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL=1
CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT=y
CONFIG_ARDUHAL_PARTITION_SCHEME="default"
CONFIG_AUTOCONNECT_WIFI=y
CONFIG_ARDUINO_SELECTIVE_WiFi=y
CONFIG_MBEDTLS_PSK_MODES=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
Loading