Allen Litton
/
BreakoutBoardDemo
Demo Application for the Celeritous Breakout Board
Embed:
(wiki syntax)
Show/hide line numbers
L25AA02EA48.cpp
00001 #include "L25AA02EA48.h" 00002 L25AA02EA48::L25AA02EA48(PinName MOSI, PinName MISO, PinName SCLK, PinName CS) : _serial(MOSI,MISO,SCLK), _cs(CS) 00003 { 00004 _cs = 1; 00005 _serial.frequency(2000000); 00006 _serial.format(8,3); 00007 } 00008 00009 int L25AA02EA48::command(int c) 00010 { 00011 int response=0; 00012 _cs = 0; 00013 00014 _serial.write(c); 00015 response = _serial.write(0x0); //address 0 00016 00017 _cs = 1; 00018 return response; 00019 } 00020 00021 int L25AA02EA48::read_address(int a) 00022 { 00023 int response=0; 00024 _cs = 0; 00025 00026 _serial.write(COMMAND_READ); 00027 _serial.write(a); //address 0 00028 response=_serial.write(0x0); 00029 _cs = 1; 00030 return response; 00031 } 00032 char * L25AA02EA48::getMacAddress() 00033 { 00034 // for (int i=0; i<6; i++) 00035 // MacAddress[i] = read_address(0xfa+i); 00036 00037 _cs = 0; 00038 00039 _serial.write(COMMAND_READ); 00040 _serial.write(0xfa); //address 0 00041 for(int i=0; i<6; i++) 00042 MacAddress[i]=_serial.write(0x0); 00043 00044 _cs = 1; 00045 return MacAddress; 00046 }
Generated on Tue Jul 12 2022 13:41:30 by 1.7.2