Browse Source

Merge pull request #25 from KurtE/CP210X_fix_for_adafruit_boards

Serial CP210x support for more boards
main
Paul Stoffregen 5 years ago
parent
commit
2a3ff1ca87
No account linked to committer's email address
1 changed files with 11 additions and 17 deletions
  1. +11
    -17
      serial.cpp

+ 11
- 17
serial.cpp View File

if (format_ & 0x100) cp210x_format |= 2; if (format_ & 0x100) cp210x_format |= 2;


mk_setup(setup, 0x41, 3, cp210x_format, 0, 0); // data format 8N1 mk_setup(setup, 0x41, 3, cp210x_format, 0, 0); // data format 8N1
println("CP210x setup, 0x41, 3, cp210x_format ",cp210x_format, HEX);
queue_Control_Transfer(device, &setup, NULL, this); queue_Control_Transfer(device, &setup, NULL, this);
control_queued = true; control_queued = true;
return; return;
setupdata[2] = (baudrate >> 16) & 0xff; setupdata[2] = (baudrate >> 16) & 0xff;
setupdata[3] = (baudrate >> 24) & 0xff; setupdata[3] = (baudrate >> 24) & 0xff;
mk_setup(setup, 0x40, 0x1e, 0, 0, 4); mk_setup(setup, 0x40, 0x1e, 0, 0, 4);
println("CP210x Set Baud 0x40, 0x1e");
queue_Control_Transfer(device, &setup, setupdata, this); queue_Control_Transfer(device, &setup, setupdata, this);
control_queued = true; control_queued = true;
return; return;
} }
// configure flow control
// Appears to be an enable command
if (pending_control & 4) { if (pending_control & 4) {
pending_control &= ~4; pending_control &= ~4;
memset(setupdata, 0, sizeof(setupdata)); // clear out the data memset(setupdata, 0, sizeof(setupdata)); // clear out the data
setupdata[0] = 1; // Set dtr active?
mk_setup(setup, 0x41, 13, 0, 0, 0x10);
queue_Control_Transfer(device, &setup, setupdata, this);
println("CP210x 0x41, 0, 1");
mk_setup(setup, 0x41, 0, 1, 0, 0);
queue_Control_Transfer(device, &setup, NULL, this);
control_queued = true; control_queued = true;
return; return;
} }
// set DTR

// MHS_REQUEST
if (pending_control & 8) { if (pending_control & 8) {
pending_control &= ~8;
mk_setup(setup, 0x41, 7, 0x0101, 0, 0);
pending_control &= ~0x88;
mk_setup(setup, 0x41, 7, 0x0303, 0, 0);
queue_Control_Transfer(device, &setup, NULL, this); queue_Control_Transfer(device, &setup, NULL, this);
control_queued = true; control_queued = true;
println("CP210x 0x41, 7, 0x0303");
return; return;
} }
// clear DTR
if (pending_control & 0x80) {
pending_control &= ~0x80;
println("CP210x clear DTR");
mk_setup(setup, 0x40, 1, 0x0100, 0, 0);
queue_Control_Transfer(device, &setup, NULL, this);
control_queued = true;
return;
}

} }
} }



Loading…
Cancel
Save