1// {
2//     "version": "1.0.0",
3//     "io": {
4//         "oled_dc": {
5//             "type": "GPIO",
6//             "port": 28,
7//             "dir": "output",
8//             "pull": "pulldown"
9//         },
10//         "oled_res": {
11//             "type": "GPIO",
12//             "port": 30,
13//             "dir": "output",
14//             "pull": "pulldown"
15//         },
16//         "oled_spi": {
17//             "type": "SPI",
18//             "port": 1,
19//             "mode": "mode3",
20//             "freq": 26000000
21//         }
22//     },
23//     "debugLevel": "DEBUG"
24// }
25
26import * as spi from 'spi'
27import * as gpio from 'gpio'
28import SH1106 from './sh1106.js'
29
30var oled_dc = gpio.open({
31    id: "oled_dc",
32    success: function () {
33        console.log('gpio: open oled_dc success')
34    },
35    fail: function () {
36        console.log('gpio: open oled_dc failed')
37    }
38});
39
40var oled_res = gpio.open({
41    id: "oled_res",
42    success: function () {
43        console.log('gpio: open oled_res success')
44    },
45    fail: function () {
46        console.log('gpio: open oled_res failed')
47    }
48});
49
50var oled_spi = spi.open({
51    id: "oled_spi",
52    success: function () {
53        console.log('gpio: open oled_spi success')
54    },
55
56    fail: function () {
57        console.log('gpio: open oled_spi failed')
58    }
59});
60
61console.log("look here!!!!")
62
63let dispaly = new SH1106(132, 64, oled_spi, oled_dc, oled_res, undefined)
64dispaly.open()
65
66while (1) {
67    dispaly.fill(1)
68    dispaly.show()
69
70    dispaly.fill(0)
71    dispaly.show()
72}
73