Refactor with clang-format

This commit is contained in:
Marco 2023-12-28 16:20:30 +01:00
parent 44b2ca3888
commit 8541c5cb7c
13 changed files with 27 additions and 74 deletions

View File

@ -1,19 +0,0 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"/usr/avr/include",
"${workspaceFolder}/**"
],
"defines": [
"__AVR_ATmega32U4__"
],
"compilerPath": "/usr/bin/avr-gcc",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}

10
.vscode/settings.json vendored
View File

@ -1,10 +0,0 @@
{
"files.associations": {
"io.h": "c",
"sfr_defs.h": "c",
"string.h": "c",
"random": "c",
"math.h": "c",
"bridge.h": "c"
}
}

View File

@ -167,4 +167,3 @@ int cmd_handle_switch_timer(void) {
return timer1_on;
}

View File

@ -10,4 +10,3 @@ void cmd_handle(cmd_t *command);
void cmd_handle_set(char *op1, char *op2);
void cmd_handle_switch(char *op1, char *op2);
int cmd_handle_switch_timer(void);

View File

@ -3,4 +3,3 @@
void togglePin(volatile uint8_t *port, unsigned int pin);
void unsetPin(volatile uint8_t *port, unsigned int pin);
void setPin(volatile uint8_t *port, unsigned int pin);

View File

@ -3,4 +3,3 @@
void pwm_init(void);
void pwm_worker(void);
void pwm_interrupt(void);

View File

@ -12,4 +12,3 @@ typedef struct {
} sm_t;
void sm_handleTransition(sm_t *statemachine, sm_state_t to);

View File

@ -16,4 +16,3 @@ void tmr_enableT1(void);
void tmr_disableT1(void);
void tmr_setT1CompareMatch(uint16_t cm);
uint16_t tmr_getT1Top(void);

View File

@ -3,4 +3,3 @@
void uart_init(unsigned int baud);
void uart_sendByte(uint8_t byte);
int uart_printf(char var, FILE *stream);

View File

@ -1,33 +1,32 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include <math.h>
#include "uart.h"
#include "timer.h"
#include "commands.h"
#include "pins.h"
#include "pwm.h"
#include "timer.h"
#include "uart.h"
int main(void)
{
sei();
int main(void) {
sei();
/* With this MCU frequency (16 MHz), 25 is a baudrate of 38.4k baud */
uart_init(25);
pwm_init();
tmr_initT1();
tmr_enableT1();
/* With this MCU frequency (16 MHz), 25 is a baudrate of 38.4k baud */
uart_init(25);
pwm_init();
tmr_initT1();
tmr_enableT1();
/* Arduino Leonardo has a LED that we turn off here */
DDRC |= (1 << DDC7);
unsetPin(&PORTC, PIN7);
/* Arduino Leonardo has a LED that we turn off here */
DDRC |= (1 << DDC7);
unsetPin(&PORTC, PIN7);
printf("Up and running.\n\r");
printf("Up and running.\n\r");
while (1) {
cmd_worker();
pwm_worker();
}
while (1) {
cmd_worker();
pwm_worker();
}
return 0;
return 0;
}

View File

@ -12,4 +12,3 @@ void unsetPin(volatile uint8_t *port, unsigned int pin) {
void togglePin(volatile uint8_t *port, unsigned int pin) {
*port ^= (1 << pin);
}

View File

@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include "pwm.h"
#include "timer.h"
@ -8,19 +8,11 @@
int interrupt_received = 0;
uint32_t interrupt_counter = 0;
void pwm_init(void)
{
tmr_subToT1Overflow(pwm_interrupt);
void pwm_init(void) { tmr_subToT1Overflow(pwm_interrupt); }
void pwm_worker(void) {
if (!interrupt_received)
return;
}
void pwm_worker(void)
{
if (!interrupt_received)
return;
}
void pwm_interrupt(void)
{
}
void pwm_interrupt(void) {}

View File

@ -1,4 +1,3 @@
#include "statemachine.h"
void sm_handleTransition(sm_t *statemachine, sm_state_t to) {}