Skip to content

Introduce an abstract type (Hongwei said) #2

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

Open
master-q opened this issue May 10, 2014 · 0 comments
Open

Introduce an abstract type (Hongwei said) #2

master-q opened this issue May 10, 2014 · 0 comments

Comments

@master-q
Copy link
Member

githwxi/ATS-Postiats#3 (comment)

Maybe it makes sense to introduce an abstract type here:

abstype PORTBval_t = int8
macdef PORTB_LEDON = $extval(PORTBval_t, "0xff")
macdef PORTB_LEDOFF = $extval(PORTBval_t, "0xff")

PORTB_get and PORTB_set can be implemented as templates:

extern
fun{} PORTB_get (): PORTBval_t
extern
fun{} PORTB_set (v: PORTBval_t): void

This will allow you to re-implement them for different chip models.
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