patch #9123: ftdi_syncbb: use FT245R_CYCLES in ft245r_set_bitclock()

Submitted by Ivan Frederiks:

Replace magic numbers by #defined constant



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1475 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2021-11-14 15:47:29 +00:00
parent e8c5ed0fcd
commit f821bfc03d
2 changed files with 4 additions and 3 deletions

1
NEWS
View File

@ -109,6 +109,7 @@ Current:
patch #9320: fix TPI RESET in bitbang.c
patch #9079: Fix ftdi_syncbb teardown (supersedes #9893)
patch #9122: Fixed MISO sampling in ftdi_syncbb
patch #9123: ftdi_syncbb: use FT245R_CYCLES in ft245r_set_bitclock()
* Internals:
- New avrdude.conf keyword "family_id", used to verify SIB attributes

View File

@ -260,16 +260,16 @@ static int ft245r_set_bitclock(PROGRAMMER * pgm) {
/* bitclock is second. 1us = 0.000001. Max rate for ft232r 750000 */
if(pgm->bitclock) {
rate = (uint32_t)(1.0/pgm->bitclock) * 2;
rate = (uint32_t)(1.0/pgm->bitclock) * FT245R_CYCLES;
} else if (pgm->baudrate) {
rate = pgm->baudrate * 2;
rate = pgm->baudrate * FT245R_CYCLES;
} else {
rate = 150000; /* should work for all ftdi chips and the avr default internal clock of 1MHz */
}
if (FT245R_DEBUG) {
avrdude_message(MSG_NOTICE2, " ft245r: spi bitclk %d -> ft baudrate %d\n",
rate / 2, rate);
rate / FT245R_CYCLES, rate);
}
r = ftdi_set_baudrate(handle, rate);
if (r) {