Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atmega32: Add ATmega32 and ATmega324p support. Implement simpler-api branch #138

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Add another 32 USART test
  • Loading branch information
jamesrwaugh committed Feb 14, 2023
commit 1bb309f544adc50fe52e40ed659c3cb7a81a4cc8
13 changes: 12 additions & 1 deletion src/peripherals/usart_atmega32.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,21 @@ describe('ATmege32 USART', () => {
const usart = new AVRUSARTATmega32(cpu, usart0Config, FREQ_16MHZ);
cpu.writeData(usart0Config.UCSRC, usart0Config.UCSRC_URSEL | 0x40);
cpu.writeData(usart0Config.UCSRC, 0x0a);
cpu.cycles += 1;
expect(cpu.readData(usart0Config.UCSRC)).toEqual(0x0a);
cpu.cycles += 1;
expect(cpu.readData(usart0Config.UCSRC)).toEqual(0x40);
});

it('resets the sequential read after multiple cycles', () => {
const cpu = new CPU(new Uint16Array(1024));
cpu.cycles = 100;
const usart = new AVRUSARTATmega32(cpu, usart0Config, FREQ_16MHZ);
cpu.writeData(usart0Config.UCSRC, usart0Config.UCSRC_URSEL | 0x40);
cpu.writeData(usart0Config.UCSRC, 0x0a);
expect(cpu.readData(usart0Config.UCSRC)).toEqual(0x0a);
cpu.cycles += 1;
cpu.cycles += 1;
expect(cpu.readData(usart0Config.UCSRC)).toEqual(0x0a);
});
});
});