コード例 #1
0
        public void WriteFailedOutOfRangeTest()
        {
            FRAM ram = new FRAM(10);

            byte[] data = { 0x12, 0x34, 0x56, 0x78 };
            Assert.AreEqual(-2, ram.Write(data, 10, 4));
        }
コード例 #2
0
        public void ReadFailedOutOfRangeTest()
        {
            FRAM ram = new FRAM(10);

            ram.Memory[0] = 0x12;
            ram.Memory[1] = 0x34;
            ram.Memory[2] = 0x56;
            ram.Memory[3] = 0x78;
            ram.Memory[4] = 0x21;
            ram.Memory[5] = 0x43;
            ram.Memory[6] = 0x65;
            int size = 3;

            byte[] data = new byte[size];
            Assert.AreEqual(-2, ram.Read(data, 10, size));
        }
コード例 #3
0
        public void WriteSuccessTest()
        {
            FRAM ram = new FRAM(20);

            byte[] data = { 0x12, 0x34, 0x56, 0x78 };
            Assert.AreNotEqual(0x12, ram.Memory[0]);
            Assert.AreEqual(0, ram.Write(data, 0, 4));
            Assert.AreEqual(0x12, ram.Memory[0]);
            Assert.AreEqual(0x34, ram.Memory[1]);
            Assert.AreEqual(0x56, ram.Memory[2]);
            Assert.AreEqual(0x78, ram.Memory[3]);

            Assert.AreEqual(0, ram.Write(data, 10, 2));
            Assert.AreEqual(0x12, ram.Memory[10]);
            Assert.AreEqual(0x34, ram.Memory[11]);
            Assert.AreNotEqual(0x56, ram.Memory[12]);
            Assert.AreNotEqual(0x78, ram.Memory[13]);
        }
コード例 #4
0
        public void ReadSuccessTest()
        {
            FRAM ram = new FRAM(10);

            ram.Memory[0] = 0x12;
            ram.Memory[1] = 0x34;
            ram.Memory[2] = 0x56;
            ram.Memory[3] = 0x78;
            ram.Memory[4] = 0x21;
            ram.Memory[5] = 0x43;
            ram.Memory[6] = 0x65;
            int size = 3;

            byte[] data = new byte[size];
            Assert.AreEqual(0, ram.Read(data, 4, size));
            Assert.AreEqual(0x21, data[0]);
            Assert.AreEqual(0x43, data[1]);
            Assert.AreEqual(0x65, data[2]);
        }
コード例 #5
0
ファイル: FRAMLogic.cs プロジェクト: reututy/SatelliteCSharp
 /*!
  * De-initializes the FRAM driver.
  */
 public void FRAM_stop()
 {
     fram = null;
 }
コード例 #6
0
ファイル: FRAMLogic.cs プロジェクト: reututy/SatelliteCSharp
 /*!
  * Initializes the FRAM driver and the SPI driver if its not already initialized.
  * @return -2 if initializing the SPI driver fails,
  * -1 If creating semaphores to control access to the FRAM fails.
  * 0 on success.
  */
 public int FRAM_start()
 {
     fram = new FRAM(OBCConstants.SIZE_8K);
     return(0);
 }
コード例 #7
0
ファイル: FRAMLogic.cs プロジェクト: reututy/SatelliteCSharp
 public FRAMLogic()
 {
     fram = null;
 }