Skip to content

Add PinInput and PinOutput HAL #753

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
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Add PinInput and PinOutput HAL #753

wants to merge 6 commits into from

Conversation

soypat
Copy link
Contributor

@soypat soypat commented Apr 8, 2025

machine.Pin is not compileable by upstream go. To promote development of drivers which are usable by upstream Go I propose we add the following API.

// PinInput is hardware abstraction for a pin which receives a
// digital signal and reads it (high or low voltage).
type PinInput func() (level bool)

// PinOutput is hardware abstraction for a pin which outputs a
// digital signal (high or low voltage).
type PinOutput func(level bool)

@deadprogram
Copy link
Member

What about #749 ?

@soypat
Copy link
Contributor Author

soypat commented Apr 8, 2025

I missed that @deadprogram. Will comment

@soypat
Copy link
Contributor Author

soypat commented Apr 30, 2025

@aykevl @ysoldak I've started work on the PR. Most of the infra is in place and the drivers I've worked on are good demonstrations of the proposal in action. I'll be on vacations for a few days so I might not be available for a week or so :)

@soypat soypat changed the base branch from release to dev June 19, 2025 16:36
@soypat
Copy link
Contributor Author

soypat commented Jul 3, 2025

I think around half of the work is done. On vacation this weekend so I'll get around sometime next week

@@ -0,0 +1,83 @@
//go:build baremetal
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baremetal tags are used for when the implementation must use the machine.Pin type to avoid user breakage.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already use that buildtag in tinygo itself, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it for MCUs in TinyGo; is my understanding. So to let users use easystepper outside TinyGo I've split the implementation in baremetal and non-baremetal files protected with the baremetal tag.

@soypat
Copy link
Contributor Author

soypat commented Jul 9, 2025

OK! I just finished the brunt of the work. @aykevl @ysoldak @deadprogram @sago35 Tagging ready for review of the work done!

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.

2 participants