Add Lerdge S,X,K (#18302)

This commit is contained in:
J.C. Nelson
2020-07-06 15:08:52 -07:00
committed by GitHub
parent af8be58d92
commit 6f14d2d37f
29 changed files with 1775 additions and 157 deletions

View File

@ -337,11 +337,12 @@
#define BOARD_BTT_BTT002_V1_0 4211 // BigTreeTech BTT002 v1.0 (STM32F407VG)
#define BOARD_BTT_GTR_V1_0 4212 // BigTreeTech GTR v1.0 (STM32F407IGT)
#define BOARD_LERDGE_K 4213 // Lerdge K (STM32F407ZG)
#define BOARD_LERDGE_X 4214 // Lerdge X (STM32F407VE)
#define BOARD_VAKE403D 4215 // VAkE 403D (STM32F446VET6)
#define BOARD_FYSETC_S6 4216 // FYSETC S6 board
#define BOARD_FLYF407ZG 4217 // FLYF407ZG board (STM32F407ZG)
#define BOARD_MKS_ROBIN2 4218 // MKS_ROBIN2 (STM32F407ZE)
#define BOARD_LERDGE_S 4214 // Lerdge S (STM32F407VE)
#define BOARD_LERDGE_X 4215 // Lerdge X (STM32F407VE)
#define BOARD_VAKE403D 4216 // VAkE 403D (STM32F446VET6)
#define BOARD_FYSETC_S6 4217 // FYSETC S6 board
#define BOARD_FLYF407ZG 4218 // FLYF407ZG board (STM32F407ZG)
#define BOARD_MKS_ROBIN2 4219 // MKS_ROBIN2 (STM32F407ZE)
//
// ARM Cortex M7

View File

@ -1598,12 +1598,20 @@ void Temperature::init() {
#if MB(RUMBA)
// Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
#define _AD(N) ANY(HEATER_##N##_USES_AD595, HEATER_##N##_USES_AD8495)
#if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER)
#if _AD(0) || _AD(1) || _AD(2) || _AD(BED) || _AD(CHAMBER)
MCUCR = _BV(JTD);
MCUCR = _BV(JTD);
#endif
#endif
// Thermistor activation by MCU pin
#if PIN_EXISTS(TEMP_0_TR_ENABLE_PIN)
OUT_WRITE(TEMP_0_TR_ENABLE_PIN, ENABLED(HEATER_0_USES_MAX6675));
#endif
#if PIN_EXISTS(TEMP_1_TR_ENABLE_PIN)
OUT_WRITE(TEMP_1_TR_ENABLE_PIN, ENABLED(HEATER_1_USES_MAX6675));
#endif
#if BOTH(PIDTEMP, PID_EXTRUSION_SCALING)
last_e_position = 0;
#endif

View File

@ -586,8 +586,10 @@
#include "stm32f4/pins_BTT_BTT002_V1_0.h" // STM32F4 env:BIGTREE_BTT002
#elif MB(LERDGE_K)
#include "stm32f4/pins_LERDGE_K.h" // STM32F4 env:STM32F4
#elif MB(LERDGE_S)
#include "stm32f4/pins_LERDGE_S.h" // STM32F4 env:LERDGE_S
#elif MB(LERDGE_X)
#include "stm32f4/pins_LERDGE_X.h" // STM32F4 env:STM32F4
#include "stm32f4/pins_LERDGE_X.h" // STM32F4 env:LERDGE_X
#elif MB(VAKE403D)
#include "stm32f4/pins_VAKE403D.h" // STM32F4 env:STM32F4
#elif MB(FYSETC_S6)

View File

@ -29,13 +29,10 @@
#define I2C_EEPROM
// Ignore temp readings during develpment.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
//
// Servos
//
//#define SERVO0_PIN PD12
//#define SERVO0_PIN PB11
//
// Limit Switches
@ -48,14 +45,14 @@
// Z Probe (when not Z_MIN_PIN)
//
//#ifndef Z_MIN_PROBE_PIN
// #define Z_MIN_PROBE_PIN PB15
// #define Z_MIN_PROBE_PIN PG6
//#endif
//
// Filament runout
//
#define FIL_RUNOUT_PIN PE6
#define FIL_RUNOUT2_PIN PE7
#define FIL_RUNOUT_PIN PE5
#define FIL_RUNOUT2_PIN PE6
//
// Steppers
@ -64,35 +61,35 @@
#define X_DIR_PIN PB10
#define X_ENABLE_PIN PG0
//#ifndef X_CS_PIN
// #define X_CS_PIN PE0
// #define X_CS_PIN PE0
//#endif
#define Y_STEP_PIN PF14
#define Y_DIR_PIN PF15
#define Y_ENABLE_PIN PF13
//#ifndef Y_CS_PIN
// #define Y_CS_PIN PE1
// #define Y_CS_PIN PE1
//#endif
#define Z_STEP_PIN PF11
#define Z_DIR_PIN PF12
#define Z_ENABLE_PIN PC5
//#ifndef Z_CS_PIN
// #define Z_CS_PIN PE2
// #define Z_CS_PIN PE2
//#endif
#define E0_STEP_PIN PC14
#define E0_DIR_PIN PC13
#define E0_ENABLE_PIN PC15
//#ifndef E0_CS_PIN
// #define E0_CS_PIN PE3
// #define E0_CS_PIN PE3
//#endif
#define E1_STEP_PIN PF1
#define E1_DIR_PIN PF0
#define E1_ENABLE_PIN PF2
//#ifndef E1_CS_PIN
// #define E1_CS_PIN PE4
// #define E1_CS_PIN PE4
//#endif
//
@ -102,6 +99,12 @@
#define TEMP_1_PIN PC2 // Analog Input
#define TEMP_BED_PIN PC0 // Analog Input
// Lergde-K can choose thermocouple/thermistor mode in software.
// For use with thermistors, these pins must be OUT/LOW.
// This is done automatically.
#define TEMP_0_TR_ENABLE_PIN PF10
#define TEMP_1_TR_ENABLE_PIN PF9
//
// Heaters / Fans
//
@ -110,10 +113,10 @@
#define HEATER_BED_PIN PA2
#ifndef FAN_PIN
#define FAN_PIN PC15
#define FAN_PIN PF7
#endif
#define FAN1_PIN PF6
#define FAN2_PIN PF7
#define FAN2_PIN PF8
#ifndef E0_AUTO_FAN_PIN
#define E0_AUTO_FAN_PIN PF6
@ -125,12 +128,15 @@
//#define CASE_LIGHT_PIN_CI -1
//#define CASE_LIGHT_PIN_DO -1
//#define NEOPIXEL_PIN -1
//
// Prusa i3 MK2 Multi-Material Multiplexer Support
//
//#define E_MUX0_PIN -1
//#define E_MUX1_PIN -1
#ifndef RGB_LED_R_PIN
#define RGB_LED_R_PIN PB7
#endif
#ifndef RGB_LED_G_PIN
#define RGB_LED_G_PIN PB8
#endif
#ifndef RGB_LED_B_PIN
#define RGB_LED_B_PIN PB9
#endif
//
// SD support
@ -141,45 +147,34 @@
// Misc. Functions
//
#define SDSS PC11
#define LED_PIN PC7 // Alive
#define LED_PIN PA15 // Alive
#define PS_ON_PIN -1
#define KILL_PIN -1
#define POWER_LOSS_PIN -1 // Power-loss / nAC_FAULT
#define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT
#define SCK_PIN PC12
#define MISO_PIN PC8
#define MOSI_PIN PD2
#define SS_PIN PC11
#define SD_DETECT_PIN PA8
#define BEEPER_PIN PC7
//
// LCD / Controller
//
// TODO: Replace these with the correct FSMC pins, once known
#define SD_DETECT_PIN -1
#define BEEPER_PIN PD12
#define LCD_PINS_RS -1
#define LCD_PINS_ENABLE -1
#define LCD_PINS_D4 -1
#define LCD_PINS_D5 -1
#define LCD_PINS_D6 -1
#define LCD_PINS_D7 -1
#define TFT_RESET_PIN PD6
#define TFT_BACKLIGHT_PIN PD3
#define BTN_EN1 PE3
#define BTN_EN2 PE4
#define BTN_ENC PE2
#define TFT_CS_PIN PD7
#define TFT_RS_PIN PD11
//
// ST7920 Delays
//
#if HAS_GRAPHICAL_LCD
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(96)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(48)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(715)
#endif
#endif
#define TOUCH_CS_PIN PG15
#define TOUCH_SCK_PIN PB3
#define TOUCH_MOSI_PIN PB5
#define TOUCH_MISO_PIN PB4
#define BTN_EN1 PG10
#define BTN_EN2 PG11
#define BTN_ENC PG9

View File

@ -0,0 +1,208 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#if !defined(STM32F4) && !defined(STM32F4xx)
#error "Oops! Select an STM32F4 board in 'Tools > Board.'"
#elif HOTENDS > 2 || E_STEPPERS > 2
#error "LERDGE S supports up to 2 hotends / E-steppers."
#endif
#define BOARD_INFO_NAME "Lerdge S"
#define DEFAULT_MACHINE_NAME "LERDGE"
#define STEP_TIMER 4
#define TEMP_TIMER 2
//#define I2C_EEPROM
//
// Servos
//
#define SERVO0_PIN PD12 //confirmed
//#define SERVO1_PIN -1
//
// Limit Switches
//
#define X_MIN_PIN PG9 //confirmed
#define Y_MIN_PIN PG10 //confirmed
#define Z_MIN_PIN PG11 //confirmed
#define X_MAX_PIN PG12 //confirmed
#define Y_MAX_PIN PG13 //confirmed
#define Z_MAX_PIN PG14 //confirmed
//
// Filament runout
//
#define FIL_RUNOUT_PIN PC5 //confirmed
//
// Z Probe (when not Z_MIN_PIN)
//
#ifndef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN PG8 //confirmed
#endif
//
// Steppers
//
#define X_STEP_PIN PF7 //confirmed
#define X_DIR_PIN PF8 //confirmed
#define X_ENABLE_PIN PF6 //confirmed
#define Y_STEP_PIN PF10 //confirmed
#define Y_DIR_PIN PF11 //confirmed
#define Y_ENABLE_PIN PF9 //confirmed
#define Z_STEP_PIN PF13 //confirmed
#define Z_DIR_PIN PF14 //confirmed
#define Z_ENABLE_PIN PF12 //confirmed
#define E0_STEP_PIN PG0 //confirmed
#define E0_DIR_PIN PG1 //confirmed
#define E0_ENABLE_PIN PF15 //confirmed
#define E1_STEP_PIN PG3 //confirmed
#define E1_DIR_PIN PG4 //confirmed
#define E1_ENABLE_PIN PG2 //confirmed
//
// Temperature Sensors
//
#define TEMP_0_PIN PC0 // See below for activation of thermistor readings
#define TEMP_1_PIN PC1 // See below for activation of thermistor readings
#define TEMP_BED_PIN PC3 //confirmed
// Lergde-S can choose thermocouple/thermistor mode in software.
// For use with thermistors, these pins must be OUT/LOW.
// This is done automatically.
#define TEMP_0_TR_ENABLE_PIN PF3
#define TEMP_1_TR_ENABLE_PIN PF4
// MAX6675 Cold-Junction-Compensated K-Thermocouple to Digital Converter (0°C to +1024°C)
// https://datasheets.maximintegrated.com/en/ds/MAX6675.pdf
#define MAX6675_SCK_PIN PB3 // max6675 datasheet: SCK pin, found with multimeter, not tested
#define MAX6675_DO_PIN PB4 // max6675 datasheet: SO pin, found with multimeter, not tested
#define MAX6675_SS_PIN PC4 // max6675 datasheet: /CS pin, found with multimeter, not tested and likely wrong
// Expansion board with second max6675
// Warning: Some boards leave the slot unpopulated.
//#define MAX6675_SCK2_PIN PB3 // max6675 datasheet: SCK pin, found with multimeter, not tested
//#define MAX6675_DO2_PIN PB4 // max6675 datasheet: SO pin, found with multimeter, not tested
//#define MAX6675_SS2_PIN PF1 // max6675 datasheet: /CS pin, found with multimeter, not tested
//
// Heaters / Fans
//
#define HEATER_0_PIN PA0 //confirmed
#define HEATER_1_PIN PA1 //confirmed
#define HEATER_BED_PIN PA3 //confirmed
#define FAN_PIN PA15 // heater 0 fan 1 //confirmed
#define FAN1_PIN PB10 // heater 1 fan 2 //confirmed
#define FAN2_PIN PF5 // heater 0 fan 2 and heater 1 fan 1 (two sockets, switched together) //confirmed
#ifndef E0_AUTO_FAN_PIN
#define E0_AUTO_FAN_PIN PF5
#endif
//
// Prusa i3 MK2 Multi Material Multiplexer Support
//
//#define E_MUX0_PIN -1
//#define E_MUX1_PIN -1
//
// LED / Lighting
//
//Lerdge-S board has two LED connectors (this is the one on the mainboard)
#define CASE_LIGHT_PIN PC7 //confirmed
//on the dual extrusion addon board is a RGB connector
#define RGB_LED_R_PIN PC7 // Shared with the mainboard LED light connector (CASE_LIGHT_PIN), confirmed
#define RGB_LED_G_PIN PB0 //confirmed
#define RGB_LED_B_PIN PB1 //confirmed
//
// Misc. Functions
//
#define SDSS PC11 // SD is working using SDIO, not sure if this definition is needed?
#define LED_PIN PC6 // Mainboard soldered green LED, confirmed
#define PS_ON_PIN PB2 // Board has a power module connector, confirmed
#define KILL_PIN -1 // There is no reset button on the LCD
#define POWER_LOSS_PIN -1 // PB2 could be used for this as well
//
// SD support
//
#define SDIO_SUPPORT
#define SCK_PIN PC12 //confirmed working
#define MISO_PIN PC8 //confirmed working
#define MOSI_PIN PD2 //confirmed working
#define SS_PIN PC11 //confirmed working
#define SD_DETECT_PIN PG15 //confirmed
//
// Persistent Storage
// If no option is selected below the SD Card will be used
// (this section modelled after pins_LONGER3D_LK.h)
// Warning: Not tested yet! Pins traced with multimeter, mistakes are possible
//#define SPI_EEPROM
#if ENABLED(SPI_EEPROM)
// Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PB12 // datasheet: /CS pin, found with multimeter, not tested
#define EEPROM_SCK PB13 // datasheet: CLK pin, found with multimeter, not tested
#define EEPROM_MISO PB14 // datasheet: DO pin, found with multimeter, not tested
#define EEPROM_MOSI PB15 // datasheet: DI pin, found with multimeter, not tested
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#else
#define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM
#endif
//
// LCD / Controller
//
// The LCD is initialized in FSMC mode
#define BEEPER_PIN PD13 //confirmed
#define BTN_EN1 PC14 //confirmed
#define BTN_EN2 PC15 //confirmed
#define BTN_ENC PC13 //confirmed
#define TFT_RESET_PIN PD6 //confirmed
#define TFT_BACKLIGHT_PIN PD3 //confirmed
#define TFT_CS_PIN PD7 // TFT works
#define TFT_RS_PIN PD11 // TFT works
// There is touch, but calibration is off
#define TOUCH_CS_PIN PB6
#define TOUCH_SCK_PIN PB3
#define TOUCH_MOSI_PIN PB5
#define TOUCH_MISO_PIN PB4

View File

@ -20,20 +20,22 @@
#if !defined(STM32F4) && !defined(STM32F4xx)
#error "Oops! Select an STM32F4 board in 'Tools > Board.'"
#elif HOTENDS > 2 || E_STEPPERS > 2
#error "LERDGE X supports up to 2 hotends / E-steppers."
#elif HOTENDS > 1 || E_STEPPERS > 1
#error "LERDGE X supports only one hotend / E-steppers"
#endif
#define BOARD_INFO_NAME "Lerdge X"
#define DEFAULT_MACHINE_NAME "LERDGE"
//#define I2C_EEPROM
#define STEP_TIMER 4
#define TEMP_TIMER 2
#define I2C_EEPROM
//
// Servos
//
//#define SERVO0_PIN PD12
//#define SERVO1_PIN -1
//#define SERVO0_PIN PD13
//
// Limit Switches
@ -51,7 +53,7 @@
// Z Probe (when not Z_MIN_PIN)
//
//#ifndef Z_MIN_PROBE_PIN
// #define Z_MIN_PROBE_PIN PB15
// #define Z_MIN_PROBE_PIN PB15
//#endif
//
@ -60,37 +62,18 @@
#define X_STEP_PIN PB10
#define X_DIR_PIN PB2
#define X_ENABLE_PIN PB11
//#ifndef X_CS_PIN
// #define X_CS_PIN PD1
//#endif
#define Y_STEP_PIN PB0
#define Y_DIR_PIN PC5
#define Y_ENABLE_PIN PB1
//#ifndef Y_CS_PIN
// #define Y_CS_PIN PE12
//#endif
#define Z_STEP_PIN PA7
#define Z_DIR_PIN PA6
#define Z_ENABLE_PIN PC4
//#ifndef Z_CS_PIN
// #define Z_CS_PIN PD5
//#endif
#define E0_STEP_PIN PA4
#define E0_DIR_PIN PA3
#define E0_ENABLE_PIN PA5
//#ifndef E0_CS_PIN
// #define E0_CS_PIN PB4
//#endif
#define E1_STEP_PIN -1
#define E1_DIR_PIN -1
#define E1_ENABLE_PIN -1
//#ifndef E1_CS_PIN
// #define E1_CS_PIN PE5
//#endif
//
// Temperature Sensors
@ -106,9 +89,9 @@
#define HEATER_1_PIN -1
#define HEATER_BED_PIN PA2
#ifndef FAN_PIN
//#define FAN_PIN PC15
#endif
//#ifndef FAN_PIN
// #define FAN_PIN PC15
//#endif
#define FAN1_PIN PC15
#define FAN2_PIN PA0
@ -116,12 +99,6 @@
#define E0_AUTO_FAN_PIN PC15 // FAN1_PIN
#endif
//
// Prusa i3 MK2 Multi Material Multiplexer Support
//
//#define E_MUX0_PIN -1
//#define E_MUX1_PIN -1
//
// LED / Lighting
//
@ -136,7 +113,9 @@
#define LED_PIN PC7 // Alive
#define PS_ON_PIN -1
#define KILL_PIN -1
#define POWER_LOSS_PIN -1 // Power-loss / nAC_FAULT
// Lerdge supports auto-power off and power loss sense through a single pin.
#define POWER_LOSS_PIN PC14 // Power-loss / nAC_FAULT
#define SCK_PIN PC12
#define MISO_PIN PC8
@ -147,36 +126,26 @@
// SD support
//
#define SDIO_SUPPORT
#define SD_DETECT_PIN PA8
//
// LCD / Controller
//
// The LCD is initialized in FSMC mode
#define SD_DETECT_PIN -1
#define BEEPER_PIN PD12
#define BTN_EN1 PE3
#define BTN_EN2 PE4
#define BTN_ENC PE2
#define LCD_RESET_PIN PD6
#define LCD_BACKLIGHT_PIN PD3
#define FSMC_CS_PIN PD4
#define FSMC_RS_PIN PD11
#define TOUCH_CS PB6
#define TFT_RESET_PIN PD6
#define TFT_BACKLIGHT_PIN PD3
//
// ST7920 Delays
//
#if HAS_GRAPHICAL_LCD
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(96)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(48)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(715)
#endif
#endif
#define TFT_CS_PIN PD7
#define TFT_RS_PIN PD11
#define TOUCH_CS_PIN PB6
#define TOUCH_SCK_PIN PB3
#define TOUCH_MOSI_PIN PB5
#define TOUCH_MISO_PIN PB4

View File

@ -428,7 +428,7 @@ void USB::Task() { //USB state machine
uint8_t rcode;
uint8_t tmpdata;
static uint32_t delay = 0;
//USB_FD_DEVICE_DESCRIPTOR buf;
//USB_DEVICE_DESCRIPTOR buf;
bool lowspeed = false;
MAX3421E::Task();
@ -647,8 +647,8 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
//printf("Configuring: parent = %i, port = %i\r\n", parent, port);
uint8_t devConfigIndex;
uint8_t rcode = 0;
uint8_t buf[sizeof (USB_FD_DEVICE_DESCRIPTOR)];
USB_FD_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR *>(buf);
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
UsbDevice *p = nullptr;
EpInfo *oldep_ptr = nullptr;
EpInfo epInfo;
@ -678,13 +678,13 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
p->lowspeed = lowspeed;
// Get device descriptor
rcode = getDevDescr(0, 0, sizeof (USB_FD_DEVICE_DESCRIPTOR), (uint8_t*)buf);
rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
// Restore p->epinfo
p->epinfo = oldep_ptr;
if (rcode) {
//printf("Configuring error: Can't get USB_FD_DEVICE_DESCRIPTOR\r\n");
//printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n");
return rcode;
}
@ -762,7 +762,7 @@ uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t con
uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
const uint8_t bufSize = 64;
uint8_t buf[bufSize];
USB_FD_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR *>(buf);
USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);
if (ret) return ret;

View File

@ -30,10 +30,10 @@
class UsbConfigXtracter {
public:
//virtual void ConfigXtract(const USB_FD_CONFIGURATION_DESCRIPTOR *conf) = 0;
//virtual void InterfaceXtract(uint8_t conf, const USB_FD_INTERFACE_DESCRIPTOR *iface) = 0;
//virtual void ConfigXtract(const USB_CONFIGURATION_DESCRIPTOR *conf) = 0;
//virtual void InterfaceXtract(uint8_t conf, const USB_INTERFACE_DESCRIPTOR *iface) = 0;
virtual void EndpointXtract(uint8_t conf __attribute__((unused)), uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_FD_ENDPOINT_DESCRIPTOR *ep __attribute__((unused))) {
virtual void EndpointXtract(uint8_t conf __attribute__((unused)), uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *ep __attribute__((unused))) {
}
};
@ -50,7 +50,7 @@ class ConfigDescParser : public USBReadParser {
MultiValueBuffer theBuffer;
MultiByteValueParser valParser;
ByteSkipper theSkipper;
uint8_t varBuffer[16 /*sizeof(USB_FD_CONFIGURATION_DESCRIPTOR)*/];
uint8_t varBuffer[16 /*sizeof(USB_CONFIGURATION_DESCRIPTOR)*/];
uint8_t stateParseDescr; // ParseDescriptor state
@ -97,8 +97,8 @@ void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::Parse(const uin
compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */
template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor(uint8_t **pp, uint16_t *pcntdn) {
USB_FD_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR*>(varBuffer);
USB_FD_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_FD_INTERFACE_DESCRIPTOR*>(varBuffer);
USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(varBuffer);
USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_INTERFACE_DESCRIPTOR*>(varBuffer);
switch (stateParseDescr) {
case 0:
theBuffer.valueSize = 2;
@ -155,7 +155,7 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
case USB_DESCRIPTOR_ENDPOINT:
if (!valParser.Parse(pp, pcntdn)) return false;
if (isGoodInterface && theXtractor)
theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_FD_ENDPOINT_DESCRIPTOR*)varBuffer);
theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer);
break;
//case HID_DESCRIPTOR_HID:
// if (!valParser.Parse(pp, pcntdn)) return false;

View File

@ -250,10 +250,10 @@ bLastUsbError(0) {
*/
uint8_t BulkOnly::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
const uint8_t constBufSize = sizeof (USB_FD_DEVICE_DESCRIPTOR);
const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
uint8_t buf[constBufSize];
USB_FD_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR*>(buf);
USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
uint8_t rcode;
UsbDevice *p = nullptr;
EpInfo *oldep_ptr = nullptr;
@ -529,7 +529,7 @@ uint8_t BulkOnly::Init(uint8_t parent __attribute__((unused)), uint8_t port __at
* @param proto
* @param pep
*/
void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_FD_ENDPOINT_DESCRIPTOR * pep) {
void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR * pep) {
ErrorMessage<uint8_t> (PSTR("Conf.Val"), conf);
ErrorMessage<uint8_t> (PSTR("Iface Num"), iface);
ErrorMessage<uint8_t> (PSTR("Alt.Set"), alt);
@ -1166,7 +1166,7 @@ uint8_t BulkOnly::HandleSCSIError(uint8_t status) {
*
* @param ep_ptr
*/
void BulkOnly::PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR * ep_ptr) {
void BulkOnly::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR * ep_ptr) {
Notify(PSTR("Endpoint descriptor:"), 0x80);
Notify(PSTR("\r\nLength:\t\t"), 0x80);
D_PrintHex<uint8_t> (ep_ptr->bLength, 0x80);

View File

@ -491,7 +491,7 @@ protected:
uint16_t CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]; // Sector size, clipped to 16 bits
bool LUNOk[MASS_MAX_SUPPORTED_LUN]; // use this to check for media changes.
bool WriteOk[MASS_MAX_SUPPORTED_LUN];
void PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR* ep_ptr);
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
// Additional Initialization Method for Subclasses
@ -526,7 +526,7 @@ public:
virtual uint8_t GetAddress() { return bAddress; }
// UsbConfigXtracter implementation
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_FD_ENDPOINT_DESCRIPTOR *ep);
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
virtual bool DEVCLASSOK(uint8_t klass) { return klass == USB_CLASS_MASS_STORAGE; }

View File

@ -37,7 +37,7 @@ int UsbDEBUGlvl = 0x80;
void E_Notifyc(char c, int lvl) {
if (UsbDEBUGlvl < lvl) return;
USB_HOST_SERIAL.print(c
#if !defined(ARDUINO) && !defined(ARDUINO_ARCH_LPC176X)
#if !defined(ARDUINO) || ARDUINO < 100
, BYTE
#endif
);

View File

@ -116,7 +116,7 @@ typedef struct {
uint8_t iProduct; // Index of String Descriptor describing the product.
uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
uint8_t bNumConfigurations; // Number of possible configurations.
} __attribute__((packed)) USB_FD_DEVICE_DESCRIPTOR;
} __attribute__((packed)) USB_DEVICE_DESCRIPTOR;
/* Configuration descriptor structure */
typedef struct {
@ -128,7 +128,7 @@ typedef struct {
uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
uint8_t bmAttributes; // Configuration characteristics.
uint8_t bMaxPower; // Maximum power consumed by this configuration.
} __attribute__((packed)) USB_FD_CONFIGURATION_DESCRIPTOR;
} __attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR;
/* Interface descriptor structure */
typedef struct {
@ -141,7 +141,7 @@ typedef struct {
uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific.
uint8_t iInterface; // Index of String Descriptor describing the interface.
} __attribute__((packed)) USB_FD_INTERFACE_DESCRIPTOR;
} __attribute__((packed)) USB_INTERFACE_DESCRIPTOR;
/* Endpoint descriptor structure */
typedef struct {
@ -151,7 +151,7 @@ typedef struct {
uint8_t bmAttributes; // Endpoint transfer type.
uint16_t wMaxPacketSize; // Maximum packet size.
uint8_t bInterval; // Polling interval in frames.
} __attribute__((packed)) USB_FD_ENDPOINT_DESCRIPTOR;
} __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR;
/* HID descriptor */
typedef struct {

View File

@ -174,7 +174,7 @@ protected:
volatile uint16_t CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]; // Sector size, clipped to 16 bits
volatile bool LUNOk[MASS_MAX_SUPPORTED_LUN]; // use this to check for media changes.
volatile bool WriteOk[MASS_MAX_SUPPORTED_LUN];
void PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR* ep_ptr);
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
public:
UHS_Bulk_Storage(UHS_USB_HOST_BASE *p);

View File

@ -1188,7 +1188,7 @@ uint8_t UHS_NI UHS_Bulk_Storage::HandleSCSIError(uint8_t status) {
*
* @param ep_ptr
*/
void UHS_NI UHS_Bulk_Storage::PrintEndpointDescriptor(const USB_FD_ENDPOINT_DESCRIPTOR * ep_ptr) {
void UHS_NI UHS_Bulk_Storage::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR * ep_ptr) {
Notify(PSTR("Endpoint descriptor:"), 0x80);
Notify(PSTR("\r\nLength:\t\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);

View File

@ -239,12 +239,12 @@ uint8_t UHS_USB_HOST_BASE::Configuring(uint8_t parent, uint8_t port, uint8_t spe
// wrap in {} to throw away the 64 byte buffer when we are done with it
{
uint8_t buf[biggest];
USB_FD_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR *>(buf);
USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
#else
const uint8_t biggest = 18;
uint8_t buf[biggest];
USB_FD_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_FD_DEVICE_DESCRIPTOR *>(buf);
USB_FD_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR *>(buf);
USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
#endif
//for(devConfigIndex = 0; devConfigIndex < UHS_HOST_MAX_INTERFACE_DRIVERS; devConfigIndex++) {
@ -309,7 +309,7 @@ again:
sof_delay(200);
goto again;
}
HOST_DEBUG("Configuring error: 0x%2.2x Can't get USB_FD_DEVICE_DESCRIPTOR\r\n", rcode);
HOST_DEBUG("Configuring error: 0x%2.2x Can't get USB_DEVICE_DESCRIPTOR\r\n", rcode);
return rcode;
}
@ -378,7 +378,7 @@ again:
} // unwrapped, old large buf now invalid and discarded.
uint8_t buf[18];
USB_FD_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_FD_CONFIGURATION_DESCRIPTOR *>(buf);
USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
#endif
ei.address = addrPool.AllocAddress(parent, IsHub(ei.klass), port);
@ -415,9 +415,9 @@ again:
HOST_DEBUG("configs: %i\r\n", configs);
for(uint8_t conf = 0; (!rcode) && (conf < configs); conf++) {
// read the config descriptor into a buffer.
rcode = getConfDescr(ei.address, sizeof (USB_FD_CONFIGURATION_DESCRIPTOR), conf, buf);
rcode = getConfDescr(ei.address, sizeof (USB_CONFIGURATION_DESCRIPTOR), conf, buf);
if(rcode) {
HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR\r\n", rcode);
HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR\r\n", rcode);
rcode = UHS_HOST_ERROR_FailGetConfDescr;
continue;
}
@ -438,7 +438,7 @@ again:
uint8_t offset;
rcode = initDescrStream(&ei, ucd, pep, data, &left, &read, &offset);
if(rcode) {
HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
break;
}
for(; (numinf) && (!rcode); inf++) {
@ -451,7 +451,7 @@ again:
break;
}
if(rcode) {
HOST_DEBUG("Configuring error: %2.2x Can't close USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
HOST_DEBUG("Configuring error: %2.2x Can't close USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
continue;
}
rcode = TestInterface(&ei);
@ -471,9 +471,9 @@ again:
if(!bestsuccess) rcode = UHS_HOST_ERROR_DEVICE_NOT_SUPPORTED;
}
if(!rcode) {
rcode = getConfDescr(ei.address, sizeof (USB_FD_CONFIGURATION_DESCRIPTOR), bestconf, buf);
rcode = getConfDescr(ei.address, sizeof (USB_CONFIGURATION_DESCRIPTOR), bestconf, buf);
if(rcode) {
HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR\r\n", rcode);
HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR\r\n", rcode);
rcode = UHS_HOST_ERROR_FailGetConfDescr;
}
}
@ -497,7 +497,7 @@ again:
uint8_t offset;
rcode = initDescrStream(&ei, ucd, pep, data, &left, &read, &offset);
if(rcode) {
HOST_DEBUG("Configuring error: %2.2x Can't get USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
HOST_DEBUG("Configuring error: %2.2x Can't get USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
} else {
for(; (numinf) && (!rcode); inf++) {
// iterate for each interface on this config
@ -508,7 +508,7 @@ again:
break;
}
if(rcode) {
HOST_DEBUG("Configuring error: %2.2x Can't close USB_FD_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
HOST_DEBUG("Configuring error: %2.2x Can't close USB_INTERFACE_DESCRIPTOR stream.\r\n", rcode);
continue;
}
@ -721,7 +721,7 @@ uint8_t UHS_USB_HOST_BASE::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytes
* @param offset
* @return zero for success or error code
*/
uint8_t UHS_USB_HOST_BASE::initDescrStream(ENUMERATION_INFO *ei, USB_FD_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset) {
uint8_t UHS_USB_HOST_BASE::initDescrStream(ENUMERATION_INFO *ei, USB_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset) {
if(!ei || !ucd) return UHS_HOST_ERROR_BAD_ARGUMENT;
if(!pep) return UHS_HOST_ERROR_NULL_EPINFO;
*left = ucd->wTotalLength;
@ -837,7 +837,7 @@ uint8_t UHS_USB_HOST_BASE::getNextInterface(ENUMERATION_INFO *ei, UHS_EpInfo *pe
return rcode;
}
uint8_t UHS_USB_HOST_BASE::seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_FD_CONFIGURATION_DESCRIPTOR *ucd) {
uint8_t UHS_USB_HOST_BASE::seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_CONFIGURATION_DESCRIPTOR *ucd) {
if(!ei || !ucd) return UHS_HOST_ERROR_BAD_ARGUMENT;
uint8_t data[ei->bMaxPacketSize0];
UHS_EpInfo *pep;

View File

@ -164,7 +164,7 @@ typedef struct {
uint8_t iProduct; // Index of String Descriptor describing the product.
uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
uint8_t bNumConfigurations; // Number of possible configurations.
} __attribute__((packed)) USB_FD_DEVICE_DESCRIPTOR;
} __attribute__((packed)) USB_DEVICE_DESCRIPTOR;
/* Configuration descriptor structure */
typedef struct {
@ -176,7 +176,7 @@ typedef struct {
uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
uint8_t bmAttributes; // Configuration characteristics.
uint8_t bMaxPower; // Maximum power consumed by this configuration.
} __attribute__((packed)) USB_FD_CONFIGURATION_DESCRIPTOR;
} __attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR;
/* Interface descriptor structure */
typedef struct {
@ -189,7 +189,7 @@ typedef struct {
uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific.
uint8_t iInterface; // Index of String Descriptor describing the interface.
} __attribute__((packed)) USB_FD_INTERFACE_DESCRIPTOR;
} __attribute__((packed)) USB_INTERFACE_DESCRIPTOR;
/* Endpoint descriptor structure */
typedef struct {
@ -199,7 +199,7 @@ typedef struct {
uint8_t bmAttributes; // Endpoint transfer type.
uint16_t wMaxPacketSize; // Maximum packet size.
uint8_t bInterval; // Polling interval in frames.
} __attribute__((packed)) USB_FD_ENDPOINT_DESCRIPTOR;
} __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR;
/* HID descriptor */
/*

View File

@ -207,7 +207,7 @@ public:
interrupts();
}
uint8_t UHS_NI seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_FD_CONFIGURATION_DESCRIPTOR *ucd);
uint8_t UHS_NI seekInterface(ENUMERATION_INFO *ei, uint16_t inf, USB_CONFIGURATION_DESCRIPTOR *ucd);
uint8_t UHS_NI setEpInfoEntry(uint8_t addr, uint8_t iface, uint8_t epcount, volatile UHS_EpInfo* eprecord_ptr);
@ -261,7 +261,7 @@ public:
uint8_t TestInterface(ENUMERATION_INFO *ei);
uint8_t enumerateInterface(ENUMERATION_INFO *ei);
uint8_t getNextInterface(ENUMERATION_INFO *ei, UHS_EpInfo *pep, uint8_t data[], uint16_t *left, uint16_t *read, uint8_t *offset);
uint8_t initDescrStream(ENUMERATION_INFO *ei, USB_FD_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset);
uint8_t initDescrStream(ENUMERATION_INFO *ei, USB_CONFIGURATION_DESCRIPTOR *ucd, UHS_EpInfo *pep, uint8_t *data, uint16_t *left, uint16_t *read, uint8_t *offset);
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data);
uint8_t doSoftReset(uint8_t parent, uint8_t port, uint8_t address);