Skip to content

Commit 5d76e54

Browse files
committed
Update slip.h
1 parent 920fd34 commit 5d76e54

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

firmware/chipignite/polysat/include/slip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <stdlib.h>
1414
#include <string.h>
1515

16-
// Maximum payload length in bytes
16+
/* Maximum payload length in bytes */
1717
#define SLIP_MAX_PAYLOAD_LEN 64
1818

1919
/* Begin typedef declarations */

firmware/chipignite/polysat/src/polysat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ void main() {
169169
gpio_set(33, true);
170170
}
171171
pulse = !pulse;
172+
const char message_to_send[] = "Hello, World!";
173+
slip_send_packet(message_to_send, sizeof(message_to_send) - 1, SLIP_CMD_DATA, uart_write);
172174

173175
// Wait for 1 second
174176
delay(10000000);

firmware/chipignite/polysat/src/slip.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void slip_send_packet(const uint8_t* data, uint16_t data_len, uint8_t cmd, void
3131
hdr.length = (uint16_t)data_len;
3232
hdr.crc = crc16_ccitt_false(data, data_len);
3333
hdr.cmd = (slip_cmd_t)cmd;
34-
hdr.id = packet_count;
34+
hdr.id = packet_count++;
3535

3636
/* Write header to buffer */
3737
uint8_t* buffer = (uint8_t*)&hdr;
@@ -88,7 +88,8 @@ void slip_receive_packet(uint8_t input_byte, slip_packet_t* decoded_packet, uint
8888
decoded_packet->header.length = read_byte() | (read_byte() << 8);
8989
decoded_packet->header.crc = read_byte() | (read_byte() << 8);
9090
decoded_packet->header.cmd = (slip_cmd_t)read_byte();
91-
decoded_packet->header.id = read_byte() | (read_byte() << 8);
91+
packet_count = decoded_packet->header.id = read_byte() | (read_byte() << 8);
92+
packet_count++;
9293

9394
/* Check if payload length exceeds buffer size */
9495
if (decoded_packet->header.length > SLIP_MAX_PAYLOAD_LEN) {

0 commit comments

Comments
 (0)