コード例 #1
0
ファイル: spotfire.c プロジェクト: tceulema/Emuchron
//
// Function: spotMenuBarUpdate
//
// Put a (not so special) header in a Spotfire clock menu bar
//
static void spotMenuBarUpdate(void)
{
  // Only get a new menu bar when the date has changed or when we're
  // initializing
  if (mcClockDateEvent == GLCD_TRUE || mcClockInit == GLCD_TRUE)
  {
    uint8_t i = 1;
    uint8_t posX;
    menuBarDriver_t *mbDriver = menuBarDriver;

    // Find the new menu bar
    while (i < sizeof(menuBarDriver) / sizeof(menuBarDriver_t))
    {
      if (mcClockNewDD == mbDriver->day && mcClockNewDM == mbDriver->month)
        break;
      i++;
      mbDriver++;
    }

    // Only update the menu bar if it has changed
    if (menuBarId != i)
    {
      DEBUG(putstring("Menu bar Id -> "));
      DEBUG(uart_putw_dec(i));
      DEBUG(putstring_nl(""));

      // Sync new menu bar
      menuBarId = i;

      // Get starting position on x axis
      if (mbDriver->barText == MBAR_TXT_LEFT)
      {
        // Text is to be started at left (with a small align indent)
        posX = 2;
      }
      else
      {
        // Text is to be centered
        posX = glcdGetWidthStr(FONT_5X5P, mbDriver->msg1);
        if (mbDriver->msg2 != 0)
          posX = posX + glcdGetWidthStr(FONT_5X5P, mbDriver->msg2);
        posX = (GLCD_XPIXELS - posX + 1) / 2;
      }

      // Clear the current bar
      glcdFillRectangle(0, 0, GLCD_XPIXELS, 7, mcBgColor);

      // Print the first and optionally second msg string
      posX = posX + glcdPutStr2(posX, 1, FONT_5X5P, mbDriver->msg1, mcFgColor);
      if (mbDriver->msg2 != 0)
        glcdPutStr2(posX, 1, FONT_5X5P, mbDriver->msg2, mcFgColor);
    }
  }
}
コード例 #2
0
ファイル: main.c プロジェクト: NexusIF/ProjectsBackup
uint8_t print_disk_info(const struct fat_fs_struct* fs)
{
    if(!fs)
        return 0;

    struct sd_raw_info disk_info;
    if(!sd_raw_get_info(&disk_info))
        return 0;

    uart_puts_p(PSTR("manuf:  0x")); uart_putc_hex(disk_info.manufacturer); uart_putc('\n');
    uart_puts_p(PSTR("oem:    ")); uart_puts((char*) disk_info.oem); uart_putc('\n');
    uart_puts_p(PSTR("prod:   ")); uart_puts((char*) disk_info.product); uart_putc('\n');
    uart_puts_p(PSTR("rev:    ")); uart_putc_hex(disk_info.revision); uart_putc('\n');
    uart_puts_p(PSTR("serial: 0x")); uart_putdw_hex(disk_info.serial); uart_putc('\n');
    uart_puts_p(PSTR("date:   ")); uart_putw_dec(disk_info.manufacturing_month); uart_putc('/');
                                   uart_putw_dec(disk_info.manufacturing_year); uart_putc('\n');
    uart_puts_p(PSTR("size:   ")); uart_putdw_dec(disk_info.capacity / 1024 / 1024); uart_puts_p(PSTR("MB\n"));
    uart_puts_p(PSTR("copy:   ")); uart_putw_dec(disk_info.flag_copy); uart_putc('\n');
    uart_puts_p(PSTR("wr.pr.: ")); uart_putw_dec(disk_info.flag_write_protect_temp); uart_putc('/');
                                   uart_putw_dec(disk_info.flag_write_protect); uart_putc('\n');
    uart_puts_p(PSTR("format: ")); uart_putw_dec(disk_info.format); uart_putc('\n');
    uart_puts_p(PSTR("free:   ")); uart_putdw_dec(fat_get_fs_free(fs)); uart_putc('/');
                                   uart_putdw_dec(fat_get_fs_size(fs)); uart_putc('\n');

    return 1;
}
コード例 #3
0
ファイル: anim_rat.c プロジェクト: scottjgibson/monochron
void setscore_rat(void)
{
    if(score_mode != last_score_mode_rat) {
        redraw_time_rat = 1;
        last_score_mode_rat = score_mode;
    }
    switch(score_mode) {
#ifdef OPTION_DOW_DATELONG
    case SCORE_MODE_DOW:
        break;
    case SCORE_MODE_DATELONG:
        right_score = date_d;
        break;
#endif
    case SCORE_MODE_TIME:
        if((minute_changed || hour_changed)) {
            if(hour_changed) {
                left_score = hours(old_h);
                right_score = old_m;
            } else if (minute_changed) {
                right_score = old_m;
            }
        } else {
            left_score = hours(time_h);
            right_score = time_m;
        }
        break;
    case SCORE_MODE_DATE:
#ifdef OPTION_DOW_DATELONG
        if((region == REGION_US)||(region == DOW_REGION_US)) {
#else
        if(region == REGION_US) {
#endif
            left_score = date_m;
            right_score = date_d;
        } else {
            left_score = date_d;
            right_score = date_m;
        }
        break;
    case SCORE_MODE_YEAR:
        left_score = 20;
        right_score = date_y;
        break;
    case SCORE_MODE_ALARM:
        left_score = hours(alarm_h);
        right_score = alarm_m;
        break;
    }
}

int16_t ticksremaining;  //JMM !! FIX THIS !!  It's a global and it's passed as an arg
void initanim_rat(void) {
    DEBUG(putstring("screen width: "));
    DEBUG(uart_putw_dec(GLCD_XPIXELS));
    DEBUG(putstring("\n\rscreen height: "));
    DEBUG(uart_putw_dec(GLCD_YPIXELS));
    DEBUG(putstring_nl(""));

    oldball_x = ball_x = 25*FIXED_MATH;
    oldball_y = ball_y = 25*FIXED_MATH;	//Somewhere away from 0,0.
    oldleftpaddle_y = leftpaddle_y = 25*FIXED_MATH;
    oldrightpaddle_y = rightpaddle_y = 25*FIXED_MATH;
    init_crand();

    ball_dx = ball_dy = 0;
    initdisplay_rat(0);
}