Skip to content

Commit

Permalink
run_one_inverter changes
Browse files Browse the repository at this point in the history
- Rename to run_inverter_cycle
- Modify function signature to include amplitude parameter
  • Loading branch information
samderanova committed May 7, 2024
1 parent 1ab085f commit d55ee6e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 9 deletions.
48 changes: 47 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,51 @@
"cmake.configureSettings": {
"CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools"
},
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"files.associations": {
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
}
}
11 changes: 3 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ void set_hilo_pins_(bool v)

constexpr auto& set_inverter_pins_ = TEST_CIRCUIT ? set_logic_pin_ : set_hilo_pins_;

void run_one_inverter(int N)
void run_inverter_cycle(int N, float amplitude)
{
float qe = 0.0;
for (int i = 0; i < N; ++i)
{
float s = std::sin(2 * M_PI * i / N);
float s = amplitude * std::sin(2 * M_PI * i / N);
qe += s;
bool v = qe > 0;
int fix = v ? 1 : -1;
Expand All @@ -98,12 +98,7 @@ int main()

while (true)
{
run_one_inverter(frequency);

// if (time_us_32() % 10000000 > 5000000)
// {
// frequency = (frequency == 2000) ? 3000 : 2000;
// }
run_inverter_cycle(frequency, 1);
}

return 0;
Expand Down

0 comments on commit d55ee6e

Please sign in to comment.