Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: adafruit/Adafruit_SPIFlash
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.3.3
Choose a base ref
...
head repository: adafruit/Adafruit_SPIFlash
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Dec 22, 2023

  1. Fix typo in flash device definition

    This was a typo from a previous PR. This fixes the invalid struct.
    bobobo1618 authored Dec 22, 2023
    Copy the full SHA
    8d24030 View commit details
  2. Update flash_devices.h

    bobobo1618 authored Dec 22, 2023
    Copy the full SHA
    823ed1b View commit details
  3. Update flash_devices.h

    bobobo1618 authored Dec 22, 2023
    Copy the full SHA
    1e5f015 View commit details
  4. Update flash_devices.h

    bobobo1618 authored Dec 22, 2023
    Copy the full SHA
    49a4774 View commit details
  5. Update flash_devices.h

    bobobo1618 authored Dec 22, 2023
    Copy the full SHA
    43c9460 View commit details

Commits on Dec 25, 2023

  1. Merge pull request #168 from bobobo1618/patch-1

    Fix typo in flash device definition
    hathach authored Dec 25, 2023
    Copy the full SHA
    04d7ae7 View commit details

Commits on Dec 27, 2023

  1. Copy the full SHA
    71c7cff View commit details
  2. Merge pull request #169 from adafruit/tyeth-patch-2

    Update library.properties - bump version to 4.3.4
    tyeth authored Dec 27, 2023
    Copy the full SHA
    160b5ff View commit details

Commits on Aug 11, 2024

  1. Make Adafruit_FlashCache generic

    Changed Adafruit_FlashCache to operate on base class
    Adafruit_SPIFlashBase instead of derived Adafruit_SPIFlash so that it
    can be used with other derived classes inheriting from
    Adafruit_SPIFlashBase.
    Changed private member variables in Adafruit_SPIFlash to protected to
    allow for external derived classes inheriting from Adafruit_SPIFlash as well.
    attermann committed Aug 11, 2024
    Copy the full SHA
    e1ad01f View commit details

Commits on Aug 28, 2024

  1. fix clang format

    hathach committed Aug 28, 2024
    Copy the full SHA
    0404b97 View commit details
  2. Merge pull request #174 from attermann/inheritance

    Make Adafruit_FlashCache generic
    hathach authored Aug 28, 2024
    Copy the full SHA
    d8353ba View commit details

Commits on Sep 18, 2024

  1. Copy the full SHA
    ab83e2c View commit details
  2. Copy the full SHA
    1a61f08 View commit details
  3. Merge pull request #177 from adafruit/tyeth-patch-2

    Update library.properties - bump version to 5.0.0
    tyeth authored Sep 18, 2024
    Copy the full SHA
    076492f View commit details

Commits on Nov 7, 2024

  1. actions version

    FoamyGuy committed Nov 7, 2024
    Copy the full SHA
    b980d26 View commit details
  2. attempt distinct names

    FoamyGuy committed Nov 7, 2024
    Copy the full SHA
    1519212 View commit details
  3. Merge pull request #180 from FoamyGuy/update_actions_version

    actions version
    ladyada authored Nov 7, 2024
    Copy the full SHA
    641327b View commit details

Commits on Nov 11, 2024

  1. correct get jedec for pico, also print out raw device size using jede…

    …c 3rd byte in flash_info.ino
    hathach committed Nov 11, 2024
    Copy the full SHA
    6271024 View commit details
  2. Merge pull request #181 from adafruit/fix-pico-jedec

    correctly get jedec for pico
    hathach authored Nov 11, 2024
    Copy the full SHA
    0739c83 View commit details

Commits on Nov 12, 2024

  1. Copy the full SHA
    d6b4995 View commit details
  2. Merge pull request #182 from adafruit/tyeth-patch-2

    Update library.properties - bump version to 5.0.1
    tyeth authored Nov 12, 2024
    Copy the full SHA
    2daa9e8 View commit details
4 changes: 2 additions & 2 deletions .github/workflows/githubci.yml
Original file line number Diff line number Diff line change
@@ -88,9 +88,9 @@ jobs:
for i in examples/*/build/*/*.uf2; do if [ -f $i ]; then j=${i##*/}; j=${j%%*.}; mv $i build/$j-${{ matrix.arduino-platform }}.uf2; fi done
- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}.${{ github.sha }}
name: ${{ github.event.repository.name }}.${{ github.sha }}.${{ matrix.arduino-platform }}
path: |
build/*.hex
build/*.bin
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Adafruit SPI Flash

[![Build Status](https://travis-ci.com/adafruit/Adafruit_SPIFlash.svg?branch=master)](https://travis-ci.com/adafruit/Adafruit_SPIFlash) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
[![Build Status](https://github.com/adafruit/Adafruit_SPIFlash/workflows/Build/badge.svg)](https://github.com/adafruit/Adafruit_SPIFlash/actions) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)

Arduino library for external (Q)SPI flash device.

16 changes: 13 additions & 3 deletions examples/flash_info/flash_info.ino
Original file line number Diff line number Diff line change
@@ -73,14 +73,24 @@ void setup() {
// Using a flash device not already listed? Start the flash memory by passing
// it the array of device settings defined above, and the number of elements
// in the array.

// flash.begin(my_flash_devices, flashDevices);

uint32_t jedec_id = flash.getJEDECID();
Serial.print("JEDEC ID: 0x");
Serial.println(flash.getJEDECID(), HEX);
Serial.print("Flash size: ");
Serial.println(jedec_id, HEX);
Serial.print("Flash size (usable): ");
Serial.print(flash.size() / 1024);
Serial.println(" KB");

#ifdef ARDUINO_ARCH_RP2040
// For rp2 since flash device is also used for storing code, the flash.size()
// only return usable flash size for data which is dictated by e.g Menu->Flash
// Size -> 2MB (Sketch 1920KB, FS 64KB) --> size = 64KB For reference purpose,
// we only try to find and print actual flash device size using JEDEC here
Serial.print("Flash size (raw): ");
Serial.print(1 << ((jedec_id & 0xff) - 10));
Serial.println(" KB");
#endif
}

void loop() {
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit SPIFlash
version=4.3.3
version=5.0.1
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=SPI Flash filesystem support for FAT and CircuitPython FS support from within Arduino
9 changes: 5 additions & 4 deletions src/Adafruit_FlashCache.cpp
Original file line number Diff line number Diff line change
@@ -22,7 +22,8 @@
* THE SOFTWARE.
*/

#include "Adafruit_SPIFlash.h"
#include "Adafruit_FlashCache.h"
#include "Adafruit_SPIFlashBase.h"

#if SPIFLASH_DEBUG
#define SPICACHE_LOG(_new_addr) \
@@ -49,7 +50,7 @@ static inline uint32_t offset_of(uint32_t addr) {

Adafruit_FlashCache::Adafruit_FlashCache(void) { _addr = INVALID_ADDR; }

bool Adafruit_FlashCache::sync(Adafruit_SPIFlash *fl) {
bool Adafruit_FlashCache::sync(Adafruit_SPIFlashBase *fl) {
if (_addr == INVALID_ADDR) {
return true;
}
@@ -62,7 +63,7 @@ bool Adafruit_FlashCache::sync(Adafruit_SPIFlash *fl) {
return true;
}

bool Adafruit_FlashCache::write(Adafruit_SPIFlash *fl, uint32_t address,
bool Adafruit_FlashCache::write(Adafruit_SPIFlashBase *fl, uint32_t address,
void const *src, uint32_t len) {
uint8_t const *src8 = (uint8_t const *)src;
uint32_t remain = len;
@@ -96,7 +97,7 @@ bool Adafruit_FlashCache::write(Adafruit_SPIFlash *fl, uint32_t address,
return true;
}

bool Adafruit_FlashCache::read(Adafruit_SPIFlash *fl, uint32_t address,
bool Adafruit_FlashCache::read(Adafruit_SPIFlashBase *fl, uint32_t address,
uint8_t *buffer, uint32_t count) {
// overwrite with cache value if available
if ((_addr != INVALID_ADDR) &&
9 changes: 5 additions & 4 deletions src/Adafruit_FlashCache.h
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
#include <stdint.h>

// forward declaration
class Adafruit_SPIFlash;
class Adafruit_SPIFlashBase;

class Adafruit_FlashCache {
private:
@@ -39,10 +39,11 @@ class Adafruit_FlashCache {
public:
Adafruit_FlashCache(void);

bool sync(Adafruit_SPIFlash *fl);
bool write(Adafruit_SPIFlash *fl, uint32_t dst, void const *src,
bool sync(Adafruit_SPIFlashBase *fl);
bool write(Adafruit_SPIFlashBase *fl, uint32_t dst, void const *src,
uint32_t len);
bool read(Adafruit_SPIFlash *fl, uint32_t addr, uint8_t *dst, uint32_t count);
bool read(Adafruit_SPIFlashBase *fl, uint32_t addr, uint8_t *dst,
uint32_t count);
};

#endif /* ADAFRUIT_FLASHCACHE_H_ */
2 changes: 1 addition & 1 deletion src/Adafruit_SPIFlash.h
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ class Adafruit_SPIFlash : public FsBlockDeviceInterface,
return writeSectors(block, src, nb);
}

private:
protected:
bool _cache_en;
Adafruit_FlashCache *_cache;
};
11 changes: 5 additions & 6 deletions src/flash_devices.h
Original file line number Diff line number Diff line change
@@ -532,12 +532,11 @@ typedef struct {
{ \
.total_size = (1 << 21), /* 2 MiB */ \
.start_up_time_us = 5000, .manufacturer_id = 0x85, \
.memory_type = 0x60, .capacity = 0x15, \
.max_clock_speed_mhz = 104.quad_enable_bit_mask = 0x02, \
.has_sector_protection = false, .supports_fast_read = true, \
.supports_qspi = true, .supports_qspi_writes = true, \
.write_status_register_split = false, .single_status_byte = false, \
.is_fram = false, \
.memory_type = 0x60, .capacity = 0x15, .max_clock_speed_mhz = 104, \
.quad_enable_bit_mask = 0x02, .has_sector_protection = false, \
.supports_fast_read = true, .supports_qspi = true, \
.supports_qspi_writes = true, .write_status_register_split = false, \
.single_status_byte = false, .is_fram = false, \
}

#endif // MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_DEVICES_H
9 changes: 1 addition & 8 deletions src/rp2040/Adafruit_FlashTransport_RP2040.cpp
Original file line number Diff line number Diff line change
@@ -86,7 +86,6 @@ Adafruit_FlashTransport_RP2040::Adafruit_FlashTransport_RP2040(
void Adafruit_FlashTransport_RP2040::begin(void) {
_flash_dev.total_size = _size;

#if 0
// Read the RDID register only for JEDEC ID
uint8_t const cmd[] = {
0x9f,
@@ -96,20 +95,14 @@ void Adafruit_FlashTransport_RP2040::begin(void) {
};
uint8_t data[4];
fl_lock(_idle_other_core_on_write);
flash_do_cmd(cmd, data, 5);
flash_do_cmd(cmd, data, 4);
fl_unlock(_idle_other_core_on_write);

uint8_t *jedec_ids = data + 1;

_flash_dev.manufacturer_id = jedec_ids[0];
_flash_dev.memory_type = jedec_ids[1];
_flash_dev.capacity = jedec_ids[2];
#else
// skip JEDEC ID
_flash_dev.manufacturer_id = 0xad;
_flash_dev.memory_type = 0xaf;
_flash_dev.capacity = 0x00;
#endif
}

void Adafruit_FlashTransport_RP2040::end(void) {