Skip to content

Commit

Permalink
Split out the peripherals library in preparation of sharing with Make…
Browse files Browse the repository at this point in the history
…Code.
  • Loading branch information
tannewt committed Jun 15, 2018
1 parent 5ce1d71 commit a5e03b7
Show file tree
Hide file tree
Showing 64 changed files with 67 additions and 5,952 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@
[submodule "frozen/Adafruit_CircuitPython_DotStar"]
path = frozen/Adafruit_CircuitPython_DotStar
url = https://github.com/adafruit/Adafruit_CircuitPython_DotStar.git
[submodule "ports/atmel-samd/peripherals"]
path = ports/atmel-samd/peripherals
url = https://github.com/adafruit/samd-peripherals.git
33 changes: 17 additions & 16 deletions ports/atmel-samd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ INC += -I. \
-Iasf4_conf/$(CHIP_FAMILY) \
-Iboards/$(BOARD) \
-Iboards/ \
-Iperipherals/ \
-Ifreetouch \
-I$(BUILD)

Expand Down Expand Up @@ -248,21 +249,21 @@ SRC_C = \
flash_api.c \
mphalport.c \
reset.c \
peripherals/clocks.c \
peripherals/dma.c \
peripherals/events.c \
peripherals/external_interrupts.c \
peripherals/sercom.c \
peripherals/timers.c \
peripherals/$(CHIP_FAMILY)/adc.c \
peripherals/$(CHIP_FAMILY)/cache.c \
peripherals/$(CHIP_FAMILY)/clocks.c \
peripherals/$(CHIP_FAMILY)/dma.c \
peripherals/$(CHIP_FAMILY)/events.c \
peripherals/$(CHIP_FAMILY)/external_interrupts.c \
peripherals/$(CHIP_FAMILY)/pins.c \
peripherals/$(CHIP_FAMILY)/sercom.c \
peripherals/$(CHIP_FAMILY)/timers.c \
peripherals/samd/clocks.c \
peripherals/samd/dma.c \
peripherals/samd/events.c \
peripherals/samd/external_interrupts.c \
peripherals/samd/sercom.c \
peripherals/samd/timers.c \
peripherals/samd/$(CHIP_FAMILY)/adc.c \
peripherals/samd/$(CHIP_FAMILY)/cache.c \
peripherals/samd/$(CHIP_FAMILY)/clocks.c \
peripherals/samd/$(CHIP_FAMILY)/dma.c \
peripherals/samd/$(CHIP_FAMILY)/events.c \
peripherals/samd/$(CHIP_FAMILY)/external_interrupts.c \
peripherals/samd/$(CHIP_FAMILY)/pins.c \
peripherals/samd/$(CHIP_FAMILY)/sercom.c \
peripherals/samd/$(CHIP_FAMILY)/timers.c \
tick.c \
usb.c \
usb_mass_storage.c \
Expand Down Expand Up @@ -402,7 +403,7 @@ ifneq ($(CHIP_VARIANT),SAMD51G18A)
audiobusio/__init__.c \
audiobusio/I2SOut.c \
audiobusio/PDMIn.c
SRC_C += peripherals/i2s.c peripherals/$(CHIP_FAMILY)/i2s.c
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
endif
endif

Expand Down
6 changes: 3 additions & 3 deletions ports/atmel-samd/audio_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/

#include "audio_dma.h"
#include "peripherals/clocks.h"
#include "peripherals/events.h"
#include "peripherals/dma.h"
#include "samd/clocks.h"
#include "samd/events.h"
#include "samd/dma.h"

#include "shared-bindings/audioio/RawSample.h"
#include "shared-bindings/audioio/WaveFile.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/bindings/samd/Clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

#include "bindings/samd/Clock.h"
#include "peripherals/clocks.h"
#include "samd/clocks.h"
#include "py/obj.h"
#include "py/objproperty.h"
#include "py/runtime.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/board_busses.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "shared-bindings/microcontroller/Pin.h"
#include "mpconfigboard.h"
#include "peripherals/pins.h"
#include "samd/pins.h"
#include "py/runtime.h"

#if !defined(DEFAULT_I2C_BUS_SDA) || !defined(DEFAULT_I2C_BUS_SCL)
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/analogio/AnalogIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "py/binary.h"
#include "py/mphal.h"

#include "peripherals/adc.h"
#include "samd/adc.h"
#include "shared-bindings/analogio/AnalogIn.h"

#include "atmel_start_pins.h"
Expand Down
12 changes: 6 additions & 6 deletions ports/atmel-samd/common-hal/audiobusio/I2SOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
#include "hpl/pm/hpl_pm_base.h"
#endif

#include "peripherals/clocks.h"
#include "peripherals/dma.h"
#include "peripherals/events.h"
#include "peripherals/i2s.h"
#include "peripherals/pins.h"
#include "peripherals/timers.h"
#include "samd/clocks.h"
#include "samd/dma.h"
#include "samd/events.h"
#include "samd/i2s.h"
#include "samd/pins.h"
#include "samd/timers.h"

#include "audio_dma.h"

Expand Down
10 changes: 5 additions & 5 deletions ports/atmel-samd/common-hal/audiobusio/PDMIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
#include "hal/include/hal_gpio.h"
#include "hal/utils/include/utils.h"

#include "peripherals/clocks.h"
#include "peripherals/events.h"
#include "peripherals/i2s.h"
#include "peripherals/pins.h"
#include "peripherals/dma.h"
#include "samd/clocks.h"
#include "samd/events.h"
#include "samd/i2s.h"
#include "samd/pins.h"
#include "samd/dma.h"

#include "audio_dma.h"
#include "tick.h"
Expand Down
8 changes: 4 additions & 4 deletions ports/atmel-samd/common-hal/audioio/AudioOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@

#include "audio_dma.h"

#include "peripherals/dma.h"
#include "peripherals/events.h"
#include "peripherals/pins.h"
#include "peripherals/timers.h"
#include "samd/dma.h"
#include "samd/events.h"
#include "samd/pins.h"
#include "samd/timers.h"

void audioout_reset(void) {
}
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/busio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "hal/include/hal_i2c_m_sync.h"
#include "hal/include/hpl_i2c_m_sync.h"

#include "peripherals/sercom.h"
#include "samd/sercom.h"
#include "shared-bindings/microcontroller/__init__.h"


Expand Down
4 changes: 2 additions & 2 deletions ports/atmel-samd/common-hal/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include "hal/include/hpl_spi_m_sync.h"
#include "supervisor/shared/rgb_led_status.h"

#include "peripherals/dma.h"
#include "peripherals/sercom.h"
#include "samd/dma.h"
#include "samd/sercom.h"

void common_hal_busio_spi_construct(busio_spi_obj_t *self,
const mcu_pin_obj_t * clock, const mcu_pin_obj_t * mosi,
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/busio/UART.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "hal/include/hal_usart_async.h"
#include "hal/include/hpl_usart_async.h"

#include "peripherals/sercom.h"
#include "samd/sercom.h"

// Do-nothing callback needed so that usart_async code will enable rx interrupts.
// See comment below re usart_async_register_callback()
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/microcontroller/Pin.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "atmel_start_pins.h"
#include "hal/include/hal_gpio.h"

#include "peripherals/pins.h"
#include "samd/pins.h"
#include "supervisor/shared/rgb_led_status.h"

#ifdef MICROPY_HW_NEOPIXEL
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/microcontroller/Pin.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ void reset_all_pins(void);
void reset_pin(uint8_t pin);
void claim_pin(const mcu_pin_obj_t* pin);

#include "peripherals/pins.h"
#include "peripherals/samd/pins.h"

#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_MICROCONTROLLER_PIN_H
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/microcontroller/Processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

#include "common-hal/microcontroller/Processor.h"

#include "peripherals/adc.h"
#include "samd/adc.h"

#include "peripheral_clk_config.h"

Expand Down
4 changes: 2 additions & 2 deletions ports/atmel-samd/common-hal/pulseio/PWMOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

#include "atmel_start_pins.h"
#include "hal/utils/include/utils_repeat_macro.h"
#include "peripherals/timers.h"
#include "samd/timers.h"

#include "peripherals/pins.h"
#include "samd/pins.h"

#undef ENABLE

Expand Down
4 changes: 2 additions & 2 deletions ports/atmel-samd/common-hal/pulseio/PulseIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include "mpconfigport.h"
#include "py/gc.h"
#include "py/runtime.h"
#include "peripherals/external_interrupts.h"
#include "peripherals/pins.h"
#include "samd/external_interrupts.h"
#include "samd/pins.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/pulseio/PulseIn.h"

Expand Down
4 changes: 2 additions & 2 deletions ports/atmel-samd/common-hal/pulseio/PulseOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include "hal/include/hal_gpio.h"

#include "mpconfigport.h"
#include "peripherals/pins.h"
#include "peripherals/timers.h"
#include "samd/pins.h"
#include "samd/timers.h"
#include "py/gc.h"
#include "py/runtime.h"
#include "shared-bindings/pulseio/PulseOut.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "atmel_start_pins.h"

#include "peripherals/external_interrupts.h"
#include "samd/external_interrupts.h"
#include "py/runtime.h"

void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t* self,
Expand Down
4 changes: 2 additions & 2 deletions ports/atmel-samd/common-hal/touchio/TouchIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#include "hpl/pm/hpl_pm_base.h"
#endif

#include "peripherals/clocks.h"
#include "peripherals/pins.h"
#include "samd/clocks.h"
#include "samd/pins.h"

#include "tick.h"
#include "adafruit_ptc.h"
Expand Down
4 changes: 2 additions & 2 deletions ports/atmel-samd/external_flash/qspi_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include "mpconfigboard.h" // for EXTERNAL_FLASH_QSPI_DUAL

#include "external_flash/common_commands.h"
#include "peripherals/cache.h"
#include "peripherals/dma.h"
#include "samd/cache.h"
#include "samd/dma.h"

#include "atmel_start_pins.h"
#include "hal_gpio.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/external_flash/spi_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <string.h>

#include "external_flash/common_commands.h"
#include "peripherals/sercom.h"
#include "samd/sercom.h"
#include "py/mpconfig.h"

#include "hal_gpio.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ extern const struct _mp_obj_module_t usb_hid_module;

#define MP_STATE_PORT MP_STATE_VM

#include "peripherals/dma.h"
#include "peripherals/samd/dma.h"

#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/peripherals
Submodule peripherals added at 5b18f0
35 changes: 0 additions & 35 deletions ports/atmel-samd/peripherals/adc.h

This file was deleted.

33 changes: 0 additions & 33 deletions ports/atmel-samd/peripherals/cache.h

This file was deleted.

Loading

0 comments on commit a5e03b7

Please sign in to comment.