aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUri Shaked2020-04-27 21:59:13 +0300
committerUri Shaked2020-04-27 21:59:13 +0300
commitc792b8c5938bc6331dc4869c6c51dc01cde75641 (patch)
treed70b95699ef73cdefd0d21417e14bb85c51dff27
parentchore(deps): prettier 2.0 (diff)
downloadavr8js-c792b8c5938bc6331dc4869c6c51dc01cde75641.tar.gz
avr8js-c792b8c5938bc6331dc4869c6c51dc01cde75641.tar.bz2
avr8js-c792b8c5938bc6331dc4869c6c51dc01cde75641.zip
style: reformat code with prettier 2.x
prettier rules have changed since we upgraded to 2.x
-rw-r--r--demo/src/compile.ts4
-rw-r--r--demo/src/execute.ts2
-rw-r--r--demo/src/index.ts4
-rw-r--r--src/index.ts2
-rw-r--r--src/peripherals/gpio.ts24
-rw-r--r--src/peripherals/timer.spec.ts2
-rw-r--r--src/peripherals/timer.ts20
-rw-r--r--src/peripherals/twi.spec.ts4
-rw-r--r--src/peripherals/twi.ts2
-rw-r--r--src/peripherals/usart.ts2
-rw-r--r--src/utils/assembler.spec.ts6
-rw-r--r--src/utils/assembler.ts6
12 files changed, 39 insertions, 39 deletions
diff --git a/demo/src/compile.ts b/demo/src/compile.ts
index 7ca7a72..fa846b1 100644
--- a/demo/src/compile.ts
+++ b/demo/src/compile.ts
@@ -12,9 +12,9 @@ export async function buildHex(source: string) {
mode: 'cors',
cache: 'no-cache',
headers: {
- 'Content-Type': 'application/json'
+ 'Content-Type': 'application/json',
},
- body: JSON.stringify({ sketch: source })
+ body: JSON.stringify({ sketch: source }),
});
return (await resp.json()) as HexiResult;
}
diff --git a/demo/src/execute.ts b/demo/src/execute.ts
index 2ba9ee0..7d56275 100644
--- a/demo/src/execute.ts
+++ b/demo/src/execute.ts
@@ -9,7 +9,7 @@ import {
portBConfig,
portCConfig,
portDConfig,
- usart0Config
+ usart0Config,
} from 'avr8js';
import { loadHex } from './intelhex';
import { MicroTaskScheduler } from './task-scheduler';
diff --git a/demo/src/index.ts b/demo/src/index.ts
index 5e90bb3..0e99ece 100644
--- a/demo/src/index.ts
+++ b/demo/src/index.ts
@@ -29,13 +29,13 @@ void loop() {
declare const window: any; // eslint-disable-line @typescript-eslint/no-explicit-any
declare const monaco: any; // eslint-disable-line @typescript-eslint/no-explicit-any
window.require.config({
- paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs' }
+ paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.20.0/min/vs' },
});
window.require(['vs/editor/editor.main'], () => {
editor = monaco.editor.create(document.querySelector('.code-editor'), {
value: EditorHistoryUtil.getValue() || BLINK_CODE,
language: 'cpp',
- minimap: { enabled: false }
+ minimap: { enabled: false },
});
});
diff --git a/src/index.ts b/src/index.ts
index 58afde3..8db88f9 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -23,7 +23,7 @@ export {
portJConfig,
portKConfig,
portLConfig,
- PinState
+ PinState,
} from './peripherals/gpio';
export { AVRUSART, usart0Config } from './peripherals/usart';
export * from './peripherals/twi';
diff --git a/src/peripherals/gpio.ts b/src/peripherals/gpio.ts
index 35030b8..ba3217b 100644
--- a/src/peripherals/gpio.ts
+++ b/src/peripherals/gpio.ts
@@ -20,74 +20,74 @@ export type GPIOListener = (value: u8, oldValue: u8) => void;
export const portAConfig: AVRPortConfig = {
PIN: 0x20,
DDR: 0x21,
- PORT: 0x22
+ PORT: 0x22,
};
export const portBConfig: AVRPortConfig = {
PIN: 0x23,
DDR: 0x24,
- PORT: 0x25
+ PORT: 0x25,
};
export const portCConfig: AVRPortConfig = {
PIN: 0x26,
DDR: 0x27,
- PORT: 0x28
+ PORT: 0x28,
};
export const portDConfig: AVRPortConfig = {
PIN: 0x29,
DDR: 0x2a,
- PORT: 0x2b
+ PORT: 0x2b,
};
export const portEConfig: AVRPortConfig = {
PIN: 0x2c,
DDR: 0x2d,
- PORT: 0x2e
+ PORT: 0x2e,
};
export const portFConfig: AVRPortConfig = {
PIN: 0x2f,
DDR: 0x30,
- PORT: 0x31
+ PORT: 0x31,
};
export const portGConfig: AVRPortConfig = {
PIN: 0x32,
DDR: 0x33,
- PORT: 0x34
+ PORT: 0x34,
};
export const portHConfig: AVRPortConfig = {
PIN: 0x100,
DDR: 0x101,
- PORT: 0x102
+ PORT: 0x102,
};
export const portJConfig: AVRPortConfig = {
PIN: 0x103,
DDR: 0x104,
- PORT: 0x105
+ PORT: 0x105,
};
export const portKConfig: AVRPortConfig = {
PIN: 0x106,
DDR: 0x107,
- PORT: 0x108
+ PORT: 0x108,
};
export const portLConfig: AVRPortConfig = {
PIN: 0x109,
DDR: 0x10a,
- PORT: 0x10b
+ PORT: 0x10b,
};
export enum PinState {
Low,
High,
Input,
- InputPullUp
+ InputPullUp,
}
export class AVRIOPort {
diff --git a/src/peripherals/timer.spec.ts b/src/peripherals/timer.spec.ts
index 472dfac..5a62246 100644
--- a/src/peripherals/timer.spec.ts
+++ b/src/peripherals/timer.spec.ts
@@ -214,7 +214,7 @@ describe('timer', () => {
'LDI r16, 0x30', // TCNT <- 0x30
'OUT 0x26, r16',
'NOP',
- 'IN r17, 0x26' // r17 <- TCNT
+ 'IN r17, 0x26', // r17 <- TCNT
];
loadProgram(...program);
const timer = new AVRTimer(cpu, timer0Config);
diff --git a/src/peripherals/timer.ts b/src/peripherals/timer.ts
index ac344ef..ebd7b58 100644
--- a/src/peripherals/timer.ts
+++ b/src/peripherals/timer.ts
@@ -17,7 +17,7 @@ const timer01Dividers = {
4: 256,
5: 1024,
6: 0, // TODO: External clock source on T0 pin. Clock on falling edge.
- 7: 0 // TODO: External clock source on T0 pin. Clock on rising edge.
+ 7: 0, // TODO: External clock source on T0 pin. Clock on rising edge.
};
const TOV = 1;
@@ -78,7 +78,7 @@ export const timer0Config: AVRTimerConfig = {
TCCRB: 0x45,
TCCRC: 0, // not available
TIMSK: 0x6e,
- dividers: timer01Dividers
+ dividers: timer01Dividers,
};
export const timer1Config: AVRTimerConfig = {
@@ -96,7 +96,7 @@ export const timer1Config: AVRTimerConfig = {
TCCRB: 0x81,
TCCRC: 0x82,
TIMSK: 0x6f,
- dividers: timer01Dividers
+ dividers: timer01Dividers,
};
export const timer2Config: AVRTimerConfig = {
@@ -122,8 +122,8 @@ export const timer2Config: AVRTimerConfig = {
4: 64,
5: 128,
6: 256,
- 7: 1024
- }
+ 7: 1024,
+ },
};
/* All the following types and constants are related to WGM (Waveform Generation Mode) bits: */
@@ -133,19 +133,19 @@ enum TimerMode {
CTC,
FastPWM,
PWMPhaseFrequencyCorrect,
- Reserved
+ Reserved,
}
enum TOVUpdateMode {
Max,
Top,
- Bottom
+ Bottom,
}
enum OCRUpdateMode {
Immediate,
Top,
- Bottom
+ Bottom,
}
const TopOCRA = 1;
@@ -162,7 +162,7 @@ const wgmModes8Bit: WGMConfig[] = [
/*4*/ [TimerMode.Reserved, 0xff, OCRUpdateMode.Immediate, TOVUpdateMode.Max],
/*5*/ [TimerMode.PWMPhaseCorrect, TopOCRA, OCRUpdateMode.Top, TOVUpdateMode.Bottom],
/*6*/ [TimerMode.Reserved, 0xff, OCRUpdateMode.Immediate, TOVUpdateMode.Max],
- /*7*/ [TimerMode.FastPWM, TopOCRA, OCRUpdateMode.Bottom, TOVUpdateMode.Top]
+ /*7*/ [TimerMode.FastPWM, TopOCRA, OCRUpdateMode.Bottom, TOVUpdateMode.Top],
];
// Table 16-4 in the datasheet
@@ -182,7 +182,7 @@ const wgmModes16Bit: WGMConfig[] = [
/*12*/ [TimerMode.CTC, TopICR, OCRUpdateMode.Immediate, TOVUpdateMode.Max],
/*13*/ [TimerMode.Reserved, 0xffff, OCRUpdateMode.Immediate, TOVUpdateMode.Max],
/*14*/ [TimerMode.FastPWM, TopICR, OCRUpdateMode.Bottom, TOVUpdateMode.Top],
- /*15*/ [TimerMode.FastPWM, TopOCRA, OCRUpdateMode.Bottom, TOVUpdateMode.Top]
+ /*15*/ [TimerMode.FastPWM, TopOCRA, OCRUpdateMode.Bottom, TOVUpdateMode.Top],
];
export class AVRTimer {
diff --git a/src/peripherals/twi.spec.ts b/src/peripherals/twi.spec.ts
index 542cf2a..7d5fbf3 100644
--- a/src/peripherals/twi.spec.ts
+++ b/src/peripherals/twi.spec.ts
@@ -176,7 +176,7 @@ describe('TWI', () => {
stop: jest.fn(),
connectToSlave: jest.fn(),
writeByte: jest.fn(),
- readByte: jest.fn()
+ readByte: jest.fn(),
};
// Step 1: wait for start condition
@@ -344,7 +344,7 @@ describe('TWI', () => {
stop: jest.fn(),
connectToSlave: jest.fn(),
writeByte: jest.fn(),
- readByte: jest.fn()
+ readByte: jest.fn(),
};
// Step 1: wait for start condition
diff --git a/src/peripherals/twi.ts b/src/peripherals/twi.ts
index ec0a206..52258a6 100644
--- a/src/peripherals/twi.ts
+++ b/src/peripherals/twi.ts
@@ -65,7 +65,7 @@ export const twiConfig: TWIConfig = {
TWAR: 0xba,
TWDR: 0xbb,
TWCR: 0xbc,
- TWAMR: 0xbd
+ TWAMR: 0xbd,
};
// A simple TWI Event Handler that sends a NACK for all events
diff --git a/src/peripherals/usart.ts b/src/peripherals/usart.ts
index b93c0ea..c1d6f13 100644
--- a/src/peripherals/usart.ts
+++ b/src/peripherals/usart.ts
@@ -24,7 +24,7 @@ export const usart0Config: USARTConfig = {
UCSRC: 0xc2,
UBRRL: 0xc4,
UBRRH: 0xc5,
- UDR: 0xc6
+ UDR: 0xc6,
};
export type USARTTransmitCallback = (value: u8) => void;
diff --git a/src/utils/assembler.spec.ts b/src/utils/assembler.spec.ts
index 7b1491f..f0daf64 100644
--- a/src/utils/assembler.spec.ts
+++ b/src/utils/assembler.spec.ts
@@ -13,7 +13,7 @@ describe('AVR assembler', () => {
expect(assemble('ADD r16, r11')).toEqual({
bytes: bytes('0b0d'),
errors: [],
- lines: [{ byteOffset: 0, bytes: '0d0b', line: 1, text: 'ADD r16, r11' }]
+ lines: [{ byteOffset: 0, bytes: '0d0b', line: 1, text: 'ADD r16, r11' }],
});
});
@@ -35,7 +35,7 @@ describe('AVR assembler', () => {
expect(assemble('')).toEqual({
bytes: new Uint8Array(0),
errors: [],
- lines: []
+ lines: [],
});
});
@@ -43,7 +43,7 @@ describe('AVR assembler', () => {
expect(assemble('LDI r15, 20')).toEqual({
bytes: new Uint8Array(0),
errors: ['Line 0: Rd out of range: 16<>31'],
- lines: []
+ lines: [],
});
});
diff --git a/src/utils/assembler.ts b/src/utils/assembler.ts
index 22ac948..17b20b4 100644
--- a/src/utils/assembler.ts
+++ b/src/utils/assembler.ts
@@ -763,7 +763,7 @@ const OPTABLE: { [key: string]: opcodeHandler } = {
throw 'Bad param, not Z';
}
return zeroPad(r);
- }
+ },
};
function passOne(inputdata: string) {
@@ -880,7 +880,7 @@ function passOne(inputdata: string) {
return {
labels: lableTable,
errors: errorTable,
- lines: lineTable
+ lines: lineTable,
};
}
@@ -950,7 +950,7 @@ export function assemble(input: string) {
return {
bytes: new Uint8Array(0),
errors: mid.errors,
- lines: []
+ lines: [],
};
}
return passTwo(mid.lines, mid.labels);
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.