예제 #1
0
파일: app_lcd.c 프로젝트: gillspice/mios32
/////////////////////////////////////////////////////////////////////////////
// Clear Screen
// IN: -
// OUT: returns < 0 on errors
/////////////////////////////////////////////////////////////////////////////
s32 APP_LCD_Clear(void)
{
  s32 error = 0;
  u8 x, y;

  // use default font
  MIOS32_LCD_FontInit((u8 *)GLCD_FONT_NORMAL);

  // send data
  for(y=0; y<8; ++y) {
    error |= MIOS32_LCD_CursorSet(0, y);

    // select all LCDs
#if APP_LCD_USE_J10_FOR_CS
    MIOS32_BOARD_J10_Set(0x00);
#else
    MIOS32_BOARD_J15_DataSet(0x00);
#endif
    MIOS32_BOARD_J15_RS_Set(1); // RS pin used to control DC

    for(x=0; x<128; ++x)
      MIOS32_BOARD_J15_SerDataShift(0x00);
  }

  // set X=0, Y=0
  error |= MIOS32_LCD_CursorSet(0, 0);

  return error;
}
예제 #2
0
파일: app_lcd.c 프로젝트: gillspice/mios32
/////////////////////////////////////////////////////////////////////////////
// Sends data byte to LCD
// IN: data byte in <data>
// OUT: returns < 0 on errors
/////////////////////////////////////////////////////////////////////////////
s32 APP_LCD_Data(u8 data)
{
  // select LCD depending on current cursor position
  // THIS PART COULD BE CHANGED TO ARRANGE THE 8 DISPLAYS ON ANOTHER WAY
  u8 line = mios32_lcd_y / APP_LCD_HEIGHT;
  u8 row = (mios32_lcd_x % (2*APP_LCD_WIDTH)) / APP_LCD_WIDTH;

  u8 cs = 2*line + row;

  if( cs >= 8 )
    return -1; // invalid CS line

  // chip select and DC
#if APP_LCD_USE_J10_FOR_CS
  MIOS32_BOARD_J10_Set(~(1 << cs));
#else
  MIOS32_BOARD_J15_DataSet(~(1 << cs));
#endif
  MIOS32_BOARD_J15_RS_Set(1); // RS pin used to control DC

  // send data
  MIOS32_BOARD_J15_SerDataShift(data);

  // increment graphical cursor
  ++mios32_lcd_x;

  // if end of display segment reached: set X position of all segments to 0
  if( (mios32_lcd_x % APP_LCD_WIDTH) == 0 ) {
    APP_LCD_Cmd(0x00); // set X=0
    APP_LCD_Cmd(0x10);
  }

  return 0; // no error
}
예제 #3
0
파일: app_lcd.c 프로젝트: gillspice/mios32
/////////////////////////////////////////////////////////////////////////////
// Sends command byte to LCD
// IN: command byte in <cmd>
// OUT: returns < 0 on errors
/////////////////////////////////////////////////////////////////////////////
s32 APP_LCD_Cmd(u8 cmd)
{
  // select all LCDs
#if APP_LCD_USE_J10_FOR_CS
  MIOS32_BOARD_J10_Set(0x00);
#else
  MIOS32_BOARD_J15_DataSet(0x00);
#endif
  MIOS32_BOARD_J15_RS_Set(0); // RS pin used to control DC

  MIOS32_BOARD_J15_SerDataShift(cmd);

  return 0; // no error
}
예제 #4
0
/////////////////////////////////////////////////////////////////////////////
//! Sets the 8bit value of a DIO port
/////////////////////////////////////////////////////////////////////////////
s32 MBNG_DIO_PortSet(u8 port, u8 value)
{
#if MBNG_PATCH_NUM_DIO == 0
  return -1; // not supported
#else
  switch( port ) {
  case 0: {
#if defined(MIOS32_FAMILY_STM32F4xx)
    MIOS32_BOARD_J10A_Set(value);
#elif defined(MIOS32_FAMILY_LPC17xx)
    MIOS32_BOARD_J10_Set(value);
#else
# error "Please adapt J10 port assignments here"
#endif
  } break;

  case 1: {
#if defined(MIOS32_FAMILY_STM32F4xx)
    MIOS32_BOARD_J10B_Set(value);
#elif defined(MIOS32_FAMILY_LPC17xx)
    MIOS32_BOARD_J28_Set(value);
#else
# error "Please adapt J10 port assignments here"
#endif
  } break;

  default:
    return -1; // invalid port
#if MBNG_PATCH_NUM_DIO > 2
# error "Add pin set function here"
#endif
  }

  return 0; // no error
#endif
}