forked from tbnobody/OpenDTU
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
391 additions
and
297 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,91 +1,3 @@ | ||
# Device Profiles | ||
|
||
This documentation will has been moved and can be found here: <https://tbnobody.github.io/OpenDTU-docs/firmware/device_profiles/> | ||
|
||
## Structure of the json file for openDTU-onBattery (outdated example) | ||
|
||
```json | ||
[ | ||
{ | ||
"name": "Generic NodeMCU 38 pin", | ||
"nrf24": { | ||
"miso": 19, | ||
"mosi": 23, | ||
"clk": 18, | ||
"irq": 16, | ||
"en": 4, | ||
"cs": 5 | ||
}, | ||
"victron": { | ||
"rx": 22, | ||
"tx": 21 | ||
}, | ||
"battery": { | ||
"rx": 27, | ||
"tx": 14 | ||
}, | ||
"huawei": { | ||
"miso": 12, | ||
"mosi": 13, | ||
"clk": 26, | ||
"irq": 25, | ||
"power": 33, | ||
"cs": 15 | ||
}, | ||
"eth": { | ||
"enabled": false, | ||
"phy_addr": -1, | ||
"power": -1, | ||
"mdc": -1, | ||
"mdio": -1, | ||
"type": -1, | ||
"clk_mode": -1 | ||
} | ||
}, | ||
{ | ||
"name": "Generic NodeMCU 38 pin with SSD1306", | ||
"nrf24": { | ||
"miso": 19, | ||
"mosi": 23, | ||
"clk": 18, | ||
"irq": 16, | ||
"en": 4, | ||
"cs": 5 | ||
}, | ||
"eth": { | ||
"enabled": false, | ||
"phy_addr": -1, | ||
"power": -1, | ||
"mdc": -1, | ||
"mdio": -1, | ||
"type": -1, | ||
"clk_mode": -1 | ||
}, | ||
"display": { | ||
"type": 2, | ||
"data": 21, | ||
"clk": 22 | ||
} | ||
}, | ||
{ | ||
"name": "Olimex ESP32-POE", | ||
"nrf24": { | ||
"miso": 15, | ||
"mosi": 2, | ||
"clk": 14, | ||
"irq": 13, | ||
"en": 16, | ||
"cs": 5 | ||
}, | ||
"eth": { | ||
"enabled": true, | ||
"phy_addr": 0, | ||
"power": 12, | ||
"mdc": 23, | ||
"mdio": 18, | ||
"type": 0, | ||
"clk_mode": 3 | ||
} | ||
} | ||
] | ||
``` | ||
This documentation has been [moved to the wiki](https://github.com/helgeerbe/OpenDTU-OnBattery/wiki/Device-Profiles). |
This file contains 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,27 +1,21 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <map> | ||
#include <array> | ||
#include <optional> | ||
#include <string> | ||
|
||
class SerialPortManagerClass { | ||
public: | ||
bool allocateMpptPort(int port); | ||
bool allocateBatteryPort(int port); | ||
void invalidateBatteryPort(); | ||
void invalidateMpptPorts(); | ||
void init(); | ||
|
||
private: | ||
enum Owner { | ||
BATTERY, | ||
MPPT | ||
}; | ||
|
||
std::map<uint8_t, Owner> allocatedPorts; | ||
std::optional<uint8_t> allocatePort(std::string const& owner); | ||
void freePort(std::string const& owner); | ||
|
||
bool allocatePort(uint8_t port, Owner owner); | ||
void invalidate(Owner owner); | ||
|
||
static const char* print(Owner owner); | ||
private: | ||
// the amount of hardare UARTs available on supported ESP32 chips | ||
static size_t constexpr _num_controllers = 3; | ||
std::array<std::string, _num_controllers> _ports = { "" }; | ||
}; | ||
|
||
extern SerialPortManagerClass SerialPortManager; |
This file contains 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
Oops, something went wrong.