Skip to content

Commit

Permalink
fix(PeriphDrivers): Replace pow() with left shift in MAX32670 and MAX…
Browse files Browse the repository at this point in the history
…32672 UART drivers (analogdevicesinc#1217)

Signed-off-by: Tahsin Mutlugun <[email protected]>
  • Loading branch information
ttmut authored Oct 8, 2024
1 parent ef6e111 commit 3630152
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Libraries/PeriphDrivers/Source/UART/uart_me15.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*
******************************************************************************/

#include <math.h>
#include "uart.h"
#include "mxc_device.h"
#include "mxc_pins.h"
Expand Down Expand Up @@ -188,7 +187,7 @@ int MXC_UART_SetFrequency(mxc_uart_regs_t *uart, unsigned int baud, mxc_uart_clo
case MXC_UART_AOD_CLK:
aon_clk_div = (MXC_GCR->pclkdiv & MXC_F_GCR_PCLKDIV_AON_CLKDIV) >>
MXC_F_GCR_PCLKDIV_AON_CLKDIV_POS;
clock_freq = PeripheralClock / (4 * (pow(2, aon_clk_div)));
clock_freq = PeripheralClock / (4 * (1 << aon_clk_div));
break;

default:
Expand Down
1 change: 0 additions & 1 deletion Libraries/PeriphDrivers/Source/UART/uart_me16.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#pragma diag_suppress 68 // integer conversion resulted in a change of sign
#endif

#include <math.h>
#include "uart.h"
#include "mxc_device.h"
#include "mxc_pins.h"
Expand Down
3 changes: 1 addition & 2 deletions Libraries/PeriphDrivers/Source/UART/uart_me21.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*
******************************************************************************/

#include <math.h>
#include "uart.h"
#include "mxc_device.h"
#include "mxc_pins.h"
Expand Down Expand Up @@ -206,7 +205,7 @@ int MXC_UART_SetFrequency(mxc_uart_regs_t *uart, unsigned int baud, mxc_uart_clo
case MXC_UART_AOD_CLK:
aon_clk_div = (MXC_GCR->pclkdiv & MXC_F_GCR_PCLKDIV_AON_CLKDIV) >>
MXC_F_GCR_PCLKDIV_AON_CLKDIV_POS;
clock_freq = PeripheralClock / (4 * (pow(2, aon_clk_div)));
clock_freq = PeripheralClock / (4 * (1 << aon_clk_div));
break;
default:
return E_BAD_PARAM;
Expand Down

0 comments on commit 3630152

Please sign in to comment.