-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bidirectional communications to Calypso (#44)
* initial bidirectional config * remove generated files * fix clippy * add msbs, format, and clippy * misc error fixes, cleanup, release performance improvements * remove unneeded result, fix up docs * remove uneeded let * bump and upgrade bitstream to const eval, msrv 1.79 * make clippy happy * bump
- Loading branch information
Showing
15 changed files
with
391 additions
and
352 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
rustflags = ["-Ctarget-cpu=native"] |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Submodule Embedded-Base
updated
22 files
+5 −0 | cangen/CANField.py | |
+17 −2 | cangen/CANMsg.py | |
+25 −9 | cangen/README.md | |
+9 −3 | cangen/Result.py | |
+248 −50 | cangen/RustSynth.py | |
+2 −1 | cangen/YAMLParser.py | |
+1 −0 | cangen/can-messages/bms.yaml | |
+69 −0 | cangen/can-messages/calypso_cmd.yaml | |
+1 −1 | cangen/can-messages/dti.yaml | |
+44 −4 | cangen/can-messages/mpu.yaml | |
+384 −0 | cangen/can-messages/msb.yaml | |
+741 −9 | clang-format | |
+1,019 −0 | general/include/vl6180x_api.h | |
+119 −0 | general/include/vl6180x_cfg.h | |
+773 −0 | general/include/vl6180x_def.h | |
+166 −0 | general/include/vl6180x_i2c.h | |
+312 −0 | general/include/vl6180x_platform.h | |
+104 −0 | general/include/vl6180x_types.h | |
+2,769 −0 | general/src/vl6180x_api.c | |
+261 −0 | general/src/vl6180x_i2c.c | |
+50 −0 | middleware/include/i2c_utility.h | |
+158 −0 | middleware/src/i2c_utility.c |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use crate::data::EncodeData; | ||
|
||
use super::encode_master_mapping::get_message_info; | ||
/** | ||
* Wrapper class for an individual encodable message. | ||
*/ | ||
pub struct EncodableMessage { | ||
key: String, | ||
data: Vec<f32>, | ||
} | ||
|
||
/** | ||
* Implementation of Message. | ||
*/ | ||
impl EncodableMessage { | ||
/** | ||
* Creates a new message with the given string key and value | ||
*/ | ||
pub fn new(key: String, data: Vec<f32>) -> Self { | ||
Self { key, data } | ||
} | ||
|
||
/** | ||
* Decodes the message and returns a struct which defines a CAN packet | ||
*/ | ||
pub fn encode(self) -> EncodeData { | ||
EncodableMessage::encode_message(self.key, self.data) | ||
} | ||
|
||
/** | ||
* Decodes the message and returns a vector of Data objects. | ||
* Achieves this by calling the decoder function associated with the message key. | ||
* param key: The key of the message. | ||
* param data: The data of the message. | ||
* return: A vector of Data objects. | ||
*/ | ||
fn encode_message(key: String, data: Vec<f32>) -> EncodeData { | ||
let encoder = get_message_info(key).encoder; | ||
encoder(data) | ||
} | ||
} |
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,6 +1,11 @@ | ||
pub mod command_data; | ||
pub mod data; | ||
pub mod decodable_message; | ||
pub mod decode_data; | ||
pub mod master_mapping; | ||
pub mod message; | ||
pub mod decode_master_mapping; | ||
pub mod encodable_message; | ||
pub mod encode_data; | ||
pub mod encode_master_mapping; | ||
pub mod format_data; | ||
pub mod mqtt; | ||
pub mod serverdata; |
Oops, something went wrong.