mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 05:23:40 +00:00
machine/avr: implement raw GPIO access for bitbanged drivers
This commit is contained in:
@@ -15,13 +15,8 @@ func (p GPIO) Configure(config GPIOConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
// Set changes the value of the GPIO pin. The pin must be configured as output.
|
||||
func (p GPIO) Set(value bool) {
|
||||
if value { // set bits
|
||||
*avr.PORTB |= 1 << p.Pin
|
||||
} else { // clear bits
|
||||
*avr.PORTB &^= 1 << p.Pin
|
||||
}
|
||||
func (p GPIO) getPortMask() (*avr.RegValue, uint8) {
|
||||
return avr.PORTB, 1 << p.Pin
|
||||
}
|
||||
|
||||
// Get returns the current value of a GPIO pin.
|
||||
|
||||
Reference in New Issue
Block a user