Skip to content

Commit 0f11972

Browse files
authored
Add some extra defines to platform_defs.h (#227)
1 parent c6a09bd commit 0f11972

File tree

2 files changed

+6
-1
lines changed
  • src

2 files changed

+6
-1
lines changed

src/rp2040/hardware_regs/include/hardware/platform_defs.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
#define NUM_PWM_SLICES _u(8)
2626
#define NUM_SPIN_LOCKS _u(32)
2727
#define NUM_UARTS _u(2)
28+
#define NUM_I2CS _u(2)
29+
#define NUM_SPIS _u(2)
30+
31+
#define NUM_ADC_CHANNELS _u(5)
32+
2833
#define NUM_BANK0_GPIOS _u(30)
2934

3035
#define PIO_INSTRUCTION_COUNT _u(32)

src/rp2_common/hardware_adc/include/hardware/adc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static inline void adc_gpio_init(uint gpio) {
8484
* \param input Input to select.
8585
*/
8686
static inline void adc_select_input(uint input) {
87-
invalid_params_if(ADC, input > 4);
87+
valid_params_if(ADC, input < NUM_ADC_CHANNELS);
8888
hw_write_masked(&adc_hw->cs, input << ADC_CS_AINSEL_LSB, ADC_CS_AINSEL_BITS);
8989
}
9090

0 commit comments

Comments
 (0)