Jump to content

JoVM

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JoVM

    KS0108 driver review

    It would be nice if you could test the driver if you find the time. The datasheet states min 2.0V at the logic pins except RTS. I hooked my display on a BIGPIC5 board to test it but nothing shows only BL is on. At his maiden I reversed polarised the displays +5V supply. Could be it is damaged. :shock: Me no, I'm going to order a 128x64 SPI or I2C based controller. The KS0108.h is very minimalistic. #define KS0108_SCREEN_WIDTH 128 #define KS0108_SCREEN_HEIGHT 64 #define DISPLAY_SET_Y 0x40 #define DISPLAY_SET_X 0xB8 #define DISPLAY_START_LINE 0xC0 #define DISPLAY_ON_CMD 0x3E #define ON 0x01 #define OFF 0x00 #define DISPLAY_STATUS_BUSY 0x80
  2. JoVM

    KS0108 driver review

    Hi Tectu, code is tested with the LogicAnalyzer and found working. My GLCD is broken so can't get live test. grt!
  3. JoVM

    KS0108 driver review

    No prob Tectu, my code is still under production. The datasheet states strict timings for the command and data pins so basically I'm still optimizing this part. I will post the full driver s.a.p.
  4. JoVM

    KS0108 driver review

    Hi guys, This part: //------------------------------------------------------------------------------------------------- // Delay function /for 8MHz/ //------------------------------------------------------------------------------------------------- static inline void GLCD_Delay(void) { asm("nop");asm("nop");asm("nop");asm("nop"); } is ofcourse obselete. This is for an AVR at 8MHz. For the STM32F4 you could use gfxSleepMilliseconds() but I prefer to set up a gpt and use gptPolledDelay() for short delays.
  5. JoVM

    KS0108 driver review

    Tnx inmarket, What functions are mandatory(should be included) in a gdisp driver? imho I would exclude draw_pixel(), ...
  6. JoVM

    KS0108 driver review

    Hi Tectu, I follow the Window model. The display surface gets loaded into RAM and then flushed to the controller? I think the HW driver(board file) fitts(is ready) for the KS0108.
  7. JoVM

    KS0108 driver review

    This parts can be optimized: palSetPadMode(KS0108_PORT, 0, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 1, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 2, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 3, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 4, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 5, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 6, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 7, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 1, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 2, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 3, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 5, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 6, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 7, PAL_MODE_OUTPUT_PUSHPULL); with: IOBus Databus = { KS0108_PORT, (1 << 0) | (1 << 1) | (1 <<2) | (1 <<3) | \ (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7), 0 }; /*respectively*/ palSetBusMode(&Databus , PAL_MODE_INPUT_PULLUP); palSetBusMode(&Databus , PAL_MODE_OUTPUT_PUSHPULL);
  8. JoVM

    KS0108 driver review

    board config file: /* * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://ugfx.org/license.html */ #ifndef _GDISP_LLD_CONFIG_H #define _GDISP_LLD_CONFIG_H #if GFX_USE_GDISP /*===========================================================================*/ /* Driver hardware support. */ /*===========================================================================*/ #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing #define GDISP_HARDWARE_DRAWPIXEL TRUE #define GDISP_HARDWARE_PIXELREAD TRUE #define GDISP_HARDWARE_CONTROL TRUE #define GDISP_HARDWARE_FILLS TRUE #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO // This controller supports a special gdispControl() to inverse the display. // Pass a parameter of 1 for inverse and 0 for normal. #define GDISP_CONTROL_INVERSE (GDISP_CONTROL_LLD+0) #endif /* GFX_USE_GDISP */ #endif /* _GDISP_LLD_CONFIG_H */
  9. This is a rudimentary hardware driver for the KS0108 controller. /* * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://ugfx.org/license.html */ #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H #include "pal.h" #define KS0108_PORT GPIOA #define KS0108_RS GPIOA_PIN8 #define KS0108_RW GPIOA_PIN9 #define KS0108_EN GPIOA_PIN10 #define KS0108_CS1 GPIOA_CS1 #define KS0108_CS2 GPIOA_CS2 #define KS0108_CS3 GPIOA_CS3 #define KS0108_D0 0 #define DISPLAY_STATUS_BUSY 0x80 unsigned char screen_x; unsigned char screen_y; //#define KS0108_PAGE_PREFIX 0x40 //------------------------------------------------------------------------------------------------- // Delay function /for 8MHz/ //------------------------------------------------------------------------------------------------- static inline void GLCD_Delay(void) { asm("nop");asm("nop");asm("nop");asm("nop"); } //------------------------------------------------------------------------------------------------- // Enalbe Controller (0-2) //------------------------------------------------------------------------------------------------- static inline void GLCD_EnableController(unsigned char controller) { switch(controller){ case 0 : palClearPad(KS0108_PORT, KS0108_CS1); break; case 1 : palClearPad(KS0108_PORT, KS0108_CS2); break; case 2 : palClearPad(KS0108_PORT, KS0108_CS3); break; } } //------------------------------------------------------------------------------------------------- // Disable Controller (0-2) //------------------------------------------------------------------------------------------------- static inline void GLCD_DisableController(unsigned char controller) { switch(controller){ case 0 : palSetPad(KS0108_PORT, KS0108_CS1); break; case 1 : palSetPad(KS0108_PORT, KS0108_CS2); break; case 2 : palSetPad(KS0108_PORT, KS0108_CS3); break; } } //------------------------------------------------------------------------------------------------- // Read Status byte from specified controller (0-2) //------------------------------------------------------------------------------------------------- static inline uint8_t read_data(uint8_t controller) { uint8_t status; palSetPadMode(KS0108_PORT, 0, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 1, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 2, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 3, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 4, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 5, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 6, PAL_MODE_INPUT_PULLUP); palSetPadMode(KS0108_PORT, 7, PAL_MODE_INPUT_PULLUP); palSetPad(KS0108_PORT, KS0108_RW); palClearPad(KS0108_PORT, KS0108_RS); GLCD_EnableController(controller); GLCD_Delay(); palSetPad(KS0108_PORT, KS0108_EN); GLCD_Delay(); status = ((palReadPort(KS0108_PORT) >> KS0108_D0) & 0xFF); palClearPad(KS0108_PORT, KS0108_EN); GLCD_DisableController(controller); return status; } static inline void init_board(GDisplay *g) { (void) g; } static inline void post_init_board(GDisplay *g) { (void) g; } static inline void setpin_reset(GDisplay *g, bool_t state) { (void) g; (void) state; } static inline void acquire_bus(GDisplay *g) { (void) g; } static inline void release_bus(GDisplay *g) { (void) g; } static inline void write_cmd(GDisplay *g, uint8_t cmd, uint8_t controller) { (void) g; //(void) cmd; while(read_data(controller)&DISPLAY_STATUS_BUSY); palSetPadMode(KS0108_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 1, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 2, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 3, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 5, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 6, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 7, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(KS0108_PORT, KS0108_RS | KS0108_RW); GLCD_Delay(); GLCD_EnableController(controller); GLCD_Delay(); palSetPad(KS0108_PORT, (cmd << KS0108_D0)); cmd ^= 0xFF; palClearPad(KS0108_PORT, (cmd << KS0108_D0)); GLCD_Delay(); palSetPad(KS0108_PORT, KS0108_EN); GLCD_Delay(); palClearPad(KS0108_PORT, KS0108_EN); GLCD_Delay(); GLCD_DisableController(controller); } static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) { (void) g; (void) data; (void) length; while(read_data(screen_x / 64)&DISPLAY_STATUS_BUSY); palSetPadMode(KS0108_PORT, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 1, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 2, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 3, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 5, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 6, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(KS0108_PORT, 7, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(KS0108_PORT, KS0108_RW); GLCD_Delay(); palSetPad(KS0108_PORT, KS0108_RS); GLCD_Delay(); palSetPad(KS0108_PORT, (*data << KS0108_D0)); *data ^= 0xFF; palClearPad(KS0108_PORT, (*data << KS0108_D0)); GLCD_Delay(); GLCD_EnableController(screen_x / 64); GLCD_Delay(); palSetPad(KS0108_PORT, KS0108_EN); GLCD_Delay(); palClearPad(KS0108_PORT, KS0108_EN); GLCD_Delay(); GLCD_DisableController(screen_x / 64); screen_x++; } #endif /* _GDISP_LLD_BOARD_H */ I do a HARDWARE_FLUSH on the data pins. read_status and enable- disablecontroller() needs to go in driver code. Please your review.
×
×
  • Create New...