Skip to content

CreateAVR: Refactor ATmega328p #165

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

Closed
atluft opened this issue Apr 17, 2025 · 1 comment
Closed

CreateAVR: Refactor ATmega328p #165

atluft opened this issue Apr 17, 2025 · 1 comment

Comments

@atluft
Copy link

atluft commented Apr 17, 2025

I would like to refactor the existing ATmega328p implementation to utilize the implementation mentioned in pull request 138: Add ATmega32

Definition of done:

  1. Refactor the existing ATmega328p chip details in a single file named src/chips/ATmega328p.ts
  2. Implement the CreateAVR function as provided in the ATMega32 effort
  3. npm test reports all tests passed
  4. npm start demo shows a blinking led

My ultimate goal is to add the ATtiny841 and believe this is a solid step towards adding any new chip, ATtiny841, ATmega32, and so on.

Here is a GIST for ADC testing. Created this section to convey one possible approach. Open to other ideas.

import { ATmega328p } from '../chips/ATmega328p';
import { createAVR } from '../create-avr';

. . . SNIP . . .

    const avr = createAVR(ATmega328p, { program: program });
    const cpu = avr.cpu;
    const adc = avr.adc;
    const runner = new TestProgramRunner(cpu);

Notice:

  • createAVR is being utilized
  • New / refactored ATmega328p configuration is provided as input argument
  • program remains unchanged from existing
  • cpu and adc are instantiated by createAVR using the ATmega328p configuration
  • in the future new Chip configurations could be utilized and tested as needed
@atluft
Copy link
Author

atluft commented Apr 25, 2025

closing, duplicate work, feel free to delete this issue

@atluft atluft closed this as completed Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant