int main(void) { RCC_Configuration(); RCC_ClocksTypeDef RCC_Clocks; RCC_GetClocksFreq(&RCC_Clocks); EnableClock(); //LCD_GLASS_Configure_GPIO(); //LCD_GLASS_Init(); SysTick_Config((RCC_Clocks.SYSCLK_Frequency / 2) / 1000); // Cannot exceed 16,777,215 /* Set SysTick Preemption Priority, it's a system handler rather than a regular interrupt */ //NVIC_SetPriority(SysTick_IRQn, 0x04); lcdInit(); lcdClear(); lcdXY( 2, 5 ); lcdStr( "Test"); //lcdBender(); // init rtc RTC_InitTypeDef rtcInit; rtcInit.RTC_HourFormat = RTC_HourFormat_24; rtcInit.RTC_AsynchPrediv = 0x7F; rtcInit.RTC_SynchPrediv = 0xFF; RTC_Init(&rtcInit); RTC_TimeTypeDef RTC_TimeStructure; RTC_DateTypeDef RTC_DateStructure; usart_init(); SetRTCClock(); GPIO_InitTypeDef gpio_btn; gpio_btn.GPIO_Pin = GPIO_Pin_0; gpio_btn.GPIO_Mode = GPIO_Mode_IN; gpio_btn.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOA, &gpio_btn); int prevSecond = -1; while (1) { //uint8_t __status = GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0); if (GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0) == 0x00 && !_sent) { _sent = 1; mini_snprintf( strDisp, 22, "20%02d/%02d/%02d %02d:%02d:%02d Hallo !!!", RTC_DateStructure.RTC_Year, RTC_DateStructure.RTC_Month, RTC_DateStructure.RTC_Date, RTC_TimeStructure.RTC_Hours, RTC_TimeStructure.RTC_Minutes, RTC_TimeStructure.RTC_Seconds); SendSMS("0836325001",strDisp); } if (GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0) != 0x00 && _sent) { _sent = 0; } RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure ); RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure); if ( RTC_TimeStructure.RTC_Seconds != prevSecond ) { lcdClear(); mini_snprintf( strDisp, 11, "20%02d/%02d/%02d", RTC_DateStructure.RTC_Year, RTC_DateStructure.RTC_Month, RTC_DateStructure.RTC_Date); lcdXY( 0, 0 ); lcdStr( strDisp); mini_snprintf( strDisp, 10, "%02d:%02d:%02d", RTC_TimeStructure.RTC_Hours, RTC_TimeStructure.RTC_Minutes, RTC_TimeStructure.RTC_Seconds ); lcdXY( 0, 1 ); lcdStr( strDisp); //LCD_GLASS_Clear(); //LCD_GLASS_DisplayString( strDisp ); prevSecond = RTC_TimeStructure.RTC_Seconds; } /*if ( usart_available() ) // data available { //usart_print( "Data Available: " ); uint8_t ch = usart_read(); //usart_write(ch); //usart_print( "\r\n" ); SendSMS("836325001","Wynand"); }*/ } return 0; }
void end_round() { round_started = false; club_menu_index = 0; text_layer_set_text(&club, club_menu[club_menu_index]); window_init(&finalscore, "Final Score"); window_stack_push(&finalscore, true /* Animated */); text_layer_init(&finalscore_score, GRect(0, 0, 144, 168-16)); text_layer_set_background_color(&finalscore_score, GColorWhite); text_layer_set_text_color(&finalscore_score, GColorBlack); text_layer_set_font(&finalscore_score,fonts_get_system_font(FONT_KEY_GOTHAM_42_BOLD)); mini_snprintf(s_final_score, 25, "Final Score %d", totalshots); text_layer_set_text(&finalscore_score, s_final_score); text_layer_set_text_alignment(&finalscore_score, GTextAlignmentCenter); layer_add_child(&finalscore.layer, &finalscore_score.layer); text_layer_init(&finalscore_putts, GRect(0, 126, 144, 168-16-126)); text_layer_set_background_color(&finalscore_putts, GColorWhite); text_layer_set_text_color(&finalscore_putts, GColorBlack); text_layer_set_font(&finalscore_putts,fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); mini_snprintf(s_final_putts, 25, "Total Putts: %d", totalputts); text_layer_set_text(&finalscore_putts, s_final_putts); text_layer_set_text_alignment(&finalscore_putts, GTextAlignmentCenter); layer_add_child(&finalscore.layer, &finalscore_putts.layer); vibes_double_pulse(); // Need to destroy list_of_shots array. }
char* mthr(float time1, float time2, char* inject) { static char fmttime[] = "00:00A> 00:00A"; int h1 = hours(time1); int m1 = mins(time1); int h2 = hours(time2); int m2 = mins(time2); if (clock_is_24h_style()) { mini_snprintf(fmttime, sizeof(fmttime), "%d:%02d%s %d:%02d",h1,m1,inject,h2,m2); } else { if (h1 > 11 && h2 > 11) { if (h1 > 12) h1 -= 12; if (h2 > 12) h2 -= 12; mini_snprintf(fmttime, sizeof(fmttime), "%d:%02dP%s %d:%02dP",h1,m1,inject,h2,m2); } else if (h1 > 11) { if (h1 > 12) h1 -= 12; if (h2 == 0) h2=12; mini_snprintf(fmttime, sizeof(fmttime), "%d:%02dP%s %d:%02dA",h1,m1,inject,h2,m2); } else if (h2 > 11) { if (h2 > 12) h2 -= 12; if (h1 == 0) h1=12; mini_snprintf(fmttime, sizeof(fmttime), "%d:%02dA%s %d:%02dP",h1,m1,inject,h2,m2); } else { if (h1 == 0) h1=12; if (h2 == 0) h2=12; mini_snprintf(fmttime, sizeof(fmttime), "%d:%02dA%s %d:%02dA",h1,m1,inject,h2,m2); } } return fmttime; }
void printGraphsLCD(int* accelData, int analogIn) { // Only draw if it is time to do so //if (TM_DELAY_Time() > 1) { mini_snprintf(lcdstr,100,"A:%d___",analogIn); TM_ILI9341_Puts(30, 60, lcdstr, &TM_Font_11x18, ILI9341_COLOR_YELLOW, ILI9341_COLOR_BLACK); // Draw 3 accel graphs on top half of the screen int ax = 80 + accelData[0]*40/4096; int ay = 80 + accelData[1]*40/4096; int az = 80 + accelData[2]*40/4096; TM_ILI9341_DrawLine(xpix,80,xpix+1,80,ILI9341_COLOR_GRAY); TM_ILI9341_DrawLine(xpix,axprev,xpix+1,ax,ILI9341_COLOR_RED); TM_ILI9341_DrawLine(xpix,ayprev,xpix+1,ay,ILI9341_COLOR_GREEN); TM_ILI9341_DrawLine(xpix,azprev,xpix+1,az,ILI9341_COLOR_BLUE); axprev = ax; ayprev = ay; azprev = az; // Draw vertical line TM_ILI9341_DrawLine(1,160,240,160,ILI9341_COLOR_WHITE); // Draw strain graph on bottom half int strain = 180 + analogIn*140/4096; TM_ILI9341_DrawLine(xpix,strainprev,xpix+1,strain,ILI9341_COLOR_CYAN); strainprev = strain; // Move x coord xpix++; if(xpix > 239) { xpix = 1; // Clear whole screen TM_ILI9341_Fill(ILI9341_COLOR_BLACK); } // Reset timer // TM_DELAY_SetTime(0); //} }
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) { int i = cell_index->row; if (i < 0) return; char sub[20]; mini_snprintf(sub, 19, "Size: %d <%s>", aqueues[i].size, aqueues[i].status == 1 ? "CLOSED" : "OPEN"); menu_cell_basic_draw(ctx, cell_layer, aqueues[i].name, sub, NULL); }
void update_shot() { thishole++; mini_snprintf(s_shots_hole, 25, "Shots: %d", thishole); text_layer_set_text(&shots_hole, s_shots_hole); update_total(); text_layer_set_text(&club, "Shot Recorded"); timer_handle = app_timer_send_event(g_ctx, 1500 /* milliseconds */, COOKIE_MY_TIMER); }
//If 12 hour time, subtract 12 from hr if hr > 12 char* thr(float time, char ap) { static char fmttime[] = "00:00A"; int h = hours(time); int m = mins(time); if (clock_is_24h_style()) { mini_snprintf(fmttime, sizeof(fmttime), "%d:%02d",h,m); } else { if (h > 11) { if (h > 12) h -= 12; mini_snprintf(fmttime, sizeof(fmttime), (ap==1)?"%d:%02dP":"%d:%02d",h,m); } else { if (h == 0) h=12; mini_snprintf(fmttime, sizeof(fmttime), (ap==1)?"%d:%02dA":"%d:%02d",h,m); } } return fmttime; }
void displayScore(void) { mini_snprintf(strHeader,99, "::: %d%c%c inning :::\n" , team+1 , (team)?'n':'s' , (team)?'d':'t' ); mini_snprintf(strScore,99, "%d/%d\n" , current->runs , current->wickets ); mini_snprintf(strStats,99, "%d.%d overs\n RR: %d.%d\n" , current->balls/6 , (current->balls - (6*(current->balls/6))) , (current->runs*6/current->balls) , (current->runs*600/current->balls)-(current->runs*6/current->balls)*100 ); mini_snprintf(strHistory,99, "%c %c %c %c %c %c %c %c %c %c %c %c\n" , keyPad[keyHistory[(keyPos+1)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+2)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+3)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+4)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+5)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+6)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+7)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+8)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+9)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+10)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+11)%MAX_HISTORY]] , keyPad[keyHistory[(keyPos+0)%MAX_HISTORY]] ); text_layer_set_text(&headerLayer, strHeader); text_layer_set_text(&scoreLayer, strScore); text_layer_set_text(&statsLayer, strStats); text_layer_set_text(&historyLayer, strHistory); }
/* dump an area of memory as hex to the terminal XXX fix to use "printf" rather than buffers + snprintf */ void terminal_hexdump(void *memory, size_t byte_count) { char buffer[256]; for (size_t index = 0; index < byte_count + ((byte_count % HEXDUMP_WIDTH) ? (HEXDUMP_WIDTH - byte_count % HEXDUMP_WIDTH) : 0); index++) { /* print offset at line start */ if (index % HEXDUMP_WIDTH == 0) { mini_snprintf(buffer, 256, "0x%06x: ", index); terminal_write(buffer); } /* print hex data */ if (index < byte_count) { mini_snprintf(buffer, 256, "%02x ", 0xFF & ((char*)memory)[index]); terminal_write(buffer); } else { terminal_write(" "); } if (index % HEXDUMP_WIDTH == HEXDUMP_WIDTH - 1) { terminal_write("\n"); } } }
void handle_minute_tick(AppContextRef ctx, PebbleTickEvent *t) { (void)ctx; if (round_started) { PblTm currenttime; get_time(¤ttime); int rt_hour; int rt_min; rt_hour = (currenttime.tm_hour - round_start_hour); rt_min = (currenttime.tm_min - round_start_minute); if (rt_min < 0) { rt_hour--; rt_min += 60; }; if (rt_min > 59) { rt_hour++; rt_min -= 60; }; mini_snprintf(s_roundtime, 25, "Round Time: %02d:%02d", rt_hour, rt_min); text_layer_set_text(&roundtime, s_roundtime); } }
void update_match_layer_callback(Layer *me, GContext* ctx) { (void)me; graphics_context_set_text_color(ctx, TEXT_COLOR); static char txt[21]; mini_snprintf(txt, 20, TXT_MATCH, match_me, match_opponent); graphics_text_draw(ctx, txt, fonts_get_system_font(FONT_MATCH), FRAME_MATCH, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); }
void update_score_layer_opponent_callback(Layer *me, GContext* ctx) { (void)me; graphics_context_set_text_color(ctx, TEXT_COLOR); static char txt[11]; mini_snprintf(txt, 10, TXT_SCORE_OPPONENT, score_opponent); graphics_text_draw(ctx, txt, fonts_get_system_font(FONT_SCORE), FRAME_SCORE_OPPONENT, GTextOverflowModeWordWrap, GTextAlignmentLeft, NULL); }
void updateDisplay() { // PblTm currentTime; // get_time(¤tTime); // string_format_time(timeText, sizeof(timeText), "%T", ¤tTime); // text_layer_set_text(&timeLayer, timeText); //count_text[0]= count+'0'; //count_text[1]= 0; mini_snprintf(count_text,32,"count=%d",count); text_layer_set_text(&timeLayer, count_text); //sprintf(buffer,"Counted=%d",count); }
void update_duration_layer_callback(Layer *me, GContext* ctx) { (void)me; graphics_context_set_text_color(ctx, TEXT_COLOR); int minutes = (int)duration_seconds / 60; int seconds = duration_seconds % 60; static char txt[21]; mini_snprintf(txt, 20, TXT_DURATION, minutes, seconds); graphics_text_draw(ctx, txt, fonts_get_system_font(FONT_DURATION), FRAME_DURATION, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); }
void start_new_round() { holenum_index = 0; text_layer_set_text(&holepar_hole_num, s_holenum[holenum_index]); // Start Round timer totalshots = -1; thishole = -1; update_shot(); club_menu_index = 1; text_layer_set_text(&club, club_menu[club_menu_index]); round_started = true; mini_snprintf(s_roundtime, 25, "Round Time: %02d:%02d", 0, 0); text_layer_set_text(&roundtime, s_roundtime); PblTm roundstarttime; get_time(&roundstarttime); round_start_hour = roundstarttime.tm_hour; round_start_minute = roundstarttime.tm_min; }
void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) { (void)recognizer; (void)window; switch (club_menu_index) { case 0 : { /* Start Round*/ if (round_started == false) { start_new_round(); } break; } case 14 : { /* Next Hole*/ thishole = 0; mini_snprintf(s_shots_hole, 25, "Shots: %d", thishole); text_layer_set_text(&shots_hole, s_shots_hole); update_holepar(); club_menu_index = 1; text_layer_set_text(&club, club_menu[club_menu_index]); break; } // case 15 : { /* Previous Hole */ // break; // } case 15 : { /* End Round*/ // Stop Round Timer // Clear hole par // Add new layer with final score big? end_round(); break; } default : { /* Record Shot*/ save_clubinfo(); update_shot(); } } }
void formatDiceString(char *string) { char *t = "%dd%d"; mini_snprintf(string, 8, t, normalDie.count, faces[normalDie.face]); }
// Called once per day void handle_day(AppContextRef ctx, PebbleTickEvent* t) { (void)t; (void)ctx; static char riseText[] = "00:00a 00:00a"; static char setText[] = "00:00a 00:00a"; static char moon1Text[] = "<00:00a\n<00:00a"; static char moon2Text[] = "00:00a>\n00:00a>"; static char date[] = "00/00/0000"; static char moon[] = "m"; static char moonp[] = "-----"; char riseTemp[] = "00:00a"; char setTemp[] = "00:00a"; float moonphase_number = 0.0; int moonphase_letter = 0; float sunrise, sunset, dawn, dusk, moonrise[3], moonset[3]; PblTm* time = t->tick_time; if (!t) get_time(time); // date string_format_time(date, sizeof(date), DATEFMT, time); text_layer_set_text(&dateLayer, date); moonphase_number = moon_phase(tm2jd(time)); moonphase_letter = (int)(moonphase_number*27 + 0.5); // correct for southern hemisphere if ((moonphase_letter > 0) && (LAT < 0)) moonphase_letter = 28 - moonphase_letter; // select correct font char if (moonphase_letter == 14) { moon[0] = (unsigned char)(48); } else if (moonphase_letter == 0) { moon[0] = (unsigned char)(49); } else if (moonphase_letter < 14) { moon[0] = (unsigned char)(moonphase_letter+96); } else { moon[0] = (unsigned char)(moonphase_letter+95); } text_layer_set_text(&moonLayer, moon); if (moonphase_number >= 0.5) { mini_snprintf(moonp,sizeof(moonp)," %d-",(int)((1-(1+pbl_cos(moonphase_number*M_PI*2))/2)*100)); } else { mini_snprintf(moonp,sizeof(moonp)," %d+",(int)((1-(1+pbl_cos(moonphase_number*M_PI*2))/2)*100)); } text_layer_set_text(&moonPercent, moonp); //sun rise set sunmooncalc(tm2jd(time), TZ, LAT, -LON, 1, &sunrise, &sunset); sunmooncalc(tm2jd(time), TZ, LAT, -LON, 2, &dawn, &dusk); (dawn == 99.0) ? mini_snprintf(riseTemp,sizeof(riseTemp),"--:--") : mini_snprintf(riseTemp,sizeof(riseTemp),"%s",thr(dawn,0)); (sunrise == 99.0) ? mini_snprintf(riseText,sizeof(riseText),"%s --:--",riseTemp) : mini_snprintf(riseText,sizeof(riseText),"%s %s",riseTemp,thr(sunrise,0)); (sunset == 99.0) ? mini_snprintf(setTemp,sizeof(setTemp),"--:--") : mini_snprintf(setTemp,sizeof(setTemp),"%s",thr(sunset,0)); (dusk == 99.0) ? mini_snprintf(setText,sizeof(setText),"%s --:--",setTemp) : mini_snprintf(setText,sizeof(setText),"%s %s",setTemp,thr(dusk,0)); text_layer_set_text(&riseLayer, riseText); text_layer_set_text(&setLayer, setText); //moon times sunmooncalc(tm2jd(time)-1, TZ, LAT, -LON, 0, &moonrise[0], &moonset[0]); // yesterday sunmooncalc(tm2jd(time), TZ, LAT, -LON, 0, &moonrise[1], &moonset[1]); // today sunmooncalc(tm2jd(time)+1, TZ, LAT, -LON, 0, &moonrise[2], &moonset[2]); // tomorrow if (moonrise[1] == 99.0) { // moon didn't rise today mini_snprintf(moon1Text,sizeof(moon1Text),"<%s",mthr(moonrise[0],moonset[1],"\0")); mini_snprintf(moon2Text,sizeof(moon2Text),"%s>",mthr(moonrise[2],moonset[2],">")); } else if (moonset[1] == 99.0) { // moon didn't set today mini_snprintf(moon1Text,sizeof(moon1Text),"%s>",mthr(moonrise[1],moonset[2],"\0")); mini_snprintf(moon2Text,sizeof(moon2Text),"%s>\n--:--",thr(moonrise[2],1)); } else if (moonrise[1] > moonset[1]) { // moon rose before midnight, rises again today mini_snprintf(moon1Text,sizeof(moon1Text),"<%s",mthr(moonrise[0],moonset[1],"\0")); mini_snprintf(moon2Text,sizeof(moon2Text),"%s>",mthr(moonrise[1],moonset[2],"\0")); } else { // moon was down at midnight, rose today mini_snprintf(moon1Text,sizeof(moon1Text),"%s",mthr(moonrise[1],moonset[1],"\0")); mini_snprintf(moon2Text,sizeof(moon2Text),"%s>",mthr(moonrise[2],moonset[2],">")); } text_layer_set_text(&moonLeft, moon1Text); text_layer_set_text(&moonRight, moon2Text); }
int main( int argc, char ** argv ) { char buffer[ 512 ]; mini_snprintf( buffer, 128, "\n%s", "test" ); printf( "\n%s", buffer ); }
void handle_init(AppContextRef ctx) { (void)ctx; g_ctx = ctx; window_init(&window, "Golf Dashboard"); window_stack_push(&window, true /* Animated */); GFont defaultfont = fonts_get_system_font(FONT_KEY_GOTHIC_14); layer_init(&holepar, GRect(0, 0, 144 /* width */, 40 /* height */)); holepar.update_proc = &holepar_layer_callback; layer_add_child(&window.layer, &holepar); text_layer_init(&holepar_hole, GRect(0, 0, 72, 17)); text_layer_set_background_color(&holepar_hole, GColorClear); text_layer_set_text_color(&holepar_hole, GColorBlack); text_layer_set_text(&holepar_hole, "Hole"); text_layer_set_text_alignment(&holepar_hole, GTextAlignmentCenter); layer_add_child(&holepar, &holepar_hole.layer); GFont holeparfont = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD); text_layer_init(&holepar_hole_num, GRect(0, 10, 60, 30)); text_layer_set_background_color(&holepar_hole_num, GColorClear); text_layer_set_text_color(&holepar_hole_num, GColorBlack); text_layer_set_font(&holepar_hole_num,holeparfont); text_layer_set_text(&holepar_hole_num, ""); text_layer_set_text_alignment(&holepar_hole_num, GTextAlignmentCenter); layer_add_child(&holepar, &holepar_hole_num.layer); text_layer_init(&holepar_par, GRect(72, 0, 72, 17)); text_layer_set_background_color(&holepar_par, GColorClear); text_layer_set_text_color(&holepar_par, GColorBlack); text_layer_set_text(&holepar_par, "Par"); text_layer_set_text_alignment(&holepar_par, GTextAlignmentCenter); layer_add_child(&holepar, &holepar_par.layer); // GFont holeparfont = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD); text_layer_init(&holepar_par_num, GRect(75, 10, 60, 30)); text_layer_set_background_color(&holepar_par_num, GColorClear); text_layer_set_text_color(&holepar_par_num, GColorBlack); text_layer_set_font(&holepar_par_num,holeparfont); text_layer_set_text(&holepar_par_num, "0"); text_layer_set_text_alignment(&holepar_par_num, GTextAlignmentCenter); layer_add_child(&holepar, &holepar_par_num.layer); text_layer_init(&roundtime, GRect(0, 40, 144 /* width */, 15 /* height */)); text_layer_set_background_color(&roundtime, GColorBlack); text_layer_set_text_color(&roundtime, GColorWhite); text_layer_set_font(&roundtime, defaultfont); text_layer_set_text(&roundtime, "Round Time: "); text_layer_set_text_alignment(&roundtime, GTextAlignmentCenter); layer_add_child(&window.layer, &roundtime.layer); GFont yrdfont = fonts_get_system_font(FONT_KEY_GOTHAM_42_MEDIUM_NUMBERS); text_layer_init(&distance, GRect(0, 55, 144 /* width */, 50 /* height */)); text_layer_set_background_color(&distance, GColorBlack); text_layer_set_text_color(&distance, GColorWhite); // Placeholder for Sports SDK text_layer_set_text(&distance, "000"); text_layer_set_font(&distance, yrdfont); text_layer_set_text_alignment(&distance, GTextAlignmentCenter); layer_add_child(&window.layer, &distance.layer); mini_snprintf(s_shots_hole, 25, "Shots: %d", thishole); text_layer_init(&shots_hole, GRect(0, 105, 72 /* width */, 15 /* height */)); text_layer_set_background_color(&shots_hole, GColorBlack); text_layer_set_text_color(&shots_hole, GColorWhite); text_layer_set_font(&shots_hole, defaultfont); text_layer_set_text(&shots_hole, s_shots_hole); text_layer_set_text_alignment(&shots_hole, GTextAlignmentLeft); layer_add_child(&window.layer, &shots_hole.layer); mini_snprintf(s_shots_total, 25, "Total: %d", totalshots); text_layer_init(&shots_total, GRect(72, 105, 72 /* width */, 15 /* height */)); text_layer_set_background_color(&shots_total, GColorBlack); text_layer_set_text_color(&shots_total, GColorWhite); text_layer_set_font(&shots_total, defaultfont); text_layer_set_text(&shots_total, s_shots_total); text_layer_set_text_alignment(&shots_total, GTextAlignmentRight); layer_add_child(&window.layer, &shots_total.layer); GFont clubfont = fonts_get_system_font(FONT_KEY_GOTHIC_24); text_layer_init(&club, GRect(0, 120, 144 /* width */, 168-120-16 /* height */)); text_layer_set_background_color(&club, GColorWhite); text_layer_set_text_color(&club, GColorBlack); text_layer_set_font(&club, clubfont); text_layer_set_text(&club, club_menu[club_menu_index]); text_layer_set_text_alignment(&club, GTextAlignmentCenter); layer_add_child(&window.layer, &club.layer); window_set_click_config_provider(&window, (ClickConfigProvider) click_config_provider); }
void printAccel(int* accelData) { mini_snprintf(str,100,"%d %d %d\n",accelData[0],accelData[1],accelData[2]); SendString(str); }
void printAccelLCD(int* accelData) { mini_snprintf(lcdstr,100,"X:%d___\nY:%d___\nZ:%d___\n",accelData[0],accelData[1],accelData[2]); TM_ILI9341_Puts(30, 60, lcdstr, &TM_Font_11x18, ILI9341_COLOR_YELLOW, ILI9341_COLOR_BLACK); }
void update_total() { totalshots++; if (club_menu_index == 13) {totalputts++;} mini_snprintf(s_shots_total, 25, "Total: %d", totalshots); text_layer_set_text(&shots_total, s_shots_total); }