spwm_generator

Crates.iospwm_generator
lib.rsspwm_generator
version0.3.0
sourcesrc
created_at2022-11-29 21:51:05.775425
updated_at2022-12-19 16:41:53.561732
descriptionA simple cli tool for genrate SPWM lookup tables
homepage
repositoryhttps://github.com/Ali-Mirghasemi/spwm_generator
max_upload_size
id725741
size68,386
Ali Mirghasemi (Ali-Mirghasemi)

documentation

README

SPWM Generator

This is a simple cli app to help you generate SPWM lookup table for your projects

Usage

You can use prebuilt binaries or build the project with rust compiler

Install with Rust

You can install this tool with cargo

cargo install spwm_generator

Parameters

Usage: spwm_generator [OPTIONS] --sin_freq <SIN_FREQ> --num_of_samples <NUM_OF_SAMPLES> --out <OUTPUT>

Options:
  -f, --sin_freq <SIN_FREQ>
          sin wave frequency
  -n, --num_of_samples <NUM_OF_SAMPLES>
          number of samples
  -t, --pwm_top <PWM_TOP>
          pwm top value [default: 255]
  -p, --padding <PADDING>
          padding for pwm min and max value [default: 0]
  -o, --out <OUTPUT>
          output file path
  -m, --format <FORMAT>
          format [default: raw] [possible values: raw, raw-hex, c, c-hex, rust, rust-hex]
  -w, --row_width <ROW_WIDTH>
          number of samples in row [default: 16]
  -s, --separator <SEPARATOR>
          separator character [default: ", "]
  -a, --name <NAME>
          name of variable [default: WAVE]
  -h, --help
          Print help information
  -V, --version
          Print version information

Example C

Generate SPWM table for C project

spwm_generator -m c -f 50 -c 10000 -o Table_50Hz.c

or

spwm_generator -m c-hex -f 50 -c 10000 -o Table_50Hz.c

Example Rust

Generate SPWM table for Rust project

spwm_generator -m rust -f 50 -c 10000 -o Table_50Hz.c

or

spwm_generator -m rust-hex -f 50 -c 10000 -o Table_50Hz.c
Commit count: 47

cargo fmt