mirror of
https://github.com/brmlab/edubrm.git
synced 2025-06-08 12:53:59 +02:00
we have 7 ADCs not 6
This commit is contained in:
parent
8218ba6b93
commit
f37c8b64dc
3 changed files with 27 additions and 13 deletions
|
@ -10,13 +10,13 @@ void GetInReport (uint8_t src[], uint32_t length)
|
|||
uint32_t volatile reg = LPC_USB->CmdCode;
|
||||
if (reg & (5<<8)) return;
|
||||
|
||||
for (i=0; i<6; ++i) {
|
||||
for (i=0; i<7; ++i) {
|
||||
uint32_t v = ADCRead(i);
|
||||
src[i*2 ] = v & 0xff;
|
||||
src[i*2+1] = (v>>8) & 0xff;
|
||||
}
|
||||
// TODO: fix the following - replace IP[i] with real value of input pin (I)
|
||||
// src[12] = IP[0] + (IP[1]<<1) + (IP[2]<<2);
|
||||
// src[14] = IP[0] + (IP[1]<<1) + (IP[2]<<2);
|
||||
}
|
||||
|
||||
void SetOutReport (uint8_t dst[], uint32_t length)
|
||||
|
|
|
@ -53,8 +53,9 @@ class Device:
|
|||
self.epo.write('o' + chr(which<<1 + state))
|
||||
|
||||
def read(self):
|
||||
# 6x AD (16 bits) + 3 x I
|
||||
# 7x AD (16 bits) + 3 x I
|
||||
i = self.epi.read(self.INSIZE)
|
||||
return (i[0] + i[1]<<8, i[2] + i[3]<<8, i[4] + i[5]<<8,
|
||||
i[6] + i[7]<<8, i[9] + i[9]<<8, i[10] + i[11]<<8,
|
||||
i[12] & 0x01, (i[12] & 0x02) >> 1, (i[12] & 0x04) >> 2)
|
||||
return (i[0] + i[1]<<8, # AD0
|
||||
i[2] + i[3]<<8, i[4] + i[5]<<8, i[6] + i[7]<<8, # AD1 .. AD3
|
||||
i[9] + i[9]<<8, i[10] + i[11]<<8, i[12] + i[13]<<8, # AD4 .. AD6
|
||||
i[14] & 0x01, (i[14] & 0x02) >> 1, (i[14] & 0x04) >> 2) # IO1 .. IO3
|
||||
|
|
|
@ -646,7 +646,7 @@
|
|||
<x>10</x>
|
||||
<y>270</y>
|
||||
<width>461</width>
|
||||
<height>151</height>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
|
@ -703,7 +703,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>20</y>
|
||||
<y>40</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -716,7 +716,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>40</y>
|
||||
<y>60</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -729,7 +729,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>60</y>
|
||||
<y>80</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -742,7 +742,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>80</y>
|
||||
<y>100</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -755,7 +755,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>100</y>
|
||||
<y>120</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -768,7 +768,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>120</y>
|
||||
<y>140</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -816,6 +816,19 @@
|
|||
<string>IO1: 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelAD0">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>20</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AD0: 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue