Incorporate feedback:
* Clean up board defines. * Add flush on eject and stay ejected. * Swith back to NONE protocol for CDC.
This commit is contained in:
parent
688f0e388b
commit
43f7ca7985
@ -1 +1 @@
|
||||
Subproject commit 537a29273c08b1e047004e1bd71c37af82937dd4
|
||||
Subproject commit 299a2f12de2ddb76b9a488b23e7e562058faee90
|
@ -5,7 +5,7 @@
|
||||
#define MICROPY_HW_LED_TX &pin_PA27
|
||||
#define MICROPY_HW_LED_RX &pin_PB03
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25 | PORT_PA27)
|
||||
#define MICROPY_PORT_A (PORT_PA27)
|
||||
#define MICROPY_PORT_B (PORT_PB03)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#define SPI_FLASH_CS_PIN &pin_PB22
|
||||
|
||||
// These are pins not to reset.
|
||||
// PA24 and PA25 are USB.
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
@ -9,7 +9,9 @@
|
||||
#define SPI_FLASH_CS_PIN &pin_PA07
|
||||
|
||||
// These are pins not to reset.
|
||||
// NeoPixel and for the display: Reset, Command or data, and Chip select
|
||||
#define MICROPY_PORT_A ( PORT_PA01 | PORT_PA12 | PORT_PA27 | PORT_PA28)
|
||||
// Data and Clock for the display
|
||||
#define MICROPY_PORT_B ( PORT_PB22 | PORT_PB23 )
|
||||
#define MICROPY_PORT_C ( 0 )
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Metro M0 Express"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
//#define MICROPY_HW_LED_TX &pin_PA27
|
||||
//#define MICROPY_HW_LED_RX &pin_PA31
|
||||
#define MICROPY_HW_LED_TX &pin_PA27
|
||||
// Comment this out if you have trouble connecting over SWD. It's one of the SWD pins.
|
||||
#define MICROPY_HW_LED_RX &pin_PA31
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PA30)
|
||||
|
||||
@ -15,7 +16,7 @@
|
||||
#define SPI_FLASH_CS_PIN &pin_PA13
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25 | PORT_PA30 | PORT_PA31)
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define MICROPY_HW_APA102_MOSI (&pin_PA00)
|
||||
#define MICROPY_HW_APA102_SCK (&pin_PA01)
|
||||
|
||||
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25)
|
||||
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
|
@ -53,12 +53,7 @@ void reset_all_pins(void) {
|
||||
// Do not full reset USB or SWD lines.
|
||||
pin_mask[0] &= ~(PORT_PA24 | PORT_PA25 | PORT_PA30 | PORT_PA31);
|
||||
|
||||
#ifdef SAMD21
|
||||
pin_mask[0] &= ~(PORT_PA31);
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0; i < PORT_COUNT; i++) {
|
||||
pin_mask[i] &= ~(PORT_PA31);
|
||||
pin_mask[i] &= ~never_reset_pins[i];
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#define MSC_FLASH_BLOCK_SIZE 512
|
||||
|
||||
static bool ejected[1];
|
||||
|
||||
// The root FS is always at the end of the list.
|
||||
static fs_user_mount_t* get_vfs(int lun) {
|
||||
// TODO(tannewt): Return the mount which matches the lun where 0 is the end
|
||||
@ -60,7 +62,7 @@ static fs_user_mount_t* get_vfs(int lun) {
|
||||
// - READ10 and WRITE10 have their own callbacks
|
||||
int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer, uint16_t bufsize) {
|
||||
const void* response = NULL;
|
||||
uint16_t resplen = 0;
|
||||
int32_t resplen = 0;
|
||||
|
||||
switch ( scsi_cmd[0] ) {
|
||||
case SCSI_CMD_TEST_UNIT_READY:
|
||||
@ -73,6 +75,9 @@ int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer,
|
||||
if (current_mount == NULL) {
|
||||
resplen = -1;
|
||||
}
|
||||
if (ejected[lun]) {
|
||||
resplen = -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -96,6 +101,11 @@ int32_t tud_msc_scsi_cb (uint8_t lun, const uint8_t scsi_cmd[16], void* buffer,
|
||||
if (current_mount == NULL) {
|
||||
resplen = -1;
|
||||
}
|
||||
if (disk_ioctl(current_mount, CTRL_SYNC, NULL) != RES_OK) {
|
||||
resplen = -1;
|
||||
} else {
|
||||
ejected[lun] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ cdc_comm_interface = standard.InterfaceDescriptor(
|
||||
description="CDC comm",
|
||||
bInterfaceClass=cdc.CDC_CLASS_COMM, # Communications Device Class
|
||||
bInterfaceSubClass=cdc.CDC_SUBCLASS_ACM, # Abstract control model
|
||||
bInterfaceProtocol=cdc.CDC_PROTOCOL_V25TER,
|
||||
bInterfaceProtocol=cdc.CDC_PROTOCOL_NONE,
|
||||
iInterface=StringIndex.index("CircuitPython CDC control"),
|
||||
subdescriptors=[
|
||||
cdc.Header(
|
||||
@ -254,7 +254,7 @@ cdc_iad = standard.InterfaceAssociationDescriptor(
|
||||
bInterfaceCount=len(cdc_interfaces),
|
||||
bFunctionClass=cdc.CDC_CLASS_COMM, # Communications Device Class
|
||||
bFunctionSubClass=cdc.CDC_SUBCLASS_ACM, # Abstract control model
|
||||
bFunctionProtocol=cdc.CDC_PROTOCOL_V25TER) # TODO(tannewt): can this be NONE (aka 0)?
|
||||
bFunctionProtocol=cdc.CDC_PROTOCOL_NONE)
|
||||
|
||||
# audio_iad = standard.InterfaceAssociationDescriptor(
|
||||
# description="Audio IAD",
|
||||
|
Loading…
Reference in New Issue
Block a user