Skip to content

Add plain ATmega32 model.#21

Open
rekado wants to merge 1 commit into
ryansuchocki:masterfrom
rekado:atmega32
Open

Add plain ATmega32 model.#21
rekado wants to merge 1 commit into
ryansuchocki:masterfrom
rekado:atmega32

Conversation

@rekado

@rekado rekado commented Nov 21, 2015

Copy link
Copy Markdown

This adds a new ATmega32 model for non Arduino boards. The pin mappings expose all pins from ports A, B, C, and D. PORTC7 is used as the diagnosis LED pin (on the RN-control board all pins of PORTC are connected to LEDs).

This works for my RN-control board with an ATmega32.

This adds a new ATmega32 model for non-Arduino boards.  The pin mappings
expose all pins from ports A, B, C, and D.  PORTC7 is used as the
diagnosis LED pin (on the RN-control board all pins of PORTC are
connected to LEDs).
@rekado

rekado commented Dec 28, 2015

Copy link
Copy Markdown
Author

ping :)

@ryansuchocki

Copy link
Copy Markdown
Owner

I'm a bit concerned about creating an arbitrary mapping between microscheme pin numbers, and real port/pins. For the arduino models this is fine, because the arbitrary mapping is printed on the boards, but for raw chips we need something more systematic. What do you think of doing it like this:

(define 2^ (vector 1 2 4 8 16 32 64 128))

(define (raw-pin port pin)
    (digital-state port (vector-ref 2^ pin)))

(define (set-raw-pin port pin)
    ...)

(define (set-raw-ddr port pin)
    ...)

(@if-model "ATmega32"
    (define PORTA #x39)
    (define PORTB #x36)
    (define PORTC #x33)
    (define PORTD #x30))

@thatismatt

Copy link
Copy Markdown

I had a similar issue where I wanted to use the LEDs on the Pro Micro's board. So @ryansuchocki , your suggestion would be great for me.

My current workaround is to use the LEO for the model, and call set-digital-state directly from my code. Which is fine, but not very "user friendly"!

Finally, thanks for the work on this Ryan. Are you planning to do any more work on it? As I'm considering using it on a project.

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

Successfully merging this pull request may close these issues.

3 participants