mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 23:13:40 +00:00
added support for ADC1 on atsamd51 (PB04 / PB05 / PB06 / PB07)
This commit is contained in:
committed by
Ron Evans
parent
aeb7539f67
commit
3aaa029c70
@@ -587,6 +587,9 @@ func (a ADC) Get() uint16 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a ADC) getADCBus() *sam.ADC_Type {
|
func (a ADC) getADCBus() *sam.ADC_Type {
|
||||||
|
if a.Pin >= PB04 && a.Pin <= PB07 {
|
||||||
|
return sam.ADC1
|
||||||
|
}
|
||||||
return sam.ADC0
|
return sam.ADC0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,6 +621,15 @@ func (a ADC) getADCChannel() uint8 {
|
|||||||
return 17
|
return 17
|
||||||
case PA11:
|
case PA11:
|
||||||
return 19
|
return 19
|
||||||
|
|
||||||
|
case PB04:
|
||||||
|
return 6
|
||||||
|
case PB05:
|
||||||
|
return 7
|
||||||
|
case PB06:
|
||||||
|
return 8
|
||||||
|
case PB07:
|
||||||
|
return 9
|
||||||
default:
|
default:
|
||||||
panic("Invalid ADC pin")
|
panic("Invalid ADC pin")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user