Exemple #1
0
        public FakeEpd(EpdModel model, Image image)
        {
            Width  = EpdResolution.WIDTH[(int)model];
            Height = EpdResolution.HEIGHT[(int)model];

            buffer = new byte[Width / 8 * Height];  // Create a buffer for image
            for (int i = 0; i < Width / 8 * Height; ++i)
            {
                buffer[i] = 0xFF;
            }

            _image = image;     // EPD preview will be updated to this control
        }
Exemple #2
0
        public SPIEpd(EpdModel model,
                      int reset_pin = SPIEpdDefaultConnection.RST_PIN,
                      int dc_pin    = SPIEpdDefaultConnection.DC_PIN,
                      int cs_pin    = SPIEpdDefaultConnection.CS_PIN,
                      int busy_pin  = SPIEpdDefaultConnection.BUSY_PIN)
        {
            ResetPin      = reset_pin;
            DCPin         = dc_pin;
            ChipSelectPin = cs_pin;
            BusyPin       = busy_pin;
            Width         = EpdResolution.WIDTH[(int)model];
            Height        = EpdResolution.HEIGHT[(int)model];

            Model = model;

            switch (Model)
            {
            case EpdModel.EPD1IN54:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD1IN54B:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD1IN54C:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD2IN13:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD2IN13B:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD2IN7:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD2IN7B:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD2IN9:
                _impl = new Epd2in9(this);
                break;

            case EpdModel.EPD2IN9B:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD4IN2:
                _impl = new Epd4in2(this);
                break;

            case EpdModel.EPD4IN2B:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD7IN5:
                _impl = new EpdFallback();
                break;

            case EpdModel.EPD7IN5B:
                _impl = new EpdFallback();
                break;

            default:
                _impl = new EpdFallback();
                break;
            }

            /* init Gpio Pins */
            var controller = GpioController.GetDefault();

            _reset = controller.OpenPin(ResetPin);
            _reset.SetDriveMode(GpioPinDriveMode.Output);

            _dc = controller.OpenPin(DCPin);
            _dc.SetDriveMode(GpioPinDriveMode.Output);

            //_chipselect = controller.OpenPin(ChipSelectPin);
            //_chipselect.SetDriveMode(GpioPinDriveMode.Output);

            _busy = controller.OpenPin(BusyPin);
            _busy.SetDriveMode(GpioPinDriveMode.Input);

            /* add busy state listener */
            _busy.ValueChanged += _busy_ValueChanged;
        }