Skip to content

Commit 77f59ee

Browse files
committed
update simpletest; wrong is not simple.
1 parent 286fe45 commit 77f59ee

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

examples/fram_i2c_simpletest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
## problems on memory-constrained platforms.
3535

3636
#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])

examples/fram_spi_simpletest.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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])

0 commit comments

Comments
 (0)