diff options
author | Daniel Friesel <derf@finalrewind.org> | 2018-01-11 14:23:07 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2018-01-11 14:23:07 +0100 |
commit | 0d84f5e512c4148bc45dd26eea177e09c0a21b56 (patch) | |
tree | 8d8ae62a68f11482d1c25f32d86cf1c43246f61d /src | |
parent | 1978e406b816d463dc7feab083ce30638e8b787a (diff) |
Add Sharp96 display driver, split up msp430 SPI into a1 / b
Diffstat (limited to 'src')
-rw-r--r-- | src/app/sharp96test/Makefile.inc | 1 | ||||
-rw-r--r-- | src/app/sharp96test/main.cc | 135 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/Makefile.inc | 4 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/driver/spi.cc | 61 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/driver/spi_b.cc | 26 | ||||
-rw-r--r-- | src/driver/sharp96.cc | 80 |
6 files changed, 237 insertions, 70 deletions
diff --git a/src/app/sharp96test/Makefile.inc b/src/app/sharp96test/Makefile.inc new file mode 100644 index 0000000..4dbcaca --- /dev/null +++ b/src/app/sharp96test/Makefile.inc @@ -0,0 +1 @@ +driver_sharp96 ?= 1 diff --git a/src/app/sharp96test/main.cc b/src/app/sharp96test/main.cc new file mode 100644 index 0000000..bbf9258 --- /dev/null +++ b/src/app/sharp96test/main.cc @@ -0,0 +1,135 @@ +#include "arch.h" +#include "driver/gpio.h" +#include "driver/stdout.h" +#include "driver/spi_b.h" +#include "driver/sharp96.h" + +unsigned char const lynx[12 * 96] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01, 0x88, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0C, 0x16, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x18, 0x0A, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x30, 0x0B, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x60, 0x0D, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x40, 0x2D, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x80, 0x3D, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0x81, 0x80, 0x1D, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0xC1, 0x00, 0x1C, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0xE3, 0x00, 0xFC, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF6, 0x11, 0xFC, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFE, 0x10, 0x7C, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFE, 0x10, 0x7C, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFE, 0x10, 0xFC, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x1F, 0x10, 0xFF, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0xFF, 0x0F, 0x19, 0xFF, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x07, 0xFF, 0x80, 0x0F, 0xFF, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1F, 0x71, 0xC0, 0xFF, 0x7F, 0xE0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x70, 0x40, 0x7C, 0x7F, 0xF0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x70, 0x60, 0x20, 0x00, 0x7F, 0xF0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0xC0, 0xE0, 0x00, 0x00, 0xE1, 0xB8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x07, 0x81, 0xC0, 0x00, 0x00, 0x70, 0x9E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0F, 0x81, 0xC0, 0x00, 0x00, 0x70, 0x1F, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x0F, 0xE0, 0x00, 0x00, + 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x0F, 0xF8, 0x00, 0x00, + 0x00, 0x00, 0x0C, 0x01, 0xFE, 0x00, 0x3F, 0x80, 0x0F, 0xFE, 0x00, 0x00, + 0x00, 0x00, 0x0C, 0x03, 0xE0, 0x00, 0x0F, 0x80, 0x0F, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x0C, 0x07, 0x18, 0x00, 0x03, 0x8C, 0x07, 0xFF, 0x80, 0x00, + 0x00, 0x00, 0x08, 0x3E, 0x60, 0x00, 0x01, 0xCC, 0x03, 0xFF, 0xC0, 0x00, + 0x00, 0x00, 0x08, 0x39, 0xC0, 0x00, 0x00, 0xFC, 0x03, 0x80, 0xE0, 0x00, + 0x00, 0x00, 0x18, 0x7F, 0xE0, 0x01, 0xE0, 0x7E, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x33, 0xC4, 0x00, 0x00, 0x3C, 0x3F, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x07, 0x9F, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xEC, 0x00, 0x01, 0xFE, 0x01, 0xEF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x00, + 0x00, 0x0E, 0x20, 0x1C, 0x00, 0x00, 0x0F, 0x07, 0xF0, 0x00, 0x00, 0x00, + 0x00, 0x0F, 0xA0, 0x70, 0x00, 0x00, 0x01, 0xC7, 0xF0, 0x00, 0x00, 0x00, + 0x00, 0x0F, 0xC1, 0xC6, 0x00, 0x0F, 0xFF, 0xF3, 0xE0, 0x00, 0x00, 0x00, + 0x00, 0x0F, 0xC3, 0x1C, 0x00, 0x00, 0x1F, 0xFD, 0xF0, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x86, 0x3F, 0x80, 0x00, 0x03, 0xFF, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x99, 0xFF, 0xE0, 0x00, 0x07, 0xFF, 0xFC, 0x00, 0x00, 0x00, + 0x00, 0x03, 0xFF, 0xFD, 0xF8, 0x00, 0x00, 0x7F, 0xFC, 0x00, 0x00, 0x00, + 0x00, 0x01, 0xFF, 0xC5, 0xFE, 0x00, 0x06, 0x3F, 0xFC, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xE2, 0x6F, 0xFF, 0x80, 0x03, 0x8F, 0xF6, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x02, 0x5F, 0xFF, 0xC0, 0x00, 0xC7, 0xF0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x21, 0x43, 0xFE, 0xF0, 0x00, 0x73, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0xC0, 0xFE, 0xF8, 0x00, 0x11, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1C, 0xC0, 0x7E, 0xF8, 0x00, 0x08, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0C, 0x40, 0x36, 0x7C, 0x0C, 0x04, 0x7C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x17, 0x7E, 0x07, 0x80, 0x3C, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0B, 0x3E, 0x01, 0xE0, 0x1E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0B, 0x9E, 0x00, 0xF0, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0xCF, 0x00, 0x7C, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0xEF, 0x00, 0x3E, 0x03, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0x00, 0x1F, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x7F, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x7F, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x7F, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0xFE, 0x00, 0x33, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0xDE, 0x01, 0x3B, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0x01, 0xBF, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0xFF, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x11, 0x0E, 0x03, 0xFF, 0xC0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x03, 0xFF, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x07, 0xFF, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x07, 0xFF, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x82, 0xEE, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9C, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +void loop(void) +{ + static unsigned char i = 0; + gpio.led_toggle(1); + sharp96.writeLine(i, (unsigned char *)lynx + (12 * i)); + sharp96.toggleVCOM(); + if (++i == 96) { + i = 0; + sharp96.clear(); + } +} + +int main(void) +{ + unsigned char i = 0; + arch.setup(); + gpio.setup(); + kout.setup(); + spi.setup(); + sharp96.setup(); + sharp96.powerOn(); + sharp96.clear(); + for (i = 0; i < 96; i++) { + sharp96.writeLine(i, (unsigned char *)lynx + (12 * i)); + } + + arch.idle_loop(); + + return 0; +} diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc index 8480b71..1581c2d 100644 --- a/src/arch/msp430fr5969lp/Makefile.inc +++ b/src/arch/msp430fr5969lp/Makefile.inc @@ -24,8 +24,8 @@ ifneq ($(findstring i2c,${arch_drivers}), ) TARGETS += src/arch/msp430fr5969lp/driver/i2c.cc endif -ifneq ($(findstring spi,${arch_drivers}), ) - TARGETS += src/arch/msp430fr5969lp/driver/spi.cc +ifneq ($(findstring spi_a1,${arch_drivers}), ) + TARGETS += src/arch/msp430fr5969lp/driver/spi_a1.cc endif ifneq ($(findstring spi_b,${arch_drivers}), ) diff --git a/src/arch/msp430fr5969lp/driver/spi.cc b/src/arch/msp430fr5969lp/driver/spi.cc deleted file mode 100644 index 981bc53..0000000 --- a/src/arch/msp430fr5969lp/driver/spi.cc +++ /dev/null @@ -1,61 +0,0 @@ -#include "driver/spi.h" -#include <msp430.h> - -signed char SPI::setup() -{ - /* UCA1CLK Pin 2.4 */ - P2SEL0 &= ~BIT4; - P2SEL1 |= BIT4; - P2DIR |= BIT4; - - /* UCA1SIMO Pin 2.5 */ - P2SEL0 &= ~BIT5; - P2SEL1 |= BIT5; - P2DIR |= BIT5; - - /* UCA1SOMI Pin 2.6 */ - P2SEL0 &= ~BIT6; - P2SEL1 |= BIT6; - P2DIR &= ~BIT6; - //P2REN |= BIT6; - - UCA1CTLW0 |= UCSWRST; - UCA1MCTLW = 0; // no modulation - - UCA1CTLW0 = UCCKPH | UCMSB | UCMST | UCSYNC | UCMODE_0 | UCSSEL__SMCLK | UCSWRST; - UCA1BRW = 15; // /16 -> 1MHz - UCA1CTLW0 &= ~UCSWRST; -} - -signed char SPI::xmit(unsigned char tx_len, unsigned char *tx_buf, - unsigned char rx_len, unsigned char *rx_buf) -{ - volatile char rxbuf_cache; - if (tx_len < 1) { - return -1; - } - - UCA1IE &= ~(UCTXIE | UCRXIE); - - while (UCA1STATW & UCBUSY) ; - - rxbuf_cache = UCA1RXBUF; - UCA1TXBUF = tx_buf[0]; - - unsigned char tx_pos = 1; - unsigned char rx_pos = 0; - - while (tx_pos < tx_len || rx_pos < rx_len) { - if ((tx_pos < tx_len) && (UCA1IF & UCTXIFG)) { - UCBA1TXBUF = tx_buf[tx_pos++]; - } - if (UCA1IFG & UCRXIFG) { - if (rx_pos < rx_len) { - rx_buf[rx_pos] = UCA1RXBUF; - } else { - rxbuf_cache = UCA1RXBUF; - } - } - rx_pos++; - } -} diff --git a/src/arch/msp430fr5969lp/driver/spi_b.cc b/src/arch/msp430fr5969lp/driver/spi_b.cc index eafb94e..2eb3a79 100644 --- a/src/arch/msp430fr5969lp/driver/spi_b.cc +++ b/src/arch/msp430fr5969lp/driver/spi_b.cc @@ -1,8 +1,10 @@ -#include "driver/spi.h" +#include "driver/spi_b.h" #include <msp430.h> -signed char SPI::setup() +void SPI::setup() { + UCB0CTLW0 |= UCSWRST; + /* UCB0CLK Pin 2.2 */ P2SEL0 &= ~BIT2; P2SEL1 |= BIT2; @@ -24,19 +26,25 @@ signed char SPI::setup() UCB0CTLW0 &= ~UCSWRST; } +static inline unsigned char clean_rxbuf() +{ + return UCB0RXBUF; +} + signed char SPI::xmit(unsigned char tx_len, unsigned char *tx_buf, unsigned char rx_len, unsigned char *rx_buf) { - volatile char rxbuf_cache; if (tx_len < 1) { return -1; } - UCB0IE &= ~(UCTXIE | UCRXIE); - while (UCB0STATW & UCBUSY) ; - rxbuf_cache = UCB0RXBUF; + if (!(UCB0IFG & UCTXIFG)) { + return -1; + } + + UCB0IFG &= ~UCRXIFG; UCB0TXBUF = tx_buf[0]; unsigned char tx_pos = 1; @@ -50,9 +58,13 @@ signed char SPI::xmit(unsigned char tx_len, unsigned char *tx_buf, if (rx_pos < rx_len) { rx_buf[rx_pos] = UCB0RXBUF; } else { - rxbuf_cache = UCB0RXBUF; + UCB0IFG &= ~UCRXIFG; } rx_pos++; } } + while (UCB0STATW & UCBUSY) ; + return 0; } + +SPI spi; diff --git a/src/driver/sharp96.cc b/src/driver/sharp96.cc new file mode 100644 index 0000000..1e9a2ec --- /dev/null +++ b/src/driver/sharp96.cc @@ -0,0 +1,80 @@ +#include "driver/sharp96.h" +#include "driver/spi_b.h" +#include "driver/gpio.h" + +#ifndef SHARP96_POWER_PIN +#error makeflag sharp96_power_pin required +#endif + +#ifndef SHARP96_EN_PIN +#error makeflag sharp96_en_pin required +#endif + +#ifndef SHARP96_CS_PIN +#error makeflag sharp96_cs_pin required +#endif + +#define CMD_WRITE_LINE 0x80 +#define CMD_TOGGLE_VCOM 0x40 +#define CMD_CLEAR_SCREEN 0x20 + +void Sharp96::setup() +{ + gpio.output(SHARP96_POWER_PIN); + gpio.output(SHARP96_EN_PIN); + gpio.output(SHARP96_CS_PIN); +} + +void Sharp96::powerOn() +{ + gpio.write(SHARP96_POWER_PIN, 1); + gpio.write(SHARP96_EN_PIN, 1); +} + +void Sharp96::powerOff() +{ + gpio.write(SHARP96_EN_PIN, 0); + gpio.write(SHARP96_POWER_PIN, 0); +} + +unsigned char Sharp96::swap_bits(unsigned char byte) +{ + byte = (byte & 0xF0) >> 4 | (byte & 0x0F) << 4; + byte = (byte & 0xCC) >> 2 | (byte & 0x33) << 2; + byte = (byte & 0xAA) >> 1 | (byte & 0x55) << 1; + return byte; +} + +void Sharp96::clear() +{ + gpio.write(SHARP96_CS_PIN, 1); + txbuf[0] = CMD_CLEAR_SCREEN | (CMD_TOGGLE_VCOM * vcom); + txbuf[1] = 0; + spi.xmit(2, txbuf, 0, txbuf); + gpio.write(SHARP96_CS_PIN, 0); +} + +void Sharp96::writeLine(unsigned char line_no, unsigned char* data) +{ + txbuf[0] = CMD_WRITE_LINE | (CMD_WRITE_LINE * vcom); + txbuf[1] = swap_bits(line_no + 1); + gpio.write(SHARP96_CS_PIN, 1); + spi.xmit(2, txbuf, 0, txbuf); + spi.xmit(12, data, 0, txbuf); + txbuf[0] = 0; + txbuf[1] = 0; + spi.xmit(2, txbuf, 0, txbuf); + gpio.write(SHARP96_CS_PIN, 0); +} + +void Sharp96::toggleVCOM() +{ + vcom = !vcom; + txbuf[0] = CMD_TOGGLE_VCOM * vcom; + txbuf[1] = 0; + gpio.write(SHARP96_CS_PIN, 1); + spi.xmit(2, txbuf, 0, txbuf); + gpio.write(SHARP96_CS_PIN, 0); +} + +Sharp96 sharp96; |