Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
heatshrink_helper.h File Reference

Go to the source code of this file.

Functions

uint8_t * readHeatshrinkFileInplace (cnfsFileIdx_t fIdx, uint32_t *outsize, uint8_t *decompressedBuf, heatshrink_decoder *hsd)
 Read a heatshrink compressed file from the filesystem into an output array. Files that are in the assets_image folder before compilation and flashing will automatically be included in the firmware.
 
uint8_t * readHeatshrinkFile (cnfsFileIdx_t fIdx, uint32_t *outsize, bool readToSpiRam)
 Read a heatshrink compressed file from the filesystem into an output array. Files that are in the assets_image folder before compilation and flashing will automatically be included in the firmware.
 
uint8_t * readHeatshrinkNvs (const char *namespace, const char *key, uint32_t *outsize, bool spiRam)
 
uint32_t heatshrinkCompress (uint8_t *dest, const uint8_t *src, uint32_t size)
 
bool writeHeatshrinkNvs (const char *namespace, const char *key, const uint8_t *data, uint32_t size)
 
bool heatshrinkDecompress (uint8_t *dest, uint32_t *destSize, const uint8_t *source, uint32_t sourceSize)
 Get the size of and decompress heatshrink data.
 

Function Documentation

◆ readHeatshrinkFileInplace()

uint8_t * readHeatshrinkFileInplace ( cnfsFileIdx_t fIdx,
uint32_t * outsize,
uint8_t * decompressedBuf,
heatshrink_decoder * hsd )

Read a heatshrink compressed file from the filesystem into an output array. Files that are in the assets_image folder before compilation and flashing will automatically be included in the firmware.

You must provide a decoder and decode space for this function

Parameters
fIdxThe CNFS index of the file to load
outsizeA pointer to a size_t to return how much data was read
decompressedBufMemory to store decoded data. This must be as large as the decoded data
hsdA heatshrink decoder
Returns
A pointer to the read data if successful, or NULL if there is a failure This data must be freed when done

◆ readHeatshrinkFile()

uint8_t * readHeatshrinkFile ( cnfsFileIdx_t fIdx,
uint32_t * outsize,
bool readToSpiRam )

Read a heatshrink compressed file from the filesystem into an output array. Files that are in the assets_image folder before compilation and flashing will automatically be included in the firmware.

Parameters
fIdxThe CNFS index of the file to load
outsizeA pointer to a size_t to return how much data was read
readToSpiRamtrue to use SPI RAM, false to use normal RAM
Returns
A pointer to the read data if successful, or NULL if there is a failure This data must be freed when done

◆ readHeatshrinkNvs()

uint8_t * readHeatshrinkNvs ( const char * namespace,
const char * key,
uint32_t * outsize,
bool spiRam )

◆ heatshrinkCompress()

uint32_t heatshrinkCompress ( uint8_t * dest,
const uint8_t * src,
uint32_t size )

◆ writeHeatshrinkNvs()

bool writeHeatshrinkNvs ( const char * namespace,
const char * key,
const uint8_t * data,
uint32_t size )

◆ heatshrinkDecompress()

bool heatshrinkDecompress ( uint8_t * dest,
uint32_t * destSize,
const uint8_t * source,
uint32_t sourceSize )

Get the size of and decompress heatshrink data.

Parameters
dest
destSize
source
sourceSize
Returns
true
false