这里有一些bug,会导致digitalRead()函数不正常:
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
(uint16_t)&PINC,
(uint16_t)&PIND,
(uint16_t)&PINE,
(uint16_t)&PINF,
(uint16_t)&PING,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
};
应该改为:
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PIN,
NOT_A_PIN,
(uint16_t)&PINB,
NOT_A_PIN,
(uint16_t)&PIND,
(uint16_t)&PINE,
(uint16_t)&PINF,
(uint16_t)&PING,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
};
这里有一些bug,会导致digitalRead()函数不正常:
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
(uint16_t)&PINC,
(uint16_t)&PIND,
(uint16_t)&PINE,
(uint16_t)&PINF,
(uint16_t)&PING,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
};
应该改为:
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PIN,
NOT_A_PIN,
(uint16_t)&PINB,
NOT_A_PIN,
(uint16_t)&PIND,
(uint16_t)&PINE,
(uint16_t)&PINF,
(uint16_t)&PING,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
NOT_A_PIN,
};