我正在尝试将数据存储在 PROGMEM 中并稍后检索它。然后通过 USB 串行通讯将它们发送到屏幕。
int8_t serial_comm_write(const uint8_t *buffer, uint16_t size){
//Here contains the code from the lib which I don't understand.
//Basically, it's sending data (char *data) thru to screen.
}
//This char *data could simply be:
// char *line = "This is stored in RAM"
//usb_send_info(line); would send the "line" to the screen.
void usb_send_info(char *data){
serial_comm_write((uint8_t *)data, strlen(data));
}
//This doesn't work. I got a squiggly line saying "unknown register name
//'r0'
//have no idea what it means.
void usb_send_info_P(const char *data){
while(pgm_read_byte(data) != 0x00){
usb_send_info((pgm_read_byte(data++)));
}
}
const static char line1[] PROGMEM = "This is stored in flash mem";
usb_send_info_P(line1);
它只是行不通。任何提示或替代方案?干杯。