Hotboards_eeprom.cpp - Driver to control serial (spi) eeprom memories, The memories are compatibles amount the manufactures Microchip, Atmel and ST, and of course you can control Hotboards eeprom boards (http://hotboards.org)
Dependents: Hotboards_eeprom_write_byte Hotboards_eeprom_write_array
Hotboards_eeprom.h
00001 /* 00002 Hotboards_eeprom.h - Driver to control serial (spi) eeprom memories, The memories are 00003 compatibles amount the manufactures Microchip, Atmel and ST, and of course you can control 00004 Hotboards eeprom board (http://hotboards.org) 00005 Created by Diego Perez, January 16, 2016. 00006 Released into the public domain. 00007 00008 Density: 1Kbit | 2Kbit | 4Kbit | 8Kbit | 16Kbit | 32Kbit | 64Kbit | 128Kbit | 256Kbit | 512Kbit | 1 Mbit 00009 Part: 25xx010 | 25xx020 | 25xx040 | 25xx080 | 25xx160 | 25xx320 | 25xx640 | 25xx128 | 25xx256 | 25xx512 | 25xx1024 00010 Page/Byte: 16 | 16 | 16 | 16(32) | 16(32) | 32 | 32 | 64 | 64 | 128 | 256 00011 Addr/Bits: 7 | 8 | 9 | 16 | 16 | 16 | 16 | 16 | 16 | 16 00012 */ 00013 00014 #ifndef Hotboards_eeprom_h 00015 #define Hotboards_eeprom_h 00016 00017 #include "mbed.h" 00018 00019 //EEPROM size in kilobits. EEPROM part numbers are usually designated in k-bits. 00020 typedef enum 00021 { 00022 HT_EEPROM25xx_1Kb = 0, 00023 HT_EEPROM25xx_2Kb, 00024 HT_EEPROM25xx_4Kb, 00025 HT_EEPROM25xx_8Kb, 00026 HT_EEPROM25xx_16Kb, 00027 HT_EEPROM25xx_32Kb, 00028 HT_EEPROM25xx_64Kb, 00029 HT_EEPROM25xx_128Kb, 00030 HT_EEPROM25xx_256Kb, 00031 HT_EEPROM25xx_512Kb, 00032 HT_EEPROM25xx_1Mb 00033 }_eEEPROM; 00034 00035 class Hotboards_eeprom 00036 { 00037 public : 00038 Hotboards_eeprom( SPI &spi, PinName cs, uint8_t type ); 00039 void init( void ); 00040 void write( uint32_t address, uint8_t data ); 00041 void write( uint32_t address, uint8_t *data, uint16_t size ); 00042 uint8_t read( uint32_t address ); 00043 void read( uint32_t address, uint8_t *data, uint16_t size ); 00044 00045 protected : 00046 void sendAddress( uint8_t cmd, uint32_t address ); 00047 void writePage( uint32_t address, uint8_t *data, uint16_t size ); 00048 00049 SPI _spi; 00050 DigitalOut _cs_pin; 00051 uint8_t _type; 00052 uint16_t _page; 00053 uint32_t _density; 00054 }; 00055 00056 #endif
Generated on Thu Jul 14 2022 04:08:35 by 1.7.2