mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-29 11:52:59 +08:00
Compute fp on the fly
This commit is contained in:
parent
ec796f4d81
commit
b17da830ed
1 changed files with 4 additions and 6 deletions
|
@ -236,13 +236,11 @@ void usart_init(uint32_t baudrate, uint8_t parity) {
|
|||
// OVER = 1, -yes we are oversampling
|
||||
// baudrate == selected clock/8/CD --> this is ours
|
||||
//
|
||||
uint32_t fractional = 0;
|
||||
if ( baudrate == 921600 )
|
||||
fractional = 4;
|
||||
else if ( baudrate == 1382400 )
|
||||
fractional = 2;
|
||||
uint32_t brgr = 48000000 / (usart_baudrate << 3);
|
||||
pUS1->US_BRGR = (fractional << 16) | brgr;
|
||||
// doing fp = round((mck / (usart_baudrate << 3) - brgr) * 8) with integers:
|
||||
uint32_t fp = ((16 * 48000000 / (usart_baudrate << 3) - 16 * brgr)+1)/2;
|
||||
|
||||
pUS1->US_BRGR = (fp << 16) | brgr;
|
||||
|
||||
// Write the Timeguard Register
|
||||
pUS1->US_TTGR = 0;
|
||||
|
|
Loading…
Reference in a new issue