-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
Copy pathNrf24l01Pipe.cs
63 lines (56 loc) · 1.56 KB
/
Nrf24l01Pipe.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Iot.Device.Nrf24l01
{
/// <summary>
/// nRF24L01 Receive Pipe
/// </summary>
public class Nrf24l01Pipe
{
private readonly byte _pipeID;
private readonly Nrf24l01 _nrf;
/// <summary>
/// Creates a new instance of the Nrf24l01Pipe
/// </summary>
/// <param name="nrf">nRF24L01</param>
/// <param name="pipeID">Pipe ID</param>
public Nrf24l01Pipe(Nrf24l01 nrf, byte pipeID)
{
_nrf = nrf;
_pipeID = pipeID;
}
/// <summary>
/// Receive Pipe Address
/// </summary>
public byte[] Address
{
get => _nrf.ReadRxAddress(_pipeID);
set => _nrf.SetRxAddress(_pipeID, value);
}
/// <summary>
/// Auto Acknowledgment
/// </summary>
public bool AutoAck
{
get => _nrf.ReadAutoAck(_pipeID);
set => _nrf.SetAutoAck(_pipeID, value);
}
/// <summary>
/// Receive Pipe Payload
/// </summary>
public byte Payload
{
get => _nrf.ReadRxPayload(_pipeID);
set => _nrf.SetRxPayload(_pipeID, value);
}
/// <summary>
/// Enable Pipe
/// </summary>
public bool Enable
{
get => _nrf.ReadRxPipe(_pipeID);
set => _nrf.SetRxPipe(_pipeID, value);
}
}
}