Skip to content

Introduce an abstract type (Hongwei said) #2

@master-q

Description

@master-q

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions