Skip to content

Commit fd0e8e4

Browse files
committed
Updated implementation of S_CMD_Q_SERBUF and changebuffer sizes to be 1024
1 parent 91b78de commit fd0e8e4

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

main.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
#define SPI_MISO 4
2424
#define SPI_MOSI 3
2525
#define SPI_SCK 2
26-
#define MAX_BUFFER_SIZE 4096
27-
#define MAX_OPBUF_SIZE 4096
26+
#define MAX_BUFFER_SIZE 1024
27+
#define MAX_OPBUF_SIZE 1024
28+
#define SERIAL_BUFFER_SIZE 1024
2829

2930
// Define a global operation buffer and a pointer to track the current position
3031
uint8_t opbuf[MAX_OPBUF_SIZE];
@@ -165,10 +166,16 @@ static void command_loop(void)
165166
break;
166167
}
167168
case S_CMD_Q_SERBUF:
168-
sendbyte_blocking(S_ACK);
169-
sendbyte_blocking(0xFF);
170-
sendbyte_blocking(0xFF);
171-
break;
169+
{
170+
sendbyte_blocking(S_ACK);
171+
172+
// Send the buffer size as a 16-bit little-endian value
173+
uint16_t bufferSizeLE = SERIAL_BUFFER_SIZE & 0xFFFF;
174+
sendbyte_blocking((uint8_t)(bufferSizeLE & 0xFF)); // Lower byte
175+
sendbyte_blocking((uint8_t)((bufferSizeLE >> 8) & 0xFF)); // Upper byte
176+
177+
break;
178+
}
172179
case S_CMD_Q_BUSTYPE:
173180
sendbyte_blocking(S_ACK);
174181
sendbyte_blocking((1 << 3)); // BUS_SPI

0 commit comments

Comments
 (0)