[WIP] Add syntax check for rust and C\C++ code (#108)
* proof of concept * fix syntax for rust and add auto fix syntax * fix syntax for C * fix bug with files owner * add information to wiki * try to add ci * format code from master * even more format fixes * change docker to docker-compose * Exclude ./target_*/build directories from format check * Run rustfmt only on project files * add ulimit setup for long clang list * merge * fix rustfmt, exclude target Inc directory * sync with master * abspath Co-authored-by: aanper <mail@s3f.ru> Co-authored-by: Vadim Kaushan <admin@disasm.info>
This commit is contained in:
@@ -15,18 +15,18 @@ void app_gpio_init(GpioPin gpio, GpioMode mode) {
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
|
||||
switch(mode) {
|
||||
case GpioModeInput:
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
case GpioModeInput:
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
break;
|
||||
|
||||
case GpioModeOutput:
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
||||
case GpioModeOutput:
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
||||
break;
|
||||
|
||||
case GpioModeOpenDrain:
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
||||
case GpioModeOpenDrain:
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -36,20 +36,21 @@ void app_gpio_init(GpioPin gpio, GpioMode mode) {
|
||||
|
||||
// TODO delay from timer
|
||||
void delay_us(uint32_t time) {
|
||||
time *= 11.8;
|
||||
time *= 11.8;
|
||||
|
||||
while(time--) {}
|
||||
while(time--) {
|
||||
}
|
||||
}
|
||||
|
||||
void pwm_set(float value, float freq, TIM_HandleTypeDef* tim, uint32_t channel) {
|
||||
tim->Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
tim->Init.Period = (uint32_t)((SystemCoreClock/tim->Init.Prescaler)/freq);
|
||||
tim->Init.Period = (uint32_t)((SystemCoreClock / tim->Init.Prescaler) / freq);
|
||||
tim->Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
HAL_TIM_PWM_Init(tim);
|
||||
|
||||
TIM_OC_InitTypeDef sConfigOC;
|
||||
|
||||
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = (uint16_t)(291 * value);
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
|
||||
Reference in New Issue
Block a user