File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 34
34
## problems on memory-constrained platforms.
35
35
36
36
#values = list(range(100)) # or bytearray or tuple
37
- #fram[0:100 ] = values
38
- #print(fram[0:100 ])
37
+ #fram[0] = values
38
+ #print(fram[0:99 ])
Original file line number Diff line number Diff line change
1
+ ## Simple Example For CircuitPython/Python SPI FRAM Library
2
+
3
+ import board
4
+ import busio
5
+ import digitalio
6
+ import adafruit_fram
7
+
8
+ ## Create a FRAM object.
9
+ spi = busio .SPI (board .SCK , board .MOSI , board .MISO )
10
+ cs = digitalio .DigitalInOut (board .D5 )
11
+ fram = adafruit_fram .FRAM_SPI (spi , cs )
12
+
13
+ ## Write a single-byte value to register address '0'
14
+
15
+ fram [0 ] = 1
16
+
17
+ ## Read that byte to ensure a proper write.
18
+ ## Note: 'read()' returns a bytearray
19
+
20
+ print (fram [0 ])
21
+
22
+ ## Or write a sequential value, then read the values back.
23
+ ## Note: 'read()' returns a bytearray. It also allocates
24
+ ## a buffer the size of 'length', which may cause
25
+ ## problems on memory-constrained platforms.
26
+
27
+ #values = list(range(100)) # or bytearray or tuple
28
+ #fram[0] = values
29
+ #print(fram[0:99])
You can’t perform that action at this time.
0 commit comments