WIP target lo
custom debug stream run docker with project dir, specify dir to makefile remove unused includes fix broken F1
This commit is contained in:
41
target_lo/Src/flipper_hal.c
Normal file
41
target_lo/Src/flipper_hal.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Flipper devices inc.
|
||||
|
||||
GPIO and HAL implementations
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "flipper_hal.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void app_gpio_init(GpioPin gpio, GpioMode mode) {
|
||||
if(gpio.pin != 0) {
|
||||
|
||||
switch(mode) {
|
||||
case GpioModeInput:
|
||||
printf("[GPIO] %d:%d input\n", gpio.port, gpio.pin);
|
||||
break;
|
||||
|
||||
case GpioModeOutput:
|
||||
printf("[GPIO] %d:%d push pull\n", gpio.port, gpio.pin);
|
||||
break;
|
||||
|
||||
case GpioModeOpenDrain:
|
||||
printf("[GPIO] %d:%d open drain\n", gpio.port, gpio.pin);
|
||||
break;
|
||||
}
|
||||
|
||||
gpio.mode = mode;
|
||||
} else {
|
||||
printf("[GPIO] no pin\n");
|
||||
}
|
||||
}
|
||||
|
||||
void delay_us(uint32_t time) {
|
||||
// How to deal with it
|
||||
printf("[DELAY] %d us\n", time);
|
||||
}
|
||||
|
||||
void pwm_set(float value, float freq, TIM_HandleTypeDef* tim, uint32_t channel) {
|
||||
printf("[TIM] set pwm %d:%d %f Hz, %f%%\n", *tim, channel, freq, value * 100.);
|
||||
}
|
21
target_lo/Src/lo_hal.c
Normal file
21
target_lo/Src/lo_hal.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Flipper devices inc.
|
||||
|
||||
Dummy hal for local fw build
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "main.h"
|
||||
#include <unistd.h>
|
||||
|
||||
UART_HandleTypeDef DEBUG_UART = 0;
|
||||
|
||||
uint16_t HAL_UART_Transmit(
|
||||
UART_HandleTypeDef* handle,
|
||||
uint8_t* bufer,
|
||||
uint16_t size,
|
||||
uint32_t wait_ms
|
||||
) {
|
||||
uint16_t res = write(1, (const char*)bufer, size);
|
||||
return res;
|
||||
}
|
8
target_lo/Src/lo_os.c
Normal file
8
target_lo/Src/lo_os.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "cmsis_os.h"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void osDelay(uint32_t ms) {
|
||||
usleep(ms * 1000);
|
||||
printf("[DELAY] %d ms\n", ms);
|
||||
}
|
13
target_lo/Src/main.c
Normal file
13
target_lo/Src/main.c
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
Flipper devices inc.
|
||||
|
||||
Local fw build entry point.
|
||||
*/
|
||||
|
||||
void app();
|
||||
|
||||
int main() {
|
||||
app();
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user