aboutsummaryrefslogtreecommitdiff
path: root/atmel-samd/common-hal/microcontroller/Pin.h
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2017-09-22 18:05:51 -0700
committerDan Halbert <halbert@halwitz.org>2017-09-22 21:05:51 -0400
commit6839fff31303463d5c7942387fa498895edf1abf (patch)
treef4c5b94c6534c8d5c65ea6b7209cd2d681508f5f /atmel-samd/common-hal/microcontroller/Pin.h
parent3ad01ddb04b160b74b4baee9fce043da17dbcef5 (diff)
Move to ASF4 and introduce SAMD51 support. (#258)3.0.0-alpha.0
* atmel-samd: Remove ASF3. This will break builds. * atmel-samd: Add ASF4 for the SAMD21 and SAMD51. * Introduce the supervisor concept to facilitate porting. The supervisor is the code which runs individual MicroPython VMs. By splitting it out we make it more consistent and easier to find. This also adds very basic SAMD21 and SAMD51 support using the supervisor. Only the REPL currently works. This begins the work for #178.
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;