Skip to content
New issue

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

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

Already on GitHub? # to your account

Add pwrcan support #36

Merged
merged 2 commits into from
Sep 20, 2024
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
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ M5 stack library for cybergear

![image](https://github.com/project-sternbergia/cybergear_m5/assets/147309062/c36d82cf-e91a-45da-ac53-a79e8d8fc730)

## H/W Components (ESP32 + PWRCAN)

* [Xiaomi Cybergear](https://www.mi.com/cyber-gear)
* [M5Stack Basic V2.7](https://shop.m5stack.com/collections/m5-controllers/products/esp32-basic-core-lot-development-kit-v2-7)
* [PWRCAN 13.2 Module with Isolated 2-Ch CAN & 1-Ch RS485](https://shop.m5stack.com/products/pwrcan-13-2-module-with-isolated-2-ch-can-1-ch-rs485)

![image](https://github.com/project-sternbergia/cybergear_m5/assets/147309062/c36d82cf-e91a-45da-ac53-a79e8d8fc730)

## H/W Components (ESP32 + CAN Transceiver Unit)

* [Xiaomi Cybergear](https://www.mi.com/cyber-gear)
Expand Down Expand Up @@ -62,7 +70,7 @@ git clone https://github.com/project-sternbergia/cybergear_m5.git
![image](https://github.com/project-sternbergia/cybergear_m5/assets/147309062/8a4edd90-241c-4683-a13d-4a26685e8251)

Put this file in the same folder as control_mode_example.ino (for Arduino IDE)

If you want to use ESP32_CAN library, please comment in [this lines]().

4. Build and write firmware to M5Stack

Expand Down
Binary file added docs/img/cybergear_m5_pwrcan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions examples/control_mode_example/control_mode_example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <M5Stack.h>
#include "cybergear_driver.hh"

// #define USE_ESP32_CAN // If you want to use ESP32_CAN or PWRCAN, please uncomment this line
// #define USE_PWRCAN // If you want to use PWRCAN, please uncomment this line
#ifdef USE_ESP32_CAN
#include "cybergear_can_interface_esp32.hh"
#else
Expand Down Expand Up @@ -67,7 +69,12 @@ void setup()
sprite.createSprite(M5.Lcd.width(), M5.Lcd.height());

// init cybergear driver
#ifdef USE_PWRCAN
interface.init(16, 17);
#else
interface.init();
#endif

driver.init(&interface);
driver.init_motor(mode);
driver.set_limit_speed(init_speed);
Expand Down