| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# You may distribute under the terms of either the GNU General Public License |
|
2
|
|
|
|
|
|
|
# or the Artistic License (the same terms as Perl itself) |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# (C) Paul Evans, 2015 -- leonerd@leonerd.org.uk |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Device::BusPirate::Chip::SSD1306::SPI4; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
582
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
27
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
19
|
|
|
10
|
1
|
|
|
1
|
|
3
|
use base qw( Device::BusPirate::Chip::SSD1306 ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
65
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
3
|
use constant CHIP => "SSD1306-SPI4"; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
15
|
1
|
|
|
1
|
|
3
|
use constant MODE => "SPI"; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
646
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
C - use a F OLED driver in 4-wire SPI mode |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This L subclass provides specific |
|
24
|
|
|
|
|
|
|
communication to an F chip attached to the F via SPI in |
|
25
|
|
|
|
|
|
|
4-wire mode; where the C pin is attached to the C line. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
The chip name for this module is C. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
For actually interacting with the attached module, see the main |
|
30
|
|
|
|
|
|
|
L documentation. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub mount |
|
35
|
|
|
|
|
|
|
{ |
|
36
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
37
|
0
|
|
|
|
|
|
my ( $mode ) = @_; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$self->SUPER::mount( $mode ) |
|
40
|
|
|
|
|
|
|
->then( sub { |
|
41
|
0
|
|
|
0
|
|
|
$mode->configure( |
|
42
|
|
|
|
|
|
|
speed => "8M", |
|
43
|
|
|
|
|
|
|
) |
|
44
|
0
|
|
|
|
|
|
}); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub send_cmd |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
50
|
0
|
|
|
|
|
|
my @vals = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$self->aux(0)->then( sub { |
|
53
|
0
|
|
|
0
|
|
|
$self->mode->writeread_cs( join "", map { chr } @vals ) |
|
|
0
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
}); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub send_data |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
60
|
0
|
|
|
|
|
|
my ( $bytes ) = @_; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$self->aux(1)->then( sub { |
|
63
|
0
|
|
|
0
|
|
|
$self->mode->writeread_cs( $bytes ); |
|
64
|
0
|
|
|
|
|
|
}); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Paul Evans |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
0x55AA; |