|
2 | 2 |
|
3 | 3 | namespace OpenEphys.Onix1 |
4 | 4 | { |
5 | | - class NeuropixelsV1eMetadata |
| 5 | + class NeuropixelsV1eMetadata : I2CRegisterContext |
6 | 6 | { |
7 | 7 | const uint OFFSET_ID = 0; |
8 | 8 | const uint OFFSET_VERSION = 10; |
9 | 9 | const uint OFFSET_REVISION = 11; |
10 | 10 | const uint OFFSET_FLEXPN = 20; |
11 | 11 | const uint OFFSET_PROBEPN = 40; |
12 | 12 |
|
13 | | - public NeuropixelsV1eMetadata(I2CRegisterContext serializer) |
| 13 | + public NeuropixelsV1eMetadata(DeviceContext deviceContext) |
| 14 | + : base(deviceContext, NeuropixelsV1.FlexEepromI2CAddress) |
14 | 15 | { |
15 | | - var flexI2C = new I2CRegisterContext(serializer, NeuropixelsV1.FlexEepromI2CAddress); |
16 | 16 | try |
17 | 17 | { |
18 | | - var sn = flexI2C.ReadBytes(OFFSET_ID, 8); |
| 18 | + var sn = ReadBytes(OFFSET_ID, 8); |
19 | 19 | ProbeSerialNumber = BitConverter.ToUInt64(sn, 0); |
20 | | - Version = flexI2C.ReadByte(OFFSET_VERSION); |
21 | | - Revision = flexI2C.ReadByte(OFFSET_REVISION); |
22 | | - PartNumber = flexI2C.ReadString(OFFSET_FLEXPN, 20); |
23 | | - ProbePartNumber = flexI2C.ReadString(OFFSET_PROBEPN, 20); |
| 20 | + Version = ReadByte(OFFSET_VERSION); |
| 21 | + Revision = ReadByte(OFFSET_REVISION); |
| 22 | + PartNumber = ReadString(OFFSET_FLEXPN, 20); |
| 23 | + ProbePartNumber = ReadString(OFFSET_PROBEPN, 20); |
24 | 24 | } |
25 | 25 | catch (oni.ONIException ex) |
26 | 26 | { |
27 | | - throw new InvalidOperationException("Could not communicate with probe. Ensure that the " + |
| 27 | + throw new InvalidOperationException("Could not communicate with probe at address " + deviceContext.Address + " . Ensure that the " + |
28 | 28 | "flex connection is properly seated.", ex); |
29 | 29 | } |
30 | 30 | } |
|
0 commit comments