-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add new hardware: Heltec MeshPocket #6533
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
838f23a
Add Heltec MeshPocket.
Heltec-Aaron-Lee 4182768
Merge branch 'meshtastic:master' into master
Heltec-Aaron-Lee 69c41af
MeshPocket source code update
Heltec-Aaron-Lee 2093e0b
Optimiz code for refresh border during full update.
Heltec-Aaron-Lee e0526af
Merge branch 'meshtastic:master' into master
Heltec-Aaron-Lee 5c71491
Update Heltec MeshPocket json file info.
Heltec-Aaron-Lee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"build": { | ||
"arduino": { | ||
"ldscript": "nrf52840_s140_v6.ld" | ||
}, | ||
"core": "nRF5", | ||
"cpu": "cortex-m4", | ||
"extra_flags": "-DNRF52840_XXAA", | ||
"f_cpu": "64000000L", | ||
"hwids": [ | ||
["0x239A", "0x4405"], | ||
["0x239A", "0x0029"], | ||
["0x239A", "0x002A"] | ||
], | ||
"usb_product": "HT-n5262", | ||
"mcu": "nrf52840", | ||
"variant": "heltec_mesh_pocket", | ||
"variants_dir": "variants", | ||
"bsp": { | ||
"name": "adafruit" | ||
}, | ||
"softdevice": { | ||
"sd_flags": "-DS140", | ||
"sd_name": "s140", | ||
"sd_version": "6.1.1", | ||
"sd_fwid": "0x00B6" | ||
}, | ||
"bootloader": { | ||
"settings_addr": "0xFF000" | ||
} | ||
}, | ||
"connectivity": ["bluetooth"], | ||
"debug": { | ||
"jlink_device": "nRF52840_xxAA", | ||
"onboard_tools": ["jlink"], | ||
"svd_path": "nrf52840.svd", | ||
"openocd_target": "nrf52840-mdk-rs" | ||
}, | ||
"frameworks": ["arduino"], | ||
"name": "Heltec nrf (Adafruit BSP)", | ||
"upload": { | ||
"maximum_ram_size": 248832, | ||
"maximum_size": 815104, | ||
"speed": 115200, | ||
"protocol": "nrfutil", | ||
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"], | ||
"use_1200bps_touch": true, | ||
"require_upload_port": true, | ||
"wait_for_upload_port": true | ||
}, | ||
"url": "https://heltec.org/project/meshpocket/", | ||
"vendor": "Heltec" | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "./LCMEN2R13ECC1.h" | ||
|
||
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS | ||
|
||
using namespace NicheGraphics::Drivers; | ||
|
||
// Map the display controller IC's output to the connected panel | ||
void LCMEN2R13ECC1::configScanning() | ||
{ | ||
// "Driver output control" | ||
sendCommand(0x01); | ||
sendData(0xF9); | ||
sendData(0x00); | ||
sendData(0x00); | ||
|
||
// To-do: delete this method? | ||
// Values set here might be redundant: F9, 00, 00 seems to be default | ||
} | ||
|
||
// Specify which information is used to control the sequence of voltages applied to move the pixels | ||
// - For this display, configUpdateSequence() specifies that a suitable LUT will be loaded from | ||
// the controller IC's OTP memory, when the update procedure begins. | ||
void LCMEN2R13ECC1::configWaveform() | ||
{ | ||
switch (updateType) { | ||
case FAST: | ||
sendCommand(0x3C); // Border waveform: | ||
sendData(0x85); | ||
break; | ||
|
||
case FULL: | ||
default: | ||
// From OTP memory | ||
break; | ||
} | ||
} | ||
|
||
void LCMEN2R13ECC1::configUpdateSequence() | ||
{ | ||
switch (updateType) { | ||
case FAST: | ||
sendCommand(0x22); // Set "update sequence" | ||
sendData(0xFF); // Will load LUT from OTP memory, Display mode 2 "differential refresh" | ||
break; | ||
|
||
case FULL: | ||
default: | ||
sendCommand(0x22); // Set "update sequence" | ||
sendData(0xF7); // Will load LUT from OTP memory | ||
break; | ||
} | ||
} | ||
|
||
// Once the refresh operation has been started, | ||
// begin periodically polling the display to check for completion, using the normal Meshtastic threading code | ||
// Only used when refresh is "async" | ||
void LCMEN2R13ECC1::detachFromUpdate() | ||
{ | ||
switch (updateType) { | ||
case FAST: | ||
return beginPolling(50, 800); // At least 500ms for fast refresh | ||
case FULL: | ||
default: | ||
return beginPolling(100, 2500); // At least 2 seconds for full refresh | ||
} | ||
} | ||
|
||
#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
|
||
E-Ink display driver | ||
- SSD1680 | ||
- Manufacturer: WISEVAST | ||
- Size: 2.13 inch | ||
- Resolution: 122px x 255px | ||
- Flex connector marking: Soldering connector, no connector is needed | ||
|
||
*/ | ||
|
||
#pragma once | ||
|
||
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS | ||
|
||
#include "configuration.h" | ||
|
||
#include "./SSD16XX.h" | ||
|
||
namespace NicheGraphics::Drivers | ||
{ | ||
class LCMEN2R13ECC1 : public SSD16XX | ||
{ | ||
// Display properties | ||
private: | ||
static constexpr uint32_t width = 122; | ||
static constexpr uint32_t height = 250; | ||
static constexpr UpdateTypes supported = (UpdateTypes)(FULL | FAST); | ||
|
||
public: | ||
LCMEN2R13ECC1() : SSD16XX(width, height, supported, 1) {} // Note: left edge of this display is offset by 1 byte | ||
|
||
protected: | ||
virtual void configScanning() override; | ||
virtual void configWaveform() override; | ||
virtual void configUpdateSequence() override; | ||
void detachFromUpdate() override; | ||
}; | ||
|
||
} // namespace NicheGraphics::Drivers | ||
#endif // MESHTASTIC_INCLUDE_NICHE_GRAPHICS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#pragma once | ||
|
||
#include "configuration.h" | ||
|
||
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS | ||
|
||
// InkHUD-specific components | ||
// --------------------------- | ||
#include "graphics/niche/InkHUD/InkHUD.h" | ||
|
||
// Applets | ||
#include "graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.h" | ||
#include "graphics/niche/InkHUD/Applets/User/DM/DMApplet.h" | ||
#include "graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.h" | ||
#include "graphics/niche/InkHUD/Applets/User/Positions/PositionsApplet.h" | ||
#include "graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.h" | ||
#include "graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.h" | ||
|
||
// #include "graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.h" | ||
// #include "graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h" | ||
|
||
// Shared NicheGraphics components | ||
// -------------------------------- | ||
#include "graphics/niche/Drivers/EInk/LCMEN2R13ECC1.h" | ||
#include "graphics/niche/Inputs/TwoButton.h" | ||
|
||
#include "graphics/niche/Fonts/FreeSans6pt7b.h" | ||
#include "graphics/niche/Fonts/FreeSans6pt8bCyrillic.h" | ||
#include <Fonts/FreeSans9pt7b.h> | ||
|
||
void setupNicheGraphics() | ||
{ | ||
using namespace NicheGraphics; | ||
|
||
// SPI | ||
// ----------------------------- | ||
SPIClass *spi1=&SPI1; | ||
spi1->begin(); | ||
// Display is connected to SPI1 | ||
|
||
// E-Ink Driver | ||
// ----------------------------- | ||
// Use E-Ink driver | ||
Drivers::EInk *driver = new Drivers::LCMEN2R13ECC1; | ||
driver->begin(spi1, PIN_EINK_DC, PIN_EINK_CS, PIN_EINK_BUSY, PIN_EINK_RES); | ||
|
||
// InkHUD | ||
// ---------------------------- | ||
|
||
InkHUD::InkHUD *inkhud = InkHUD::InkHUD::getInstance(); | ||
|
||
// Set the driver | ||
inkhud->setDriver(driver); | ||
|
||
// Set how many FAST updates per FULL update | ||
// Set how unhealthy additional FAST updates beyond this number are | ||
inkhud->setDisplayResilience(10, 1.5); | ||
|
||
// Prepare fonts | ||
InkHUD::Applet::fontLarge = InkHUD::AppletFont(FreeSans9pt7b); | ||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt7b); | ||
/* | ||
// Font localization demo: Cyrillic | ||
InkHUD::Applet::fontSmall = InkHUD::AppletFont(FreeSans6pt8bCyrillic); | ||
InkHUD::Applet::fontSmall.addSubstitutionsWin1251(); | ||
*/ | ||
|
||
// Customize default settings | ||
inkhud->persistence->settings.userTiles.maxCount = 2; // How many tiles can the display handle? | ||
inkhud->persistence->settings.rotation = 3; // 270 degrees clockwise | ||
inkhud->persistence->settings.userTiles.count = 1; // One tile only by default, keep things simple for new users | ||
inkhud->persistence->settings.optionalMenuItems.nextTile = true; | ||
|
||
// Pick applets | ||
inkhud->addApplet("All Messages", new InkHUD::AllMessageApplet, true, true); // Activated, autoshown | ||
inkhud->addApplet("DMs", new InkHUD::DMApplet); // Inactive | ||
inkhud->addApplet("Channel 0", new InkHUD::ThreadedMessageApplet(0)); // Inactive | ||
inkhud->addApplet("Channel 1", new InkHUD::ThreadedMessageApplet(1)); // Inactive | ||
inkhud->addApplet("Positions", new InkHUD::PositionsApplet, true); // Activated | ||
inkhud->addApplet("Recents List", new InkHUD::RecentsListApplet); // Inactive | ||
inkhud->addApplet("Heard", new InkHUD::HeardApplet, true, false, 0); // Activated, not autoshown, default on tile 0 | ||
// inkhud->addApplet("Basic", new InkHUD::BasicExampleApplet); | ||
// inkhud->addApplet("NewMsg", new InkHUD::NewMsgExampleApplet); | ||
|
||
// Start running InkHUD | ||
inkhud->begin(); | ||
|
||
// Buttons | ||
// -------------------------- | ||
|
||
Inputs::TwoButton *buttons = Inputs::TwoButton::getInstance(); // Shared NicheGraphics component | ||
constexpr uint8_t MAIN_BUTTON = 0; | ||
// constexpr uint8_t AUX_BUTTON = 1; | ||
|
||
// Setup the main user button | ||
buttons->setWiring(MAIN_BUTTON, Inputs::TwoButton::getUserButtonPin()); | ||
buttons->setHandlerShortPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->shortpress(); }); | ||
buttons->setHandlerLongPress(MAIN_BUTTON, []() { InkHUD::InkHUD::getInstance()->longpress(); }); | ||
|
||
// Setup the aux button | ||
// Bonus feature of VME213 | ||
// buttons->setWiring(AUX_BUTTON, BUTTON_PIN_SECONDARY); | ||
// buttons->setHandlerShortPress(AUX_BUTTON, []() { InkHUD::InkHUD::getInstance()->nextTile(); }); | ||
buttons->start(); | ||
} | ||
|
||
#endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.