lpc176x: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
7e2c0ffa91
commit
8aa8feedb8
|
@ -28,10 +28,6 @@ def named_pins(fmt, port_count, bit_count=32):
|
||||||
for port in range(port_count)
|
for port in range(port_count)
|
||||||
for portbit in range(bit_count) }
|
for portbit in range(bit_count) }
|
||||||
|
|
||||||
def lpc_pins():
|
|
||||||
return { 'P%d.%d' % (port, pin) : port * 32 + pin
|
|
||||||
for port in range(5) for pin in range(32) }
|
|
||||||
|
|
||||||
def beaglebone_pins():
|
def beaglebone_pins():
|
||||||
gpios = named_pins("gpio%d_%d", 4)
|
gpios = named_pins("gpio%d_%d", 4)
|
||||||
gpios.update({"AIN%d" % i: i+4*32 for i in range(8)})
|
gpios.update({"AIN%d" % i: i+4*32 for i in range(8)})
|
||||||
|
@ -39,7 +35,6 @@ def beaglebone_pins():
|
||||||
|
|
||||||
MCU_PINS = {
|
MCU_PINS = {
|
||||||
"stm32f103": port_pins(5, 16),
|
"stm32f103": port_pins(5, 16),
|
||||||
"lpc176x": lpc_pins(),
|
|
||||||
"pru": beaglebone_pins(),
|
"pru": beaglebone_pins(),
|
||||||
"linux": {"analog%d" % i: i for i in range(8)}, # XXX
|
"linux": {"analog%d" % i: i for i in range(8)}, # XXX
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
* Pin mappings
|
* Pin mappings
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
|
DECL_ENUMERATION_RANGE("pin", "P0.0", GPIO(0, 0), 32);
|
||||||
|
DECL_ENUMERATION_RANGE("pin", "P1.0", GPIO(1, 0), 32);
|
||||||
|
DECL_ENUMERATION_RANGE("pin", "P2.0", GPIO(2, 0), 32);
|
||||||
|
DECL_ENUMERATION_RANGE("pin", "P3.0", GPIO(3, 0), 32);
|
||||||
|
DECL_ENUMERATION_RANGE("pin", "P4.0", GPIO(4, 0), 32);
|
||||||
|
|
||||||
static LPC_GPIO_TypeDef * const digital_regs[] = {
|
static LPC_GPIO_TypeDef * const digital_regs[] = {
|
||||||
LPC_GPIO0, LPC_GPIO1, LPC_GPIO2, LPC_GPIO3, LPC_GPIO4
|
LPC_GPIO0, LPC_GPIO1, LPC_GPIO2, LPC_GPIO3, LPC_GPIO4
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue