Merge pull request #1100 from tannewt/samr
Initial SAMR board revision.
This commit is contained in:
commit
b735b9dbed
@ -14,6 +14,7 @@ env:
|
|||||||
- TRAVIS_BOARD=pca10056
|
- TRAVIS_BOARD=pca10056
|
||||||
- TRAVIS_BOARD=trinket_m0
|
- TRAVIS_BOARD=trinket_m0
|
||||||
- TRAVIS_BOARD=feather_m4_express
|
- TRAVIS_BOARD=feather_m4_express
|
||||||
|
- TRAVIS_BOARD=feather_radiofruit_zigbee
|
||||||
- TRAVIS_BOARD=arduino_zero
|
- TRAVIS_BOARD=arduino_zero
|
||||||
- TRAVIS_BOARD=circuitplayground_express_crickit
|
- TRAVIS_BOARD=circuitplayground_express_crickit
|
||||||
- TRAVIS_BOARD=feather_m0_basic
|
- TRAVIS_BOARD=feather_m0_basic
|
||||||
@ -50,7 +51,7 @@ notifications:
|
|||||||
before_script:
|
before_script:
|
||||||
- sudo dpkg --add-architecture i386
|
- sudo dpkg --add-architecture i386
|
||||||
|
|
||||||
- ([[ -z "$TRAVIS_BOARD" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
|
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
|
||||||
|
|
||||||
# For nrf builds
|
# For nrf builds
|
||||||
- ([[ $TRAVIS_BOARD != "feather52832" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
|
- ([[ $TRAVIS_BOARD != "feather52832" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
|
||||||
@ -62,7 +63,7 @@ before_script:
|
|||||||
- ([[ $TRAVIS_TEST != "docs" ]] || sudo pip install Sphinx sphinx-rtd-theme recommonmark)
|
- ([[ $TRAVIS_TEST != "docs" ]] || sudo pip install Sphinx sphinx-rtd-theme recommonmark)
|
||||||
- ([[ $TRAVIS_TEST != "translations" ]] || sudo pip3 install polib)
|
- ([[ $TRAVIS_TEST != "translations" ]] || sudo pip3 install polib)
|
||||||
- gcc --version
|
- gcc --version
|
||||||
- ([[ -z "$TRAVIS_BOARD" ]] || arm-none-eabi-gcc --version)
|
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || arm-none-eabi-gcc --version)
|
||||||
- python3 --version
|
- python3 --version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
@ -336,8 +336,6 @@ SRC_COMMON_HAL = \
|
|||||||
pulseio/PWMOut.c \
|
pulseio/PWMOut.c \
|
||||||
usb_hid/__init__.c \
|
usb_hid/__init__.c \
|
||||||
usb_hid/Device.c \
|
usb_hid/Device.c \
|
||||||
audioio/__init__.c \
|
|
||||||
audioio/AudioOut.c \
|
|
||||||
touchio/__init__.c \
|
touchio/__init__.c \
|
||||||
touchio/TouchIn.c \
|
touchio/TouchIn.c \
|
||||||
|
|
||||||
@ -378,13 +376,8 @@ SRC_BINDINGS_ENUMS = \
|
|||||||
supervisor/__init__.c \
|
supervisor/__init__.c \
|
||||||
util.c
|
util.c
|
||||||
|
|
||||||
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
|
||||||
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
|
||||||
$(addprefix common-hal/, $(SRC_COMMON_HAL))
|
|
||||||
|
|
||||||
SRC_SHARED_MODULE = \
|
SRC_SHARED_MODULE = \
|
||||||
audioio/RawSample.c \
|
|
||||||
audioio/WaveFile.c \
|
|
||||||
bitbangio/__init__.c \
|
bitbangio/__init__.c \
|
||||||
bitbangio/I2C.c \
|
bitbangio/I2C.c \
|
||||||
bitbangio/OneWire.c \
|
bitbangio/OneWire.c \
|
||||||
@ -402,17 +395,33 @@ SRC_SHARED_MODULE = \
|
|||||||
uheap/__init__.c \
|
uheap/__init__.c \
|
||||||
ustack/__init__.c
|
ustack/__init__.c
|
||||||
|
|
||||||
|
# SAMRs don't have a DAC
|
||||||
|
ifneq ($(CHIP_VARIANT),SAMR21G18A)
|
||||||
|
SRC_COMMON_HAL += \
|
||||||
|
audioio/__init__.c \
|
||||||
|
audioio/AudioOut.c
|
||||||
|
SRC_SHARED_MODULE += \
|
||||||
|
audioio/RawSample.c \
|
||||||
|
audioio/WaveFile.c
|
||||||
|
endif
|
||||||
|
|
||||||
# The smallest SAMD51 packages don't have I2S. Everything else does.
|
# The smallest SAMD51 packages don't have I2S. Everything else does.
|
||||||
ifneq ($(CHIP_VARIANT),SAMD51G18A)
|
ifneq ($(CHIP_VARIANT),SAMD51G18A)
|
||||||
ifneq ($(CHIP_VARIANT),SAMD51G19A)
|
ifneq ($(CHIP_VARIANT),SAMD51G19A)
|
||||||
|
ifneq ($(CHIP_VARIANT),SAMR21G18A)
|
||||||
SRC_COMMON_HAL += \
|
SRC_COMMON_HAL += \
|
||||||
audiobusio/__init__.c \
|
audiobusio/__init__.c \
|
||||||
audiobusio/I2SOut.c \
|
audiobusio/I2SOut.c \
|
||||||
audiobusio/PDMIn.c
|
audiobusio/PDMIn.c
|
||||||
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
|
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
||||||
|
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
||||||
|
$(addprefix common-hal/, $(SRC_COMMON_HAL))
|
||||||
|
|
||||||
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
|
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
|
||||||
$(addprefix shared-module/, $(SRC_SHARED_MODULE))
|
$(addprefix shared-module/, $(SRC_SHARED_MODULE))
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 88a67f9c83eeb225fe65f596078f8aaa3f6de1ec
|
Subproject commit 4007ba846bc937410f7eb8350e62e0f5fe9ed8f5
|
@ -33,7 +33,9 @@
|
|||||||
volatile uint64_t last_finished_tick = 0;
|
volatile uint64_t last_finished_tick = 0;
|
||||||
|
|
||||||
void run_background_tasks(void) {
|
void run_background_tasks(void) {
|
||||||
|
#if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
|
||||||
audio_dma_background();
|
audio_dma_background();
|
||||||
|
#endif
|
||||||
usb_msc_background();
|
usb_msc_background();
|
||||||
usb_cdc_background();
|
usb_cdc_background();
|
||||||
last_finished_tick = ticks_ms;
|
last_finished_tick = ticks_ms;
|
||||||
|
38
ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c
Executable file
38
ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "boards/board.h"
|
||||||
|
|
||||||
|
void board_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool board_requests_safe_mode(void) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_board(void) {
|
||||||
|
}
|
64
ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.h
Executable file
64
ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.h
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#define MICROPY_HW_BOARD_NAME "Adafruit Feather RadioFruit Zigbee"
|
||||||
|
#define MICROPY_HW_MCU_NAME "samr21g18"
|
||||||
|
|
||||||
|
#define MICROPY_HW_NEOPIXEL (&pin_PA22)
|
||||||
|
|
||||||
|
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||||
|
#define SPI_FLASH_BAUDRATE (8000000)
|
||||||
|
|
||||||
|
#define SPI_FLASH_MOSI_PIN PIN_PA31
|
||||||
|
#define SPI_FLASH_MISO_PIN PIN_PA30
|
||||||
|
#define SPI_FLASH_SCK_PIN PIN_PA17
|
||||||
|
#define SPI_FLASH_CS_PIN PIN_PA28
|
||||||
|
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA31D_SERCOM1_PAD3
|
||||||
|
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA30D_SERCOM1_PAD2
|
||||||
|
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA17C_SERCOM1_PAD1
|
||||||
|
#define SPI_FLASH_SERCOM SERCOM1
|
||||||
|
#define SPI_FLASH_SERCOM_INDEX 1
|
||||||
|
#define SPI_FLASH_MOSI_PAD 3
|
||||||
|
#define SPI_FLASH_MISO_PAD 2
|
||||||
|
#define SPI_FLASH_SCK_PAD 1
|
||||||
|
// <o> Transmit Data Pinout
|
||||||
|
// <0x0=>PAD[0,1]_DO_SCK
|
||||||
|
// <0x1=>PAD[2,3]_DO_SCK
|
||||||
|
// <0x2=>PAD[3,1]_DO_SCK
|
||||||
|
// <0x3=>PAD[0,3]_DO_SCK
|
||||||
|
#define SPI_FLASH_DOPO 2
|
||||||
|
#define SPI_FLASH_DIPO 2 // same as MISO pad
|
||||||
|
|
||||||
|
// These are pins not to reset.
|
||||||
|
#define MICROPY_PORT_A (PORT_PA17 | PORT_PA22 | PORT_PA24 | PORT_PA25 | PORT_PA28 | PORT_PA30 | PORT_PA31)
|
||||||
|
#define MICROPY_PORT_B ( 0 )
|
||||||
|
#define MICROPY_PORT_C ( 0 )
|
||||||
|
|
||||||
|
#include "external_flash/external_flash.h"
|
||||||
|
|
||||||
|
// If you change this, then make sure to update the linker scripts as well to
|
||||||
|
// make sure you don't overwrite code.
|
||||||
|
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||||
|
|
||||||
|
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||||
|
|
||||||
|
#include "external_flash/devices.h"
|
||||||
|
|
||||||
|
#define EXTERNAL_FLASH_DEVICE_COUNT 2
|
||||||
|
#define EXTERNAL_FLASH_DEVICES S25FL216K, \
|
||||||
|
GD25Q16C
|
||||||
|
|
||||||
|
#include "external_flash/external_flash.h"
|
||||||
|
|
||||||
|
#define BOARD_HAS_CRYSTAL 1
|
||||||
|
|
||||||
|
#define DEFAULT_I2C_BUS_SCL (&pin_PA13)
|
||||||
|
#define DEFAULT_I2C_BUS_SDA (&pin_PA12)
|
||||||
|
|
||||||
|
#define DEFAULT_SPI_BUS_SCK (&pin_PB23)
|
||||||
|
#define DEFAULT_SPI_BUS_MOSI (&pin_PB22)
|
||||||
|
#define DEFAULT_SPI_BUS_MISO (&pin_PA23)
|
||||||
|
|
||||||
|
#define DEFAULT_UART_BUS_RX (&pin_PA09)
|
||||||
|
#define DEFAULT_UART_BUS_TX (&pin_PA08)
|
||||||
|
|
||||||
|
// USB is always used internally so skip the pin objects for it.
|
||||||
|
#define IGNORE_PIN_PA24 1
|
||||||
|
#define IGNORE_PIN_PA25 1
|
11
ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.mk
Executable file
11
ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.mk
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
LD_FILE = boards/samd21x18-bootloader-external-flash.ld
|
||||||
|
USB_VID = 0x239A
|
||||||
|
USB_PID = 0x8023
|
||||||
|
USB_PRODUCT = "Feather RadioFruit Zigbee"
|
||||||
|
USB_MANUFACTURER = "Adafruit Industries LLC"
|
||||||
|
|
||||||
|
SPI_FLASH_FILESYSTEM = 1
|
||||||
|
LONGINT_IMPL = MPZ
|
||||||
|
|
||||||
|
CHIP_VARIANT = SAMR21G18A
|
||||||
|
CHIP_FAMILY = samd21
|
46
ports/atmel-samd/boards/feather_radiofruit_zigbee/pins.c
Executable file
46
ports/atmel-samd/boards/feather_radiofruit_zigbee/pins.c
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
|
#include "board_busses.h"
|
||||||
|
|
||||||
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB02) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB03) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA05) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA06) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA07) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB23) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB22) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA23) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA09) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA09) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA08) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA08) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA14) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA15) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA16) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA22) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA22) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA27) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||||
|
|
||||||
|
// Internally connected within the package
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_DIG3), MP_ROM_PTR(&pin_PA10) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_DIG4), MP_ROM_PTR(&pin_PA11) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SLP_TR), MP_ROM_PTR(&pin_PA20) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_IRQ), MP_ROM_PTR(&pin_PB00) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_DIG1), MP_ROM_PTR(&pin_PA16) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_DIG2), MP_ROM_PTR(&pin_PA17) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_RF_MOSI), MP_ROM_PTR(&pin_PB30) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_SEL), MP_ROM_PTR(&pin_PB31) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_CLKM), MP_ROM_PTR(&pin_PC16) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_RF_SCK), MP_ROM_PTR(&pin_PC18) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_RF_MISO), MP_ROM_PTR(&pin_PC19) },
|
||||||
|
};
|
||||||
|
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
@ -45,6 +45,9 @@
|
|||||||
|
|
||||||
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self,
|
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self,
|
||||||
const mcu_pin_obj_t *pin) {
|
const mcu_pin_obj_t *pin) {
|
||||||
|
#if defined(SAMD21) && !defined(PIN_PA02)
|
||||||
|
mp_raise_NotImplementedError("No DAC on chip");
|
||||||
|
#else
|
||||||
if (pin->number != PIN_PA02
|
if (pin->number != PIN_PA02
|
||||||
#ifdef SAMD51
|
#ifdef SAMD51
|
||||||
&& pin->number != PIN_PA05
|
&& pin->number != PIN_PA05
|
||||||
@ -97,6 +100,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self,
|
|||||||
gpio_set_pin_function(pin->number, GPIO_PIN_FUNCTION_B);
|
gpio_set_pin_function(pin->number, GPIO_PIN_FUNCTION_B);
|
||||||
|
|
||||||
dac_sync_enable_channel(&self->descriptor, self->channel);
|
dac_sync_enable_channel(&self->descriptor, self->channel);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
|
bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
|
||||||
@ -104,6 +108,7 @@ bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
|
void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
|
||||||
|
#if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
|
||||||
if (common_hal_analogio_analogout_deinited(self)) {
|
if (common_hal_analogio_analogout_deinited(self)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -119,16 +124,23 @@ void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
|
|||||||
#endif
|
#endif
|
||||||
self->deinited = true;
|
self->deinited = true;
|
||||||
// TODO(tannewt): Turn off the DAC clocks to save power.
|
// TODO(tannewt): Turn off the DAC clocks to save power.
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self,
|
void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self,
|
||||||
uint16_t value) {
|
uint16_t value) {
|
||||||
|
#if defined(SAMD21) && !defined(PIN_PA02)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
// Input is 16 bit so make sure and set LEFTADJ to 1 so it takes the top
|
// Input is 16 bit so make sure and set LEFTADJ to 1 so it takes the top
|
||||||
// bits. This is currently done in asf4_conf/*/hpl_dac_config.h.
|
// bits. This is currently done in asf4_conf/*/hpl_dac_config.h.
|
||||||
dac_sync_write(&self->descriptor, self->channel, &value, 1);
|
dac_sync_write(&self->descriptor, self->channel, &value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void analogout_reset(void) {
|
void analogout_reset(void) {
|
||||||
|
#if defined(SAMD21) && !defined(PIN_PA02)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
#ifdef SAMD21
|
#ifdef SAMD21
|
||||||
while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {}
|
while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {}
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,6 +53,22 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
|||||||
uint8_t mosi_pad = 0;
|
uint8_t mosi_pad = 0;
|
||||||
uint8_t miso_pad = 0;
|
uint8_t miso_pad = 0;
|
||||||
uint8_t dopo = 255;
|
uint8_t dopo = 255;
|
||||||
|
#ifdef PIN_PC19
|
||||||
|
if (miso == &pin_PC19) {
|
||||||
|
if (mosi == &pin_PB30 && clock == &pin_PC18) {
|
||||||
|
sercom = SERCOM4;
|
||||||
|
sercom_index = 4;
|
||||||
|
clock_pinmux = MUX_F;
|
||||||
|
mosi_pinmux = MUX_F;
|
||||||
|
miso_pinmux = MUX_F;
|
||||||
|
clock_pad = 3;
|
||||||
|
mosi_pad = 2;
|
||||||
|
miso_pad = 0;
|
||||||
|
dopo = samd_peripherals_get_spi_dopo(clock_pad, mosi_pad);
|
||||||
|
}
|
||||||
|
// Error, leave SERCOM unset to throw an exception later.
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
for (int i = 0; i < NUM_SERCOMS_PER_PIN; i++) {
|
for (int i = 0; i < NUM_SERCOMS_PER_PIN; i++) {
|
||||||
sercom_index = clock->sercom[i].index; // 2 for SERCOM2, etc.
|
sercom_index = clock->sercom[i].index; // 2 for SERCOM2, etc.
|
||||||
if (sercom_index >= SERCOM_INST_NUM) {
|
if (sercom_index >= SERCOM_INST_NUM) {
|
||||||
@ -109,6 +125,9 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef PIN_PC19
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (sercom == NULL) {
|
if (sercom == NULL) {
|
||||||
mp_raise_ValueError("Invalid pins");
|
mp_raise_ValueError("Invalid pins");
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,16 @@ STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
|
{ MP_ROM_QSTR(MP_QSTR_PB02), MP_ROM_PTR(&pin_PB02) },
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_PB03) && !defined(IGNORE_PIN_PB03)
|
#if defined(PIN_PB03) && !defined(IGNORE_PIN_PB03)
|
||||||
{ MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) }
|
{ MP_ROM_QSTR(MP_QSTR_PB03), MP_ROM_PTR(&pin_PB03) },
|
||||||
|
#endif
|
||||||
|
#if defined(PIN_PC16)
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_PC16), MP_ROM_PTR(&pin_PC16) },
|
||||||
|
#endif
|
||||||
|
#if defined(PIN_PC18)
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_PC18), MP_ROM_PTR(&pin_PC18) },
|
||||||
|
#endif
|
||||||
|
#if defined(PIN_PC19)
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_PC19), MP_ROM_PTR(&pin_PC19) },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_global_dict_table);
|
MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_global_dict_table);
|
||||||
|
@ -213,15 +213,21 @@ extern const struct _mp_obj_module_t usb_hid_module;
|
|||||||
// Scan gamepad every 32ms
|
// Scan gamepad every 32ms
|
||||||
#define CIRCUITPY_GAMEPAD_TICKS 0x1f
|
#define CIRCUITPY_GAMEPAD_TICKS 0x1f
|
||||||
|
|
||||||
#if defined(__SAMD51G19A__) || defined(__SAMD51G18A__)
|
#if defined(__SAMD51G19A__) || defined(__SAMD51G18A__) || defined(__SAMR21G18A__)
|
||||||
#define AUDIOBUSIO_MODULE
|
#define AUDIOBUSIO_MODULE
|
||||||
#else
|
#else
|
||||||
#define AUDIOBUSIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audiobusio), (mp_obj_t)&audiobusio_module },
|
#define AUDIOBUSIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audiobusio), (mp_obj_t)&audiobusio_module },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__SAMR21G18A__)
|
||||||
|
#define AUDIOIO_MODULE
|
||||||
|
#else
|
||||||
|
#define AUDIOIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module },
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EXTRA_BUILTIN_MODULES
|
#ifndef EXTRA_BUILTIN_MODULES
|
||||||
#define EXTRA_BUILTIN_MODULES \
|
#define EXTRA_BUILTIN_MODULES \
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module }, \
|
AUDIOIO_MODULE \
|
||||||
AUDIOBUSIO_MODULE \
|
AUDIOBUSIO_MODULE \
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module }, \
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module }, \
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module }, \
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module }, \
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 75c3d3d50b25d2ba3a8872f0bff621ffdf94353f
|
Subproject commit 1140ff6d7ed413aa1e2f34c5d847dcc41c924bb9
|
@ -239,7 +239,7 @@ void reset_port(void) {
|
|||||||
sercom_instances[i]->SPI.CTRLA.bit.SWRST = 1;
|
sercom_instances[i]->SPI.CTRLA.bit.SWRST = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPRESS_BOARD
|
#if defined(EXPRESS_BOARD) && !defined(__SAMR21G18A__)
|
||||||
audioout_reset();
|
audioout_reset();
|
||||||
#if !defined(__SAMD51G19A__) && !defined(__SAMD51G18A__)
|
#if !defined(__SAMD51G19A__) && !defined(__SAMD51G18A__)
|
||||||
i2sout_reset();
|
i2sout_reset();
|
||||||
|
@ -269,6 +269,7 @@ axtls: $(BUILD)/libaxtls.a
|
|||||||
|
|
||||||
$(BUILD)/libaxtls.a:
|
$(BUILD)/libaxtls.a:
|
||||||
cd $(TOP)/lib/axtls; cp config/upyconfig config/.config
|
cd $(TOP)/lib/axtls; cp config/upyconfig config/.config
|
||||||
|
cd $(TOP)/lib/axtls; $(MAKE) ssl/version.h
|
||||||
cd $(TOP)/lib/axtls; $(MAKE) oldconfig -B
|
cd $(TOP)/lib/axtls; $(MAKE) oldconfig -B
|
||||||
cd $(TOP)/lib/axtls; $(MAKE) clean
|
cd $(TOP)/lib/axtls; $(MAKE) clean
|
||||||
cd $(TOP)/lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)" AR="$(AR)" CFLAGS_EXTRA="$(CFLAGS_XTENSA) -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096"
|
cd $(TOP)/lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)" AR="$(AR)" CFLAGS_EXTRA="$(CFLAGS_XTENSA) -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096"
|
||||||
|
@ -2,7 +2,7 @@ rm -rf ports/atmel-samd/build*
|
|||||||
rm -rf ports/esp8266/build*
|
rm -rf ports/esp8266/build*
|
||||||
rm -rf ports/nrf/build*
|
rm -rf ports/nrf/build*
|
||||||
|
|
||||||
ATMEL_BOARDS="arduino_zero circuitplayground_express circuitplayground_express_crickit feather_m0_basic feather_m0_adalogger itsybitsy_m0_express itsybitsy_m4_express feather_m0_rfm69 feather_m0_rfm9x feather_m0_express feather_m0_express_crickit feather_m4_express metro_m0_express metro_m4_express pirkey_m0 trinket_m0 gemma_m0 feather52832 feather_huzzah pca10056 hallowing_m0_express"
|
ATMEL_BOARDS="arduino_zero circuitplayground_express circuitplayground_express_crickit feather_radiofruit_zigbee feather_m0_basic feather_m0_adalogger itsybitsy_m0_express itsybitsy_m4_express feather_m0_rfm69 feather_m0_rfm9x feather_m0_express feather_m0_express_crickit feather_m4_express metro_m0_express metro_m4_express pirkey_m0 trinket_m0 gemma_m0 feather52832 feather_huzzah pca10056 hallowing_m0_express"
|
||||||
ROSIE_SETUPS="rosie-ci"
|
ROSIE_SETUPS="rosie-ci"
|
||||||
|
|
||||||
PARALLEL="-j 5"
|
PARALLEL="-j 5"
|
||||||
|
Loading…
Reference in New Issue
Block a user