Skip to content

Commit

Permalink
Merge pull request #1061 from energia/BOOSTXL-SHARP128
Browse files Browse the repository at this point in the history
Boostxl sharp128
  • Loading branch information
StefanSch authored May 4, 2020
2 parents 3116b84 + 4e4a650 commit a89bf8d
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 34 deletions.
63 changes: 39 additions & 24 deletions libraries/LCD_SharpBoosterPack_SPI/LCD_SharpBoosterPack_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
//
// Author : Stefan Schauer
// Date : Mar 05, 2015
// Version: 1.03
// Version: 1.04
// File : LCD_SharpBoosterPack_SPI_main.c
//
// Version: 1.01 : added support for CC3200
// Version: 1.02 : added print class
// Version: 1.03 : added support for Sharp 128
// version: 1.04 : horrible patch for CC13x0 ENERGIA_ARCH_CC13XX
//
// Based on the LCD5110 Library
// Created by Rei VILO on 28/05/12
// Copyright (c) 2012 http://embeddedcomputing.weebly.com
// Copyright (c) 2012 https://embeddedcomputing.weebly.com
// Licence CC = BY SA NC
//
// Edited 2015-07-11 by ReiVilo
Expand All @@ -26,6 +27,9 @@
// Added flushReversed() for reversed display and preserved buffer
// Simplified Clear function
//
// Edited 2019-03-19 by StefaSch
// Added support for smaller memory with put LCD data to FRAM
//

#include <Energia.h>
#include "LCD_SharpBoosterPack_SPI.h"
Expand All @@ -38,13 +42,16 @@ uint8_t _pinVCC;
uint8_t _pinChipSelect;
uint8_t _pinSerialClock;
bool _autoVCOM;
uint8_t lcd_vertical_max;
uint8_t lcd_horizontal_max;


// Booster Pack Pins
// 7 - P2.2 for SPI_CLK mode
// 15 - P1.6 for SPI_SIMO mode
// 6 - P2.4 output pin for SPI_CS
// 2 - P4.2 as output to supply the LCD
// 5 - P4.3 as output for DISP
// 7 - SPI_CLK mode
// 15 - SPI_SIMO mode
// 6 - output pin for SPI_CS
// 2 - output to supply the LCD
// 5 - output for DISP
// Set display's VCC and DISP pins to high


Expand Down Expand Up @@ -83,36 +90,40 @@ uint16_t LCD_SharpBoosterPack_SPI::_index(uint8_t x, uint8_t y)

LCD_SharpBoosterPack_SPI::LCD_SharpBoosterPack_SPI(uint8_t model)
{
_pinChipSelect = P_CS;
_pinDISP = P_DISP;
_pinVCC = P_VCC;
_autoVCOM = true;

lcd_vertical_max = model;
lcd_horizontal_max = model;
LCD_SharpBoosterPack_SPI(P_CS, P_DISP, P_VCC, true, model);
}

static uint8_t * _frameBuffer;
_frameBuffer = new uint8_t[_index(lcd_vertical_max, lcd_horizontal_max)];
DisplayBuffer = (uint8_t *) _frameBuffer;
LCD_SharpBoosterPack_SPI::LCD_SharpBoosterPack_SPI(uint8_t pinChipSelect, uint8_t pinDISP, uint8_t pinVCC, uint8_t model)
{
LCD_SharpBoosterPack_SPI(pinChipSelect, pinDISP, pinVCC, true, model);
}

LCD_SharpBoosterPack_SPI::LCD_SharpBoosterPack_SPI(uint8_t pinChipSelect, uint8_t pinDISP, uint8_t pinVCC, bool autoVCOM, uint8_t model)
#ifdef PLACE_IN_FRAM
uint8_t _frameBuffer[128][128/8] PLACE_IN_FRAM;
#else
uint8_t * _frameBuffer = 0;
#endif

LCD_SharpBoosterPack_SPI::LCD_SharpBoosterPack_SPI(uint8_t pinChipSelect, uint8_t pinDISP, uint8_t pinVCC, bool autoVCOM, uint8_t model)
{

_pinChipSelect = pinChipSelect;
_pinDISP = pinDISP;
_pinVCC = pinVCC;
_autoVCOM = autoVCOM;

digitalWrite(RED_LED, HIGH);
lcd_vertical_max = model;
lcd_horizontal_max = model;
}

LCD_SharpBoosterPack_SPI::LCD_SharpBoosterPack_SPI(uint8_t pinChipSelect, uint8_t pinDISP, uint8_t pinVCC, uint8_t model)
{
LCD_SharpBoosterPack_SPI(pinChipSelect, pinDISP, pinVCC, true, model);
#ifndef PLACE_IN_FRAM
if (_frameBuffer == 0){
_frameBuffer = new uint8_t[_index(lcd_vertical_max, lcd_horizontal_max)];
}
#endif
DisplayBuffer = (uint8_t *) _frameBuffer;
}


void LCD_SharpBoosterPack_SPI::setOrientation(uint8_t orientation)
{
_orientation = orientation % 4;
Expand Down Expand Up @@ -528,9 +539,13 @@ static void SendToggleVCOMCommand(void)
// Set P2.4 High for CS
digitalWrite(_pinChipSelect, HIGH);

#if defined(ENERGIA_ARCH_CC13XX) // Horrible patch for CC13x0
shiftOut(15, 7, MSBFIRST, (char)command);
shiftOut(15, 7, MSBFIRST, (char)SHARP_LCD_TRAILER_BYTE);
#else
SPI.transfer((char)command);
SPI.transfer((char)SHARP_LCD_TRAILER_BYTE);

#endif
// Wait for last byte to be sent, then drop SCS
delayMicroseconds(10);
// Set P2.4 High for CS
Expand Down
12 changes: 9 additions & 3 deletions libraries/LCD_SharpBoosterPack_SPI/LCD_SharpBoosterPack_SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
//
// Author : Stefan Schauer
// Date : Mar 05, 2015
// Version: 1.02
// Version: 1.04
// File : LCD_SharpBoosterPack_SPI_main.h
//
// Based on the LCD5110 Library
// Created by Rei VILO on 28 May 2012
// Copyright (c) 2012 http://embeddedcomputing.weebly.com
// Copyright (c) 2012 https://embeddedcomputing.weebly.com
// Licence CC = BY SA NC
//
// Edited 11 Jul 2015 by ReiVilo
Expand All @@ -21,6 +21,12 @@
// Added support for Sharp 128 with minimal change
// Added flushReversed() for reversed display and preserved buffer
//
// Edited 2019-03-19 by StefaSch
// Added support for smaller memory with put LCD data to FRAM
//
// Edited 22 Apr 2020 by ReiVilo
// Horrible patch for CC13x0 ENERGIA_ARCH_CC13XX
//

#ifndef LCD_SharpBoosterPack_SPI_h
#define LCD_SharpBoosterPack_SPI_h
Expand Down Expand Up @@ -136,7 +142,7 @@ class LCD_SharpBoosterPack_SPI : public Print

///
/// @brief Get size àf the screen
/// @return 96 for 96x96 or &28 for 128x128
/// @return 96 for 96x96 or 128 for 128x128
///
uint8_t getSize();

Expand Down
12 changes: 6 additions & 6 deletions libraries/OneMsTaskTimer/OneMsTaskTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void OneMsTaskTimer_int(void)
{
OneMsTaskTimer::_ticHandler();
}


#endif //if defined(__MSP430__)


Expand Down Expand Up @@ -271,27 +271,27 @@ void OneMsTaskTimer_int(void)
#define DEFAULT_TIMER 1
uint32_t timer_index_ = DEFAULT_TIMER;
static volatile uint32_t g_ulBase;
Clock_Handle myClock = NULL;
Clock_Handle myOneMsTaskTimerClock = NULL;
void OneMsTaskTimer_int(UArg arg);

void OneMsTaskTimer::start(uint32_t timer_index) {
Clock_Params clockParams;
Error_Block eb;
Error_init(&eb);

if (myClock == NULL){
if (myOneMsTaskTimerClock == NULL){
Clock_Params_init(&clockParams);
clockParams.period = (uint32_t)1000 / (uint64_t)Clock_tickPeriod;
clockParams.startFlag = FALSE;
clockParams.arg = (UArg)0x5555;

myClock = Clock_create(OneMsTaskTimer_int, clockParams.period, &clockParams, &eb);
myOneMsTaskTimerClock = Clock_create(OneMsTaskTimer_int, clockParams.period, &clockParams, &eb);
}
Clock_start(myClock);
Clock_start(myOneMsTaskTimerClock);
}

void OneMsTaskTimer::stop() {
Clock_stop(myClock);
Clock_stop(myOneMsTaskTimerClock);
}
void OneMsTaskTimer_int(UArg arg)
{
Expand Down
4 changes: 3 additions & 1 deletion libraries/OneMsTaskTimer/OneMsTaskTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
added suppport for CC3200
by Stefan Sch
23 Apr 2020 - Renamed trivial myClock name to myOneMsTaskTimerClock to avoid prossible conflicts, by Rei Vilo
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
Expand Down Expand Up @@ -101,4 +103,4 @@ namespace OneMsTaskTimer {
void _ticHandler();
}

#endif
#endif

0 comments on commit a89bf8d

Please sign in to comment.