Skip to content

Commit

Permalink
Changed to Arduino 1.5 library format
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyCircuits committed Feb 12, 2016
1 parent 5a3035a commit 5184606
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 2 deletions.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# TinyCircuits TinyScreen/TinyScreen+ Arduino Library

This library allows for easy use of the TinyScreen display and input buttons. Text, shapes, pixel manipulation, flipping, mirroring, and more allow you to display data, pictures, video, games or whatever you can fit in 96 by 64 pixels.

## Basic Example

An example demonstrating and explaining most of the library functions is included. A list of further notes:

* Include the TinyScreen, SPI, and Wire libraries (Wire can be omitted from TinyScreen+ code if necessary)
* Declare TinyScreen as display, and use the correct board type(TinyScreenDefault, TinyScreenAlternate, TinyScreenPlus): TinyScreen display = TinyScreen(TinyScreenPlus);
* TinyScreen library defaults to BGR colors, and this is what the TS_8b and TS_16b color definitions use. This can be changed with setColorMode(TSColorModeRGB);
* Testing for a button press can now be done in a readable way, and works the same when the display is flipped: if (display.getButtons(TSButtonUpperLeft)) { };
* TinyScreen+ supports DMA data transfers- check the end of TinySCreen.cpp
11 changes: 10 additions & 1 deletion TinyScreen.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
TinyScreen.cpp - Last modified 2 February 2016
TinyScreen.cpp - Last modified 11 February 2016
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -641,6 +641,9 @@ void DMAC_Handler() {
uint8_t TinyScreen::getReadyStatusDMA(){
#if defined(ARDUINO_ARCH_SAMD)
return dmaReady;
#else
//it's tough to raise an error about not having DMA in the IDE- try to fall back to regular software transfer
return 1;//always return ready
#endif
}

Expand Down Expand Up @@ -682,6 +685,9 @@ void TinyScreen::writeBufferDMA(uint8_t *txdata,int n) {

//DMAC->CHID.reg = DMAC_CHID_ID(chnltx); //disable DMA to allow lib SPI- necessary? needs to be done after completion
//DMAC->CHCTRLA.reg &= ~DMAC_CHCTRLA_ENABLE;
#else
//it's tough to raise an error about not having DMA in the IDE- try to fall back to regular software transfer
writeBuffer(txdata,n);//just write the data without DMA
#endif
}

Expand All @@ -695,5 +701,8 @@ void TinyScreen::initDMA(void){
DMAC->BASEADDR.reg = (uint32_t)descriptor_section;
DMAC->WRBADDR.reg = (uint32_t)wrb;
DMAC->CTRL.reg = DMAC_CTRL_DMAENABLE | DMAC_CTRL_LVLEN(0xf);
#else
//it's tough to raise an error about not having DMA in the IDE- try to fall back to regular software transfer
//ignore init
#endif
}
2 changes: 1 addition & 1 deletion TinyScreen.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
TinyScreen.h - Last modified 29 January 2016
TinyScreen.h - Last modified 11 February 2016
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=TinyScreen
version=1.1.0
author=TinyCircuits <[email protected]>
maintainer=TinyCircuits <[email protected]>
sentence=Arduino compatible software support for TinyScreen and TinyScreen+.
paragraph=Allows easy use of text and graphics on a tiny display as well as reading built-in button inputs.
category=Display
url=https://github.com/TinyCircuits/TinyCircuits-TinyScreen_Lib
architectures=*

0 comments on commit 5184606

Please sign in to comment.