MCPcopy Create free account
hub / github.com/kiibohd/controller / storage_read

Function storage_read

Lib/storage.c:467–481  ·  view source on GitHub ↗

Read storage block data - Buffer to read into address - Starting address from storage size - Number of bytes to read starting from address storage_init() must be called first Returns: 0 - If range is invalid and will not fit inside a block 1 - Read was successful

Source from the content-addressed store, hash-verified

465// 0 - If range is invalid and will not fit inside a block
466// 1 - Read was successful
467uint8_t storage_read( uint8_t* data, uint16_t address, uint16_t size )
468{
469 // Make sure the data section fully exists
470 if ( size + address > STORAGE_SIZE )
471 {
472 return 0;
473 }
474
475 // Read out from buffer
476 for ( int i = 0; i < size; i++ )
477 {
478 data[i] = storage_buffer[address + i];
479 }
480 return 1;
481}
482
483// Read storage page position
484// Must run storage_init() first!

Callers 1

storage_load_settingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…