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

Added Espressif esp32 code for CAN/TWAI integration and display functionality #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions twai_can_receiver/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
managed_components/
.vscode/
6 changes: 6 additions & 0 deletions twai_can_receiver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 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.16)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(twai_network_slave)
24 changes: 24 additions & 0 deletions twai_can_receiver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# TWAI/CAN Receiver Code
ESP32 code for the CAN receiver. Also connects to a display using I2C and draws graphics with lvgl.

## Setup
If ESP-IDF is not installed, follow [espressif's installation guide.](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html)


If ESP-IDF is installed, run
```
. $HOME/esp/esp-idf/export.sh
cd <project-directory>
idf.py set-target esp32
idf.py add-dependency "espressif/esp_lvgl_port^2.3.0"
idf.py menuconfig
```
In menuconfig,
Component config --> LVGL Configuration --> Font usage --> Enable built-in fonts --> Enable Montserrat 32
this will enable the larger font size. Then click S to save and Q to exit menuconfig.
Then run,
```
idf.py build
idf.py -p <PORT> flash monitor
```

33 changes: 33 additions & 0 deletions twai_can_receiver/dependencies.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
dependencies:
espressif/esp_lvgl_port:
component_hash: ff682937ac7f94653e45719f888db637830e90dd0ba3ff5b72d2c808c7a93949
dependencies:
- name: idf
require: private
version: '>=4.4'
- name: lvgl/lvgl
registry_url: https://components.espressif.com
require: public
version: '>=8,<10'
source:
registry_url: https://components.espressif.com/
type: service
version: 2.4.1
idf:
source:
type: idf
version: 5.4.0
lvgl/lvgl:
component_hash: d7c1ac037ae6e85d94897f807d6e7ba0946a83e720074fc95a4f6241da9f9f53
dependencies: []
source:
registry_url: https://components.espressif.com/
type: service
version: 8.4.0
direct_dependencies:
- espressif/esp_lvgl_port
- idf
- lvgl/lvgl
manifest_hash: 4d22193101c18ee11370590bf1a5f7be65523ee18360c0c216a4ab2d8922b03e
target: esp32
version: 2.0.0
2 changes: 2 additions & 0 deletions twai_can_receiver/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
idf_component_register(SRCS "twai_network_example_slave_main.c"
INCLUDE_DIRS ".")
19 changes: 19 additions & 0 deletions twai_can_receiver/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
menu "Example Configuration"

config EXAMPLE_TX_GPIO_NUM
int "TX GPIO number"
default 21 if IDF_TARGET_ESP32
default 0
help
This option selects the GPIO pin used for the TX signal. Connect the
TX signal to your transceiver.

config EXAMPLE_RX_GPIO_NUM
int "RX GPIO number"
default 22 if IDF_TARGET_ESP32
default 2
help
This option selects the GPIO pin used for the RX signal. Connect the
RX signal to your transceiver.

endmenu
19 changes: 19 additions & 0 deletions twai_can_receiver/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## IDF Component Manager Manifest File
dependencies:
espressif/esp_lvgl_port: "^2.4.1"
## Required IDF version
idf:
version: ">=4.1.0"
lvgl/lvgl: ^8

# # Put list of dependencies here
# # For components maintained by Espressif:
# component: "~1.0.0"
# # For 3rd party components:
# username/component: ">=1.0.0,<2.0.0"
# username2/component2:
# version: "~1.0.0"
# # For transient dependencies `public` flag can be set.
# # `public` flag doesn't have an effect dependencies of the `main` component.
# # All dependencies of `main` are public by default.
# public: true
Loading