Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emeric-martineau/jsy_mk_194
Rust crate to read data from JSY-MK-194 power device
https://github.com/emeric-martineau/jsy_mk_194
esp32 hal rust
Last synced: 27 days ago
JSON representation
Rust crate to read data from JSY-MK-194 power device
- Host: GitHub
- URL: https://github.com/emeric-martineau/jsy_mk_194
- Owner: emeric-martineau
- License: mit
- Created: 2023-11-12T17:49:31.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-01T16:48:31.000Z (5 months ago)
- Last Synced: 2024-11-15T09:47:08.340Z (2 months ago)
- Topics: esp32, hal, rust
- Language: Rust
- Homepage:
- Size: 1020 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rust crate for JSY-MK-194
## What is JSY-MK-194?
JSY-MK-194 is hardware to get some informations about current, voltage, frequency of AC current.
You found this hardware easly on some chiness website.
![JSY-MK-194](doc/jsy-mk-194.jpg)
## Test hardware
This crate has only tested on ESP32-WROOM-32 microcontroler.
## Example
First, you need provide implementation of some trait (hardware abstract):
```rust
use jsy_mk_194::*;struct MyUartImpl {
// Some necessary fields
}impl Uart for MyUartImpl {
fn read(&mut self, buf: &mut [u8], _timeout: u32) -> Result {
// Do something
}fn write(&mut self, bytes: &[u8]) -> Result {
// Do something
}
}struct MyDelayImpl {
// Some necessary fields
}impl DelayMs for MyDelayImpl {
fn delay_ms(&mut self, _ms: u16) {
// Do something
}
}
```Then, you need call `read()` method:
```rust
let mut jsy_my_194 = jsy_my_194::new(my_uart_impl, my_delay_impl);
let _ = jsy_my_194.read();print!("First channel power: {}", jsy_my_194.channel1.power());
```That's all!
## Changelog
### 1.0.3
- Allow update UART after change bitrate
### 1.0.2
DON'T USE IT. IT'S MISTAKE
### 1.0.1
- Rewrite module to be more easy to understand
- Add new public `read_with_timeout` method to allow user set his timeout## License
The code is released under MIT License to allow every body to use it in all conditions. If you love open-source software and this crate, please give some money to [HaikuOS](https://haiku-os.org/) or [ReactOS](https://reactos.org).