You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: devices/NRF52LL.md
+27-4Lines changed: 27 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,8 @@ nRF52 Low Level Interface Library
4
4
5
5
<spanstyle="color:red">:warning:**Please view the correctly rendered version of this page at https://www.espruino.com/NRF52LL. Links, lists, videos, search, and other features will not work correctly when viewed on GitHub**:warning:</span>
The nRF52 microcontroller used in [Puck.js](/Puck.js), [Pixl.js](/Pixl.js) and [MDBT42Q](/MDBT42Q) has a load of really interesting peripherals built-in, not all of which are exposed by Espruino. The microcontroller also contains something called PPI - the "Programmable Peripheral Interconnect". This allows you to 'wire' peripherals together internally.
11
11
@@ -140,7 +140,7 @@ setWatch(function() {
140
140
141
141
### Make one reading from the ADC:
142
142
143
-
Uses ADC.
143
+
Uses the ADC (much line `analogRead` but with more options)
144
144
145
145
```JS
146
146
var ll =require("NRF52LL");
@@ -153,6 +153,27 @@ var saadc = ll.saadc({
153
153
} ]
154
154
});
155
155
print(saadc.sample()[0]);
156
+
saadc.stop(); // deconfigure so analogRead works again (use saadc.start() to redo)
157
+
```
158
+
159
+
### Make a differential from the ADC:
160
+
161
+
Use the ADC to measure the voltage difference between D30 and D31,
162
+
with the maximum gain and oversampling provided by the hardware.
163
+
164
+
```JS
165
+
var ll =require("NRF52LL");
166
+
var saadc =ll.saadc({
167
+
channels : [ { // channel 0
168
+
pin:D30, npin:D31,
169
+
gain:4,
170
+
tacq:40,
171
+
refvdd:true,
172
+
} ],
173
+
oversample :8
174
+
});
175
+
print(saadc.sample()[0]);
176
+
saadc.stop(); // deconfigure so analogRead works again (use saadc.start() to redo)
0 commit comments