forked from adafruit/circuitpython
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspi_flash_api.h
26 lines (20 loc) · 1.01 KB
/
spi_flash_api.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2018 Scott Shawcroft for Adafruit Industries LLC
//
// SPDX-License-Identifier: MIT
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "shared/external_flash/device.h"
#include "shared-bindings/busio/SPI.h"
extern busio_spi_obj_t supervisor_flash_spi_bus; // Used to share SPI bus on some boards
// This API is implemented for both normal SPI peripherals and QSPI peripherals.
bool spi_flash_command(uint8_t command);
bool spi_flash_read_command(uint8_t command, uint8_t *response, uint32_t length);
bool spi_flash_write_command(uint8_t command, uint8_t *data, uint32_t length);
bool spi_flash_sector_command(uint8_t command, uint32_t address);
bool spi_flash_write_data(uint32_t address, uint8_t *data, uint32_t data_length);
bool spi_flash_read_data(uint32_t address, uint8_t *data, uint32_t data_length);
void spi_flash_init(void);
void spi_flash_init_device(const external_flash_device *device);