Skip to content

Commit

Permalink
Move apps from flipperzero firmware into separate repository
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Jul 19, 2023
0 parents commit ac8196f
Show file tree
Hide file tree
Showing 58 changed files with 5,145 additions and 0 deletions.
17 changes: 17 additions & 0 deletions application.fam
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
App(
appid="spi_mem_manager",
name="SPI Mem Manager",
apptype=FlipperAppType.EXTERNAL,
entry_point="spi_mem_app",
requires=["gui"],
stack_size=1 * 2048,
order=30,
fap_icon="images/Dip8_10px.png",
fap_category="GPIO",
fap_icon_assets="images",
fap_private_libs=[
Lib(
name="spi",
),
],
)
Binary file added images/ChipLooking_64x64/frame_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ChipLooking_64x64/frame_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ChipLooking_64x64/frame_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/ChipLooking_64x64/frame_rate
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
Binary file added images/Dip8_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Dip8_32x36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/DolphinMafia_115x62.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/DolphinNice_96x59.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/SDQuestion_35x43.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Wiring_SPI_128x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions lib/spi/spi_mem_chip.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include "spi_mem_chip_i.h"

const SPIMemChipVendorName spi_mem_chip_vendor_names[] = {
{"Adesto", SPIMemChipVendorADESTO},
{"AMIC", SPIMemChipVendorAMIC},
{"Boya", SPIMemChipVendorBoya},
{"EON", SPIMemChipVendorEON},
{"PFlash", SPIMemChipVendorPFLASH},
{"Terra", SPIMemChipVendorTERRA},
{"Generalplus", SPIMemChipVendorGeneralplus},
{"Deutron", SPIMemChipVendorDEUTRON},
{"EFST", SPIMemChipVendorEFST},
{"Excel Semi.", SPIMemChipVendorEXCELSEMI},
{"Fidelix", SPIMemChipVendorFIDELIX},
{"GigaDevice", SPIMemChipVendorGIGADEVICE},
{"ICE", SPIMemChipVendorICE},
{"Intel", SPIMemChipVendorINTEL},
{"KHIC", SPIMemChipVendorKHIC},
{"Macronix", SPIMemChipVendorMACRONIX},
{"Micron", SPIMemChipVendorMICRON},
{"Mshine", SPIMemChipVendorMSHINE},
{"Nantronics", SPIMemChipVendorNANTRONICS},
{"Nexflash", SPIMemChipVendorNEXFLASH},
{"Numonyx", SPIMemChipVendorNUMONYX},
{"PCT", SPIMemChipVendorPCT},
{"Spansion", SPIMemChipVendorSPANSION},
{"SST", SPIMemChipVendorSST},
{"ST", SPIMemChipVendorST},
{"Winbond", SPIMemChipVendorWINBOND},
{"Zempro", SPIMemChipVendorZEMPRO},
{"Zbit", SPIMemChipVendorZbit},
{"Berg Micro.", SPIMemChipVendorBerg_Micro},
{"Atmel", SPIMemChipVendorATMEL},
{"ACE", SPIMemChipVendorACE},
{"ATO", SPIMemChipVendorATO},
{"Douqi", SPIMemChipVendorDOUQI},
{"Fremont", SPIMemChipVendorFremont},
{"Fudan", SPIMemChipVendorFudan},
{"Genitop", SPIMemChipVendorGenitop},
{"Paragon", SPIMemChipVendorParagon},
{"Unknown", SPIMemChipVendorUnknown}};

static const char* spi_mem_chip_search_vendor_name(SPIMemChipVendor vendor_enum) {
const SPIMemChipVendorName* vendor = spi_mem_chip_vendor_names;
while(vendor->vendor_enum != SPIMemChipVendorUnknown && vendor->vendor_enum != vendor_enum)
vendor++;
return vendor->vendor_name;
}

bool spi_mem_chip_find_all(SPIMemChip* chip_info, found_chips_t found_chips) {
const SPIMemChip* chip_info_arr;
found_chips_reset(found_chips);
for(chip_info_arr = SPIMemChips; chip_info_arr->model_name != NULL; chip_info_arr++) {
if(chip_info->vendor_id != chip_info_arr->vendor_id) continue;
if(chip_info->type_id != chip_info_arr->type_id) continue;
if(chip_info->capacity_id != chip_info_arr->capacity_id) continue;
found_chips_push_back(found_chips, chip_info_arr);
}
if(found_chips_size(found_chips)) return true;
return false;
}

void spi_mem_chip_copy_chip_info(SPIMemChip* dest, const SPIMemChip* src) {
memcpy(dest, src, sizeof(SPIMemChip));
}

size_t spi_mem_chip_get_size(SPIMemChip* chip) {
return (chip->size);
}

const char* spi_mem_chip_get_vendor_name(const SPIMemChip* chip) {
return (spi_mem_chip_search_vendor_name(chip->vendor_enum));
}

const char* spi_mem_chip_get_vendor_name_by_enum(uint32_t vendor_enum) {
return (spi_mem_chip_search_vendor_name(vendor_enum));
}

const char* spi_mem_chip_get_model_name(const SPIMemChip* chip) {
return (chip->model_name);
}

uint8_t spi_mem_chip_get_vendor_id(SPIMemChip* chip) {
return (chip->vendor_id);
}

uint8_t spi_mem_chip_get_type_id(SPIMemChip* chip) {
return (chip->type_id);
}

uint8_t spi_mem_chip_get_capacity_id(SPIMemChip* chip) {
return (chip->capacity_id);
}

SPIMemChipWriteMode spi_mem_chip_get_write_mode(SPIMemChip* chip) {
return (chip->write_mode);
}

size_t spi_mem_chip_get_page_size(SPIMemChip* chip) {
return (chip->page_size);
}

uint32_t spi_mem_chip_get_vendor_enum(const SPIMemChip* chip) {
return ((uint32_t)chip->vendor_enum);
}
34 changes: 34 additions & 0 deletions lib/spi/spi_mem_chip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include <furi.h>
#include <m-array.h>

typedef struct SPIMemChip SPIMemChip;

ARRAY_DEF(found_chips, const SPIMemChip*, M_POD_OPLIST)

typedef enum {
SPIMemChipStatusBusy,
SPIMemChipStatusIdle,
SPIMemChipStatusError
} SPIMemChipStatus;

typedef enum {
SPIMemChipWriteModeUnknown = 0,
SPIMemChipWriteModePage = (0x01 << 0),
SPIMemChipWriteModeAAIByte = (0x01 << 1),
SPIMemChipWriteModeAAIWord = (0x01 << 2),
} SPIMemChipWriteMode;

const char* spi_mem_chip_get_vendor_name(const SPIMemChip* chip);
const char* spi_mem_chip_get_model_name(const SPIMemChip* chip);
size_t spi_mem_chip_get_size(SPIMemChip* chip);
uint8_t spi_mem_chip_get_vendor_id(SPIMemChip* chip);
uint8_t spi_mem_chip_get_type_id(SPIMemChip* chip);
uint8_t spi_mem_chip_get_capacity_id(SPIMemChip* chip);
SPIMemChipWriteMode spi_mem_chip_get_write_mode(SPIMemChip* chip);
size_t spi_mem_chip_get_page_size(SPIMemChip* chip);
bool spi_mem_chip_find_all(SPIMemChip* chip_info, found_chips_t found_chips);
void spi_mem_chip_copy_chip_info(SPIMemChip* dest, const SPIMemChip* src);
uint32_t spi_mem_chip_get_vendor_enum(const SPIMemChip* chip);
const char* spi_mem_chip_get_vendor_name_by_enum(uint32_t vendor_enum);
Loading

0 comments on commit ac8196f

Please sign in to comment.