parent
							
								
									f0bda07742
								
							
						
					
					
						commit
						9bbc8fafe5
					
				| @ -25,9 +25,7 @@ void AppiButton::run() { | |||||||
| 
 | 
 | ||||||
|     AppiButtonEvent event; |     AppiButtonEvent event; | ||||||
|     while(1) { |     while(1) { | ||||||
|         osStatus_t event_status = osMessageQueueGet(event_queue, &event, NULL, 100); |         if(get_event(&event, 100)) { | ||||||
| 
 |  | ||||||
|         if(event_status == osOK) { |  | ||||||
|             if(event.type == AppiButtonEvent::EventTypeKey) { |             if(event.type == AppiButtonEvent::EventTypeKey) { | ||||||
|                 // press events
 |                 // press events
 | ||||||
|                 if(event.value.input.state && event.value.input.input == InputBack) { |                 if(event.value.input.state && event.value.input.input == InputBack) { | ||||||
| @ -63,7 +61,9 @@ void AppiButton::render(CanvasApi* canvas) { | |||||||
|     canvas->set_font(canvas, FontPrimary); |     canvas->set_font(canvas, FontPrimary); | ||||||
|     canvas->draw_str(canvas, 2, 12, "iButton"); |     canvas->draw_str(canvas, 2, 12, "iButton"); | ||||||
| 
 | 
 | ||||||
|  |     if(mode[state.mode_index] != NULL) { | ||||||
|         mode[state.mode_index]->render(canvas, &state); |         mode[state.mode_index]->render(canvas, &state); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void AppiButton::blink_red() { | void AppiButton::blink_red() { | ||||||
|  | |||||||
| @ -42,7 +42,7 @@ public: | |||||||
|     GpioPin* green_led_record; |     GpioPin* green_led_record; | ||||||
| 
 | 
 | ||||||
|     static const uint8_t modes_count = 2; |     static const uint8_t modes_count = 2; | ||||||
|     AppTemplateMode<AppiButtonState, AppiButtonEvent>* mode[modes_count]; |     AppTemplateMode<AppiButtonState, AppiButtonEvent>* mode[modes_count] = {NULL, NULL}; | ||||||
| 
 | 
 | ||||||
|     void run(); |     void run(); | ||||||
|     void render(CanvasApi* canvas); |     void render(CanvasApi* canvas); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 DrZlo13
						DrZlo13