示例#1
0
void display_layer_update_callback(Layer *me, GContext* ctx) {

  PblTm t;

  get_time(&t);
  int m = t.tm_min;
  int h = t.tm_hour;

  graphics_context_set_stroke_color(ctx, GColorBlack);
  graphics_context_set_fill_color(ctx, GColorBlack);

  displayReset();

  displayCol(ctx, DIGIT_SPACE);
  displayCol(ctx, DIGIT_SPACE);
  displayNum(ctx, h/10);
  displayCol(ctx, DIGIT_SPACE);
  displayNum(ctx, h%10);
  displayCol(ctx, DIGIT_SPACE);
  displayNum(ctx, m/10);
  displayCol(ctx, DIGIT_SPACE);
  displayNum(ctx, m%10);
  displayCol(ctx, DIGIT_SPACE);
  displayCol(ctx, DIGIT_SPACE);
}
示例#2
0
void loop(){

    createMsg();

    int t1;
    int l;
    int letter;


    for(letter=0; letter< MAX_MSG; letter++)
    {
        for(l=0;l< LETTER_TIME;l++)
        {
            for(t1=0;t1<8;t1++)
            {
                displayNum(outStr[letter][t1],(t1+1));
            }
        }

        if (letter == msgLen+4) {
            break;
        }
    }

//    for (int row=0; row<8; row++) {
//        digitalWrite(row1+row, HIGH);
//        for (int col=0; col<8; col++) {
//            digitalWrite(col1+col, LOW);
//        }
//    }
}
示例#3
0
int main(void)
{
	//some setup code
	
	//enable internal interupts.
	EICRA |= 	( 1<<ISC01 );//enable INT1 to trigger on falling edge.
	EICRA |= 	( 1<<ISC11 );//enable INT0 to trigger on falling edge.
	EIMSK |= 	( 1<<INT0 )|( 1<<INT1 );
	sei();
	
	DDRD  |= 	( 1<<POWERCONTROL );//power control pin to output.
	PORTD |=   ~( 1<<POWERCONTROL ); //enable internal pullup on POWERCONTROL pin
	//set encoder pins to input.
	DDRD  &=   ~(( 1<<ENCODER_PIN_A )|( 1<<ENCODER_PIN_B )|( 1<<ENCODER_BUTTON ));
	PORTD |= 	 ( 1<<ENCODER_PIN_A )|( 1<<ENCODER_PIN_B )|( 1<<ENCODER_BUTTON ); //set pullups on encoder pins.
	
	DDRB  |= 	 ( 1<<LATCH )|( 1<<CLOCK )|( 1<<DATA_OUT ); //register pins to output
	PORTB &=   ~(( 1<<LATCH )|( 1<<CLOCK )|( 1<<DATA_OUT )); //clear register pins.
	//initialize uart
	init_uart();
	//main loop.
	while(1)
	{
		pin = atoi(uart_buffer);
		displayNum(pin);
		/*
		int i;
		for(i = 0;i<10000;i++)
			displayNum(i);
		*/
	}
	
	return 1;
}
示例#4
0
void displayMulti(uint32_t num,char special){
  //Pin 0 is actually 10^5 place
  for(int i=0;i<5;i++){
    if(i==0 && special){
      if(special == 'H'){
        displayNum(16);
      } else if(special == 'P'){
        displayNum(17);
      }
    } else {
      displayNum(nthdigit(num,4-i));
    }
    PORTD |= (1<<i);
    _delay_ms(1);
    PORTD &= ~(1<<i);
    displayClear();
  }
}
示例#5
0
int main() {

	int num1, num2;
	printf("Enter two numbers: ");
	scanf("%d %d", &num1, &num2);

	if (num1 < 0 || num2 < 0) {
		return 0;
	}

	struct node *h1 = makeList(num1);
	struct node *h2 = makeList(num2);

	struct node *h3 = addLists(h1, h2); // sum list

	printf("\nSum: ");
	displayNum(h3);

	return 0;
}
示例#6
0
void displayMultiF(float numF){
  //Pin 0 is actually 10^5 place
  //Round to 2 decimals
  uint32_t num = (uint32_t)(numF*100+.5);
  unsigned int decimal = 1;
  if(num >= 100000){
    num = num/100;
    decimal = 0;
  }
  for(int i=0;i<5;i++){
    displayNum(nthdigit(num,4-i));
    if(i==2 && decimal == 1){
      DDRC |= (1<<7);
    }
    PORTD |= (1<<i);
    _delay_ms(1);
    PORTD &= ~(1<<i);
    displayClear();
  }

}
示例#7
0
ISR(TIMER0_OVF_vect, ISR_NOBLOCK)
{
	int temp = displayedNum;
	displayNum(temp);
	TCNT0 = 255;
}