I don't have any I2C or SPI stuff laying around to mess with right now, but I am planning to start working on something in the near future that will require me to bit bang a very simple protocol. Because of this, I'm messing with writing data from the pirate in direct i/o (DIO) mode.
When writing data in DIO mode, you simply give the pirate an 8 bit value and it sets the pins appropriately. You only have five pins (CS, MISO, CLK, MOSI, and AUX) to twiddle your bits with. These are represented by the five least significant bits. The table below represents the bits
Bit | Pin |
---|---|
1 | CS |
2 | MISO |
3 | CLK |
4 | MOSI |
5 | AUX |
If you want to turn more pins on, simply do a bitwise OR of the values you wish to change. For example, entering a 5 would turn on CLK and CS. (0b100 ^ 0b001 = 0b101 = 5). More to come later.
No comments:
Post a Comment