Open jmickiewicz opened 9 years ago
One idea for this is to always do a read
for every operation, and just map each operation to a unique register:
0: ReadFunction,
...
4: StatusLedOn,
5: StatusLedOff,
6: ErrorLedOn,
7: ErrorLedOff,
8: SendVertical,
9: SendHorizontal
...
etc.
I do this for the operations I've implemented in the raster scan (SendVertical
and SendHorizontal
). I have it return the block function in the first 6 bits with above
and right
flags in the remaining two bits to signal if there are adjacent blocks:
----------------------------------------------
| above | right | function | response byte from read
----------------------------------------------
[7] [6] [5:0]
This allows us to respond to updated functions and block placement immediately after the command. I do also like your bit-field idea about extending functionality (e.g. duty cycles), so maybe some register numbers will respond to some writes as well.
@htylo assure the lexer closes smbus before serializing and piping the output to the parser -- while slower, it assures that parser/interpreter error handling can grab control of the i2c to light up error lights without collisions
Referencing #88, we now have the following byte returned from each i2c read:
------------------------------------------------------------
| above | right | category | token | response byte from read
------------------------------------------------------------
[7] [6] [5:4] [3:0]
above
- 1-bit flag signaling the lexer that there is a block above this current block and should attempt to read it.right
- 1-bit flag signaling the lexer that there is a block to the right of this current block and should attempt to read it.category
- 2-bit identifier to determine which category is presented (wheel ID).token
- 4-bit identifier to return the value read from the potentiometer through the ADC (wheel value).This needs to be plugged into the following callback:
blocks-o-code/src/controller/abc/error.py -> ErrorFilter.action(self, line, column)
What's the status of this one? Is it in? If so - during what commit?
We have control of the status
and error
leds over the global TWI bus (via abc_global.py
in 382de30703a44fa34afaf254101298b6ac796267). The current implementation uses these for topology-collection feedback, i.e. if the blocks have been "discovered" or if they are considered "out of bounds," as was demonstrated in our final presentation.
We did not complete the syntax-error detection hooks (I think that's what Tyler was mentioning above), so this wasn't closed. Not sure how you want to handle it from here.
Two LED's need to be controlled; a status and error light. This is implemented using the following python command: Adafruit_I2c.write8( reg, value)
register 6 controls error LED on PA5 register 7 controls status LED on PA4 value 1 means on, value 0 means off. other values will be invalid and ignored
These registers are readable using Adafruit_I2c.read8( reg)
alternate ideas : a single register with multiple valid values. ie bit0 is error bit1 is status. This would allow bit or's to do multiple commands in a single write, but makes things a little less clear. non-0/1 values could represent something, maybe a duty cycle or blink number. ie write8(6,2) is blink the error light. This would allow more flexibility, but I can't think of anything I'd actually want.