| 52 | return 'A%i/D%i' % (bit_count - 1, 12 - bit_count) |
| 53 | |
| 54 | def decode_model(model, bits): |
| 55 | if model == 'maplin_l95ar': |
| 56 | address = 'Addr' # Address pins A0 to A5 |
| 57 | for i in range(0, 6): |
| 58 | address += ' %i:' % (i + 1) + ('on' if bits[i][0] == '0' else 'off') |
| 59 | button = 'Button' |
| 60 | # Button pins A6/D5 to A11/D0 |
| 61 | if bits[6][0] == '0' and bits[11][0] == '0': |
| 62 | button += ' A ON/OFF' |
| 63 | elif bits[7][0] == '0' and bits[11][0] == '0': |
| 64 | button += ' B ON/OFF' |
| 65 | elif bits[9][0] == '0' and bits[11][0] == '0': |
| 66 | button += ' C ON/OFF' |
| 67 | elif bits[8][0] == '0' and bits[11][0] == '0': |
| 68 | button += ' D ON/OFF' |
| 69 | else: |
| 70 | button += ' Unknown' |
| 71 | return ['%s' % address, bits[0][1], bits[5][2], \ |
| 72 | '%s' % button, bits[6][1], bits[11][2]] |
| 73 | |
| 74 | class Decoder(srd.Decoder): |
| 75 | api_version = 3 |