|
| 1 | +/* |
| 2 | + * The MIT License (MIT) |
| 3 | + * |
| 4 | + * Copyright (c) 2025 Ha Thach (tinyusb.org) |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be included in |
| 14 | + * all copies or substantial portions of the Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | + * THE SOFTWARE. |
| 23 | + * |
| 24 | + * This file is part of the TinyUSB stack. |
| 25 | + */ |
| 26 | +#ifndef TUSB_HCD_MAX3421_H |
| 27 | +#define TUSB_HCD_MAX3421_H |
| 28 | + |
| 29 | +#ifdef __cplusplus |
| 30 | + extern "C" { |
| 31 | +#endif |
| 32 | + |
| 33 | +//--------------------------------------------------------------------+ |
| 34 | +// SPI transfer API with MAX3421E are implemented by application |
| 35 | +// - spi_cs_api(), spi_xfer_api(), int_api() |
| 36 | +//--------------------------------------------------------------------+ |
| 37 | + |
| 38 | +// API to control MAX3421 SPI CS |
| 39 | +extern void tuh_max3421_spi_cs_api(uint8_t rhport, bool active); |
| 40 | + |
| 41 | +// API to transfer data with MAX3421 SPI |
| 42 | +// Either tx_buf or rx_buf can be NULL, which means transfer is write or read only |
| 43 | +extern bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const* tx_buf, uint8_t* rx_buf, size_t xfer_bytes); |
| 44 | + |
| 45 | +// API to enable/disable MAX3421 INTR pin interrupt |
| 46 | +extern void tuh_max3421_int_api(uint8_t rhport, bool enabled); |
| 47 | + |
| 48 | +//--------------------------------------------------------------------+ |
| 49 | +// API for read/write MAX3421 registers |
| 50 | +// are implemented by this driver, can be used by application |
| 51 | +//--------------------------------------------------------------------+ |
| 52 | + |
| 53 | +// API to read MAX3421's register. Implemented by TinyUSB |
| 54 | +uint8_t tuh_max3421_reg_read(uint8_t rhport, uint8_t reg, bool in_isr); |
| 55 | + |
| 56 | +// API to write MAX3421's register. Implemented by TinyUSB |
| 57 | +bool tuh_max3421_reg_write(uint8_t rhport, uint8_t reg, uint8_t data, bool in_isr); |
| 58 | + |
| 59 | +#ifdef __cplusplus |
| 60 | + } |
| 61 | +#endif |
| 62 | + |
| 63 | +#endif |
0 commit comments