machine/samd51: correct channel init and pin map for ADC based on ItsyBitsy-M4

Signed-off-by: Ron Evans <ron@hybridgroup.com>
Этот коммит содержится в:
Ron Evans 2019-10-28 10:09:17 +01:00 коммит произвёл Ayke
родитель 3ec94a06ed
коммит 41df9648a8
2 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -28,7 +28,7 @@ const (
// Analog pins
const (
A0 = PA02 // ADC/AIN[0]
A1 = PB05 // ADC/AIN[2]
A1 = PA05 // ADC/AIN[2]
A2 = PB08 // ADC/AIN[3]
A3 = PB09 // ADC/AIN[4]
A4 = PA04 // ADC/AIN[5]

Просмотреть файл

@ -386,11 +386,8 @@ func (a ADC) Get() uint16 {
for bus.SYNCBUSY.HasBits(sam.ADC_SYNCBUSY_INPUTCTRL) {
}
// Selection for the positive ADC input
bus.INPUTCTRL.ClearBits(sam.ADC_INPUTCTRL_MUXPOS_Msk)
for bus.SYNCBUSY.HasBits(sam.ADC_SYNCBUSY_ENABLE) {
}
bus.INPUTCTRL.SetBits(uint16(ch << sam.ADC_INPUTCTRL_MUXPOS_Pos))
// Selection for the positive ADC input channel
bus.INPUTCTRL.SetBits((uint16(ch) & sam.ADC_INPUTCTRL_MUXPOS_Msk) << sam.ADC_INPUTCTRL_MUXPOS_Pos)
for bus.SYNCBUSY.HasBits(sam.ADC_SYNCBUSY_ENABLE) {
}