Subversion Repositories idreammicro-avr

Rev

Blame | Last modification | View Log | Download | RSS feed

/**************************************************************************//**
 * \brief Snootlab Deuligne library
 * \author Copyright (C) 2012  Julien Le Sech - www.idreammicro.com
 * \version 1.0
 * \date 20121026
 *
 * This file is part of the iDreamMicro library.
 *
 * 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 version 3 of the License, or (at your option) any
 * later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/
 ******************************************************************************/


/**************************************************************************//**
 * \headerfile deuligne.h
 ******************************************************************************/


#ifndef H__IDREAMMICRO__DEULIGNE__H
#define H__IDREAMMICRO__DEULIGNE__H

#ifdef _cplusplus
extern "C"{
#endif

/******************************************************************************
 * Header file inclusions.
 ******************************************************************************/


#include <stdbool.h>
#include <stdint.h>

/******************************************************************************
 * Public types.
 ******************************************************************************/


/**************************************************************************//**
 * \enum    deuligne__keys
 * \brief   Available keys.
 *
 * \typedef deuligne__key_t
 * \brief   Key.
 ******************************************************************************/

typedef enum deuligne__keys
{
    DEULIGNE__KEY__RIGHT,
    DEULIGNE__KEY__UP,
    DEULIGNE__KEY__DOWN,
    DEULIGNE__KEY__LEFT,
    DEULIGNE__KEY__SELECT,
    DEULIGNE__KEY__NONE
} deuligne__key_t;

/**************************************************************************//**
 * \enum    deuligne__display_lines
 * \brief   LCD display lines.
 *
 * \typedef deuligne__display_line_t
 * \brief   LCD display line.
 ******************************************************************************/

typedef enum deuligne__display_lines
{
    DEULIGNE__DISPLAY_LINE_1,    /*!<  One line display. */
    DEULIGNE__DISPLAY_LINE_2     /*!<  Two lines or more display. */
} deuligne__display_line_t;

/**************************************************************************//**
 * \enum lcd__character_fonts
 * \brief LCD character fonts.
 *
 * \typedef lcd__character_font_t
 * \brief LCD character font.
 ******************************************************************************/

typedef enum deuligne__character_fonts
{
    DEULIGNE__CHARACTER_FONT_5x8_DOTS,   /*!<  5x8 character font. */
    DEULIGNE__CHARACTER_FONT_5x10_DOTS   /*!<  5x10 character font. */
} deuligne__character_font_t;

/**************************************************************************//**
 * \enum lcd__address_modes
 * \brief LCD address modes.
 *
 * \typedef lcd__address_mode_t
 * \brief LCD address mode.
 ******************************************************************************/

typedef enum deuligne__address_modes
{
    DEULIGNE__INCREMENT_ADDRESS, /*!<  Increment address. */
    DEULIGNE__DECREMENT_ADDRESS  /*!<  Decrement address. */
} deuligne__address_mode_t;

/**************************************************************************//**
 * \enum lcd__display_shifts
 * \brief LCD display shift types.
 *
 * \typedef lcd__display_shift_t
 * \brief LCD display shift type.
 ******************************************************************************/

typedef enum deuligne__display_shifts
{
    DEULIGNE__DISPLAY_SHIFT_DISABLED,    /*!<  Display shift disabled. */
    DEULIGNE__DISPLAY_SHIFT_RIGHT,       /*!<  Display shift to right. */
    DEULIGNE__DISPLAY_SHIFT_LEFT         /*!<  Display shift to left */
} deuligne__display_shift_t;

/**************************************************************************//**
 * \enum lcd__shift_directions
 * \brief LCD shift directions.
 *
 * \typedef lcd__shift_direction_t
 * \brief LCD shift direction.
 ******************************************************************************/

typedef enum deuligne__shift_directions
{
    DEULIGNE__SHIFT_DIRECTION_RIGHT, /*!<  Shift to right. */
    DEULIGNE__SHIFT_DIRECTION_LEFT   /*!<  Shift to left. */
} deuligne__shift_direction_t;

/**************************************************************************//**
 * \enum lcd__lines
 * \brief LCD lines.
 *
 * \typedef lcd__line_t
 * \brief LCD line.
 ******************************************************************************/

typedef enum deuligne__lines
{
    DEULIGNE__LINE_1,    /*!<  Line 1. */
    DEULIGNE__LINE_2,    /*!<  Line 2. */
    DEULIGNE__LINE_3,    /*!<  Line 3. */
    DEULIGNE__LINE_4     /*!<  Line 4. */
} deuligne__line_t;

/******************************************************************************
 * Public function prototypes.
 ******************************************************************************/


/**************************************************************************//**
 * \fn void deuligne__initialize(void)
 *
 * \brief Initialize Deuligne.
 ******************************************************************************/

void
deuligne__initialize
(
    void
);

/**************************************************************************//**
 * \fn void deuligne__set_function(
 * deuligne__display_line_t     display_line,
 * deuligne__character_font_t   character_font)
 *
 * \brief Set the number of lines available on LCD display and the character font.
 *
 * \param display_line number of lines
 * \param character_font character font
 ******************************************************************************/

void
deuligne__set_function
(
    deuligne__display_line_t    display_line,
    deuligne__character_font_t  character_font
);

/**************************************************************************//**
 * \fn void deuligne__set_entry_mode(
 * deuligne__address_mode_t     address_mode,
 * deuligne__display_shift_t    display_shift)
 *
 * \brief Set LCD display entry mode.
 *
 * \param address_mode specify if DDRAM address is incremented or decremented
 * when a character code is written
 * \param display_shift set the display shift when a character code is written
 ******************************************************************************/

void
deuligne__set_entry_mode
(
    deuligne__address_mode_t    address_mode,
    deuligne__display_shift_t   display_shift
);

/**************************************************************************//**
 * \fn void deuligne__set_display(
 * bool enable_display,
 * bool enable_cursor_display,
 * bool enable_cursor_blink)
 *
 * \brief Set LCD display.
 * Enable or disable display, cursor display and cursor blink.
 *
 * \param enable_display true to enable display or false in contrary case
 * \param enable_cursor_display true to enable cursor display or false in
 * contrary case
 * \param enable_cursor_blink true to enable cursor blink or false in contrary
 * case
 ******************************************************************************/

void
deuligne__set_display
(
    bool enable_display,
    bool enable_cursor_display,
    bool enable_cursor_blink
);

/**************************************************************************//**
 * \fn void deuligne__clear_display(void)
 *
 * \brief Clear LCD display.
 ******************************************************************************/

void
deuligne__clear_display
(
    void
);

/**************************************************************************//**
 * \fn void deuligne__return_home(void)
 *
 * \brief Set cursor on the first column of the first line.
 ******************************************************************************/

void
deuligne__return_home
(
    void
);

/**************************************************************************//**
 *\fn void deuligne__set_cursor_position(deuligne__line_t line, uint8_t column)
 *
 * \brief Set cursor position.
 *
 * \param line destination line
 * \param column destination column
 ******************************************************************************/

void
deuligne__set_cursor_position
(
    deuligne__line_t    line,
    uint8_t             column
);

/**************************************************************************//**
 * \fn void deuligne__shift_display(deuligne__shift_direction_t shift_direction)
 *
 * \brief Shift the display on the right or on the left.
 *
 * \param shift_direction display shift direction
 ******************************************************************************/

void
deuligne__shift_display
(
    deuligne__shift_direction_t shift_direction
);

/**************************************************************************//**
 * \fn void deuligne__shift_cursor(deuligne__shift_direction_t shift_direction)
 *
 * \brief Shift the cursor on the right or on the left.
 *
 * \param shift_direction cursor shift direction
 ******************************************************************************/

void
deuligne__shift_cursor
(
    deuligne__shift_direction_t shift_direction
);

/**************************************************************************//**
 * \fn void deuligne__switch_on_backlight(void)
 *
 * \brief Switch on LCD backlight.
 ******************************************************************************/

void
deuligne__switch_on_backlight
(
    void
);

/**************************************************************************//**
 * \fn void deuligne__switch_off(voif)
 *
 * \brief Switch off backlight.
 ******************************************************************************/

void
deuligne__switch_off_backlight
(
    void
);

/**************************************************************************//**
 * \fn void deuligne__write_char(char data)
 *
 * \brief Write a character on LCD.
 *
 * \param data  Character to write.
 ******************************************************************************/

void
deuligne__write_char
(
    char data
);

/**************************************************************************//**
 * \fn void deuligne__write_string(const char* string_to_write)
 *
 * \brief Write a string on LCD display from current cursor position.
 *
 * \param string_to_write string to write
 ******************************************************************************/

void
deuligne__write_string
(
    const char* string_to_write
);

/**************************************************************************//**
 * \fn void deuligne__get_key(void)
 *
 * \brief Get key.
 *
 * \return Key.
 ******************************************************************************/

deuligne__key_t
deuligne__get_key
(
    void
);

#ifdef _cplusplus
}
#endif

#endif /* H__IDREAMMICRO__DEULIGNE__H */