2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
20 * Author: Dominic Clifton
27 typedef enum OCTOSPIDevice
{
32 #define OCTOSPIDEV_COUNT 1
34 // Macros to convert between configuration ids and device ids.
35 #define OCTOSPI_CFG_TO_DEV(x) ((x) - 1)
36 #define OCTOSPI_DEV_TO_CFG(x) ((x) + 1)
39 #error OctoSPI unsupported on this MCU
42 OCTOSPIDevice
octoSpiDeviceByInstance(OCTOSPI_TypeDef
*instance
);
43 OCTOSPI_TypeDef
*octoSpiInstanceByDevice(OCTOSPIDevice device
);
45 bool octoSpiInit(OCTOSPIDevice device
);
46 bool octoSpiReceive1LINE(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, uint8_t *in
, int length
);
47 bool octoSpiReceive4LINES(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, uint8_t *in
, int length
);
48 bool octoSpiTransmit1LINE(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, const uint8_t *out
, int length
);
50 bool octoSpiReceiveWithAddress1LINE(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, uint32_t address
, uint8_t addressSize
, uint8_t *in
, int length
);
51 bool octoSpiReceiveWithAddress4LINES(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, uint32_t address
, uint8_t addressSize
, uint8_t *in
, int length
);
52 bool octoSpiTransmitWithAddress1LINE(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, uint32_t address
, uint8_t addressSize
, const uint8_t *out
, int length
);
53 bool octoSpiTransmitWithAddress4LINES(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, uint32_t address
, uint8_t addressSize
, const uint8_t *out
, int length
);
55 bool octoSpiInstructionWithAddress1LINE(OCTOSPI_TypeDef
*instance
, uint8_t instruction
, uint8_t dummyCycles
, uint32_t address
, uint8_t addressSize
);
57 void octoSpiDisableMemoryMappedMode(OCTOSPI_TypeDef
*instance
);
58 void octoSpiEnableMemoryMappedMode(OCTOSPI_TypeDef
*instance
);