|
发表于 2010-9-27 09:01:05
|
显示全部楼层
请LZ注意以下的代码
/* General macro to calculate GPIO MODE register. */
#define GPIO_MODE_REG_VAL(port0, port1, port2, port3, port4, port5, port6, port7) ((GPIO_PORT##port0##_MODE) | (GPIO_PORT##port1##_MODE<<2) | (GPIO_PORT##port2##_MODE<<4) | (GPIO_PORT##port3##_MODE<<6) | (GPIO_PORT##port4##_MODE<<8) | (GPIO_PORT##port5##_MODE<<10) | (GPIO_PORT##port6##_MODE<<12) | (GPIO_PORT##port7##_MODE<<14))
/* General macro to calculate GPO MODE register. */
#define GPO_MODE_REG_VAL(port0, port1, port2, port3, port4, port5, port6, port7) ((GPO_PORT##port0##_MODE) | (GPO_PORT##port1##_MODE<<2) | (GPO_PORT##port2##_MODE<<4) | (GPO_PORT##port3##_MODE<<6) | (GPO_PORT##port4##_MODE<<8) | (GPO_PORT##port5##_MODE<<10) | (GPO_PORT##port6##_MODE<<12) | (GPO_PORT##port7##_MODE<<14))
/* General macro to calculate GPIO register with 1 bit unit. */
#define GPIO_HWORD_REG_FOR_1BIT(name, port0, port1, port2, port3, port4, port5, port6, port7, port8, port9, port10, port11, port12, port13, port14, port15) ((GPIO_PORT##port0##_##name) | (GPIO_PORT##port1##_##name<<1) | (GPIO_PORT##port2##_##name<<2) | (GPIO_PORT##port3##_##name<<3) | (GPIO_PORT##port4##_##name<<4) | (GPIO_PORT##port5##_##name<<5) | (GPIO_PORT##port6##_##name<<6) | (GPIO_PORT##port7##_##name<<7) | (GPIO_PORT##port8##_##name<<8) | (GPIO_PORT##port9##_##name<<9) | (GPIO_PORT##port10##_##name<<10) | (GPIO_PORT##port11##_##name<<11) | (GPIO_PORT##port12##_##name<<12) | (GPIO_PORT##port13##_##name<<13) | (GPIO_PORT##port14##_##name<<14) | (GPIO_PORT##port15##_##name<<15)) |
|