underclock CPU to 18MHz

This commit is contained in:
embr 2023-04-26 00:44:42 +02:00
parent 8025f0d380
commit 3c06c31114

View file

@ -1,11 +1,11 @@
#include "btstack.h" #include "btstack.h"
#include "buttons.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_segger_rtt_stdout.h" #include "hci_dump_segger_rtt_stdout.h"
#include "pico/btstack_cyw43.h" #include "pico/btstack_cyw43.h"
#include "pico/cyw43_arch.h" #include "pico/cyw43_arch.h"
#include "pico/stdlib.h" #include "pico/stdlib.h"
#include "state.h" #include "state.h"
#include "buttons.h"
#include "stdio_rtt.h" #include "stdio_rtt.h"
#include "vibe_bt.h" #include "vibe_bt.h"
#include <stdio.h> #include <stdio.h>
@ -30,9 +30,10 @@ static void heartbeat_handler(struct btstack_timer_source* ts) {
int main() { int main() {
stdio_init_all(); stdio_init_all();
stdio_rtt_init(); stdio_rtt_init();
printf("Starting...\n");
if (cyw43_arch_init()) { if (cyw43_arch_init()) {
printf("CYW43 init failed"); printf("CYW43 init failed\n");
return -1; return -1;
} }
@ -61,6 +62,9 @@ int main() {
// turn on bluetooth! // turn on bluetooth!
hci_power_control(HCI_POWER_ON); hci_power_control(HCI_POWER_ON);
printf("Underclocking CPU...\n");
set_sys_clock_khz(18000, true);
btstack_run_loop_execute(); btstack_run_loop_execute();
return 0; return 0;
} }