# Path: gfxlcd/driver/null/null_page.py
# class NullPage(Page, Chip):
#     """Test chip driver for page drawing"""
#     def __init__(self, width, height, driver, auto_flush=True):
#         Chip.__init__(self, width, height, driver, auto_flush)
#         Page.__init__(self, driver)
#         self.rotation = 0
#         self.buffer = []
#         self.area = {
#             'start_x': 0,
#             'start_y': 0,
#             'end_x': width-1,
#             'end_y': height-1
#         }
# 
#     def init(self):
#         """inits a device"""
#         Page.init(self)
#         Chip.init(self)
# 
#     def flush(self, force=None):
#         """flush buffer to device
#         :force - boolean|None"""
#         return self.buffer
# 
#     def set_area(self, pos_x1, pos_y1, pos_x2, pos_y2):
#         """set area to work on"""
#         self.area = {
#             'start_x': pos_x1,
#             'start_y': pos_y1,
#             'end_x': pos_x2,
#             'end_y': pos_y2
#         }
# 
# Path: gfxlcd/driver/hd44780.py
# class HD44780(BaseDriver, FlushEvent):
#     """HD44780 driver for GfxLCD"""
#     def __init__(self, gfxlcd, lcd_flush=False):
#         """Class init"""
#         self.gfxlcd = gfxlcd
#         self.mode = 0
#         self.initialized = False
#         self.lcd_flush = lcd_flush
#         self.font = self.gfxlcd.options['font']
#         self.width = self.gfxlcd.width // self.font.size[0]
#         self.height = self.gfxlcd.height // self.font.size[1]
#         self.pins = {
#             'E2': None
#         }
#         self.position = {
#             'x': 0,
#             'y': 0
#         }
#         self.address = []
# 
#     def init(self):
#         """init function"""
#         if self.initialized:
#             return
#         for address in range(self.height):
#             self.address.append(100 + (address * self.width))
# 
#         self.gfxlcd.init()
#         self.initialized = True
# 
#     def cmd(self, char, enable=0):
#         """write command - set cursor position"""
#         if char < 100:
#             return
#         char -= 100
#         pos_y = char // self.width
#         pos_x = char - (pos_y * self.width)
#         self.position = {
#             'x': pos_x * self.font.size[0],
#             'y': pos_y * self.font.size[1]
#         }
# 
#     def shutdown(self):
#         """shutdown procedure"""
#         pass
# 
#     def send(self, enable=0):
#         """send ack command"""
#         pass
# 
#     def write(self, char, enable=0):
#         """write data to lcd"""
#         pass
# 
#     def char(self, char, enable=0):
#         """write char to lcd"""
#         self.gfxlcd.draw_text(
#             self.position['x'], self.position['y'], char, True
#         )
#         self._increase_x()
# 
#     def set_mode(self, mode):
#         """sets driver mode. 4/8 bit"""
#         self.mode = mode
# 
#     def _increase_x(self):
#         self.position['x'] += self.font.size[0]
# 
#     def get_line_address(self, idx):
#         return self.address[idx]
# 
#     def pre_flush(self, buffer):
#         pass
# 
#     def post_flush(self, buffer):
#         """called after flush()"""
#         if self.lcd_flush:
#             self.gfxlcd.flush(True)


import sys
from nose.tools import assert_equal
from gfxlcd.driver.null.null_page import NullPage
from gfxlcd.driver.hd44780 import HD44780
from charlcd.buffered import CharLCD
__author__ = 'kosci'

sys.path.append("../../")


class TestChip(object):
    def setUp(self):

# Path: gfxlcd/driver/null/null_page.py
# class NullPage(Page, Chip):
#     """Test chip driver for page drawing"""
#     def __init__(self, width, height, driver, auto_flush=True):
#         Chip.__init__(self, width, height, driver, auto_flush)
#         Page.__init__(self, driver)
#         self.rotation = 0
#         self.buffer = []
#         self.area = {
#             'start_x': 0,
#             'start_y': 0,
#             'end_x': width-1,
#             'end_y': height-1
#         }
# 
#     def init(self):
#         """inits a device"""
#         Page.init(self)
#         Chip.init(self)
# 
#     def flush(self, force=None):
#         """flush buffer to device
#         :force - boolean|None"""
#         return self.buffer
# 
#     def set_area(self, pos_x1, pos_y1, pos_x2, pos_y2):
#         """set area to work on"""
#         self.area = {
#             'start_x': pos_x1,
#             'start_y': pos_y1,
#             'end_x': pos_x2,
#             'end_y': pos_y2
#         }
# 
# Path: gfxlcd/driver/hd44780.py
# class HD44780(BaseDriver, FlushEvent):
#     """HD44780 driver for GfxLCD"""
#     def __init__(self, gfxlcd, lcd_flush=False):
#         """Class init"""
#         self.gfxlcd = gfxlcd
#         self.mode = 0
#         self.initialized = False
#         self.lcd_flush = lcd_flush
#         self.font = self.gfxlcd.options['font']
#         self.width = self.gfxlcd.width // self.font.size[0]
#         self.height = self.gfxlcd.height // self.font.size[1]
#         self.pins = {
#             'E2': None
#         }
#         self.position = {
#             'x': 0,
#             'y': 0
#         }
#         self.address = []
# 
#     def init(self):
#         """init function"""
#         if self.initialized:
#             return
#         for address in range(self.height):
#             self.address.append(100 + (address * self.width))
# 
#         self.gfxlcd.init()
#         self.initialized = True
# 
#     def cmd(self, char, enable=0):
#         """write command - set cursor position"""
#         if char < 100:
#             return
#         char -= 100
#         pos_y = char // self.width
#         pos_x = char - (pos_y * self.width)
#         self.position = {
#             'x': pos_x * self.font.size[0],
#             'y': pos_y * self.font.size[1]
#         }
# 
#     def shutdown(self):
#         """shutdown procedure"""
#         pass
# 
#     def send(self, enable=0):
#         """send ack command"""
#         pass
# 
#     def write(self, char, enable=0):
#         """write data to lcd"""
#         pass
# 
#     def char(self, char, enable=0):
#         """write char to lcd"""
#         self.gfxlcd.draw_text(
#             self.position['x'], self.position['y'], char, True
#         )
#         self._increase_x()
# 
#     def set_mode(self, mode):
#         """sets driver mode. 4/8 bit"""
#         self.mode = mode
# 
#     def _increase_x(self):
#         self.position['x'] += self.font.size[0]
# 
#     def get_line_address(self, idx):
#         return self.address[idx]
# 
#     def pre_flush(self, buffer):
#         pass
# 
#     def post_flush(self, buffer):
#         """called after flush()"""
#         if self.lcd_flush:
#             self.gfxlcd.flush(True)


# Path: gfxlcd/tests/test_hd44780.py
import sys
from nose.tools import assert_equal
from gfxlcd.driver.null.null_page import NullPage
from gfxlcd.driver.hd44780 import HD44780
from charlcd.buffered import CharLCD

__author__ = 'kosci'

sys.path.append("../../")


class TestChip(object):
    def setUp(self):

        self.gfx_lcd = NullPage(132, 16, None, False)