erlang-ale SPI ssd1306

45 views
Skip to first unread message

Stuart Thackray

unread,
Apr 8, 2014, 2:32:47 PM4/8/14
to erlang-...@googlegroups.com
Hi,

  I am trying to recreate similar to ssd1306.py (https://github.com/guyc/py-gaugette) using erlang-ale, there are a few points I am struggling with; as no hardware specialist.

  The most basic being why do they init GPIO devices, but according to the raspberry pi is is RCV (receive) and TRX (transmit), I am not sure if this is another thing not understanding, they use GPIO 15 and 13 if understand correctly.

        self.gpio.setup(self.reset_pin, self.gpio.OUT)

        self.gpio.output(self.reset_pin, self.gpio.HIGH)

        self.gpio.setup(self.dc_pin, self.gpio.OUT)

        self.gpio.output(self.dc_pin, self.gpio.LOW)


Then we get more complicated, and don't know where to even start here, but I want to write out to my SSD1306 device, the following are the defines and inits of erlang code with the python for example.

Python:

        self.spi = gaugette.spi.SPI(bus, device)

where bus=0 and device =0


Erlang: (for read device)

-define(SPICHANNEL, spi1).

-define(SPIMODE, 0).

-define(SPIBPW, 8).

-define(SPISPEED, 1000000).

-define(SPIDELAY, 10).


init() ->

    spi_sup:start_link([{?SPICHANNEL, "/dev/spidev0.0"}]),   

    spi:config(?SPICHANNEL, ?SPIMODE, ?SPIBPW, ?SPISPEED, ?SPIDELAY).



If anyone has any help it would be really appreciated, sure once I get started/understand correctly it would be easy sailing.


Any help appreciated,

Thanks,

Stuart

Reply all
Reply to author
Forward
0 new messages