59 lines
2.1 KiB
C
Raw Normal View History

2018-07-02 09:06:17 -06:00
/**************
* usb_host.h *
**************/
/****************************************************************************
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
* *
* 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. *
* *
* To view a copy of the GNU General Public License, go to the following *
2020-11-06 19:09:29 -06:00
* location: <https://www.gnu.org/licenses/>. *
2018-07-02 09:06:17 -06:00
****************************************************************************/
#pragma once
2018-07-02 09:06:17 -06:00
/* This the following comes from "lib/usbhost.h", but has been rewritten
* to use the SPI functions from Marlin's HAL */
class MAX3421e {
private:
static uint8_t vbusState;
void cs();
void ncs();
uint8_t GpxHandler();
uint8_t IntHandler();
public:
bool start();
void regWr(uint8_t reg, uint8_t data);
2021-03-29 20:36:37 -05:00
uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p);
2018-07-02 09:06:17 -06:00
void gpioWr(uint8_t data);
uint8_t regRd(uint8_t reg);
2021-03-29 20:36:37 -05:00
uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p);
2018-07-02 09:06:17 -06:00
uint8_t gpioRd();
bool reset();
2019-09-16 20:31:08 -05:00
uint8_t getVbusState() {return vbusState;};
2018-07-02 09:06:17 -06:00
void busprobe();
uint8_t Task();
};
#define USE_MARLIN_MAX3421E
#if defined(__SAM3X8E__) && !defined(ARDUINO_SAM_DUE)
#define ARDUINO_SAM_DUE // Spoof the USB library that this is a DUE
#endif