Not wanting to delve into C programming just yet (I had to do some C++ at uni and didn't get very far!), I have been trying to approach the problem with just Perl. This is what I have got.

use strict; use warnings; use RPi::SPI; # Initialize SPI: bus 0, 8 MHz my $spi = RPi::SPI->new(0, 8000000); # Reset display (if necessary) sub reset_display { # Handle reset } # Send command to the display sub send_command { my ($cmd) = @_; my $data = \[ $cmd ]; # Create an array reference for a single co +mmand byte print "Sending command\n"; $spi->rw($data, 1); # Send command via SPI } # Send data to the display (ensure data is an array reference) sub send_data { my ($data_ref) = @_; print "Sending data\n"; $spi->rw($data_ref); # Send data via SPI } # Initialize the display (according to the display's datasheet) sub init_display { send_command(0x01); # Command: software reset } reset_display(); init_display();

I'm getting an error from $spi->rw($data, 1); that doesn't seem to make sense. The error is data param must be an array reference but the RPi::SPI documentation says that rw takes buf (arrayref) and len (integer). It doesn't mention a data parameter and I am giving it an arrayref and an integer!

I've searched the source code and the error text is not there.

Some help debugging this would be appreciated please


In reply to Re: ST7789V2 LCD Controller by Bod
in thread ST7789V2 LCD Controller by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.