From 072f380b1d7130cc5c5ed312d39f964f8d325300 Mon Sep 17 00:00:00 2001 From: GabrielKoppenstein Date: Wed, 22 Sep 2021 17:04:16 +0200 Subject: [PATCH] Removede FIFO Irq, Addded function for measuring and controlling motor speed --- CMakeLists.txt | 2 +- CV.h | 1 + multicore.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1336464..a121be0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set(PICO_DECODER_PATH ${PROJECT_SOURCE_DIR}) pico_sdk_init() add_compile_options(-Wall - -Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int + -Wno-format # int != int32 _t as far as the compiler is concerned because gcc has int32_t as long int -Wno-unused-function # we have some for the docs that aren't called -Wno-maybe-uninitialized ) diff --git a/CV.h b/CV.h index adcd82d..06f6181 100644 --- a/CV.h +++ b/CV.h @@ -18,6 +18,7 @@ #define CV_51 0 //PID Control D_Factor + const uint8_t CV_FUNCTION_ARRAY [256] = { // 31 30 29 28 - 27 26 25 24 -- 23 22 21 20 - 19 18 17 16 -- 15 14 13 12 - 11 10 9 8 -- 7 6 5 4 - 3 2 1 0 <- GPIO // byte_3 -- byte_2 -- byte_1 -- byte_0 diff --git a/multicore.c b/multicore.c index e0a3a53..8b071c6 100644 --- a/multicore.c +++ b/multicore.c @@ -284,6 +284,7 @@ void pid_control(){ busy_wait_us(10000); } + void init_pwm(uint gpio) { uint slice_num = pwm_gpio_to_slice_num(gpio); uint32_t wrap_counter = 5000; // 5000 Cycles @ 125MHz for 1 Period -> 25kHz