parent
							
								
									bf2f6e89ca
								
							
						
					
					
						commit
						a61eef0f99
					
				@ -32,6 +32,7 @@ void lf_rfid_workaround(void* p);
 | 
				
			|||||||
void nfc_task(void* p);
 | 
					void nfc_task(void* p);
 | 
				
			||||||
void irukagotchi_task(void* p);
 | 
					void irukagotchi_task(void* p);
 | 
				
			||||||
void power_task(void* p);
 | 
					void power_task(void* p);
 | 
				
			||||||
 | 
					void application_vibro(void* p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const FlipperStartupApp FLIPPER_STARTUP[] = {
 | 
					const FlipperStartupApp FLIPPER_STARTUP[] = {
 | 
				
			||||||
#ifdef APP_DISPLAY
 | 
					#ifdef APP_DISPLAY
 | 
				
			||||||
@ -138,4 +139,8 @@ const FlipperStartupApp FLIPPER_APPS[] = {
 | 
				
			|||||||
#ifdef BUILD_SPEAKER_DEMO
 | 
					#ifdef BUILD_SPEAKER_DEMO
 | 
				
			||||||
    {.app = coreglitch_demo_0, .name = "coreglitch_demo_0", .libs = {0}},
 | 
					    {.app = coreglitch_demo_0, .name = "coreglitch_demo_0", .libs = {0}},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef BUILD_VIBRO_DEMO
 | 
				
			||||||
 | 
					    {.app = application_vibro, .name = "application_vibro", .libs = {1, FURI_LIB{"input_task"}}},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -19,6 +19,7 @@ BUILD_EXAMPLE_INPUT_DUMP = 1
 | 
				
			|||||||
BUILD_CC1101 = 1
 | 
					BUILD_CC1101 = 1
 | 
				
			||||||
BUILD_LF_RFID = 1
 | 
					BUILD_LF_RFID = 1
 | 
				
			||||||
BUILD_SPEAKER_DEMO = 1
 | 
					BUILD_SPEAKER_DEMO = 1
 | 
				
			||||||
 | 
					BUILD_VIBRO_DEMO = 1
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
APP_NFC ?= 0
 | 
					APP_NFC ?= 0
 | 
				
			||||||
@ -204,6 +205,13 @@ APP_INPUT = 1
 | 
				
			|||||||
APP_GUI = 1
 | 
					APP_GUI = 1
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BUILD_VIBRO_DEMO ?= 0
 | 
				
			||||||
 | 
					ifeq ($(BUILD_VIBRO_DEMO), 1)
 | 
				
			||||||
 | 
					CFLAGS		+= -DBUILD_VIBRO_DEMO
 | 
				
			||||||
 | 
					C_SOURCES	+= $(wildcard $(APP_DIR)/examples/vibro.c)
 | 
				
			||||||
 | 
					APP_INPUT = 1
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# device drivers
 | 
					# device drivers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
APP_GUI	?= 0
 | 
					APP_GUI	?= 0
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										34
									
								
								applications/examples/vibro.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								applications/examples/vibro.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					#include "flipper_v2.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					    GpioPin* led;
 | 
				
			||||||
 | 
					    GpioPin* vibro;
 | 
				
			||||||
 | 
					} Ctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void button_handler(const void* value, void* _ctx) {
 | 
				
			||||||
 | 
					    const InputEvent* event = value;
 | 
				
			||||||
 | 
					    Ctx* ctx = (Ctx*)_ctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(event->input == InputOk) {
 | 
				
			||||||
 | 
					        gpio_write(ctx->vibro, event->state);
 | 
				
			||||||
 | 
					        gpio_write(ctx->led, !event->state);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void application_vibro(void* p) {
 | 
				
			||||||
 | 
					    Ctx ctx = {.led = (GpioPin*)&led_gpio[1], .vibro = (GpioPin*)&vibro_gpio};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    gpio_init(ctx.led, GpioModeOutputOpenDrain);
 | 
				
			||||||
 | 
					    gpio_init(ctx.vibro, GpioModeOutputPushPull);
 | 
				
			||||||
 | 
					    gpio_write(ctx.led, true);
 | 
				
			||||||
 | 
					    gpio_write(ctx.vibro, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // subscribe on buttons
 | 
				
			||||||
 | 
					    PubSub* event_record = furi_open("input_events");
 | 
				
			||||||
 | 
					    furi_check(event_record);
 | 
				
			||||||
 | 
					    subscribe_pubsub(event_record, button_handler, &ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    while(1) {
 | 
				
			||||||
 | 
					        osDelay(osWaitForever);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -152,6 +152,9 @@ extern TIM_HandleTypeDef htim15;
 | 
				
			|||||||
#define NFC_IRQ_Pin RFID_PULL_Pin
 | 
					#define NFC_IRQ_Pin RFID_PULL_Pin
 | 
				
			||||||
#define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port
 | 
					#define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define VIBRO_Pin GPIO_PIN_6
 | 
				
			||||||
 | 
					#define VIBRO_GPIO_Port GPIOC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* USER CODE END Private defines */
 | 
					/* USER CODE END Private defines */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -28,3 +28,4 @@ const GpioPin led_gpio[3] = {
 | 
				
			|||||||
    {LED_BLUE_GPIO_Port, LED_BLUE_Pin}};
 | 
					    {LED_BLUE_GPIO_Port, LED_BLUE_Pin}};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const GpioPin backlight_gpio = {DISPLAY_BACKLIGHT_GPIO_Port, DISPLAY_BACKLIGHT_Pin};
 | 
					const GpioPin backlight_gpio = {DISPLAY_BACKLIGHT_GPIO_Port, DISPLAY_BACKLIGHT_Pin};
 | 
				
			||||||
 | 
					const GpioPin vibro_gpio = {VIBRO_GPIO_Port, VIBRO_Pin};
 | 
				
			||||||
 | 
				
			|||||||
@ -10,3 +10,4 @@ extern const bool input_invert[GPIO_INPUT_PINS_COUNT];
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
extern const GpioPin led_gpio[3];
 | 
					extern const GpioPin led_gpio[3];
 | 
				
			||||||
extern const GpioPin backlight_gpio;
 | 
					extern const GpioPin backlight_gpio;
 | 
				
			||||||
 | 
					extern const GpioPin vibro_gpio;
 | 
				
			||||||
 | 
				
			|||||||
@ -186,6 +186,9 @@ extern TIM_HandleTypeDef htim16;
 | 
				
			|||||||
#define NFC_IRQ_Pin RFID_PULL_Pin
 | 
					#define NFC_IRQ_Pin RFID_PULL_Pin
 | 
				
			||||||
#define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port
 | 
					#define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define VIBRO_Pin GPIO_PIN_10
 | 
				
			||||||
 | 
					#define VIBRO_GPIO_Port GPIOC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* USER CODE END Private defines */
 | 
					/* USER CODE END Private defines */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
				
			|||||||
@ -26,3 +26,4 @@ const GpioPin led_gpio[3] = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const GpioPin backlight_gpio = {DISPLAY_BACKLIGHT_GPIO_Port, DISPLAY_BACKLIGHT_Pin};
 | 
					const GpioPin backlight_gpio = {DISPLAY_BACKLIGHT_GPIO_Port, DISPLAY_BACKLIGHT_Pin};
 | 
				
			||||||
const GpioPin sd_cs_gpio = {SD_CS_GPIO_Port, SD_CS_Pin};
 | 
					const GpioPin sd_cs_gpio = {SD_CS_GPIO_Port, SD_CS_Pin};
 | 
				
			||||||
 | 
					const GpioPin vibro_gpio = {VIBRO_GPIO_Port, VIBRO_Pin};
 | 
				
			||||||
 | 
				
			|||||||
@ -11,3 +11,4 @@ extern const bool input_invert[GPIO_INPUT_PINS_COUNT];
 | 
				
			|||||||
extern const GpioPin led_gpio[3];
 | 
					extern const GpioPin led_gpio[3];
 | 
				
			||||||
extern const GpioPin backlight_gpio;
 | 
					extern const GpioPin backlight_gpio;
 | 
				
			||||||
extern const GpioPin sd_cs_gpio;
 | 
					extern const GpioPin sd_cs_gpio;
 | 
				
			||||||
 | 
					extern const GpioPin vibro_gpio;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user