Adding RTS & DTS mechanism (not working yet)

This commit is contained in:
Marek Kraus
2022-11-09 20:16:08 +01:00
parent 7f69a80f0e
commit 6e036df085
2 changed files with 31 additions and 0 deletions
+10
View File
@@ -3,6 +3,7 @@
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <blisp_util.h>
#define DEBUG
@@ -138,6 +139,15 @@ blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) {
uint8_t handshake_buffer[600];
struct sp_port* serial_port = device->serial_port;
if (!in_ef_loader && !device->is_usb) {
sp_set_rts(serial_port, SP_RTS_ON);
sp_set_dtr(serial_port, SP_DTR_ON);
sleep_ms(50);
sp_set_rts(serial_port, SP_RTS_OFF);
sleep_ms(100);
sp_set_dtr(serial_port, SP_DTR_OFF);
}
uint32_t bytes_count = device->chip->handshake_byte_multiplier * (float)device->current_baud_rate / 10.0f;
if (bytes_count > 600) bytes_count = 600;
memset(handshake_buffer, 'U', bytes_count);