@ John: At tne moment I don’t have the means to downgrade to 4.2. Upgrading was easy, downgrading does not seem to be
Meanwhile, I found a solution to my Problem. I inlined the MaxO “driver” code into my program, reduced it to the bare minimum and tried some things. I observed that when I pad the array that is send to MaxO with an extra leading 0x00 then everything works as expected.
using Gadgeteer;
using Gadgeteer.Modules;
using Gadgeteer.Modules.Mountaineer;
using Gadgeteer.SocketInterfaces;
using Microsoft.SPOT;
namespace MaxOCounter {
public partial class Program {
private ButtonForMountaineer _button;
private DigitalOutput _enable;
private Spi _spi;
private SpiConfiguration _config;
private Module _module;
private DigitalOutput _clr;
private int _index;
class MyModule : Module { public MyModule() { } }
void ProgramStarted() {
Debug.Print("Program Started");
_module = new MyModule();
Socket socket = Socket.GetSocket(2, true, _module, null);
socket.EnsureTypeIsSupported('S', _module);
_config = new SpiConfiguration(false, 0, 0, false, true, 1000);
_spi = SpiFactory.Create(socket, _config, SpiSharing.Shared, socket, Socket.Pin.Five, _module);
_enable = DigitalOutputFactory.Create(socket, Socket.Pin.Three, false, _module);
_clr = DigitalOutputFactory.Create(socket, Socket.Pin.Four, true, _module);
_button = new ButtonForMountaineer();
_button.ButtonPressed += (s, e) => ButtonPressed();
}
void ButtonPressed() {
Debug.Print(_index.ToString());
var byteIndex = _index >> 3;
var bitIndex = _index & 0x7;
var mask = (byte)(1 << bitIndex);
var buffer = new byte[5]; // resize this to 4 yields the bug
// SPI's output bytes are reversed
buffer[buffer.Length - 1 - byteIndex] = mask;
_enable.Write(true);
_spi.Write(buffer);
_enable.Write(false);
_index = (_index + 1) % 32;
}
}
}
GHI, please have a look into this and test MaxO usin 4.3. I am reluctant to believe that I just received an ill-functioning one.