package ihw1

import (
	embd "netease_control_center/nembd"
	"netease_control_center/nembd/host/generic"
)

var ledMap = embd.LEDMap{
	"md1":  []string{"0", "md1", "ang2-0"},
	"md2":  []string{"1", "md2", "ang1-1"},
	"md3":  []string{"2", "md3", "ang1-0"},
	"md4":  []string{"3", "md4", "ang0-1"},
	"md5":  []string{"4", "md5", "ang0-0"},
	"md6":  []string{"5", "md6", "ang5-1"},
	"md7":  []string{"6", "md7", "ang5-0"},
	"md8":  []string{"7", "md8", "ang4-1"},
	"md9":  []string{"8", "md9", "ang4-0"},
	"md10": []string{"9", "md10", "ang3-1"},
	"md11": []string{"10", "md11", "ang3-0"},
	"md12": []string{"11", "md12", "ang2-1"},
	"led1": []string{"12", "led1"},
	"led2": []string{"13", "led2"},
	"led3": []string{"14", "led3"},
}

var pins = embd.PinMap{
	&embd.PinDesc{ID: "PL3", Aliases: []string{"355", "GPIO_RESET", "Caps: LCD_D21"}, Caps: embd.CapDigital, DigitalLogical: 355},
	&embd.PinDesc{ID: "PH8", Aliases: []string{"232", "MUTE", "Caps: TIMER4"}, Caps: embd.CapDigital, DigitalLogical: 232},
	&embd.PinDesc{ID: "PL2", Aliases: []string{"354", "GPIO_AT_STATE", "GPL2_HOLD_OUTPUT"}, Caps: embd.CapDigital, DigitalLogical: 354},
}

func init() {
	embd.Register(embd.HostIHW1, func(rev int) *embd.Descriptor {
		return &embd.Descriptor{
			LEDDriver: func() embd.LEDDriver {
				return embd.NewLEDDriver(ledMap, NewLED)
			},
			I2CDriver: func() embd.I2CDriver {
				return embd.NewI2CDriver(generic.NewI2CBus)
			},
			GPIODriver: func() embd.GPIODriver {
				return embd.NewGPIODriver(pins, generic.NewDigitalPin, nil, nil)
			},
		}
	})
}
