mirror of
https://github.com/halleysfifthinc/Toyota-AVC-LAN
synced 2025-06-07 16:06:12 +00:00
Tweak formatting rules
This commit is contained in:
parent
1d6690a234
commit
17f5510b16
@ -4,4 +4,6 @@ UseCRLF: false
|
|||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
AllowShortBlocksOnASingleLine: Empty
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
|
IndentPPDirectives: BeforeHash
|
||||||
|
AlignConsecutiveMacros: Consecutive
|
||||||
...
|
...
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
// Name difference between avr-libc and Microchip pack
|
// Name difference between avr-libc and Microchip pack
|
||||||
#if defined(EVSYS_ASYNCCH00_bm)
|
#if defined(EVSYS_ASYNCCH00_bm)
|
||||||
#define EVSYS_ASYNCCH0_0_bm EVSYS_ASYNCCH00_bm
|
#define EVSYS_ASYNCCH0_0_bm EVSYS_ASYNCCH00_bm
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define READING_BYTE GPIOR1
|
#define READING_BYTE GPIOR1
|
||||||
@ -284,9 +284,9 @@ void AVCLAN_init() {
|
|||||||
|
|
||||||
// TCB0 for read bit timing
|
// TCB0 for read bit timing
|
||||||
#ifdef SOFTWARE_DEBUG
|
#ifdef SOFTWARE_DEBUG
|
||||||
#define TCB_CNTMODE TCB_CNTMODE_FRQPW_gc
|
#define TCB_CNTMODE TCB_CNTMODE_FRQPW_gc
|
||||||
#else
|
#else
|
||||||
#define TCB_CNTMODE TCB_CNTMODE_PW_gc
|
#define TCB_CNTMODE TCB_CNTMODE_PW_gc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TCB0.CTRLB = TCB_CNTMODE;
|
TCB0.CTRLB = TCB_CNTMODE;
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
|
|
||||||
#if USART_RXMODE == USART_RXMODE_CLK2X_gc
|
#if USART_RXMODE == USART_RXMODE_CLK2X_gc
|
||||||
#define RXMODE_S 8
|
#define RXMODE_S 8
|
||||||
#elif USART_RXMODE == USART_RXMODE_NORMAL_gc
|
#elif USART_RXMODE == USART_RXMODE_NORMAL_gc
|
||||||
#define RXMODE_S 16
|
#define RXMODE_S 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USART_BAUD_RATE(BAUD_RATE) \
|
#define USART_BAUD_RATE(BAUD_RATE) \
|
||||||
|
26
src/timing.h
26
src/timing.h
@ -14,39 +14,39 @@
|
|||||||
#define __CLKCTRL_PDIV_48X_gc 48
|
#define __CLKCTRL_PDIV_48X_gc 48
|
||||||
|
|
||||||
#if CLK_PRESCALE == 0x01
|
#if CLK_PRESCALE == 0x01
|
||||||
#define F_CPU (FREQSEL / __CLK_PRESCALE_DIV)
|
#define F_CPU (FREQSEL / __CLK_PRESCALE_DIV)
|
||||||
#define CYCLE_MUL __CLK_PRESCALE_DIV
|
#define CYCLE_MUL __CLK_PRESCALE_DIV
|
||||||
#else
|
#else
|
||||||
#define F_CPU (FREQSEL)
|
#define F_CPU (FREQSEL)
|
||||||
#define CYCLE_MUL 1
|
#define CYCLE_MUL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FREQSEL == 20000000L
|
#if FREQSEL == 20000000L
|
||||||
#define CPU_CYCLE (50 * CYCLE_MUL)
|
#define CPU_CYCLE (50 * CYCLE_MUL)
|
||||||
#elif FREQSEL == 16000000L
|
#elif FREQSEL == 16000000L
|
||||||
#define CPU_CYCLE (62.5 * CYCLE_MUL)
|
#define CPU_CYCLE (62.5 * CYCLE_MUL)
|
||||||
#else
|
#else
|
||||||
#error "Not implemented"
|
#error "Not implemented"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TCB_CLKSEL_CLKDIV1_gc
|
#ifndef TCB_CLKSEL_CLKDIV1_gc
|
||||||
#define TCB_CLKSEL_CLKDIV1_gc (0x00 << 1)
|
#define TCB_CLKSEL_CLKDIV1_gc (0x00 << 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TCB_CLKSEL_CLKDIV2_gc
|
#ifndef TCB_CLKSEL_CLKDIV2_gc
|
||||||
#define TCB_CLKSEL_CLKDIV2_gc (0x01 << 1)
|
#define TCB_CLKSEL_CLKDIV2_gc (0x01 << 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TCB_CLKSEL_CLKTCA_gc
|
#ifndef TCB_CLKSEL_CLKTCA_gc
|
||||||
#define TCB_CLKSEL_CLKTCA_gc (0x02 << 1)
|
#define TCB_CLKSEL_CLKTCA_gc (0x02 << 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TCB_CLKSEL == TCB_CLKSEL_CLKDIV1_gc
|
#if TCB_CLKSEL == TCB_CLKSEL_CLKDIV1_gc
|
||||||
#define TCB_TICK (CPU_CYCLE)
|
#define TCB_TICK (CPU_CYCLE)
|
||||||
#elif TCB_CLKSEL == TCB_CLKSEL_CLKDIV2_gc
|
#elif TCB_CLKSEL == TCB_CLKSEL_CLKDIV2_gc
|
||||||
#define TCB_TICK (CPU_CYCLE * 2)
|
#define TCB_TICK (CPU_CYCLE * 2)
|
||||||
#elif TCB_CLKSEL == TCB_CLKSEL_CLKTCA_gc
|
#elif TCB_CLKSEL == TCB_CLKSEL_CLKTCA_gc
|
||||||
#error "Not implemented"
|
#error "Not implemented"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Measured at ±0.02 μs @ F_CPU=20MHz, TCB_CLKSEL=TCB_CLKSEL_CLKDIV1_gc
|
// Measured at ±0.02 μs @ F_CPU=20MHz, TCB_CLKSEL=TCB_CLKSEL_CLKDIV1_gc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user