IO状态打印
void mem_printf(void *priv)
{
mem_stats();
JL_PORT_FLASH_TypeDef *PO[] = {JL_PORTA,JL_PORTB,JL_PORTC,JL_PORTD,JL_PORTE,JL_PORTG,JL_PORTP};
char * str[] = {“JL_PORTA”,“JL_PORTB”,“JL_PORTC”,“JL_PORTD”,“JL_PORTE”,“JL_PORTG”,“JL_PORTP”};
u8 bit = 0;
u8 num = 0;
JL_PORT_FLASH_TypeDef PORT = NULL;
for(num=0;num<sizeof(PO)/sizeof(JL_PORT_FLASH_TypeDef);num++){
PORT=PO[num];
printf(“IO状态仅供参考===> %d %s”, num,str[num]);
for(bit=0;bit<16;bit++){
if((PORT->DIR &BIT(bit))==0){
if((PORT->OUT &BIT(bit)) && (PORT->PD &BIT(bit))){
printf(“输出内部PD漏电,FLASH引脚除外”);
}
if(!(PORT->OUT &BIT(bit)) && (PORT->PU &BIT(bit))){
printf(“输出内部PU漏电,FLASH引脚除外”);
}
}
if((PORT->DIR &BIT(bit))){
if((PORT->IN &BIT(bit)) && (PORT->PD &BIT(bit))){
printf(“输入外部PD漏电,DIE置0不准”);
}
if(!(PORT->IN &BIT(bit)) && (PORT->PU &BIT(bit))){
printf(“输入内部PU漏电,DIE置0不准”);
}
杰理之所有IO寄存器状态打印【篇】
最新推荐文章于 2024-09-10 10:56:36 发布