-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is like a mega-commit which isn't nice but, this is meant primarily for internal use so it is okay! A lot of the additions here are self explanatory!
- Loading branch information
Showing
35 changed files
with
461 additions
and
126 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,46 @@ | ||
name: "publish" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish-tauri: | ||
permissions: | ||
contents: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [macos-latest, ubuntu-20.04, windows-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: install Rust stable | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: install dependencies (ubuntu only) | ||
if: matrix.platform == 'ubuntu-20.04' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | ||
- name: install frontend dependencies | ||
run: yarn install # change this to npm or pnpm depending on which one you use | ||
|
||
- uses: tauri-apps/tauri-action@v0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version | ||
releaseName: "App v__VERSION__" | ||
releaseBody: "See the assets to download this version and install." | ||
releaseDraft: true | ||
prerelease: false |
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,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Muki Kiboigo | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
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,7 +1,6 @@ | ||
# Tauri + Svelte + Typescript | ||
# BQ-EVM-UI | ||
|
||
This template should help get you started developing with Tauri, Svelte and TypeScript in Vite. | ||
This is intended to give a GUI for interfacing with the BQ76925-EVM from TI without a USB-to-GPIO. | ||
|
||
## Recommended IDE Setup | ||
|
||
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). | ||
## Arduino | ||
An Arduino file is provided in the /arduino directory that contains everything needed to interface with it over the given USB port. |
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,130 @@ | ||
#include <Wire.h> | ||
|
||
uint16_t read_from_msp(unsigned int reg, int size) { | ||
// This is more "standard" I2C. | ||
// From my experience, it usually follow the flow below. | ||
// | ||
// Send Read Address. | ||
// Send Read Register. | ||
// Send Start Again (which is what the endTransmission(false) is doing) | ||
// Send Read Address Again. | ||
// THEN the peripheral I2C device responds with the data. | ||
|
||
uint8_t msp_address = 0x40; | ||
Wire.beginTransmission(msp_address); | ||
Wire.write(reg); | ||
Wire.endTransmission(false); | ||
Wire.requestFrom(msp_address, size , true); | ||
|
||
unsigned int returnInt = 0; | ||
for(int i = 0; i < size; i++) { | ||
returnInt = (returnInt << 8) | Wire.read(); | ||
} | ||
|
||
return returnInt; | ||
} | ||
|
||
uint16_t read_from_bq(unsigned int reg, int size) { | ||
// Read from BQ76925 | ||
// From: https://www.ti.com/lit/ds/symlink/bq76925.pdf?ts=1705535736818 | ||
// I2C is not really standardized so things happen however chip manus want it to. | ||
// This chip encodes both the I2C address AND the register into one address. | ||
uint8_t bq_group_addr = 0b0100; | ||
uint8_t bq_address = (bq_group_addr << 3) + reg; | ||
Wire.beginTransmission(bq_address); | ||
Wire.endTransmission(false); | ||
Wire.requestFrom((bq_address), size); | ||
|
||
unsigned int returnInt = 0; | ||
for(int i = 0; i < size; i++) { | ||
returnInt = (returnInt << 8) | Wire.read(); | ||
} | ||
|
||
return returnInt; | ||
} | ||
|
||
void write_to_bq(unsigned int reg, uint8_t data) { | ||
// Write to BQ76925 | ||
// From: https://www.ti.com/lit/ds/symlink/bq76925.pdf?ts=1705535736818 | ||
// I2C is not really standardized so things happen however chip manus want it to. | ||
// This chip encodes both the I2C address AND the register into one address. | ||
uint8_t bq_group_addr = 0b0100; | ||
uint8_t bq_address = ((bq_group_addr << 3) + reg); | ||
Wire.beginTransmission(bq_address); | ||
Wire.write(data); | ||
Wire.endTransmission(); | ||
} | ||
|
||
int get_device_from_params(String command_params) { | ||
String device = command_params.substring(0, command_params.indexOf(' ')); | ||
|
||
int value = device.compareTo("msp"); | ||
return value == 0 ? 0 : 1; | ||
} | ||
|
||
int get_register_from_params(String command_params) { | ||
String sub = command_params.substring(command_params.indexOf(' ')); | ||
String reg = sub.substring(0, command_params.indexOf(' ')); | ||
return reg.toInt(); | ||
} | ||
|
||
int get_third_from_params(String command_params) { | ||
String sub = command_params.substring(command_params.indexOf(' ')); | ||
String third = sub.substring(command_params.indexOf(' ')+1); | ||
return third.toInt(); | ||
} | ||
|
||
void setup() { | ||
while ( !Serial.available() ) { delay( 1 ); } | ||
Serial.begin(9600); | ||
Wire.begin(); | ||
Wire.setClock(10000); | ||
} | ||
|
||
char input[128] = ""; | ||
int i = 0; | ||
|
||
void loop() { | ||
|
||
while(Serial.available()) { | ||
char x = Serial.read(); | ||
input[i] = x; | ||
if (x == '\n') | ||
{ | ||
input[i] = 0x00; | ||
String command = String(input); | ||
String command_head = command.substring(0, command.indexOf(' ')); | ||
String command_params = command.substring(command.indexOf(' ') + 1); | ||
|
||
unsigned int device = get_device_from_params(command_params); | ||
unsigned int reg = get_register_from_params(command_params); | ||
unsigned int third = get_third_from_params(command_params); | ||
|
||
if(command_head.compareTo("read") == 0) { | ||
if(device) { | ||
// BQ | ||
unsigned int value = read_from_bq(reg, third); | ||
Serial.println(value); | ||
} else { | ||
// MSP | ||
unsigned int value = read_from_msp(reg, third); | ||
Serial.println(value); | ||
} | ||
|
||
} else if(command_head.compareTo("write") == 0){ | ||
if(device) { | ||
write_to_bq(reg, third); | ||
Serial.println("SUCCESS!"); | ||
} else { | ||
Serial.println("Invalid Command | Only the 'bq' device is enable for 'write'!"); | ||
} | ||
} else { | ||
Serial.println("Invalid Command | Only 'read' or 'write' is allowed!"); | ||
} | ||
i = 0; | ||
} else { | ||
i++; | ||
} | ||
} | ||
} | ||
|
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.