Attachment 'wobbulator_orangePi_patch.txt'
Download 1 3c3
2 <
3 ---
4 > # 2016-11-13 RR, mod for Orange Pi
5 44a45
6 > print("start pgm") # debug
7 156c157,159
8 < import quick2wire.i2c as i2c
9 ---
10 > #import quick2wire.i2c as i2c
11 > # for orange pi Lite, pyA20 library
12 > from pyA20 import i2c
13 159c162,165
14 < import RPi.GPIO as GPIO
15 ---
16 > # import RPi.GPIO as GPIO
17 > from pyA20.gpio import gpio
18 > from pyA20.gpio import port
19 > from pyA20.gpio import connector
20 162,163c168,170
21 < GPIO.setmode(GPIO.BOARD)
22 < GPIO.setwarnings(False)
23 ---
24 > #GPIO.setmode(GPIO.BOARD)
25 > #GPIO.setwarnings(False)
26 > gpio.init() #Initialize module. Always called first
27 166,169c173,180
28 < W_CLK = 15
29 < FQ_UD = 16
30 < DATA = 18
31 < RESET = 22
32 ---
33 > #W_CLK = 15
34 > W_CLK = port.PA3
35 > #FQ_UD = 16
36 > FQ_UD = port.PC4
37 > #DATA = 18
38 > DATA = port.PC7
39 > #RESET = 22
40 > RESET =port.PA2
41 172,175c183,190
42 < GPIO.setup(W_CLK, GPIO.OUT)
43 < GPIO.setup(FQ_UD, GPIO.OUT)
44 < GPIO.setup(DATA, GPIO.OUT)
45 < GPIO.setup(RESET, GPIO.OUT)
46 ---
47 > #GPIO.setup(W_CLK, GPIO.OUT)
48 > #GPIO.setup(FQ_UD, GPIO.OUT)
49 > #GPIO.setup(DATA, GPIO.OUT)
50 > #GPIO.setup(RESET, GPIO.OUT)
51 > gpio.setcfg(W_CLK, gpio.OUTPUT)
52 > gpio.setcfg(FQ_UD, gpio.OUTPUT)
53 > gpio.setcfg(DATA, gpio.OUTPUT)
54 > gpio.setcfg(RESET, gpio.OUTPUT)
55 178,181c193,201
56 < GPIO.output(W_CLK, False)
57 < GPIO.output(FQ_UD, False)
58 < GPIO.output(DATA, False)
59 < GPIO.output(RESET, False)
60 ---
61 > #GPIO.output(W_CLK, False)
62 > #GPIO.output(FQ_UD, False)
63 > #GPIO.output(DATA, False)
64 > #GPIO.output(RESET, False)
65 > gpio.output(W_CLK, 0)
66 > gpio.output(FQ_UD, 0)
67 > gpio.output(DATA, 0)
68 > gpio.output(RESET, 0)
69 >
70 187c207,209
71 < bus = i2c.I2CMaster()
72 ---
73 > #bus = i2c.I2CMaster()
74 > i2c.init("/dev/i2c-0")
75 > i2c.open(adc_address)
76 191,192c213,216
77 < GPIO.output(pin, True)
78 < GPIO.output(pin, False)
79 ---
80 > #GPIO.output(pin, True)
81 > #GPIO.output(pin, False)
82 > gpio.output(pin, 1)
83 > gpio.output(pin, 0)
84 200c224,225
85 < GPIO.output(DATA, data & 0x01)
86 ---
87 > #GPIO.output(DATA, data & 0x01)
88 > gpio.output(DATA, data & 0x01)
89 215c240
90 < # Function to set address for ADC
91 ---
92 > # Function to set address for ADC - not used ***
93 240c265,266
94 < bus.transaction(i2c.writing_bytes(0x05, 0x03))
95 ---
96 > #bus.transaction(i2c.writing_bytes(0x05, 0x03))
97 > i2c.write([0x05, 0x03]) #Write 0x03 to register 0x05
98 242c268
99 < avhigh, avlow = bus.transaction(i2c.reading(address,2))[0]
100 ---
101 > avhigh, avlow = i2c.read(2)
102 266a293
103 > print("tk init") # debug
104 548a576
105 > print("sweep") # debug
106 585,586c613,614
107 < # AD8307 span 0.3 - 2.1 V, *185 = 10 dB/div
108 < y = int(500 - (reading * 185))
109 ---
110 > # AD8307 span 0.3 - 2.1 V, *185 = 10 dB/div, +15 = offset
111 > y = int(500 + 25 - (reading * 185))
112 645c673
113 < root.wm_title('RPi Wobbulator v2.63RR, use "scrot -s" for window shot')
114 ---
115 > root.wm_title('RPi Wobbulator v2.6.3RR-OPi, use "scrot -s -d 4" for window shot')
116 656a685
117 > print("start mainloop") # debug
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.