PSoC 6 Peripheral Driver Library
SegLCD (Segment LCD)

General Description

The Segment LCD Driver provides an API to configure and operate the MXLCD hardware block.

The MXLCD block can be flexibly configured to drive a variety of LCD glass at different voltage levels with multiplex ratios.

Features:

Glossary

SegLCD Solution

The Segment LCD Driver can be used either as a standalone library to manage the MXLCD hardware or as a part of the more complex software solution delivered within ModusToolbox: the Device Configurator SegLCD personality and the SegLCD Configurator tools.

The SegLCD solution provides an easy method to configure an MXLCD block to drive your standard or custom LCD glass:

seglcd_solution.png

The SegLCD solution includes:

Configuration Considerations

To start working with an LCD, first initialize the MXLCD block, then initialize the frame buffer, and then enable the block:

/* Scenario: Enable an LCD block */
{
.drive = CY_SEGLCD_PWM,
.comNum = 8,
.frRate = 70,
.contrast = 70,
/*.clkFreq is unknown here */
};
const uint32_t commons[8] =
{
CY_SEGLCD_COMMON(31, 0UL), /* Com: P13_0 */
CY_SEGLCD_COMMON(32, 1UL), /* Com: P13_1 */
CY_SEGLCD_COMMON(33, 2UL), /* Com: P13_2 */
CY_SEGLCD_COMMON(34, 3UL), /* Com: P13_3 */
CY_SEGLCD_COMMON(35, 4UL), /* Com: P13_4 */
CY_SEGLCD_COMMON(36, 5UL), /* Com: P13_5 */
CY_SEGLCD_COMMON(37, 6UL), /* Com: P13_6 */
CY_SEGLCD_COMMON(38, 7UL) /* Com: P13_7 */
};
Note
If you use ModusToolbox Device Configurator, a SegLCD configuration structure is generated automatically into the GeneratedSource/cycfg_peripherals.h/.c files. All you need is just to call Cy_SegLCD_Init with a pointer to the structure.
/* Then in executable code: */
/* Get the frequency of the assigned peripheral clock divider */
if (CY_SEGLCD_SUCCESS == Cy_SegLCD_Init(LCD0, &config))
{
if (CY_SEGLCD_SUCCESS == Cy_SegLCD_ClrFrame(LCD0, commons))
{
/* Now the block generates LCD signals (all the pixels are off) and is ready to turn on any pixel
* (or many pixels) using any of the frame/pixel/character/display management API functions.
*/
}
else
{
/* error handling */
}
}
else
{
/* error handling */
}

Contrast vs. Frame Rate (cy_stc_seglcd_config_t::contrast vs. cy_stc_seglcd_config_t::frRate)
Some combinations of a frame rate and input frequency can restrict the valid contrast range because of the limited dividers size (for Low Speed mode - 8 bit, and for High Speed mode - 16 bit). For small values of contrast at small frame rates, the required divider values may be beyond permissible limits of the dividers size. For large High Speed clock frequencies, certain ratios between the contrast and frame rate cannot be achieved due to the limited divider size. The Cy_SegLCD_Init function automatically restricts such incorrect combinations (returns CY_SEGLCD_BAD_PARAM).

Speed Mode Switching (cy_stc_seglcd_config_t::speed)
The High Speed and Low Speed generators mostly duplicate each other, except that for MXLCD_ver1, the High Speed version has larger frequency dividers to generate the frame and sub-frame periods. This is because the clock of the High Speed block typically has a frequency 30-100 times bigger than the 32 KHz clock fed to the Low Speed block. For MXLCD_ver2, both High Speed and Low Speed generators have similar 16-bit dividers, because a possibility exists to source a Low Speed generator with a Medium Frequency clock (see Medium Frequency Domain Clock) that may be much higher than 32 KHz ILO. Switching between High Speed and Low Speed modes via the Cy_SegLCD_Init function causes the dividers to reconfigure. Under possible restrictions related to certain ratios between contrast and frame rates (see Contrast vs. Frame Rate section above), switching between High Speed and the Low Speed modes via the Cy_SegLCD_Init function may set new dividers values that don’t give the same contrast value.

Driving Modes (cy_stc_seglcd_config_t::drive)
SegLCD supports the following operating modes:

Conventional Waveforms (cy_stc_seglcd_config_t::wave)
Conventional LCD drivers apply waveforms to COM and SEG electrodes generated by switching between multiple different voltages. The following terms are used to define these waveforms:

The following figures show the conventional waveforms for COM and SEG electrodes for the 1/3rd bias and 1/4th duty. Only COM0/COM1 and SEG0/SEG1 are drawn. Conventional Type-A Waveform Example:

seglcd_waveA.png

Conventional Type-B Waveform Example:

seglcd_waveB.png

The generalized waveforms for individual sub-frames for any duty and bias are illustrated in the following figure. Note that these use 6 different voltages at most(including VSS and VDRV). Conventional Waveforms - Generalized:

seglcd_waveGen.png

The effective RMS voltage for on and off segments can be calculated using these waveforms:

seglcd_Voff.png
seglcd_Von.png

The resulting Discrimination Ratio (D) for various bias and duty combinations is illustrated in the following table. The bias choice (B) for each duty (M) with the highest possible value for D is colored green:

seglcd_descr.png

Digital Correlation (CY_SEGLCD_CORRELATION)
The principles of operation are illustrated by the example waveforms shown in the following figures. Digital Correlation Example – Type-A:

seglcd_DCA.png

Digital Correlation Example – Type-B:

seglcd_DCB.png

As illustrated, instead of generating bias voltages between the rails, this approach takes advantage of the LCD displays characteristic: the LCD segments' on-ness and off-ness degree is determined by the RMS voltage across the segments. In this approach, the correlation coefficient between any given pair of COM and SEG signals determines whether the corresponding LCD segment is On or Off. Thus, by doubling the base drive frequency of the COM signals in their inactive sub-frame intervals, the phase relationship of the COM and SEG drive signals can be varied to turn segments on and off – rather than varying the DC levels of the signals as is used in the conventional approaches.

PWM Drive (CY_SEGLCD_PWM)
This approach duplicates the multi-voltage drive signals of the conventional method with bias B using a PWM output signal together with the intrinsic resistance and capacitance of the LCD display to create a simple PWM DAC. This is illustrated in the following figure:

seglcd_PWM.png

To drive a low-capacitance display with an acceptable ripple and rise/fall time, using a 32-kHz PWM an additional external series resistance of 100 k - 1 M ohm is required. External Resistors are not required for PWM frequencies of greater than ~1 MHz. The exact frequency depends on the display capacitance, the internal ITO resistance of the ITO routing traces, and the drive impedance of the I/O pins. The PWM method works for any bias value (B). NOTE As B gets higher, a higher PWM step frequency is required to maintain the same PWM output frequency (the RC response of the LCD depends on the PWM output frequency, NOT the step frequency). The PWM approach may also be used to drive a 1/2-bias display. This has the advantage that PWM is only required on the COM signals, as SEG signals of a 1/2-bias display use only logic levels. Therefore, PWM 1/2-bias can be supported at 32 kHz using just four external resistors. The power consumption of the approach (even for 1/2 bias) is substantially higher than that of other methods. Therefore, it is recommended power-sensitive customers use Digital Correlation drive in Deep Sleep mode, and change to PWM mode to gain the advantage of better contrast/viewing angle on TN displays in Active or Sleep mode.

PWM1/2 LCD drive waveform:

seglcd_PWM2.png

PWM1/3 LCD drive waveform:

seglcd_PWM3.png

Digital Contrast Control
In all modes, digital contrast control is available using the duty cycle/dead time method illustrated in the following figure:

seglcd_contrast.png

This illustration shows the principle for 1/3 bias and 1/4 duty implementation, but the general approach of reducing contrast by reducing the percentage of time the glass is driven can be generalized and applied to any drive method. In all cases, during the dead time, all COM and SEG signals are set to a logic "1" state.

When the block is configured, for further work with display, a display structure is needed:

const uint32_t displayPixMap[4][CY_SEGLCD_7SEG] =
{
{
CY_SEGLCD_PIXEL(18UL, 0UL), /* Seg: P11_2, Com: P13_0, symbol 0, pixel A */
CY_SEGLCD_PIXEL(18UL, 2UL), /* Seg: P11_2, Com: P13_2, symbol 0, pixel B */
CY_SEGLCD_PIXEL(18UL, 5UL), /* Seg: P11_2, Com: P13_5, symbol 0, pixel C */
CY_SEGLCD_PIXEL(18UL, 6UL), /* Seg: P11_2, Com: P13_6, symbol 0, pixel D */
CY_SEGLCD_PIXEL(18UL, 4UL), /* Seg: P11_2, Com: P13_4, symbol 0, pixel E */
CY_SEGLCD_PIXEL(18UL, 1UL), /* Seg: P11_2, Com: P13_1, symbol 0, pixel F */
CY_SEGLCD_PIXEL(18UL, 3UL), /* Seg: P11_2, Com: P13_3, symbol 0, pixel G */
},
{
CY_SEGLCD_PIXEL(11UL, 0UL), /* Seg: P10_3, Com: P13_0, symbol 1, pixel A */
CY_SEGLCD_PIXEL(11UL, 2UL), /* Seg: P10_3, Com: P13_2, symbol 1, pixel B */
CY_SEGLCD_PIXEL(11UL, 5UL), /* Seg: P10_3, Com: P13_5, symbol 1, pixel C */
CY_SEGLCD_PIXEL(11UL, 6UL), /* Seg: P10_3, Com: P13_6, symbol 1, pixel D */
CY_SEGLCD_PIXEL(11UL, 4UL), /* Seg: P10_3, Com: P13_4, symbol 1, pixel E */
CY_SEGLCD_PIXEL(11UL, 1UL), /* Seg: P10_3, Com: P13_1, symbol 1, pixel F */
CY_SEGLCD_PIXEL(11UL, 3UL), /* Seg: P10_3, Com: P13_3, symbol 1, pixel G */
},
{
CY_SEGLCD_PIXEL(17UL, 0UL), /* Seg: P11_1, Com: P13_0, symbol 2, pixel A */
CY_SEGLCD_PIXEL(17UL, 2UL), /* Seg: P11_1, Com: P13_2, symbol 2, pixel B */
CY_SEGLCD_PIXEL(17UL, 5UL), /* Seg: P11_1, Com: P13_5, symbol 2, pixel C */
CY_SEGLCD_PIXEL(17UL, 6UL), /* Seg: P11_1, Com: P13_6, symbol 2, pixel D */
CY_SEGLCD_PIXEL(17UL, 4UL), /* Seg: P11_1, Com: P13_4, symbol 2, pixel E */
CY_SEGLCD_PIXEL(17UL, 1UL), /* Seg: P11_1, Com: P13_1, symbol 2, pixel F */
CY_SEGLCD_PIXEL(17UL, 3UL), /* Seg: P11_1, Com: P13_3, symbol 2, pixel G */
},
{
CY_SEGLCD_PIXEL(16UL, 0UL), /* Seg: P11_0, Com: P13_0, symbol 3, pixel A */
CY_SEGLCD_PIXEL(16UL, 2UL), /* Seg: P11_0, Com: P13_2, symbol 3, pixel B */
CY_SEGLCD_PIXEL(16UL, 5UL), /* Seg: P11_0, Com: P13_5, symbol 3, pixel C */
CY_SEGLCD_PIXEL(16UL, 6UL), /* Seg: P11_0, Com: P13_6, symbol 3, pixel D */
CY_SEGLCD_PIXEL(16UL, 4UL), /* Seg: P11_0, Com: P13_4, symbol 3, pixel E */
CY_SEGLCD_PIXEL(16UL, 1UL), /* Seg: P11_0, Com: P13_1, symbol 3, pixel F */
CY_SEGLCD_PIXEL(16UL, 3UL), /* Seg: P11_0, Com: P13_3, symbol 3, pixel G */
}
};
{
.symNum = 4,
.invert = false,
.pixMap = (uint32_t*)displayPixMap,
};
Note
Using the SegLCD Configurator, display structures and the commons array are generated automatically into the GeneratedSource/cycfg_seglcd.h/.c files. All you need is just to include cycfg_seglcd.h into your application code.

And now you can write multi-digit decimal and hexadecimal numbers and strings onto the initiated 7-segment display:

/* Scenario: Write a decimal number starting at the most right symbol on display: */
if (CY_SEGLCD_SUCCESS != Cy_SegLCD_WriteNumber(LCD0, 12, 3, &display, false, false))
{
/* error handling */
}

after which the next image on the glass appears:

seglcd_12.png
/* Scenario: Write a hexadecimal number with trailing zeroes: */
if (CY_SEGLCD_SUCCESS != Cy_SegLCD_WriteNumber(LCD0, 12, 3, &display, true, true))
{
/* error handling */
}
seglcd_oooc.png

Or even manage separate LCD pixels:

/* Scenario: There is a heart-shaped sign on an LCD glass: */
#define HEART (CY_SEGLCD_PIXEL(22UL, 7UL)) /* Seg: P11_6, Com: P13_7 */
/* Scenario: Set a pixel (write a true value) */
{
/* error handling */
}

after which the next image on the glass appears:

seglcd_heart.png
/* Scenario: Clear a pixel (write a false value) */
{
/* error handling */
}
/* Scenario: Invert a pixel (change the value to opposite) */
Cy_SegLCD_InvPixel(LCD0, HEART);
/* Scenario: Read a pixel value, do some action with it and write it back into the frame */
bool pixelValue = Cy_SegLCD_ReadPixel(LCD0, HEART);
Cy_SegLCD_WritePixel(LCD0, HEART, !pixelValue);

Also, you can customize basic fonts, for example:

/* This is a customized ASCII-coded font for the basic 7-segment display: */
const uint8_t customAsciiFontMap7Seg[] =
{
/*space*/ /* Zeroes for all the unused symbols */ /* - */
0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,0x40U,0x00U,0x00U,
/* 0 1 2 3 4 5 6 7 8 9 */
0x3FU,0x06U,0x5BU,0x4FU,0x66U,0x6DU,0x7DU,0x07U,0x7FU,0x6FU,0x00U,0x00U,0x00U,0x00U,0x00U,0x00U,
/* A B C D E F G H I J K L M N O */
0x00U,0x77U,0x7CU,0x39U,0x1FU,0x79U,0x71U,0x3DU,0x76U,0x06U,0x1EU,0x75U,0x38U,0x15U,0x37U,0x3FU,
/* P Q R S T U V W X Y Z */
0x73U,0x67U,0x33U,0x6DU,0x07U,0x3EU,0x72U,0x2AU,0x64U,0x66U,0x5BU,0x00U,0x00U,0x00U,0x00U,0x00U,
/* a b c d e f g h i j k l m n o */
0x00U,0x5FU,0x7CU,0x58U,0x5EU,0x7BU,0x71U,0x6FU,0x74U,0x04U,0x0EU,0x7AU,0x38U,0x15U,0x54U,0x5CU,
/* p q r s t u v w x y z */
0x73U,0x67U,0x50U,0x6DU,0x78U,0x1CU,0x62U,0x2AU,0x52U,0x6EU,0x5BU
};
const cy_stc_seglcd_font_t customAsciiFont7Seg =
{
.first = ' ',
.last = 'z',
.ascii = true,
.fontMap = customAsciiFontMap7Seg
};

And now you can write characters and strings on a standard 7-segment display:

/* Scenario: Write characters so that there the word 'char' is created */
/* Set up the custom alphanumerical font for 7-segment display */
display.font = &customAsciiFont7Seg; /* Set up the alphanumerical font */
(void) Cy_SegLCD_WriteChar(LCD0, 'c', 0, &display);
(void) Cy_SegLCD_WriteChar(LCD0, 'h', 1, &display);
(void) Cy_SegLCD_WriteChar(LCD0, 'a', 2, &display);
(void) Cy_SegLCD_WriteChar(LCD0, 'r', 3, &display);

after which the next image on the glass appears:

seglcd_char.png
/* Scenario: Write a string starting at the most left symbol on display */
char_t * string = "Font";
/* Set up the custom alphanumerical font for 7-segment display */
display.font = &customAsciiFont7Seg;
if (CY_SEGLCD_SUCCESS != Cy_SegLCD_WriteString(LCD0, string, 0, &display))
{
/* error handling */
}
seglcd_font.png

Also, you can customize or create your own displays, for example:

/* This is a custom 3x5 dot matrix display
* (which is made from the standard 5x8 dot matrix just cutting all the redundant pixels):
*/
#define CUSTOM_DISP_3x5DM_TYPE (3 * 5) /* Amount of pixels in single 3x5 symbol */
const uint32_t display3x5PixMap[4][CUSTOM_DISP_3x5DM_TYPE] =
{
{
CY_SEGLCD_PIXEL(24UL, 1UL),
CY_SEGLCD_PIXEL(24UL, 2UL),
CY_SEGLCD_PIXEL(24UL, 3UL),
CY_SEGLCD_PIXEL(24UL, 4UL),
CY_SEGLCD_PIXEL(24UL, 5UL),
CY_SEGLCD_PIXEL(25UL, 1UL),
CY_SEGLCD_PIXEL(25UL, 2UL),
CY_SEGLCD_PIXEL(25UL, 3UL),
CY_SEGLCD_PIXEL(25UL, 4UL),
CY_SEGLCD_PIXEL(25UL, 5UL),
CY_SEGLCD_PIXEL(26UL, 1UL),
CY_SEGLCD_PIXEL(26UL, 2UL),
CY_SEGLCD_PIXEL(26UL, 3UL),
CY_SEGLCD_PIXEL(26UL, 4UL),
CY_SEGLCD_PIXEL(26UL, 5UL)
},
{
CY_SEGLCD_PIXEL(29UL, 1UL),
CY_SEGLCD_PIXEL(29UL, 2UL),
CY_SEGLCD_PIXEL(29UL, 3UL),
CY_SEGLCD_PIXEL(29UL, 4UL),
CY_SEGLCD_PIXEL(29UL, 5UL),
CY_SEGLCD_PIXEL(30UL, 1UL),
CY_SEGLCD_PIXEL(30UL, 2UL),
CY_SEGLCD_PIXEL(30UL, 3UL),
CY_SEGLCD_PIXEL(30UL, 4UL),
CY_SEGLCD_PIXEL(30UL, 5UL),
CY_SEGLCD_PIXEL(12UL, 1UL),
CY_SEGLCD_PIXEL(12UL, 2UL),
CY_SEGLCD_PIXEL(12UL, 3UL),
CY_SEGLCD_PIXEL(12UL, 4UL),
CY_SEGLCD_PIXEL(12UL, 5UL)
},
{
CY_SEGLCD_PIXEL(15UL, 1UL),
CY_SEGLCD_PIXEL(15UL, 2UL),
CY_SEGLCD_PIXEL(15UL, 3UL),
CY_SEGLCD_PIXEL(15UL, 4UL),
CY_SEGLCD_PIXEL(15UL, 5UL),
CY_SEGLCD_PIXEL(31UL, 1UL),
CY_SEGLCD_PIXEL(31UL, 2UL),
CY_SEGLCD_PIXEL(31UL, 3UL),
CY_SEGLCD_PIXEL(31UL, 4UL),
CY_SEGLCD_PIXEL(31UL, 5UL),
CY_SEGLCD_PIXEL(32UL, 1UL),
CY_SEGLCD_PIXEL(32UL, 2UL),
CY_SEGLCD_PIXEL(32UL, 3UL),
CY_SEGLCD_PIXEL(32UL, 4UL),
CY_SEGLCD_PIXEL(32UL, 5UL)
},
{
CY_SEGLCD_PIXEL(35UL, 1UL),
CY_SEGLCD_PIXEL(35UL, 2UL),
CY_SEGLCD_PIXEL(35UL, 3UL),
CY_SEGLCD_PIXEL(35UL, 4UL),
CY_SEGLCD_PIXEL(35UL, 5UL),
CY_SEGLCD_PIXEL(36UL, 1UL),
CY_SEGLCD_PIXEL(36UL, 2UL),
CY_SEGLCD_PIXEL(36UL, 3UL),
CY_SEGLCD_PIXEL(36UL, 4UL),
CY_SEGLCD_PIXEL(36UL, 5UL),
CY_SEGLCD_PIXEL(37UL, 1UL),
CY_SEGLCD_PIXEL(37UL, 2UL),
CY_SEGLCD_PIXEL(37UL, 3UL),
CY_SEGLCD_PIXEL(37UL, 4UL),
CY_SEGLCD_PIXEL(37UL, 5UL)
}
};
const cy_stc_seglcd_disp_t display3x5 =
{
.type = CUSTOM_DISP_3x5DM_TYPE,
.symNum = 4,
.invert = false,
.pixMap = (uint32_t*)display3x5PixMap,
.font = &customNumericFont3x5
};

And also different fonts for them:

#define CUSTOM_DISP_3x5DM_FONT_SYM_SIZE (CY_SYSLIB_DIV_ROUNDUP(CUSTOM_DISP_3x5DM_TYPE, CY_SEGLCD_OCTET)) /* Size of the 3x5 font map array item in bytes */
/* Numeric font (numbers 0...F and blank symbol) */
const uint8_t customNumericFontMap3x5[][CUSTOM_DISP_3x5DM_FONT_SYM_SIZE] =
{
/* 0 1 2 3 4 5 6 7 */
{0x2EU,0x3AU},{0xF2U,0x43U},{0xB9U,0x4AU},{0xB1U,0x2AU},{0x87U,0x7CU},{0xB7U,0x26U},{0xAEU,0x26U},{0xA1U,0x0FU},
/* 8 9 A B C D E F space */
{0xAAU,0x2AU},{0xB2U,0x3AU},{0x3EU,0x79U},{0xBFU,0x2AU},{0x2EU,0x2AU},{0x3FU,0x3AU},{0xBFU,0x46U},{0xBFU,0x04U},{0x00U,0x00U}
};
const cy_stc_seglcd_font_t customNumericFont3x5 =
{
.first = 0,
.ascii = false,
.fontMap = (uint8_t*)customNumericFontMap3x5
};
/* ASCII-coded limited font (symbols 0...9, A...F and space) */
const uint8_t customAsciiFontMap3x5[][CUSTOM_DISP_3x5DM_FONT_SYM_SIZE] =
{
/* space */ /* All zeroes (essentially the 'space' characters) for all the unused symbols */
{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},
{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},
/* 0 1 2 3 4 5 6 7 */
{0x2EU,0x3AU},{0xF2U,0x43U},{0xB9U,0x4AU},{0xB1U,0x2AU},{0x87U,0x7CU},{0xB7U,0x26U},{0xAEU,0x26U},{0xA1U,0x0FU},
/* 8 9 */
{0xAAU,0x2AU},{0xB2U,0x3AU},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},{0x00U,0x00U},
/* A B C D E F */
{0x00U,0x00U},{0x3EU,0x79U},{0xBFU,0x2AU},{0x2EU,0x2AU},{0x3FU,0x3AU},{0xBFU,0x46U},{0xBFU,0x04U}
};
const cy_stc_seglcd_font_t customAsciiFont3x5 =
{
.first = ' ',
.last = 'F',
.ascii = true,
.fontMap = (uint8_t*)customAsciiFontMap3x5
};

And now use all that together:

/* Scenario: Write a hexadecimal number 43 981 (0xABCD): */
if (CY_SEGLCD_SUCCESS != Cy_SegLCD_WriteNumber(LCD0, 43981, 3, &display3x5, false, true))
{
/* error handling */
}
seglcd_3x5.png

More Information

Refer to the technical reference manual (TRM) and the device datasheet.

MISRA-C Compliance

MISRA Rule Rule Class (Required/Advisory) Rule Description Description of Deviation(s)
10.3 R The value of a complex expression of integer type shall only be cast to a type of the same signedness that is no wider than the underlying type of the expression. The value got from the bitfield physically cannot exceed the enumeration that describes this bitfield. So, the code is safe by design.
11.4 A A cast should not be performed between a pointer to object type and a different pointer to object type. This is a fix for the GCC compiler warning.
14.1 R There shall be no unreachable code. This is the HOBTO parameter reading for future features support.

Changelog

VersionChangesReason for Change
1.0 Initial version

API Reference

 Macros
 
 Functions
 
 Data Structures
 
 Global Data
 
 Enumerated Types