atmel-samd: Support Trinket and Gemma M0 prototypes.
This commit is contained in:
parent
8d5c90b0d0
commit
cc412a80ad
|
@ -95,7 +95,7 @@ CFLAGS_CORTEX_M0 = \
|
|||
-Wnested-externs \
|
||||
-Wunreachable-code \
|
||||
-Wcast-align \
|
||||
-D__SAMD21G18A__ \
|
||||
-D__$(CHIP_VARIANT)__ \
|
||||
-DUSB_DEVICE_PRODUCT_ID=$(USB_PID) \
|
||||
-DUSB_DEVICE_VENDOR_ID=$(USB_VID) \
|
||||
-DBOARD=USER_BOARD \
|
||||
|
|
|
@ -3,3 +3,5 @@ USB_VID = 0x2341
|
|||
USB_PID = 0x824D
|
||||
|
||||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
|
|
@ -3,3 +3,5 @@ USB_VID = 0x239A
|
|||
USB_PID = 0x8015
|
||||
|
||||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
|
|
@ -3,3 +3,5 @@ USB_VID = 0x239A
|
|||
USB_PID = 0x8015
|
||||
|
||||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
|
|
@ -3,3 +3,5 @@ USB_VID = 0x239A
|
|||
USB_PID = 0x8015
|
||||
|
||||
FLASH_IMPL = spi_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Memory access control configuration file.
|
||||
*
|
||||
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of Atmel may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software may only be redistributed and used in connection with an
|
||||
* Atmel microcontroller product.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
|
||||
*/
|
||||
|
||||
#ifndef _CONF_ACCESS_H_
|
||||
#define _CONF_ACCESS_H_
|
||||
|
||||
#include "compiler.h"
|
||||
#include "board.h"
|
||||
|
||||
|
||||
/*! \name Activation of Logical Unit Numbers
|
||||
*/
|
||||
//! @{
|
||||
#define LUN_0 ENABLE //!< On-Chip Virtual Memory.
|
||||
#define LUN_1 DISABLE //!< AT45DBX Data Flash.
|
||||
#define LUN_2 DISABLE //!< SD/MMC Card over SPI.
|
||||
#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0.
|
||||
#define LUN_4 DISABLE
|
||||
#define LUN_5 DISABLE
|
||||
#define LUN_6 DISABLE
|
||||
#define LUN_7 DISABLE
|
||||
#define LUN_USB DISABLE //!< Host Mass-Storage Memory.
|
||||
//! @}
|
||||
|
||||
/*! \name LUN 0 Definitions
|
||||
*/
|
||||
//! @{
|
||||
#define LUN_0_INCLUDE "access_vfs.h"
|
||||
#define Lun_0_test_unit_ready vfs_test_unit_ready
|
||||
#define Lun_0_read_capacity vfs_read_capacity
|
||||
#define Lun_0_unload NULL
|
||||
#define Lun_0_wr_protect vfs_wr_protect
|
||||
#define Lun_0_removal vfs_removal
|
||||
#define Lun_0_usb_read_10 vfs_usb_read_10
|
||||
#define Lun_0_usb_write_10 vfs_usb_write_10
|
||||
#define LUN_0_NAME "\"MicroPython VFS[0]\""
|
||||
//! @}
|
||||
|
||||
#define MEM_USB LUN_USB
|
||||
|
||||
/*! \name Actions Associated with Memory Accesses
|
||||
*
|
||||
* Write here the action to associate with each memory access.
|
||||
*
|
||||
* \warning Be careful not to waste time in order not to disturb the functions.
|
||||
*/
|
||||
//! @{
|
||||
#define memory_start_read_action(nb_sectors)
|
||||
#define memory_stop_read_action()
|
||||
#define memory_start_write_action(nb_sectors)
|
||||
#define memory_stop_write_action()
|
||||
//! @}
|
||||
|
||||
/*! \name Activation of Interface Features
|
||||
*/
|
||||
//! @{
|
||||
#define ACCESS_USB true //!< MEM <-> USB interface.
|
||||
#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface.
|
||||
#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface.
|
||||
#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode.
|
||||
#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface.
|
||||
#define ACCESS_CODEC false //!< Codec interface.
|
||||
//! @}
|
||||
|
||||
/*! \name Specific Options for Access Control
|
||||
*/
|
||||
//! @{
|
||||
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
|
||||
//! @}
|
||||
|
||||
|
||||
#endif // _CONF_ACCESS_H_
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief User board configuration template
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
|
||||
*/
|
||||
|
||||
#ifndef CONF_BOARD_H
|
||||
#define CONF_BOARD_H
|
||||
|
||||
#endif // CONF_BOARD_H
|
|
@ -0,0 +1,152 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef CONF_USB_H_INCLUDED
|
||||
#define CONF_USB_H_INCLUDED
|
||||
|
||||
#define USB_DEVICE_MAJOR_VERSION 1
|
||||
#define USB_DEVICE_MINOR_VERSION 0
|
||||
#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA)
|
||||
#define USB_DEVICE_ATTR \
|
||||
(USB_CONFIG_ATTR_BUS_POWERED)
|
||||
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED)
|
||||
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED)
|
||||
|
||||
//! USB Device string definitions (Optional)
|
||||
#ifndef USB_DEVICE_MANUFACTURE_NAME
|
||||
# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries"
|
||||
#endif
|
||||
|
||||
#ifndef USB_DEVICE_PRODUCT_NAME
|
||||
# define USB_DEVICE_PRODUCT_NAME "Metro M0 with Flash (Experimental)"
|
||||
#endif
|
||||
// #define USB_DEVICE_SERIAL_NAME "12...EF"
|
||||
#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number
|
||||
#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32
|
||||
extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH];
|
||||
|
||||
//! Control endpoint size
|
||||
#define USB_DEVICE_EP_CTRL_SIZE 64
|
||||
|
||||
//! Two interfaces for this device (CDC COM + CDC DATA + MSC)
|
||||
#define USB_DEVICE_NB_INTERFACE 3
|
||||
|
||||
// (3 | USB_EP_DIR_IN) // CDC Notify endpoint
|
||||
// (4 | USB_EP_DIR_IN) // CDC TX
|
||||
// (5 | USB_EP_DIR_OUT) // CDC RX
|
||||
// (1 | USB_EP_DIR_IN) // MSC IN
|
||||
// (2 | USB_EP_DIR_OUT) // MSC OUT
|
||||
#define USB_DEVICE_MAX_EP 5
|
||||
|
||||
#define UDI_CDC_PORT_NB 1
|
||||
#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port)
|
||||
extern bool mp_cdc_enable(uint8_t port);
|
||||
#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port)
|
||||
extern void mp_cdc_disable(uint8_t port);
|
||||
#define UDI_CDC_LOW_RATE
|
||||
|
||||
#define UDI_CDC_DEFAULT_RATE 115200
|
||||
#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1
|
||||
#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE
|
||||
#define UDI_CDC_DEFAULT_DATABITS 8
|
||||
|
||||
#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify()
|
||||
void usb_rx_notify(void);
|
||||
#define UDI_CDC_SET_CODING_EXT(port,cfg)
|
||||
#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set)
|
||||
void usb_dtr_notify(uint8_t port, bool set);
|
||||
#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set)
|
||||
void usb_rts_notify(uint8_t port, bool set);
|
||||
|
||||
/**
|
||||
* USB CDC low level configuration
|
||||
* In standalone these configurations are defined by the CDC module.
|
||||
* For composite device, these configuration must be defined here
|
||||
* @{
|
||||
*/
|
||||
//! Endpoint numbers definition
|
||||
|
||||
#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint
|
||||
#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX
|
||||
#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX
|
||||
|
||||
//! Interface numbers
|
||||
#define UDI_CDC_COMM_IFACE_NUMBER_0 0
|
||||
#define UDI_CDC_DATA_IFACE_NUMBER_0 1
|
||||
|
||||
/**
|
||||
* Configuration of MSC interface
|
||||
* @{
|
||||
*/
|
||||
//! Vendor name and Product version of MSC interface
|
||||
#define UDI_MSC_GLOBAL_VENDOR_ID \
|
||||
'A', 'T', 'M', 'E', 'L', ' ', ' ', ' '
|
||||
#define UDI_MSC_GLOBAL_PRODUCT_VERSION \
|
||||
'1', '.', '0', '0'
|
||||
|
||||
//! Interface callback definition
|
||||
#define UDI_MSC_ENABLE_EXT() mp_msc_enable()
|
||||
extern bool mp_msc_enable(void);
|
||||
#define UDI_MSC_DISABLE_EXT() mp_msc_disable()
|
||||
extern void mp_msc_disable(void);
|
||||
|
||||
//! Enable id string of interface to add an extra USB string
|
||||
#define UDI_MSC_STRING_ID 5
|
||||
|
||||
/**
|
||||
* USB MSC low level configuration
|
||||
* In standalone these configurations are defined by the MSC module.
|
||||
* For composite device, these configuration must be defined here
|
||||
* @{
|
||||
*/
|
||||
//! Endpoint numbers definition
|
||||
#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN)
|
||||
#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT)
|
||||
|
||||
//! Interface number
|
||||
#define UDI_MSC_IFACE_NUMBER 2
|
||||
|
||||
/**
|
||||
* Description of Composite Device
|
||||
* @{
|
||||
*/
|
||||
//! USB Interfaces descriptor structure
|
||||
#define UDI_COMPOSITE_DESC_T \
|
||||
usb_iad_desc_t udi_cdc_iad; \
|
||||
udi_cdc_comm_desc_t udi_cdc_comm; \
|
||||
udi_cdc_data_desc_t udi_cdc_data; \
|
||||
udi_msc_desc_t udi_msc
|
||||
|
||||
//! USB Interfaces descriptor value for Full Speed
|
||||
#define UDI_COMPOSITE_DESC_FS \
|
||||
.udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
|
||||
.udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
|
||||
.udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \
|
||||
.udi_msc = UDI_MSC_DESC_FS
|
||||
|
||||
//! USB Interfaces descriptor value for High Speed
|
||||
#define UDI_COMPOSITE_DESC_HS \
|
||||
.udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
|
||||
.udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
|
||||
.udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \
|
||||
.udi_msc = UDI_MSC_DESC_HS
|
||||
|
||||
//! USB Interface APIs
|
||||
#define UDI_COMPOSITE_API \
|
||||
&udi_api_cdc_comm, \
|
||||
&udi_api_cdc_data, \
|
||||
&udi_api_msc
|
||||
//@}
|
||||
|
||||
/**
|
||||
* USB Device Driver Configuration
|
||||
* @{
|
||||
*/
|
||||
//@}
|
||||
|
||||
//! The includes of classes and other headers must be done at the end of this file to avoid compile error
|
||||
#include "udi_cdc.h"
|
||||
#include "udi_msc.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief User board initialization template
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "conf_board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "asf/sam0/drivers/port/port.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#define USB_REPL
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Gemma M0 (Experimental)"
|
||||
#define MICROPY_HW_MCU_NAME "samd21e18"
|
||||
|
||||
#define MICROPY_HW_APA102 &pin_PA03
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define FLASH_INCLUDE "internal_flash.h"
|
|
@ -0,0 +1,7 @@
|
|||
LD_FILE = boards/samd21x18-bootloader.ld
|
||||
USB_VID = 0x239A
|
||||
USB_PID = 0x8015
|
||||
|
||||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21E18A
|
|
@ -0,0 +1,8 @@
|
|||
#include "samd21_pins.h"
|
||||
|
||||
STATIC const mp_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), (mp_obj_t)&pin_PA02 },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), (mp_obj_t)&pin_PA09 },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), (mp_obj_t)&pin_PA08 },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
|
@ -1,5 +1,7 @@
|
|||
LD_FILE = boards/samd21x18-bootloader-external-flash.ld
|
||||
LD_FILE = boards/samd21x18-external-flash.ld
|
||||
USB_VID = 0x239A
|
||||
USB_PID = 0x8015
|
||||
|
||||
FLASH_IMPL = spi_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Memory access control configuration file.
|
||||
*
|
||||
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The name of Atmel may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* 4. This software may only be redistributed and used in connection with an
|
||||
* Atmel microcontroller product.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
|
||||
*/
|
||||
|
||||
#ifndef _CONF_ACCESS_H_
|
||||
#define _CONF_ACCESS_H_
|
||||
|
||||
#include "compiler.h"
|
||||
#include "board.h"
|
||||
|
||||
|
||||
/*! \name Activation of Logical Unit Numbers
|
||||
*/
|
||||
//! @{
|
||||
#define LUN_0 ENABLE //!< On-Chip Virtual Memory.
|
||||
#define LUN_1 DISABLE //!< AT45DBX Data Flash.
|
||||
#define LUN_2 DISABLE //!< SD/MMC Card over SPI.
|
||||
#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0.
|
||||
#define LUN_4 DISABLE
|
||||
#define LUN_5 DISABLE
|
||||
#define LUN_6 DISABLE
|
||||
#define LUN_7 DISABLE
|
||||
#define LUN_USB DISABLE //!< Host Mass-Storage Memory.
|
||||
//! @}
|
||||
|
||||
/*! \name LUN 0 Definitions
|
||||
*/
|
||||
//! @{
|
||||
#define LUN_0_INCLUDE "access_vfs.h"
|
||||
#define Lun_0_test_unit_ready vfs_test_unit_ready
|
||||
#define Lun_0_read_capacity vfs_read_capacity
|
||||
#define Lun_0_unload NULL
|
||||
#define Lun_0_wr_protect vfs_wr_protect
|
||||
#define Lun_0_removal vfs_removal
|
||||
#define Lun_0_usb_read_10 vfs_usb_read_10
|
||||
#define Lun_0_usb_write_10 vfs_usb_write_10
|
||||
#define LUN_0_NAME "\"MicroPython VFS[0]\""
|
||||
//! @}
|
||||
|
||||
#define MEM_USB LUN_USB
|
||||
|
||||
/*! \name Actions Associated with Memory Accesses
|
||||
*
|
||||
* Write here the action to associate with each memory access.
|
||||
*
|
||||
* \warning Be careful not to waste time in order not to disturb the functions.
|
||||
*/
|
||||
//! @{
|
||||
#define memory_start_read_action(nb_sectors)
|
||||
#define memory_stop_read_action()
|
||||
#define memory_start_write_action(nb_sectors)
|
||||
#define memory_stop_write_action()
|
||||
//! @}
|
||||
|
||||
/*! \name Activation of Interface Features
|
||||
*/
|
||||
//! @{
|
||||
#define ACCESS_USB true //!< MEM <-> USB interface.
|
||||
#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface.
|
||||
#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface.
|
||||
#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode.
|
||||
#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface.
|
||||
#define ACCESS_CODEC false //!< Codec interface.
|
||||
//! @}
|
||||
|
||||
/*! \name Specific Options for Access Control
|
||||
*/
|
||||
//! @{
|
||||
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
|
||||
//! @}
|
||||
|
||||
|
||||
#endif // _CONF_ACCESS_H_
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief User board configuration template
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
|
||||
*/
|
||||
|
||||
#ifndef CONF_BOARD_H
|
||||
#define CONF_BOARD_H
|
||||
|
||||
#endif // CONF_BOARD_H
|
|
@ -0,0 +1,152 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef CONF_USB_H_INCLUDED
|
||||
#define CONF_USB_H_INCLUDED
|
||||
|
||||
#define USB_DEVICE_MAJOR_VERSION 1
|
||||
#define USB_DEVICE_MINOR_VERSION 0
|
||||
#define USB_DEVICE_POWER 100 // Consumption on Vbus line (mA)
|
||||
#define USB_DEVICE_ATTR \
|
||||
(USB_CONFIG_ATTR_BUS_POWERED)
|
||||
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED)
|
||||
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED)
|
||||
|
||||
//! USB Device string definitions (Optional)
|
||||
#ifndef USB_DEVICE_MANUFACTURE_NAME
|
||||
# define USB_DEVICE_MANUFACTURE_NAME "Adafruit Industries"
|
||||
#endif
|
||||
|
||||
#ifndef USB_DEVICE_PRODUCT_NAME
|
||||
# define USB_DEVICE_PRODUCT_NAME "Metro M0 with Flash (Experimental)"
|
||||
#endif
|
||||
// #define USB_DEVICE_SERIAL_NAME "12...EF"
|
||||
#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number
|
||||
#define USB_DEVICE_GET_SERIAL_NAME_LENGTH 32
|
||||
extern char serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH];
|
||||
|
||||
//! Control endpoint size
|
||||
#define USB_DEVICE_EP_CTRL_SIZE 64
|
||||
|
||||
//! Two interfaces for this device (CDC COM + CDC DATA + MSC)
|
||||
#define USB_DEVICE_NB_INTERFACE 3
|
||||
|
||||
// (3 | USB_EP_DIR_IN) // CDC Notify endpoint
|
||||
// (4 | USB_EP_DIR_IN) // CDC TX
|
||||
// (5 | USB_EP_DIR_OUT) // CDC RX
|
||||
// (1 | USB_EP_DIR_IN) // MSC IN
|
||||
// (2 | USB_EP_DIR_OUT) // MSC OUT
|
||||
#define USB_DEVICE_MAX_EP 5
|
||||
|
||||
#define UDI_CDC_PORT_NB 1
|
||||
#define UDI_CDC_ENABLE_EXT(port) mp_cdc_enable(port)
|
||||
extern bool mp_cdc_enable(uint8_t port);
|
||||
#define UDI_CDC_DISABLE_EXT(port) mp_cdc_disable(port)
|
||||
extern void mp_cdc_disable(uint8_t port);
|
||||
#define UDI_CDC_LOW_RATE
|
||||
|
||||
#define UDI_CDC_DEFAULT_RATE 115200
|
||||
#define UDI_CDC_DEFAULT_STOPBITS CDC_STOP_BITS_1
|
||||
#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE
|
||||
#define UDI_CDC_DEFAULT_DATABITS 8
|
||||
|
||||
#define UDI_CDC_RX_NOTIFY(port) usb_rx_notify()
|
||||
void usb_rx_notify(void);
|
||||
#define UDI_CDC_SET_CODING_EXT(port,cfg)
|
||||
#define UDI_CDC_SET_DTR_EXT(port,set) usb_dtr_notify(port, set)
|
||||
void usb_dtr_notify(uint8_t port, bool set);
|
||||
#define UDI_CDC_SET_RTS_EXT(port,set) usb_rts_notify(port, set)
|
||||
void usb_rts_notify(uint8_t port, bool set);
|
||||
|
||||
/**
|
||||
* USB CDC low level configuration
|
||||
* In standalone these configurations are defined by the CDC module.
|
||||
* For composite device, these configuration must be defined here
|
||||
* @{
|
||||
*/
|
||||
//! Endpoint numbers definition
|
||||
|
||||
#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint
|
||||
#define UDI_CDC_DATA_EP_IN_0 (4 | USB_EP_DIR_IN) // TX
|
||||
#define UDI_CDC_DATA_EP_OUT_0 (5 | USB_EP_DIR_OUT) // RX
|
||||
|
||||
//! Interface numbers
|
||||
#define UDI_CDC_COMM_IFACE_NUMBER_0 0
|
||||
#define UDI_CDC_DATA_IFACE_NUMBER_0 1
|
||||
|
||||
/**
|
||||
* Configuration of MSC interface
|
||||
* @{
|
||||
*/
|
||||
//! Vendor name and Product version of MSC interface
|
||||
#define UDI_MSC_GLOBAL_VENDOR_ID \
|
||||
'A', 'T', 'M', 'E', 'L', ' ', ' ', ' '
|
||||
#define UDI_MSC_GLOBAL_PRODUCT_VERSION \
|
||||
'1', '.', '0', '0'
|
||||
|
||||
//! Interface callback definition
|
||||
#define UDI_MSC_ENABLE_EXT() mp_msc_enable()
|
||||
extern bool mp_msc_enable(void);
|
||||
#define UDI_MSC_DISABLE_EXT() mp_msc_disable()
|
||||
extern void mp_msc_disable(void);
|
||||
|
||||
//! Enable id string of interface to add an extra USB string
|
||||
#define UDI_MSC_STRING_ID 5
|
||||
|
||||
/**
|
||||
* USB MSC low level configuration
|
||||
* In standalone these configurations are defined by the MSC module.
|
||||
* For composite device, these configuration must be defined here
|
||||
* @{
|
||||
*/
|
||||
//! Endpoint numbers definition
|
||||
#define UDI_MSC_EP_IN (1 | USB_EP_DIR_IN)
|
||||
#define UDI_MSC_EP_OUT (2 | USB_EP_DIR_OUT)
|
||||
|
||||
//! Interface number
|
||||
#define UDI_MSC_IFACE_NUMBER 2
|
||||
|
||||
/**
|
||||
* Description of Composite Device
|
||||
* @{
|
||||
*/
|
||||
//! USB Interfaces descriptor structure
|
||||
#define UDI_COMPOSITE_DESC_T \
|
||||
usb_iad_desc_t udi_cdc_iad; \
|
||||
udi_cdc_comm_desc_t udi_cdc_comm; \
|
||||
udi_cdc_data_desc_t udi_cdc_data; \
|
||||
udi_msc_desc_t udi_msc
|
||||
|
||||
//! USB Interfaces descriptor value for Full Speed
|
||||
#define UDI_COMPOSITE_DESC_FS \
|
||||
.udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
|
||||
.udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
|
||||
.udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \
|
||||
.udi_msc = UDI_MSC_DESC_FS
|
||||
|
||||
//! USB Interfaces descriptor value for High Speed
|
||||
#define UDI_COMPOSITE_DESC_HS \
|
||||
.udi_cdc_iad = UDI_CDC_IAD_DESC_0, \
|
||||
.udi_cdc_comm = UDI_CDC_COMM_DESC_0, \
|
||||
.udi_cdc_data = UDI_CDC_DATA_DESC_0_HS, \
|
||||
.udi_msc = UDI_MSC_DESC_HS
|
||||
|
||||
//! USB Interface APIs
|
||||
#define UDI_COMPOSITE_API \
|
||||
&udi_api_cdc_comm, \
|
||||
&udi_api_cdc_data, \
|
||||
&udi_api_msc
|
||||
//@}
|
||||
|
||||
/**
|
||||
* USB Device Driver Configuration
|
||||
* @{
|
||||
*/
|
||||
//@}
|
||||
|
||||
//! The includes of classes and other headers must be done at the end of this file to avoid compile error
|
||||
#include "udi_cdc.h"
|
||||
#include "udi_msc.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief User board initialization template
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "conf_board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "asf/sam0/drivers/port/port.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#define USB_REPL
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Trinket M0 (Experimental)"
|
||||
#define MICROPY_HW_MCU_NAME "samd21e18"
|
||||
|
||||
#define MICROPY_HW_APA102 &pin_PA03
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define FLASH_INCLUDE "internal_flash.h"
|
|
@ -0,0 +1,7 @@
|
|||
LD_FILE = boards/samd21x18-bootloader.ld
|
||||
USB_VID = 0x239A
|
||||
USB_PID = 0x8015
|
||||
|
||||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21E18A
|
|
@ -0,0 +1,11 @@
|
|||
#include "samd21_pins.h"
|
||||
|
||||
STATIC const mp_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), (mp_obj_t)&pin_PA02 },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), (mp_obj_t)&pin_PA11 },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), (mp_obj_t)&pin_PA10 },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), (mp_obj_t)&pin_PA09 },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), (mp_obj_t)&pin_PA08 },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_L), (mp_obj_t)&pin_PA28 },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
|
@ -229,14 +229,24 @@ PIN(PA14, false, NO_ADC_INPUT,
|
|||
TIMER(TC3, 0, 0, 0, PIN_PA14E_TC3_WO0, MUX_PA14E_TC3_WO0),
|
||||
TIMER(0, TCC0, 0, 4, PIN_PA14F_TCC0_WO4, MUX_PA14F_TCC0_WO4),
|
||||
SERCOM(SERCOM2, 2, PINMUX_PA14C_SERCOM2_PAD2),
|
||||
SERCOM(SERCOM4, 2, PINMUX_PA14D_SERCOM4_PAD2));
|
||||
#ifdef SERCOM4
|
||||
SERCOM(SERCOM4, 2, PINMUX_PA14D_SERCOM4_PAD2)
|
||||
#else
|
||||
NO_SERCOM
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifdef PIN_PA15
|
||||
PIN(PA15, false, NO_ADC_INPUT,
|
||||
TIMER(TC3, 0, 1, 1, PIN_PA15E_TC3_WO1, MUX_PA15E_TC3_WO1),
|
||||
TIMER(0, TCC0, 1, 5, PIN_PA15F_TCC0_WO5, MUX_PA15F_TCC0_WO5),
|
||||
SERCOM(SERCOM2, 3, PINMUX_PA15C_SERCOM2_PAD3),
|
||||
SERCOM(SERCOM4, 3, PINMUX_PA15D_SERCOM4_PAD3));
|
||||
#ifdef SERCOM4
|
||||
SERCOM(SERCOM4, 3, PINMUX_PA15D_SERCOM4_PAD3)
|
||||
#else
|
||||
NO_SERCOM
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifdef PIN_PA16
|
||||
PIN(PA16, false, NO_ADC_INPUT,
|
||||
|
@ -315,28 +325,48 @@ PIN(PA22, false, NO_ADC_INPUT,
|
|||
TIMER(TC4, 0, 0, 0, PIN_PA22E_TC4_WO0, MUX_PA22E_TC4_WO0),
|
||||
TIMER(0, TCC0, 0, 4, PIN_PA22F_TCC0_WO4, MUX_PA22F_TCC0_WO4),
|
||||
SERCOM(SERCOM3, 0, PINMUX_PA22C_SERCOM3_PAD0),
|
||||
SERCOM(SERCOM5, 0, PINMUX_PA22D_SERCOM5_PAD0));
|
||||
#ifdef SERCOM5
|
||||
SERCOM(SERCOM5, 0, PINMUX_PA22D_SERCOM5_PAD0)
|
||||
#else
|
||||
NO_SERCOM
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifdef PIN_PA23
|
||||
PIN(PA23, false, NO_ADC_INPUT,
|
||||
TIMER(TC4, 0, 1, 1, PIN_PA23E_TC4_WO1, MUX_PA23E_TC4_WO1),
|
||||
TIMER(0, TCC0, 1, 5, PIN_PA23F_TCC0_WO5, MUX_PA23F_TCC0_WO5),
|
||||
SERCOM(SERCOM3, 1, PINMUX_PA23C_SERCOM3_PAD1),
|
||||
SERCOM(SERCOM5, 1, PINMUX_PA23D_SERCOM5_PAD1));
|
||||
#ifdef SERCOM5
|
||||
SERCOM(SERCOM5, 1, PINMUX_PA23D_SERCOM5_PAD1)
|
||||
#else
|
||||
NO_SERCOM
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifdef PIN_PA24
|
||||
PIN(PA24, false, NO_ADC_INPUT,
|
||||
TIMER(TC5, 0, 0, 0, PIN_PA24E_TC5_WO0, MUX_PA24E_TC5_WO0),
|
||||
TIMER(0, TCC0, 2, 2, PIN_PA24F_TCC1_WO2, MUX_PA24F_TCC1_WO2),
|
||||
SERCOM(SERCOM3, 2, PINMUX_PA24C_SERCOM3_PAD2),
|
||||
SERCOM(SERCOM5, 2, PINMUX_PA24D_SERCOM5_PAD2));
|
||||
#ifdef SERCOM5
|
||||
SERCOM(SERCOM5, 2, PINMUX_PA24D_SERCOM5_PAD2)
|
||||
#else
|
||||
NO_SERCOM
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifdef PIN_PA25
|
||||
PIN(PA25, false, NO_ADC_INPUT,
|
||||
TIMER(TC5, 0, 1, 1, PIN_PA25E_TC5_WO1, MUX_PA25E_TC5_WO1),
|
||||
TIMER(0, TCC1, 3, 3, PIN_PA25F_TCC1_WO3, MUX_PA25F_TCC1_WO3),
|
||||
SERCOM(SERCOM3, 3, PINMUX_PA25C_SERCOM3_PAD3),
|
||||
SERCOM(SERCOM5, 3, PINMUX_PA25C_SERCOM3_PAD3));
|
||||
#ifdef SERCOM5
|
||||
SERCOM(SERCOM5, 3, PINMUX_PA25C_SERCOM3_PAD3)
|
||||
#else
|
||||
NO_SERCOM
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#ifdef PIN_PB22
|
||||
PIN(PB22, false, NO_ADC_INPUT,
|
||||
|
|
|
@ -4,6 +4,8 @@ rm -rf esp8266/build*
|
|||
make -C atmel-samd BOARD=feather_m0_basic
|
||||
make -C atmel-samd BOARD=feather_m0_flash
|
||||
make -C atmel-samd BOARD=metro_m0_flash
|
||||
make -C atmel-samd BOARD=trinket_m0
|
||||
make -C atmel-samd BOARD=gemma_m0
|
||||
make -C esp8266 BOARD=feather_huzzah
|
||||
|
||||
version=`git describe --tags --exact-match`
|
||||
|
@ -14,4 +16,6 @@ fi
|
|||
cp atmel-samd/build-feather_m0_basic/firmware.bin bin/adafruit-micropython-feather_m0_basic-$version.bin
|
||||
cp atmel-samd/build-feather_m0_flash/firmware.bin bin/adafruit-micropython-feather_m0_flash-$version.bin
|
||||
cp atmel-samd/build-metro_m0_flash/firmware.bin bin/adafruit-micropython-metro_m0_flash-$version.bin
|
||||
cp atmel-samd/build-trinket_m0/firmware.bin bin/adafruit-micropython-trinket_m0-$version.bin
|
||||
cp atmel-samd/build-gemma_m0/firmware.bin bin/adafruit-micropython-gemma_m0-$version.bin
|
||||
cp esp8266/build/firmware-combined.bin bin/adafruit-micropython-feather_huzzah-$version.bin
|
Loading…
Reference in New Issue