Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/rp2040/hardware_regs/include/hardware/platform_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/rp2_common/hardware_adc/include/hardware/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down