Floopper bloopper (#245)
* add floopper bloopper build * enhance canvas api * update submodule
This commit is contained in:
		
							parent
							
								
									d57b7fd448
								
							
						
					
					
						commit
						6d7ecf9a44
					
				
							
								
								
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							| @ -7,3 +7,6 @@ | |||||||
| [submodule "lib/STM32CubeWB"] | [submodule "lib/STM32CubeWB"] | ||||||
| 	path = lib/STM32CubeWB | 	path = lib/STM32CubeWB | ||||||
| 	url = https://github.com/STMicroelectronics/STM32CubeWB.git | 	url = https://github.com/STMicroelectronics/STM32CubeWB.git | ||||||
|  | [submodule "applications/floopper-bloopper"] | ||||||
|  | 	path = applications/floopper-bloopper | ||||||
|  | 	url = https://github.com/glitchcore/floopper-bloopper.git | ||||||
|  | |||||||
| @ -38,6 +38,7 @@ void app_gpio_test(void* p); | |||||||
| void app_ibutton(void* p); | void app_ibutton(void* p); | ||||||
| void cli_task(void* p); | void cli_task(void* p); | ||||||
| void music_player(void* p); | void music_player(void* p); | ||||||
|  | void floopper_bloopper(void* p); | ||||||
| 
 | 
 | ||||||
| const FlipperStartupApp FLIPPER_STARTUP[] = { | const FlipperStartupApp FLIPPER_STARTUP[] = { | ||||||
| #ifdef APP_DISPLAY | #ifdef APP_DISPLAY | ||||||
| @ -134,6 +135,10 @@ const FlipperStartupApp FLIPPER_STARTUP[] = { | |||||||
| #ifdef APP_GPIO_DEMO | #ifdef APP_GPIO_DEMO | ||||||
|     {.app = app_gpio_test, .name = "gpio test", .libs = {1, FURI_LIB{"gui_task"}}}, |     {.app = app_gpio_test, .name = "gpio test", .libs = {1, FURI_LIB{"gui_task"}}}, | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef APP_FLOOPPER_BLOOPPER | ||||||
|  |     {.app = floopper_bloopper, .name = "Floopper Bloopper", .libs = {1, FURI_LIB{"gui_task"}}}, | ||||||
|  | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const FlipperStartupApp FLIPPER_APPS[] = { | const FlipperStartupApp FLIPPER_APPS[] = { | ||||||
| @ -184,4 +189,9 @@ const FlipperStartupApp FLIPPER_APPS[] = { | |||||||
| #ifdef BUILD_MUSIC_PLAYER | #ifdef BUILD_MUSIC_PLAYER | ||||||
|     {.app = music_player, .name = "music player", .libs = {1, FURI_LIB{"gui_task"}}}, |     {.app = music_player, .name = "music player", .libs = {1, FURI_LIB{"gui_task"}}}, | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef BUILD_FLOOPPER_BLOOPPER | ||||||
|  |     {.app = floopper_bloopper, .name = "Floopper Bloopper", .libs = {1, FURI_LIB{"gui_task"}}}, | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| }; | }; | ||||||
| @ -24,6 +24,7 @@ BUILD_VIBRO_DEMO = 1 | |||||||
| BUILD_SD_TEST = 1 | BUILD_SD_TEST = 1 | ||||||
| BUILD_GPIO_DEMO = 1 | BUILD_GPIO_DEMO = 1 | ||||||
| BUILD_MUSIC_PLAYER = 1 | BUILD_MUSIC_PLAYER = 1 | ||||||
|  | BUILD_FLOOPPER_BLOOPPER = 1 | ||||||
| BUILD_IBUTTON = 1 | BUILD_IBUTTON = 1 | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| @ -259,6 +260,17 @@ CFLAGS		+= -DBUILD_MUSIC_PLAYER | |||||||
| C_SOURCES	+= $(wildcard $(APP_DIR)/music-player/*.c) | C_SOURCES	+= $(wildcard $(APP_DIR)/music-player/*.c) | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
|  | APP_FLOOPPER_BLOOPPER ?= 0 | ||||||
|  | ifeq ($(APP_FLOOPPER_BLOOPPER), 1) | ||||||
|  | CFLAGS		+= -DAPP_FLOOPPER_BLOOPPER | ||||||
|  | BUILD_FLOOPPER_BLOOPPER = 1 | ||||||
|  | endif | ||||||
|  | BUILD_FLOOPPER_BLOOPPER ?= 0 | ||||||
|  | ifeq ($(BUILD_FLOOPPER_BLOOPPER), 1) | ||||||
|  | CFLAGS		+= -DBUILD_FLOOPPER_BLOOPPER | ||||||
|  | C_SOURCES	+= $(wildcard $(APP_DIR)/floopper-bloopper/*.c) | ||||||
|  | endif | ||||||
|  | 
 | ||||||
| APP_IBUTTON ?= 0 | APP_IBUTTON ?= 0 | ||||||
| ifeq ($(APP_IBUTTON), 1) | ifeq ($(APP_IBUTTON), 1) | ||||||
| CFLAGS		+= -DAPP_IBUTTON | CFLAGS		+= -DAPP_IBUTTON | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								applications/floopper-bloopper
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										1
									
								
								applications/floopper-bloopper
									
									
									
									
									
										Submodule
									
								
							| @ -0,0 +1 @@ | |||||||
|  | Subproject commit 2039949856df06d7f6fa7698897acc48f4714976 | ||||||
| @ -27,6 +27,14 @@ void canvas_dot_draw(CanvasApi* api, uint8_t x, uint8_t y); | |||||||
| void canvas_box_draw(CanvasApi* api, uint8_t x, uint8_t y, uint8_t width, uint8_t height); | void canvas_box_draw(CanvasApi* api, uint8_t x, uint8_t y, uint8_t width, uint8_t height); | ||||||
| void canvas_draw_frame(CanvasApi* api, uint8_t x, uint8_t y, uint8_t width, uint8_t height); | void canvas_draw_frame(CanvasApi* api, uint8_t x, uint8_t y, uint8_t width, uint8_t height); | ||||||
| void canvas_draw_line(CanvasApi* api, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); | void canvas_draw_line(CanvasApi* api, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); | ||||||
|  | void canvas_draw_xbm( | ||||||
|  |     CanvasApi* canvas, | ||||||
|  |     uint8_t x, | ||||||
|  |     uint8_t y, | ||||||
|  |     uint8_t w, | ||||||
|  |     uint8_t h, | ||||||
|  |     const uint8_t* bitmap); | ||||||
|  | void canvas_draw_glyph(CanvasApi* canvas, uint8_t x, uint8_t y, uint16_t ch); | ||||||
| 
 | 
 | ||||||
| uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr); | uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr); | ||||||
| uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr); | uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr); | ||||||
| @ -55,6 +63,8 @@ CanvasApi* canvas_api_init() { | |||||||
|     canvas->api.draw_box = canvas_box_draw; |     canvas->api.draw_box = canvas_box_draw; | ||||||
|     canvas->api.draw_frame = canvas_draw_frame; |     canvas->api.draw_frame = canvas_draw_frame; | ||||||
|     canvas->api.draw_line = canvas_draw_line; |     canvas->api.draw_line = canvas_draw_line; | ||||||
|  |     canvas->api.draw_xbm = canvas_draw_xbm; | ||||||
|  |     canvas->api.draw_glyph = canvas_draw_glyph; | ||||||
| 
 | 
 | ||||||
|     return (CanvasApi*)canvas; |     return (CanvasApi*)canvas; | ||||||
| } | } | ||||||
| @ -123,6 +133,8 @@ void canvas_font_set(CanvasApi* api, Font font) { | |||||||
|         u8g2_SetFont(&canvas->fb, u8g2_font_helvB08_tf); |         u8g2_SetFont(&canvas->fb, u8g2_font_helvB08_tf); | ||||||
|     } else if(font == FontSecondary) { |     } else if(font == FontSecondary) { | ||||||
|         u8g2_SetFont(&canvas->fb, u8g2_font_haxrcorp4089_tr); |         u8g2_SetFont(&canvas->fb, u8g2_font_haxrcorp4089_tr); | ||||||
|  |     } else if(font == FontGlyph) { | ||||||
|  |         u8g2_SetFont(&canvas->fb, u8g2_font_unifont_t_symbols); | ||||||
|     } else { |     } else { | ||||||
|         furi_check(0); |         furi_check(0); | ||||||
|     } |     } | ||||||
| @ -180,3 +192,25 @@ void canvas_draw_line(CanvasApi* api, uint8_t x1, uint8_t y1, uint8_t x2, uint8_ | |||||||
|     y2 += canvas->offset_y; |     y2 += canvas->offset_y; | ||||||
|     u8g2_DrawLine(&canvas->fb, x1, y1, x2, y2); |     u8g2_DrawLine(&canvas->fb, x1, y1, x2, y2); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | void canvas_draw_xbm( | ||||||
|  |     CanvasApi* api, | ||||||
|  |     uint8_t x, | ||||||
|  |     uint8_t y, | ||||||
|  |     uint8_t w, | ||||||
|  |     uint8_t h, | ||||||
|  |     const uint8_t* bitmap) { | ||||||
|  |     furi_assert(api); | ||||||
|  |     Canvas* canvas = (Canvas*)api; | ||||||
|  |     x += canvas->offset_x; | ||||||
|  |     y += canvas->offset_y; | ||||||
|  |     u8g2_DrawXBM(&canvas->fb, x, y, w, h, bitmap); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void canvas_draw_glyph(CanvasApi* api, uint8_t x, uint8_t y, uint16_t ch) { | ||||||
|  |     furi_assert(api); | ||||||
|  |     Canvas* canvas = (Canvas*)api; | ||||||
|  |     x += canvas->offset_x; | ||||||
|  |     y += canvas->offset_y; | ||||||
|  |     u8g2_DrawGlyph(&canvas->fb, x, y, ch); | ||||||
|  | } | ||||||
| @ -9,10 +9,7 @@ typedef enum { | |||||||
|     ColorBlack = 0x01, |     ColorBlack = 0x01, | ||||||
| } Color; | } Color; | ||||||
| 
 | 
 | ||||||
| typedef enum { | typedef enum { FontPrimary = 0x00, FontSecondary = 0x01, FontGlyph = 0x02 } Font; | ||||||
|     FontPrimary = 0x00, |  | ||||||
|     FontSecondary = 0x01, |  | ||||||
| } Font; |  | ||||||
| 
 | 
 | ||||||
| typedef struct CanvasApi CanvasApi; | typedef struct CanvasApi CanvasApi; | ||||||
| struct CanvasApi { | struct CanvasApi { | ||||||
| @ -26,8 +23,16 @@ struct CanvasApi { | |||||||
| 
 | 
 | ||||||
|     void (*draw_str)(CanvasApi* canvas, uint8_t x, uint8_t y, const char* str); |     void (*draw_str)(CanvasApi* canvas, uint8_t x, uint8_t y, const char* str); | ||||||
|     void (*draw_icon)(CanvasApi* canvas, uint8_t x, uint8_t y, Icon* icon); |     void (*draw_icon)(CanvasApi* canvas, uint8_t x, uint8_t y, Icon* icon); | ||||||
|  |     void (*draw_xbm)( | ||||||
|  |         CanvasApi* canvas, | ||||||
|  |         uint8_t x, | ||||||
|  |         uint8_t y, | ||||||
|  |         uint8_t w, | ||||||
|  |         uint8_t h, | ||||||
|  |         const uint8_t* bitmap); | ||||||
|     void (*draw_dot)(CanvasApi* canvas, uint8_t x, uint8_t y); |     void (*draw_dot)(CanvasApi* canvas, uint8_t x, uint8_t y); | ||||||
|     void (*draw_box)(CanvasApi* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); |     void (*draw_box)(CanvasApi* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); | ||||||
|     void (*draw_frame)(CanvasApi* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); |     void (*draw_frame)(CanvasApi* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); | ||||||
|     void (*draw_line)(CanvasApi* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); |     void (*draw_line)(CanvasApi* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); | ||||||
|  |     void (*draw_glyph)(CanvasApi* canvas, uint8_t x, uint8_t y, uint16_t ch); | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 coreglitch
						coreglitch