Add some extra defines to platform_defs.h (#227)

This commit is contained in:
Andrew Scheller 2021-03-04 18:52:42 +00:00 committed by GitHub
parent c6a09bd495
commit 0f119727c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,11 @@
#define NUM_PWM_SLICES _u(8)
#define NUM_SPIN_LOCKS _u(32)
#define NUM_UARTS _u(2)
#define NUM_I2CS _u(2)
#define NUM_SPIS _u(2)
#define NUM_ADC_CHANNELS _u(5)
#define NUM_BANK0_GPIOS _u(30)
#define PIO_INSTRUCTION_COUNT _u(32)

View File

@ -84,7 +84,7 @@ static inline void adc_gpio_init(uint gpio) {
* \param input Input to select.
*/
static inline void adc_select_input(uint input) {
invalid_params_if(ADC, input > 4);
valid_params_if(ADC, input < NUM_ADC_CHANNELS);
hw_write_masked(&adc_hw->cs, input << ADC_CS_AINSEL_LSB, ADC_CS_AINSEL_BITS);
}