I'm a beginner to C and i want to learn it cause it has much more libraries than micropython and has more functions that i will need in my project.
I wanted to set CPU (RP2040) clock to 133khz using set_sys_clock_khz(133, false) function, but it gives me error:
Board that im using is pico w
I'm using Raspberry Pi Pico extension to compile it and flash with swd
C-Flipberry.c code:printu() is function written by me that work like prinf but to PIO uart cause uart pins on pcb that i made are alredy used and i need USB
I wanted to set CPU (RP2040) clock to 133khz using set_sys_clock_khz(133, false) function, but it gives me error:
Code:
[1/3] Building C object CMakeFiles/C-Flipberry.dir/C-Flipberry.c.obj/home/Kitki30/flipberry-c/C-Flipberry/C-Flipberry.c: In function 'main':/home/Kitki30/flipberry-c/C-Flipberry/C-Flipberry.c:20:9: warning: implicit declaration of function 'set_sys_clock_khz' [-Wimplicit-function-declaration] 20 | if (set_sys_clock_khz(133, false) == true){ | ^~~~~~~~~~~~~~~~~[3/3] Linking CXX executable C-Flipberry.elfFAILED: C-Flipberry.elf
I'm using Raspberry Pi Pico extension to compile it and flash with swd
C-Flipberry.c code:
Code:
#include <stdio.h>#include "pico/stdlib.h"#include "lib/uart-term.h"#define PIN_TX 22#define SERIAL_BAUD 115200void main(){ // Init stdio stdio_init_all(); // Init Uart Term, print basic info set_u_duplication(true); // Also show printu input to stdio init_u_term(PIN_TX, SERIAL_BAUD); // Init UART terminal printu("Flipberry by Kitki30 UART terminal\n"); printu("\nSetting clock...\n"); // Set system clock if (set_sys_clock_khz(133, false) == true){ printu("Done!"); } else{ printu("Failed!"); } sleep_ms(1000);}
Statistics: Posted by Kitki30 — Sat Oct 12, 2024 12:29 pm