nikita teggi / Mbed 2 deprecated merged_code2_3rd_nov_2017

Dependencies:   SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217

Fork of merged_code2_20sept_2017_4th_oct_2017 by nikita teggi

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers eeprom_pgm.cpp Source File

eeprom_pgm.cpp

00001 #include "mbed.h"
00002 #include "eeprom.h"
00003 #include "eeprom_pgm.h"
00004 
00005 #include <stdio.h> 
00006 Serial ec(USBTX, USBRX); // tx, rx
00007 EEPROM rom(PTC11, PTC10, 0x00, EEPROM::T24C32);
00008  
00009  
00010  
00011 
00012 void eprom_write(uint32_t address, int32_t data) 
00013 {
00014     rom.write(address ,data);           // write data into the address
00015  
00016 }
00017 
00018 void eprom_write_8(uint32_t address, int8_t data) 
00019 {
00020     rom.write(address ,data);           // write data into the address
00021  
00022 }
00023 
00024 void eprom_write_16(uint32_t address, int16_t data) 
00025 {
00026     rom.write(address ,data);           // write data into the address
00027  
00028 }
00029 
00030 
00031 int32_t eprom_read(uint32_t address)       // readng the data from the specified address
00032 {
00033     int32_t rdata;                     // changed to int32_t
00034     rom.read(address, rdata);        
00035    // ec.printf("Read back value=%d\n", rdata);  
00036     return rdata;
00037 }
00038 
00039 int8_t eprom_read_8(uint32_t address)       // readng the data from the specified address
00040 {
00041     int8_t rdata;                     // changed to int32_t
00042     rom.read(address, rdata);        
00043     //ec.printf("Read back value=%d\n", rdata);  
00044     return rdata;
00045 }
00046 
00047 int16_t eprom_read_16(uint32_t address)       // readng the data from the specified address
00048 {
00049     int16_t rdata;                     // changed to int32_t
00050     rom.read(address, rdata);        
00051     //ec.printf("Read back value=%d\n", rdata);  
00052     return rdata;
00053 }