Api hw gpio pwm (#199)

* initial gpio layer

* move temlplate.c to template.c.example in preparing to applications.mk rework

* separate arduino layer

* separate flipper_hal.x

* prepare to switch applications on v2 core gpio api

* swithch applications to v2 gpio api

* gpio api for local target

* better gpio_disable handling

* remove pwm functions from local target

* inline gpio funcs

* common function to init all api's

* fix local example blink

* move delay us to hal api folder

* move pwm_set/pwm_stop to hal api folder

* update applications to use hal pwm api

* remove gpio mode case warning

* add speaker demo to build

Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
This commit is contained in:
coreglitch
2020-10-26 13:16:54 +06:00
committed by GitHub
parent c8cc3c7dc8
commit f5b342abbe
41 changed files with 464 additions and 341 deletions

View File

@@ -8,15 +8,6 @@ void coreglitch_demo_0(void* p) {
fuprintf(log, "coreglitch demo!\n");
// open record
FuriRecordSubscriber* fb_record =
furi_open_deprecated("u8g2_fb", false, false, NULL, NULL, NULL);
if(fb_record == NULL) {
fuprintf(log, "[widget] cannot create fb record\n");
furiac_exit(NULL);
}
float notes[] = {
0.0,
330.0,
@@ -49,25 +40,11 @@ void coreglitch_demo_0(void* p) {
}
// TODO get sound from FURI
pwm_set(width, freq, &htim5, TIM_CHANNEL_4);
hal_pwm_set(width, freq, &htim5, TIM_CHANNEL_4);
// delay(1);
cnt++;
u8g2_t* fb = furi_take(fb_record);
if(fb != NULL) {
u8g2_SetDrawColor(fb, 0);
u8g2_DrawBox(fb, 0, 0, 120, 30);
u8g2_SetFont(fb, u8g2_font_6x10_mf);
u8g2_SetDrawColor(fb, 1);
u8g2_SetFontMode(fb, 1);
char buf[64];
sprintf(buf, "freq: %d Hz", (uint32_t)freq);
u8g2_DrawStr(fb, 2 + width * 20, 12 + freq / 100, buf);
}
furi_commit(fb_record);
delay(100);
}
}