flash esp fast like a nascar

master
Firmware Batman 2017-05-29 23:03:11 -07:00
parent 6a6b69ea78
commit 1b81a2e600
2 changed files with 17 additions and 0 deletions

View File

@ -720,6 +720,11 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, int hardwired) {
ur->callback = NULL;
}
break;
case 0xe4: // uart set baud rate extended
ur = get_ring_by_number(setup->b.wValue.w);
if (!ur) break;
uart_set_baud(ur->uart, (int)setup->b.wIndex.w*300);
break;
case 0xf0: // k-line wValue pulse on uart2
if (setup->b.wValue.w == 1) {
GPIOC->ODR &= ~(1 << 10);

View File

@ -45,6 +45,18 @@ class FakePort(object):
self.handle = device.open()
self.handle.claimInterface(0)
# will only work on new st, old ones will stay @ 921600
self.baudrate = 460800
@property
def baudrate(self):
return self._baudrate
@baudrate.setter
def baudrate(self, x):
print "set baud to", x
self.handle.controlWrite(usb1.TYPE_VENDOR | usb1.RECIPIENT_DEVICE, 0xe4, 1, x/300, '')
def write(self, buf):
SEND_STEP = 0x20
for i in range(0, len(buf), SEND_STEP):