From dd9b2983a7d682556f4bbe6c6fe0462b39c45ec6 Mon Sep 17 00:00:00 2001 From: Raphael Assenat Date: Sun, 14 Jun 2015 00:50:05 -0400 Subject: [PATCH] Use print_P to save memory --- usb.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/usb.c b/usb.c index 34c4300..7f37c71 100644 --- a/usb.c +++ b/usb.c @@ -33,7 +33,7 @@ static void initControlWrite(const struct usb_request *rq) memcpy(&control_write_rq, rq, sizeof(struct usb_request)); control_write_len = 0; control_write_in_progress = 1; -// printf("Init cw\r\n"); + printf_P(PSTR("Init cw\r\n")); } static int wcslen(const wchar_t *str) @@ -323,11 +323,14 @@ static void handleSetupPacket(struct usb_request *rq) }; uint16_t todo = rqlen; uint16_t pos = 0; + + // TODO : Without the delays those two printf add, it + // does not work. A handshake is missing. printf_P(PSTR("t: %02x, rq: 0x%02x, val: %04x, l: %d\r\n"), rq->bmRequestType, rq->bRequest, rq->wValue, rq->wLength); - + while(1) { - printf("pos %d todo %d\r\n", pos, todo); + printf_P(PSTR("pos %d todo %d\r\n"), pos, todo); if (todo > 64) { buf2EP(0, ((unsigned char*)g_params->reportdesc)+pos, 64, 64, @@ -342,7 +345,6 @@ static void handleSetupPacket(struct usb_request *rq) UEINTX &= ~(1<