aboutsummaryrefslogtreecommitdiff
path: root/src/peripherals
diff options
context:
space:
mode:
Diffstat (limited to 'src/peripherals')
-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
6 files changed, 27 insertions, 27 deletions
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;
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.