machine/avr: implement raw GPIO access for bitbanged drivers

This commit is contained in:
Ayke van Laethem
2018-11-20 21:04:43 +01:00
parent 9392ef900d
commit bf4a43ef04
3 changed files with 43 additions and 24 deletions
+2 -7
View File
@@ -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.