Skip to content

Commit

Permalink
Merge pull request #249 from Inchips-zb/develop
Browse files Browse the repository at this point in the history
Fix file ...\src\FWlib\peripheral_adc.c  Compiler optimization may cause 32-bit overflow
  • Loading branch information
zjli-2019 authored Apr 11, 2024
2 parents d84ebb7 + 20a251e commit c88bd1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FWlib/peripheral_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ uint16_t ADC_ReadChannelData(const uint8_t channel_id)
#include "eflash.h"
#define ADC_LEFT_SHIFT(v, s) ((v) << (s))
#define ADC_RIGHT_SHIFT(v, s) ((v) >> (s))
#define ADC_MK_MASK(b) ((ADC_LEFT_SHIFT(1, b)) - (1))
#define ADC_MK_MASK(b) ((ADC_LEFT_SHIFT(1ULL, b)) - (1))
#define ADC_REG_VAL(reg) ((*((volatile uint32_t *)((APB_SARADC_BASE) + (reg)))))
#define REG_CLR(reg, b, s) ((ADC_REG_VAL(reg)) & (~(ADC_LEFT_SHIFT(ADC_MK_MASK(b), s))))
#define REG_OR(v, s) ((ADC_REG_VAL(reg)) | (ADC_LEFT_SHIFT(v, s)))
Expand Down

0 comments on commit c88bd1b

Please sign in to comment.