summaryrefslogtreecommitdiff
path: root/model/driver/nrf24l01.dfa
blob: 56b498d302e77dffc9e7abc1eb513719d463028d (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
codegen:
  class: Nrf24l01
  instance: nrf24l01
  includes: ['driver/nrf24l01.h']
  flags: ['drivers=nrf24l01', 'arch_drivers=spi']

dummygen:
  enum:
    rf24_pa_dbm_e:
      - RF24_PA_MIN
      - RF24_PA_LOW
      - RF24_PA_HIGH
      - RF24_PA_MAX
      - RF24_PA_ERROR
    rf24_datarate_e:
      - RF24_1MBPS
      - RF24_2MBPS
      - RF24_250KBPS
    rf24_crclength_e:
      - RF24_CRC_DISABLED
      - RF24_CRC_8
      - RF24_CRC_16

parameters:
  - auto_ack!
  - payload_size
  - dynamic_payloads_enabled!
  - max_retry_count
  - retry_count
  - retry_delay
  - tx_power
  - datarate
  - channel

parameter_normalization:
  tx_power:
    unit: dBm
    enum:
      Nrf24l01::RF24_PA_MIN: 0
      Nrf24l01::RF24_PA_LOW: 6
      Nrf24l01::RF24_PA_HIGH: 12
      Nrf24l01::RF24_PA_MAX: 18
  datarate:
    unit: 'kbit/s'
    enum:
      Nrf24l01::RF24_1MBPS: 1000
      Nrf24l01::RF24_2MBPS: 2000
      Nrf24l01::RF24_250KBPS: 250
  retry_delay:
    unit: us
    formula: '250 * param + 250'

states:
  - UNINITIALIZED
  - POWEROFF
  - STANDBY1
  - TX
  - RX

transition:
  setup:
    src: [UNINITIALIZED, POWEROFF, STANDBY1]
    dst: STANDBY1
    set_param:
      'auto_ack!': 1
      'dynamic_payloads_enabled!': 0
      max_retry_count: 10
      retry_delay: 5
      datarate: 'Nrf24l01::RF24_1MBPS'
      tx_power: 'Nrf24l01::RF24_PA_MAX'
      channel: 76
  powerDown:
    src: [STANDBY1]
    dst: POWEROFF
  setAutoAck:
    src: [STANDBY1]
    dst: STANDBY1
    arguments:
      - name: enable
        values: [0, 1]
        parameter: 'auto_ack!'
  setPALevel:
    src: [STANDBY1]
    dst: STANDBY1
    arguments:
      - name: palevel
        values: ['Nrf24l01::RF24_PA_MIN', 'Nrf24l01::RF24_PA_LOW', 'Nrf24l01::RF24_PA_HIGH', 'Nrf24l01::RF24_PA_MAX']
        parameter: tx_power
  setDataRate:
    src: [STANDBY1]
    dst: STANDBY1
    arguments:
      - name: datarate
        values: ['Nrf24l01::RF24_1MBPS', 'Nrf24l01::RF24_2MBPS', 'Nrf24l01::RF24_250KBPS']
        parameter: datarate
  startListening:
    src: [STANDBY1]
    dst: RX
  stopListening:
    src: [RX]
    dst: STANDBY1
  setDynamicPayloads:
    src: [STANDBY1]
    dst: STANDBY1
    arguments:
      - name: enabled
        values: [0, 1]
        parameter: 'dynamic_payloads_enabled!'
  setRetries:
    src: [STANDBY1]
    dst: STANDBY1
    arguments:
      - name: delay
        values: [0, 5, 10, 15]
        parameter: retry_delay
      - name: count
        values: [0, 5, 10, 15]
        parameter: max_retry_count
  flushTx:
    src: [STANDBY1]
    dst: STANDBY1
  # only reports sensible values when auto_ack! == 1
  getObserveTx:
    src: [STANDBY1]
    dst: STANDBY1
    return_value:
      - parameter: retry_count
        formula: param & 0x0f
        apply_from: write
  write:
    src: [STANDBY1]
    dst: STANDBY1
    arguments:
      - name: buf
        values: ['"foo"', '"foo"', '"foofoofoo"', '"foofoofoo"', '"123456789012345678901234567890"', '"123456789012345678901234567890"']
      - name: len
        values: [3, 3, 9, 9, 30, 30]
        parameter: payload_size
      - name: await_ack
        values: [0, 1, 0, 1, 0, 1]
      - name: blocking
        values: [1, 1, 1, 1, 1, 1]
    argument_combination: zip
    return_value:
      - lol: nope