/// <summary> /// 指定したアドレスに1byte書き込みます /// </summary> /// <param name="bus">書き込み対象</param> /// <param name="addr">書き込み先</param> /// <param name="data">書き込みデータ</param> /// <returns></returns> public static bool Write8(this IBusAccessible bus, uint addr, byte data) { var src = new byte[] { data, }; return(bus.Write(addr, src)); }
/// <summary> /// 指定したアドレスに2byte書き込みます /// </summary> /// <param name="bus">書き込み対象</param> /// <param name="addr">書き込み先</param> /// <param name="data">書き込みデータ</param> /// <returns></returns> public static bool Write16(this IBusAccessible bus, uint addr, ushort data) { var src = new byte[] { (byte)(data & 0xff), (byte)((data >> 8) & 0xff), }; return(bus.Write(addr, src)); }