Skip to content

Instantly share code, notes, and snippets.

@fregmented
Created April 4, 2019 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fregmented/6cdb185a2fad3e4597973e2fdaa53099 to your computer and use it in GitHub Desktop.
Save fregmented/6cdb185a2fad3e4597973e2fdaa53099 to your computer and use it in GitHub Desktop.
int main(int argc, char *argv[]) {
// BLAHBLAH
UART_eSetRTS(iUartFd, 1); // nRESET
UART_eSetDTR(iUartFd, 1); // nPROG
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 100000000; // 100 ms
nanosleep(&ts, NULL);
UART_eSetRTS(iUartFd, 0); // nRESET
ts.tv_sec = 0;
ts.tv_nsec = 100000000; // 100 ms
nanosleep(&ts, NULL);
UART_eSetDTR(iUartFd, 0); // nPROG
if (iInitialSpeed != iProgramSpeed)
{
if (iVerbosity > 1)
{
printf("Setting baudrate: %d\n", iProgramSpeed);
}
/* Talking at initial speed - change bootloader to programming speed */
if (BL_eSetBaudrate(iUartFd, iProgramSpeed) != E_STATUS_OK)
{
printf("Error setting baudrate\n");
return -1;
}
}
// BLAHBLAH
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment