![]() ![]() ![]() ![]() |
|
This module is a thin wrapper around the standard CPAN module Device::SerialPort.
It is implemeted to give a simple write only interface to the UART0_TXD output pin for devices such as LCD controllers that accept commands on their RX pins without needing a connection on their TX pins. ( TX output pin on Raspberry Pi goes to RX input pin on device ).
For more complex interaction over a serial TX/RX link it is recommended to use Device::SerialPort directly.
Note that by default on the Pi 3 the mini uart is broken out via pins 14 and 15 on the GPIO header as the main UART is used for Bluetooth. S the the contstructor method notes below
The following interface modules use HiPi::Device::SerialPort as a backend and may contain code that helps with your own usage.
HiPi::Interface::SerLCD
HiPi::Interface::HTBackpackV2 ( as an optional backend )
Returns a new instance of the HiPi::Device::SerialPort class. You can optionally specify several parameters as key value pairs in the constructor. Their default values are: my $dev = HiPi::Device::SerialPort->new( devicename => '/dev/ttyAMA0', baudrate => 9600, parity => 'none', stopbits => 1, databits => 8, ); The devicename is passed the Device::SerialPort constructor while all other parameters are used to set the corresponding Device::SerialPort object properties. If you are using a Pi 3 with default settings, the header pins on the Rpi gpio are connected to the mini uart. You will therefore need to specify the device to override the default. my $dev = HiPi::Device::SerialPort->new( devicename => '/dev/ttyS0', );
Writes the $buffer to the open port using Device::SerialPort->write. Then calls Device::SerialPort->write_drain.