mirror of
https://github.com/digistump/DigistumpArduino.git
synced 2025-11-03 04:54:47 -08:00
switch to setup for Arduino Boards Manager
This commit is contained in:
7
digistump-sam/libraries/UTFT/hardware/arm/HW_ARM.h
Normal file
7
digistump-sam/libraries/UTFT/hardware/arm/HW_ARM.h
Normal file
@@ -0,0 +1,7 @@
|
||||
void UTFT::_convert_float(char *buf, double num, int width, byte prec)
|
||||
{
|
||||
char format[10];
|
||||
|
||||
sprintf(format, "%%%i.%if", width, prec);
|
||||
sprintf(buf, format, num);
|
||||
}
|
||||
26
digistump-sam/libraries/UTFT/hardware/arm/HW_ARM_defines.h
Normal file
26
digistump-sam/libraries/UTFT/hardware/arm/HW_ARM_defines.h
Normal file
@@ -0,0 +1,26 @@
|
||||
// CTE TFT LCD/SD Shield for Arduino Due
|
||||
// -------------------------------------
|
||||
// Uncomment the following line if you are using this shield
|
||||
//#define CTE_DUE_SHIELD 1
|
||||
//
|
||||
// For this shield: RS=25, WR=26, CS=27, RST=28
|
||||
//********************************************************************
|
||||
|
||||
// *** Hardwarespecific defines ***
|
||||
#define cbi(reg, bitmask) *reg &= ~bitmask
|
||||
#define sbi(reg, bitmask) *reg |= bitmask
|
||||
#define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask);
|
||||
#define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask);
|
||||
|
||||
#define cport(port, data) port &= data
|
||||
#define sport(port, data) port |= data
|
||||
|
||||
#define swap(type, i, j) {type t = i; i = j; j = t;}
|
||||
|
||||
#define fontbyte(x) cfont.font[x]
|
||||
|
||||
#define pgm_read_word(data) *data
|
||||
#define pgm_read_byte(data) *data
|
||||
#define regtype volatile uint32_t
|
||||
#define regsize uint32_t
|
||||
#define bitmapdatatype unsigned short*
|
||||
338
digistump-sam/libraries/UTFT/hardware/arm/HW_SAM3X8E.h
Normal file
338
digistump-sam/libraries/UTFT/hardware/arm/HW_SAM3X8E.h
Normal file
@@ -0,0 +1,338 @@
|
||||
// *** Hardwarespecific functions ***
|
||||
void UTFT::_hw_special_init()
|
||||
{
|
||||
//REG_PIOA_OWER = 0xFFFFFFFF;
|
||||
//REG_PIOB_OWER = 0xFFFFFFFF;
|
||||
//REG_PIOC_OWER = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (display_serial_mode==SERIAL_4PIN)
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_RS, B_RS);
|
||||
else
|
||||
cbi(P_RS, B_RS);
|
||||
}
|
||||
|
||||
if (VL & 0x80)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x40)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x20)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x10)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x08)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x04)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x02)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x01)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
break;
|
||||
case 8:
|
||||
#ifdef CTE_DUE_SHIELD
|
||||
REG_PIOC_CODR=0xFF000;
|
||||
REG_PIOC_SODR=(VH<<12) & 0xFF000;
|
||||
pulse_low(P_WR, B_WR);
|
||||
REG_PIOC_CODR=0xFF000;
|
||||
REG_PIOC_SODR=(VL<<12) & 0xFF000;
|
||||
pulse_low(P_WR, B_WR);
|
||||
#else
|
||||
//Clear port registers
|
||||
REG_PIOA_CODR=0xc000; //PA14,PA15
|
||||
REG_PIOB_CODR=0x4000000; //PB26
|
||||
REG_PIOD_CODR=0x64f; //PD0-3,PD6,PD9-10
|
||||
|
||||
//DB08 on PIN22 -> PIO_PB26
|
||||
REG_PIOB_SODR=(VH<<26) & 0x4000000;
|
||||
//DB09 on PIN23 -> PIO_PA14
|
||||
REG_PIOA_SODR=(VH<<13) & 0x4000;
|
||||
//DB10 on PIN24 -> PIO_PA15
|
||||
REG_PIOA_SODR=(VH<<13) & 0x8000;
|
||||
//DB11 on PIN25 -> PIO_PD0
|
||||
REG_PIOD_SODR=(VH>>3) & 0x01;
|
||||
//DB12 on PIN26 -> PIO_PD1
|
||||
REG_PIOD_SODR=(VH>>3) & 0x02;
|
||||
//DB13 on PIN27 -> PIO_PD2
|
||||
REG_PIOD_SODR=(VH>>3) & 0x04;
|
||||
//DB14 on PIN28 -> PIO_PD3
|
||||
REG_PIOD_SODR=(VH>>3) & 0x08;
|
||||
//DB15 on PIN29 -> PIO_PD6
|
||||
REG_PIOD_SODR=(VH>>1) & 0x40;
|
||||
pulse_low(P_WR, B_WR);
|
||||
|
||||
REG_PIOA_CODR=0xc000; //PA14,PA15
|
||||
REG_PIOB_CODR=0x4000000; //PB26
|
||||
REG_PIOD_CODR=0x64f; //PD0-3,PD6,PD9-10
|
||||
//DB08 on PIN22 -> PIO_PB26
|
||||
REG_PIOB_SODR=(VL<<26) & 0x4000000;
|
||||
//DB09 on PIN23 -> PIO_PA14
|
||||
REG_PIOA_SODR=(VL<<13) & 0x4000;
|
||||
//DB10 on PIN24 -> PIO_PA15
|
||||
REG_PIOA_SODR=(VL<<13) & 0x8000;
|
||||
//DB11 on PIN25 -> PIO_PD0
|
||||
REG_PIOD_SODR=(VL>>3) & 0x01;
|
||||
//DB12 on PIN26 -> PIO_PD1
|
||||
REG_PIOD_SODR=(VL>>3) & 0x02;
|
||||
//DB13 on PIN27 -> PIO_PD2
|
||||
REG_PIOD_SODR=(VL>>3) & 0x04;
|
||||
//DB14 on PIN28 -> PIO_PD3
|
||||
REG_PIOD_SODR=(VL>>3) & 0x08;
|
||||
//DB15 on PIN29 -> PIO_PD6
|
||||
REG_PIOD_SODR=(VL>>1) & 0x40;
|
||||
pulse_low(P_WR, B_WR);
|
||||
#endif
|
||||
break;
|
||||
case 16:
|
||||
#ifdef CTE_DUE_SHIELD
|
||||
REG_PIOC_CODR=0xFF1FE;
|
||||
REG_PIOC_SODR=(VL<<1) & 0x1FE;
|
||||
REG_PIOC_SODR=(VH<<12) & 0xFF000;
|
||||
#else
|
||||
//Clear port registers
|
||||
REG_PIOA_CODR=0xc080; //PA7,PA14,PA15
|
||||
REG_PIOB_CODR=0x4000000; //PB26
|
||||
REG_PIOC_CODR=0x3e; //PC1 - PC5
|
||||
REG_PIOD_CODR=0x64f; //PD0-3,PD6,PD9-10
|
||||
|
||||
//DB00 on PIN37 -> PIO_PC5
|
||||
REG_PIOC_SODR=(VL<<5) & 0x20;
|
||||
//DB01 on PIN36 -> PIO_PC4
|
||||
REG_PIOC_SODR=(VL<<3) & 0x10;
|
||||
//DB02 on PIN35 -> PIO_PC3
|
||||
REG_PIOC_SODR=(VL<<1) & 0x08;
|
||||
//DB03 on PIN34 -> PIO_PC2
|
||||
REG_PIOC_SODR=(VL>>1) & 0x04;
|
||||
//DB04 on PIN33 -> PIO_PC1
|
||||
REG_PIOC_SODR=(VL>>3) & 0x02;
|
||||
//DB05 on PIN32 -> PIO_PD10
|
||||
REG_PIOD_SODR=(VL<<5) & 0x400;
|
||||
//DB06 on PIN31 -> PIO_PA7
|
||||
REG_PIOA_SODR=(VL<<1) & 0x80;
|
||||
//DB07 on PIN30 -> PIO_PD9
|
||||
REG_PIOD_SODR=(VL<<2) & 0x200;
|
||||
//DB08 on PIN22 -> PIO_PB26
|
||||
REG_PIOB_SODR=(VH<<26) & 0x4000000;
|
||||
//DB09 on PIN23 -> PIO_PA14
|
||||
REG_PIOA_SODR=(VH<<13) & 0x4000;
|
||||
//DB10 on PIN24 -> PIO_PA15
|
||||
REG_PIOA_SODR=(VH<<13) & 0x8000;
|
||||
//DB11 on PIN25 -> PIO_PD0
|
||||
REG_PIOD_SODR=(VH>>3) & 0x01;
|
||||
//DB12 on PIN26 -> PIO_PD1
|
||||
REG_PIOD_SODR=(VH>>3) & 0x02;
|
||||
//DB13 on PIN27 -> PIO_PD2
|
||||
REG_PIOD_SODR=(VH>>3) & 0x04;
|
||||
//DB14 on PIN28 -> PIO_PD3
|
||||
REG_PIOD_SODR=(VH>>3) & 0x08;
|
||||
//DB15 on PIN29 -> PIO_PD6
|
||||
REG_PIOD_SODR=(VH>>1) & 0x40;
|
||||
#endif
|
||||
pulse_low(P_WR, B_WR);
|
||||
break;
|
||||
case LATCHED_16:
|
||||
asm("nop"); // Mode is unsupported
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_set_direction_registers(byte mode)
|
||||
{
|
||||
if (mode!=LATCHED_16)
|
||||
{
|
||||
#ifdef CTE_DUE_SHIELD
|
||||
if (mode==16)
|
||||
{
|
||||
REG_PIOC_OER=0x000FF1FE;
|
||||
}
|
||||
else
|
||||
REG_PIOC_OER=0x000FF000;
|
||||
#else
|
||||
REG_PIOA_OER=0x0000c000; //PA14,PA15 enable
|
||||
REG_PIOB_OER=0x04000000; //PB26 enable
|
||||
REG_PIOD_OER=0x0000064f; //PD0-3,PD6,PD9-10 enable
|
||||
if (mode==16)
|
||||
{
|
||||
REG_PIOA_OER=0x00000080; //PA7 enable
|
||||
REG_PIOC_OER=0x0000003e; //PC1 - PC5 enable
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
asm("nop"); // Mode is unsupported
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_16(int ch, int cl, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
#ifdef CTE_DUE_SHIELD
|
||||
REG_PIOC_CODR=0xFF1FE;
|
||||
REG_PIOC_SODR=(cl<<1) & 0x1FE;
|
||||
REG_PIOC_SODR=(ch<<12) & 0xFF000;
|
||||
#else
|
||||
//Clear port registers
|
||||
REG_PIOA_CODR=0xc080; //PA7,PA14,PA15
|
||||
REG_PIOB_CODR=0x4000000; //PB26
|
||||
REG_PIOC_CODR=0x3e; //PC1 - PC5
|
||||
REG_PIOD_CODR=0x64f; //PD0-3,PD6,PD9-10
|
||||
|
||||
//DB00 on PIN37 -> PIO_PC5
|
||||
REG_PIOC_SODR=(cl<<5) & 0x20;
|
||||
//DB01 on PIN36 -> PIO_PC4
|
||||
REG_PIOC_SODR=(cl<<3) & 0x10;
|
||||
//DB02 on PIN35 -> PIO_PC3
|
||||
REG_PIOC_SODR=(cl<<1) & 0x08;
|
||||
//DB03 on PIN34 -> PIO_PC2
|
||||
REG_PIOC_SODR=(cl>>1) & 0x04;
|
||||
//DB04 on PIN33 -> PIO_PC1
|
||||
REG_PIOC_SODR=(cl>>3) & 0x02;
|
||||
//DB05 on PIN32 -> PIO_PD10
|
||||
REG_PIOD_SODR=(cl<<5) & 0x400;
|
||||
//DB06 on PIN31 -> PIO_PA7
|
||||
REG_PIOA_SODR=(cl<<1) & 0x80;
|
||||
//DB07 on PIN30 -> PIO_PD9
|
||||
REG_PIOD_SODR=(cl<<2) & 0x200;
|
||||
//DB08 on PIN22 -> PIO_PB26
|
||||
REG_PIOB_SODR=(ch<<26) & 0x4000000;
|
||||
//DB09 on PIN23 -> PIO_PA14
|
||||
REG_PIOA_SODR=(ch<<13) & 0x4000;
|
||||
//DB10 on PIN24 -> PIO_PA15
|
||||
REG_PIOA_SODR=(ch<<13) & 0x8000;
|
||||
//DB11 on PIN25 -> PIO_PD0
|
||||
REG_PIOD_SODR=(ch>>3) & 0x01;
|
||||
//DB12 on PIN26 -> PIO_PD1
|
||||
REG_PIOD_SODR=(ch>>3) & 0x02;
|
||||
//DB13 on PIN27 -> PIO_PD2
|
||||
REG_PIOD_SODR=(ch>>3) & 0x04;
|
||||
//DB14 on PIN28 -> PIO_PD3
|
||||
REG_PIOD_SODR=(ch>>3) & 0x08;
|
||||
//DB15 on PIN29 -> PIO_PD6
|
||||
REG_PIOD_SODR=(ch>>1) & 0x40;
|
||||
#endif
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_8(int ch, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
#ifdef CTE_DUE_SHIELD
|
||||
REG_PIOC_CODR=0xFF000;
|
||||
REG_PIOC_SODR=(ch<<12) & 0xFF000;
|
||||
#else
|
||||
//Clear port registers
|
||||
REG_PIOA_CODR=0xc000; //PA14,PA15
|
||||
REG_PIOB_CODR=0x4000000; //PB26
|
||||
REG_PIOD_CODR=0x64f; //PD0-3,PD6,PD9-10
|
||||
|
||||
//DB08 on PIN22 -> PIO_PB26
|
||||
REG_PIOB_SODR=(ch<<26) & 0x4000000;
|
||||
//DB09 on PIN23 -> PIO_PA14
|
||||
REG_PIOA_SODR=(ch<<13) & 0x4000;
|
||||
//DB10 on PIN24 -> PIO_PA15
|
||||
REG_PIOA_SODR=(ch<<13) & 0x8000;
|
||||
//DB11 on PIN25 -> PIO_PD0
|
||||
REG_PIOD_SODR=(ch>>3) & 0x01;
|
||||
//DB12 on PIN26 -> PIO_PD1
|
||||
REG_PIOD_SODR=(ch>>3) & 0x02;
|
||||
//DB13 on PIN27 -> PIO_PD2
|
||||
REG_PIOD_SODR=(ch>>3) & 0x04;
|
||||
//DB14 on PIN28 -> PIO_PD3
|
||||
REG_PIOD_SODR=(ch>>3) & 0x08;
|
||||
//DB15 on PIN29 -> PIO_PD6
|
||||
REG_PIOD_SODR=(ch>>1) & 0x40;
|
||||
#endif
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
239
digistump-sam/libraries/UTFT/hardware/avr/HW_ATmega1280.h
Normal file
239
digistump-sam/libraries/UTFT/hardware/avr/HW_ATmega1280.h
Normal file
@@ -0,0 +1,239 @@
|
||||
// *** Hardwarespecific functions ***
|
||||
void UTFT::_hw_special_init()
|
||||
{
|
||||
}
|
||||
|
||||
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (display_serial_mode==SERIAL_4PIN)
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_RS, B_RS);
|
||||
else
|
||||
cbi(P_RS, B_RS);
|
||||
}
|
||||
|
||||
if (VL & 0x80)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x40)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x20)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x10)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x08)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x04)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x02)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x01)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
break;
|
||||
case 8:
|
||||
#if defined(USE_UNO_SHIELD_ON_MEGA)
|
||||
PORTG &= ~0x20;
|
||||
PORTG |= (VH & 0x10)<<1;
|
||||
PORTH &= ~0x18;
|
||||
PORTH |= (VH & 0xC0)>>3;
|
||||
PORTE &= ~0x3B;
|
||||
PORTE |= (VH & 0x03) + ((VH & 0x0C)<<2) + ((VH & 0x20)>>2);
|
||||
pulse_low(P_WR, B_WR);
|
||||
PORTG &= ~0x20;
|
||||
PORTG |= (VL & 0x10)<<1;
|
||||
PORTH &= ~0x18;
|
||||
PORTH |= (VL & 0xC0)>>3;
|
||||
PORTE &= ~0x3B;
|
||||
PORTE |= (VL & 0x03) + ((VL & 0x0C)<<2) + ((VL & 0x20)>>2);
|
||||
pulse_low(P_WR, B_WR);
|
||||
#else
|
||||
PORTA = VH;
|
||||
pulse_low(P_WR, B_WR);
|
||||
PORTA = VL;
|
||||
pulse_low(P_WR, B_WR);
|
||||
#endif
|
||||
break;
|
||||
case 16:
|
||||
PORTA = VH;
|
||||
PORTC = VL;
|
||||
pulse_low(P_WR, B_WR);
|
||||
break;
|
||||
case LATCHED_16:
|
||||
PORTG &= ~0x20;
|
||||
PORTG |= (VH & 0x10)<<1;
|
||||
PORTH &= ~0x18;
|
||||
PORTH |= (VH & 0xC0)>>3;
|
||||
PORTE &= ~0x3B;
|
||||
PORTE |= (VH & 0x03) + ((VH & 0x0C)<<2) + ((VH & 0x20)>>2);
|
||||
cbi(P_ALE, B_ALE);
|
||||
pulse_high(P_ALE, B_ALE);
|
||||
cbi(P_CS, B_CS);
|
||||
PORTG &= ~0x20;
|
||||
PORTG |= (VL & 0x10)<<1;
|
||||
PORTH &= ~0x18;
|
||||
PORTH |= (VL & 0xC0)>>3;
|
||||
PORTE &= ~0x3B;
|
||||
PORTE |= (VL & 0x03) + ((VL & 0x0C)<<2) + ((VL & 0x20)>>2);
|
||||
pulse_low(P_WR, B_WR);
|
||||
sbi(P_CS, B_CS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_set_direction_registers(byte mode)
|
||||
{
|
||||
#if defined(USE_UNO_SHIELD_ON_MEGA)
|
||||
DDRH = 0x18;
|
||||
DDRG = 0x20;
|
||||
DDRE = 0x3B;
|
||||
#else
|
||||
if (mode!=LATCHED_16)
|
||||
{
|
||||
DDRA = 0xFF;
|
||||
if (mode==16)
|
||||
DDRC = 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
DDRH = 0x18;
|
||||
DDRG = 0x20;
|
||||
DDRE = 0x3B;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_16(int ch, int cl, long pix)
|
||||
{
|
||||
#if defined(USE_UNO_SHIELD_ON_MEGA)
|
||||
if (ch==cl)
|
||||
_fast_fill_8(ch, pix);
|
||||
else
|
||||
{
|
||||
for (int i=0; i<pix; i++)
|
||||
{
|
||||
PORTG &= ~0x20;
|
||||
PORTG |= (ch & 0x10)<<1;
|
||||
PORTH &= ~0x18;
|
||||
PORTH |= (ch & 0xC0)>>3;
|
||||
PORTE &= ~0x3B;
|
||||
PORTE |= (ch & 0x03) + ((ch & 0x0C)<<2) + ((ch & 0x20)>>2);
|
||||
pulse_low(P_WR, B_WR);
|
||||
PORTG &= ~0x20;
|
||||
PORTG |= (cl & 0x10)<<1;
|
||||
PORTH &= ~0x18;
|
||||
PORTH |= (cl & 0xC0)>>3;
|
||||
PORTE &= ~0x3B;
|
||||
PORTE |= (cl & 0x03) + ((cl & 0x0C)<<2) + ((cl & 0x20)>>2);
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
#else
|
||||
long blocks;
|
||||
|
||||
PORTA = ch;
|
||||
PORTC = cl;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_8(int ch, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
#if defined(USE_UNO_SHIELD_ON_MEGA)
|
||||
PORTG &= ~0x20;
|
||||
PORTG |= (ch & 0x10)<<1;
|
||||
PORTH &= ~0x18;
|
||||
PORTH |= (ch & 0xC0)>>3;
|
||||
PORTE &= ~0x3B;
|
||||
PORTE |= (ch & 0x03) + ((ch & 0x0C)<<2) + ((ch & 0x20)>>2);
|
||||
#else
|
||||
PORTA = ch;
|
||||
#endif
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
171
digistump-sam/libraries/UTFT/hardware/avr/HW_ATmega328P.h
Normal file
171
digistump-sam/libraries/UTFT/hardware/avr/HW_ATmega328P.h
Normal file
@@ -0,0 +1,171 @@
|
||||
// *** Hardwarespecific functions ***
|
||||
void UTFT::_hw_special_init()
|
||||
{
|
||||
}
|
||||
|
||||
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (display_serial_mode==SERIAL_4PIN)
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_RS, B_RS);
|
||||
else
|
||||
cbi(P_RS, B_RS);
|
||||
}
|
||||
|
||||
if (VL & 0x80)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x40)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x20)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x10)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x08)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x04)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x02)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x01)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
break;
|
||||
case 8:
|
||||
PORTD = VH;
|
||||
pulse_low(P_WR, B_WR);
|
||||
PORTD = VL;
|
||||
pulse_low(P_WR, B_WR);
|
||||
break;
|
||||
case 16:
|
||||
PORTD = VH;
|
||||
cport(PORTC, 0xFC);
|
||||
sport(PORTC, (VL>>6) & 0x03);
|
||||
PORTB = VL & 0x3F;
|
||||
pulse_low(P_WR, B_WR);
|
||||
break;
|
||||
case LATCHED_16:
|
||||
PORTD = VH;
|
||||
cbi(P_ALE, B_ALE);
|
||||
pulse_high(P_ALE, B_ALE);
|
||||
cbi(P_CS, B_CS);
|
||||
PORTD = VL;
|
||||
pulse_low(P_WR, B_WR);
|
||||
sbi(P_CS, B_CS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_set_direction_registers(byte mode)
|
||||
{
|
||||
DDRD = 0xFF;
|
||||
if (mode==16)
|
||||
{
|
||||
DDRB |= 0x3F;
|
||||
DDRC |= 0x03;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_16(int ch, int cl, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
PORTD = ch;
|
||||
cport(PORTC, 0xFC);
|
||||
sport(PORTC, (cl>>6) & 0x03);
|
||||
PORTB = cl & 0x3F;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_8(int ch, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
PORTD = ch;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
222
digistump-sam/libraries/UTFT/hardware/avr/HW_ATmega32U4.h
Normal file
222
digistump-sam/libraries/UTFT/hardware/avr/HW_ATmega32U4.h
Normal file
@@ -0,0 +1,222 @@
|
||||
// *** Hardwarespecific functions ***
|
||||
void UTFT::_hw_special_init()
|
||||
{
|
||||
}
|
||||
|
||||
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (display_serial_mode==SERIAL_4PIN)
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_RS, B_RS);
|
||||
else
|
||||
cbi(P_RS, B_RS);
|
||||
}
|
||||
|
||||
if (VL & 0x80)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x40)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x20)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x10)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x08)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x04)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x02)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x01)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
break;
|
||||
case 8:
|
||||
cport(PORTC, 0xBF);
|
||||
cport(PORTD, 0x60);
|
||||
cport(PORTE, 0xBF);
|
||||
PORTC += ((VH & 0x20)<<1);
|
||||
PORTD += ((VH & 0x40)<<1) + (VH & 0x10) + ((VH & 0x08)>>3) + ((VH & 0x04)>>1) + ((VH & 0x03)<<2);
|
||||
PORTE += ((VH & 0x80)>>1);
|
||||
pulse_low(P_WR, B_WR);
|
||||
|
||||
cport(PORTC, 0xBF);
|
||||
cport(PORTD, 0x60);
|
||||
cport(PORTE, 0xBF);
|
||||
PORTC += ((VL & 0x20)<<1);
|
||||
PORTD += ((VL & 0x40)<<1) + (VL & 0x10) + ((VL & 0x08)>>3) + ((VL & 0x04)>>1) + ((VL & 0x03)<<2);
|
||||
PORTE += ((VL & 0x80)>>1);
|
||||
pulse_low(P_WR, B_WR);
|
||||
break;
|
||||
case 16:
|
||||
cport(PORTB, 0x0F);
|
||||
cport(PORTC, 0x3F);
|
||||
cport(PORTD, 0x20);
|
||||
cport(PORTE, 0xBF);
|
||||
cport(PORTF, 0x3F);
|
||||
|
||||
PORTB |= ((VL & 0x0F)<<4);
|
||||
PORTC |= ((VL & 0x20)<<2) + ((VH & 0x20)<<1);
|
||||
PORTD |= ((VH & 0x40)<<1) + (VH & 0x10) + ((VH & 0x08)>>3) + ((VH & 0x04)>>1) + ((VH & 0x03)<<2) + ((VL & 0x10)<<2);
|
||||
PORTE |= ((VH & 0x80)>>1);
|
||||
PORTF |= ((VL & 0x80)>>1) + ((VL & 0x40)<<1);
|
||||
|
||||
pulse_low(P_WR, B_WR);
|
||||
break;
|
||||
case LATCHED_16:
|
||||
cport(PORTC, 0xBF);
|
||||
cport(PORTD, 0x60);
|
||||
cport(PORTE, 0xBF);
|
||||
PORTC += ((VH & 0x20)<<1);
|
||||
PORTD += ((VH & 0x40)<<1) + (VH & 0x10) + ((VH & 0x08)>>3) + ((VH & 0x04)>>1) + ((VH & 0x03)<<2);
|
||||
PORTE += ((VH & 0x80)>>1);
|
||||
cbi(P_ALE, B_ALE);
|
||||
pulse_high(P_ALE, B_ALE);
|
||||
cbi(P_CS, B_CS);
|
||||
cport(PORTC, 0xBF);
|
||||
cport(PORTD, 0x60);
|
||||
cport(PORTE, 0xBF);
|
||||
PORTC += ((VL & 0x20)<<1);
|
||||
PORTD += ((VL & 0x40)<<1) + (VL & 0x10) + ((VL & 0x08)>>3) + ((VL & 0x04)>>1) + ((VL & 0x03)<<2);
|
||||
PORTE += ((VL & 0x80)>>1);
|
||||
pulse_low(P_WR, B_WR);
|
||||
sbi(P_CS, B_CS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_set_direction_registers(byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 8:
|
||||
case LATCHED_16:
|
||||
DDRC |= 0x40;
|
||||
DDRD |= 0x9F;
|
||||
DDRE |= 0x40;
|
||||
break;
|
||||
case 16:
|
||||
DDRB |= 0xF0;
|
||||
DDRC |= 0xC0;
|
||||
DDRD |= 0xDF;
|
||||
DDRE |= 0x40;
|
||||
DDRF |= 0xC0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_16(int ch, int cl, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
cport(PORTB, 0x0F);
|
||||
cport(PORTC, 0x3F);
|
||||
cport(PORTD, 0x20);
|
||||
cport(PORTE, 0xBF);
|
||||
cport(PORTF, 0x3F);
|
||||
|
||||
PORTB |= ((cl & 0x0F)<<4);
|
||||
PORTC |= ((cl & 0x20)<<2) + ((ch & 0x20)<<1);
|
||||
PORTD |= ((ch & 0x40)<<1) + (ch & 0x10) + ((ch & 0x08)>>3) + ((ch & 0x04)>>1) + ((ch & 0x03)<<2) + ((cl & 0x10)<<2);
|
||||
PORTE |= ((ch & 0x80)>>1);
|
||||
PORTF |= ((cl & 0x80)>>1) + ((cl & 0x40)<<1);
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_8(int ch, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
cport(PORTC, 0xBF);
|
||||
cport(PORTD, 0x60);
|
||||
cport(PORTE, 0xBF);
|
||||
|
||||
PORTC |= ((ch & 0x20)<<1);
|
||||
PORTD |= ((ch & 0x40)<<1) + (ch & 0x10) + ((ch & 0x08)>>3) + ((ch & 0x04)>>1) + ((ch & 0x03)<<2);
|
||||
PORTE |= ((ch & 0x80)>>1);
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
pulse_low(P_WR, B_WR);pulse_low(P_WR, B_WR);
|
||||
}
|
||||
}
|
||||
4
digistump-sam/libraries/UTFT/hardware/avr/HW_AVR.h
Normal file
4
digistump-sam/libraries/UTFT/hardware/avr/HW_AVR.h
Normal file
@@ -0,0 +1,4 @@
|
||||
void UTFT::_convert_float(char *buf, double num, int width, byte prec)
|
||||
{
|
||||
dtostrf(num, width, prec, buf);
|
||||
}
|
||||
25
digistump-sam/libraries/UTFT/hardware/avr/HW_AVR_defines.h
Normal file
25
digistump-sam/libraries/UTFT/hardware/avr/HW_AVR_defines.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// Enable or disable the use of a display shield designed for use on
|
||||
// an Arduino Uno (or compatible) on an Arduino Mega
|
||||
//
|
||||
// ** Currently only available for 8bit display shields **
|
||||
//
|
||||
// Uncomment the following line to enable this feature
|
||||
//#define USE_UNO_SHIELD_ON_MEGA 1
|
||||
//********************************************************************
|
||||
|
||||
// *** Hardwarespecific defines ***
|
||||
#define cbi(reg, bitmask) *reg &= ~bitmask
|
||||
#define sbi(reg, bitmask) *reg |= bitmask
|
||||
#define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask);
|
||||
#define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask);
|
||||
|
||||
#define cport(port, data) port &= data
|
||||
#define sport(port, data) port |= data
|
||||
|
||||
#define swap(type, i, j) {type t = i; i = j; j = t;}
|
||||
|
||||
#define fontbyte(x) pgm_read_byte(&cfont.font[x])
|
||||
|
||||
#define regtype volatile uint8_t
|
||||
#define regsize uint8_t
|
||||
#define bitmapdatatype unsigned int*
|
||||
7
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32.h
Normal file
7
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32.h
Normal file
@@ -0,0 +1,7 @@
|
||||
void UTFT::_convert_float(char *buf, double num, int width, byte prec)
|
||||
{
|
||||
char format[10];
|
||||
|
||||
sprintf(format, "%%%i.%if", width, prec);
|
||||
sprintf(buf, format, num);
|
||||
}
|
||||
174
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32MX320F128H.h
Normal file
174
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32MX320F128H.h
Normal file
@@ -0,0 +1,174 @@
|
||||
// *** Hardwarespecific functions ***
|
||||
void UTFT::_hw_special_init()
|
||||
{
|
||||
}
|
||||
|
||||
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (display_serial_mode==SERIAL_4PIN)
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_RS, B_RS);
|
||||
else
|
||||
cbi(P_RS, B_RS);
|
||||
}
|
||||
|
||||
if (VL & 0x80)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x40)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x20)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x10)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x08)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x04)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x02)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x01)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
break;
|
||||
case 8:
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VH;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VL;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
break;
|
||||
case 16:
|
||||
LATDCLR = 0xFF;
|
||||
LATDSET = VL & 0xFF;
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VH & 0xFF;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
break;
|
||||
case LATCHED_16:
|
||||
asm("nop"); // Mode is unsupported
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_set_direction_registers(byte mode)
|
||||
{
|
||||
if (mode!=LATCHED_16)
|
||||
{
|
||||
TRISE=0;
|
||||
if (mode==16)
|
||||
TRISD=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
asm("nop"); // Mode is unsupported
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_16(int ch, int cl, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
LATDCLR = 0xFF;
|
||||
LATDSET = cl & 0xFF;
|
||||
LATECLR = 0xFF;
|
||||
LATESET = ch & 0xFF;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_8(int ch, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
LATECLR = 0xFF;
|
||||
LATESET = ch;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
}
|
||||
174
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32MX340F512H.h
Normal file
174
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32MX340F512H.h
Normal file
@@ -0,0 +1,174 @@
|
||||
// *** Hardwarespecific functions ***
|
||||
void UTFT::_hw_special_init()
|
||||
{
|
||||
}
|
||||
|
||||
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (display_serial_mode==SERIAL_4PIN)
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_RS, B_RS);
|
||||
else
|
||||
cbi(P_RS, B_RS);
|
||||
}
|
||||
|
||||
if (VL & 0x80)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x40)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x20)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x10)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x08)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x04)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x02)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x01)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
break;
|
||||
case 8:
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VH;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VL;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
break;
|
||||
case 16:
|
||||
LATDCLR = 0xFF;
|
||||
LATDSET = VL & 0xFF;
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VH & 0xFF;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
break;
|
||||
case LATCHED_16:
|
||||
asm("nop"); // Mode is unsupported
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_set_direction_registers(byte mode)
|
||||
{
|
||||
if (mode!=LATCHED_16)
|
||||
{
|
||||
TRISE=0;
|
||||
if (mode==16)
|
||||
TRISD=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
asm("nop"); // Mode is unsupported
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_16(int ch, int cl, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
LATDCLR = 0xFF;
|
||||
LATDSET = cl & 0xFF;
|
||||
LATECLR = 0xFF;
|
||||
LATESET = ch & 0xFF;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_8(int ch, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
LATECLR = 0xFF;
|
||||
LATESET = ch;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
}
|
||||
188
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32MX795F512L.h
Normal file
188
digistump-sam/libraries/UTFT/hardware/pic32/HW_PIC32MX795F512L.h
Normal file
@@ -0,0 +1,188 @@
|
||||
// *** Hardwarespecific functions ***
|
||||
void UTFT::_hw_special_init()
|
||||
{
|
||||
}
|
||||
|
||||
void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1:
|
||||
if (display_serial_mode==SERIAL_4PIN)
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (VH==1)
|
||||
sbi(P_RS, B_RS);
|
||||
else
|
||||
cbi(P_RS, B_RS);
|
||||
}
|
||||
|
||||
if (VL & 0x80)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x40)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x20)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x10)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x08)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x04)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x02)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
if (VL & 0x01)
|
||||
sbi(P_SDA, B_SDA);
|
||||
else
|
||||
cbi(P_SDA, B_SDA);
|
||||
pulse_low(P_SCL, B_SCL);
|
||||
break;
|
||||
case 8:
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VH;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VL;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
break;
|
||||
case 16:
|
||||
#ifdef AQUALED_SHIELD
|
||||
LATACLR = 0xFF;
|
||||
LATASET = VL & 0xFF;
|
||||
#else
|
||||
LATDCLR = 0xFF;
|
||||
LATDSET = VL & 0xFF;
|
||||
#endif
|
||||
LATECLR = 0xFF;
|
||||
LATESET = VH & 0xFF;
|
||||
*P_WR &= ~B_WR;
|
||||
*P_WR |= B_WR;
|
||||
break;
|
||||
case LATCHED_16:
|
||||
asm("nop"); // Mode is unsupported
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_set_direction_registers(byte mode)
|
||||
{
|
||||
if (mode!=LATCHED_16)
|
||||
{
|
||||
TRISE=0;
|
||||
if (mode==16)
|
||||
#ifdef AQUALED_SHIELD
|
||||
TRISA=0;
|
||||
#else
|
||||
TRISD=0;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
asm("nop"); // Mode is unsupported
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_16(int ch, int cl, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
#ifdef AQUALED_SHIELD
|
||||
LATACLR = 0xFF;
|
||||
LATASET = cl & 0xFF;
|
||||
#else
|
||||
LATDCLR = 0xFF;
|
||||
LATDSET = cl & 0xFF;
|
||||
#endif
|
||||
LATECLR = 0xFF;
|
||||
LATESET = ch & 0xFF;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
}
|
||||
|
||||
void UTFT::_fast_fill_8(int ch, long pix)
|
||||
{
|
||||
long blocks;
|
||||
|
||||
LATECLR = 0xFF;
|
||||
LATESET = ch;
|
||||
|
||||
blocks = pix/16;
|
||||
for (int i=0; i<blocks; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
if ((pix % 16) != 0)
|
||||
for (int i=0; i<(pix % 16)+1; i++)
|
||||
{
|
||||
*P_WR &= ~B_WR; *P_WR |= B_WR; *P_WR &= ~B_WR; *P_WR |= B_WR;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// AquaLEDSource All in One Super Screw Shield
|
||||
// -------------------------------------------
|
||||
// Uncomment the following line if you are using this shield
|
||||
//#define AQUALED_SHIELD 1
|
||||
//
|
||||
// For this shield: RS=82, WR=83, CS=84, RST=85 (Standard for chipKit Max32)
|
||||
//**************************************************************************
|
||||
|
||||
// *** Hardwarespecific defines ***
|
||||
#define cbi(reg, bitmask) (*(reg + 1)) = bitmask
|
||||
#define sbi(reg, bitmask) (*(reg + 2)) = bitmask
|
||||
#define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask);
|
||||
#define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask);
|
||||
|
||||
#define cport(port, data) port &= data
|
||||
#define sport(port, data) port |= data
|
||||
|
||||
#define swap(type, i, j) {type t = i; i = j; j = t;}
|
||||
|
||||
#define fontbyte(x) cfont.font[x]
|
||||
|
||||
#define PROGMEM
|
||||
#define regtype volatile uint32_t
|
||||
#define regsize uint16_t
|
||||
#define bitmapdatatype unsigned short*
|
||||
|
||||
Reference in New Issue
Block a user