Fix assert in adc_set_round_robin() (#698)
The mask passed in shouldn't already be shifted by ADC_CS_RROBIN_LSB (16) otherwise the shift in the call to hw_write_masked() would shift all of the bits off the end of the mask, hence we should be asserting not against ADC_CS_RROBIN_BITS (0x1f0000) but against the number of ADC channels available.
This commit is contained in:
parent
96afce8ece
commit
25a3b36793
@ -106,7 +106,7 @@ static inline uint adc_get_selected_input(void) {
|
|||||||
* \param input_mask A bit pattern indicating which of the 5 inputs are to be sampled. Write a value of 0 to disable round robin sampling.
|
* \param input_mask A bit pattern indicating which of the 5 inputs are to be sampled. Write a value of 0 to disable round robin sampling.
|
||||||
*/
|
*/
|
||||||
static inline void adc_set_round_robin(uint input_mask) {
|
static inline void adc_set_round_robin(uint input_mask) {
|
||||||
invalid_params_if(ADC, input_mask & ~ADC_CS_RROBIN_BITS);
|
valid_params_if(ADC, input_mask < (1 << NUM_ADC_CHANNELS));
|
||||||
hw_write_masked(&adc_hw->cs, input_mask << ADC_CS_RROBIN_LSB, ADC_CS_RROBIN_BITS);
|
hw_write_masked(&adc_hw->cs, input_mask << ADC_CS_RROBIN_LSB, ADC_CS_RROBIN_BITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user