Document

obniz Hardware and cloud specifications.


spi

available spi0, spi1

request: init_master

clk, miso, mosi are optional, but at least one are required

path type conditions description
spiX.mode string
  • required
  • const "master"
 
spiX.clk pinSetting    
spiX.mosi pinSetting    
spiX.miso pinSetting    
spiX.clock integer
  • required
  • 1 ≤ value ≤ 26000000
 
// Json Example
[
    {
        "spi0": {
            "mode": "master",
            "clk": 0,
            "mosi": 1,
            "miso": 2,
            "clock": 115200
        }
    }
]

request: deinit

path type conditions description
spiX null
  • required
 
// Json Example
[
    {
        "spi0": null
    }
]

request: write

Related item

path type conditions description
spiX.data dataArray1024
  • required
 
spiX.read boolean
  • required
If false, write without receive 
// Json Example
[
    {
        "spi0": {
            "data": [100, 255, 21, 0, 21],
            "read": true
        }
    }
]

response: read

path type conditions description
spiX.data dataArray
  • required
 
//Response Example
[
    {
        "spi0": {
            "data": [16, 34, 242]
        }
    }
]

type defines

dataArray

type conditions examples description
array
  • items
    • 0 ≤ value ≤ 255
  • [16, 34, 242]
  • [100, 255, 21, 0, 21]
Binary data array. 

dataArray1024

type conditions examples description
array
  • length ≤ 1024
  • items
    • 0 ≤ value ≤ 255
  • [100, 255, 21, 0, 21]
 

pinSetting

type conditions examples description
integer
  • 0 ≤ value ≤ 11
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6