aboutsummaryrefslogtreecommitdiff
path: root/atmel-samd/common-hal/microcontroller/Pin.h
diff options
context:
space:
mode:
Diffstat (limited to 'atmel-samd/common-hal/microcontroller/Pin.h')
-rw-r--r--atmel-samd/common-hal/microcontroller/Pin.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/atmel-samd/common-hal/microcontroller/Pin.h b/atmel-samd/common-hal/microcontroller/Pin.h
index 31c083311..154ea1e47 100644
--- a/atmel-samd/common-hal/microcontroller/Pin.h
+++ b/atmel-samd/common-hal/microcontroller/Pin.h
@@ -27,17 +27,11 @@
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_MICROCONTROLLER_PIN_H
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_MICROCONTROLLER_PIN_H
-// Don't reorder these includes because they are dependencies of adc_feature.h.
-// They should really be included by adc_feature.h.
-#include "compiler.h"
-#include "asf/sam0/drivers/system/clock/gclk.h"
-#include "asf/sam0/utils/cmsis/samd21/include/component/adc.h"
-#include "asf/sam0/drivers/adc/adc_sam_d_r/adc_feature.h" // for adc_positive_input
+#include "py/obj.h"
-#include "asf/sam0/drivers/tc/tc.h"
-#include "asf/sam0/drivers/tcc/tcc.h"
+#include "mpconfigport.h"
-#include "py/obj.h"
+#include "include/component/sercom.h"
typedef struct {
Sercom *const sercom;
@@ -49,24 +43,32 @@ typedef struct {
Tc *const tc;
Tcc *const tcc;
};
+ #ifdef SAMD21
bool is_tc:1;
- uint8_t channel:3;
+ #endif
uint8_t wave_output:4;
} pin_timer_t;
+#ifdef SAMD21
+ #define NUM_TIMERS_PER_PIN 2
+ #define NUM_ADC_PER_PIN 1
+#endif
+#ifdef SAMD51
+ #define NUM_TIMERS_PER_PIN 3
+ #define NUM_ADC_PER_PIN 2
+#endif
#define NUM_SERCOMS_PER_PIN 2
+
typedef struct {
mp_obj_base_t base;
qstr name;
uint8_t pin;
bool has_extint:1;
uint8_t extint_channel:7;
- bool has_adc:1;
- enum adc_positive_input adc_input:7;
bool has_touch:1;
uint8_t touch_y_line:7; // 0 - 15. Assumed to be Y channel.
- pin_timer_t primary_timer;
- pin_timer_t secondary_timer;
+ uint8_t adc_input[NUM_ADC_PER_PIN];
+ pin_timer_t timer[NUM_TIMERS_PER_PIN];
pin_sercom_t sercom[NUM_SERCOMS_PER_PIN];
} mcu_pin_obj_t;