Skip to content

Commit

Permalink
Refactoring Includes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lee committed Nov 30, 2023
1 parent 8f4d942 commit 41a408c
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 101 deletions.
2 changes: 0 additions & 2 deletions helpers/meal_pager_haptic.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "meal_pager_haptic.h"
#include "../meal_pager.h"


void meal_pager_play_happy_bump(void* context) {
Meal_Pager* app = context;
Expand Down
3 changes: 3 additions & 0 deletions helpers/meal_pager_haptic.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#pragma once

#include <notification/notification_messages.h>
#include "../meal_pager_i.h"

void meal_pager_play_happy_bump(void* context);

Expand Down
3 changes: 0 additions & 3 deletions helpers/meal_pager_led.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include "meal_pager_led.h"
#include "../meal_pager.h"



void meal_pager_led_set_rgb(void* context, int red, int green, int blue) {
Meal_Pager* app = context;
Expand Down
2 changes: 2 additions & 0 deletions helpers/meal_pager_led.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once

#include "../meal_pager_i.h"

void meal_pager_led_set_rgb(void* context, int red, int green, int blue);

Expand Down
1 change: 0 additions & 1 deletion helpers/meal_pager_speaker.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "meal_pager_speaker.h"
#include "../meal_pager.h"

#define NOTE_INPUT 587.33f

Expand Down
4 changes: 4 additions & 0 deletions helpers/meal_pager_speaker.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#pragma once

#include "../meal_pager_i.h"

#define NOTE_INPUT 587.33f

void meal_pager_play_input_sound(void* context);
Expand Down
2 changes: 1 addition & 1 deletion helpers/meal_pager_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string.h>
#include <storage/storage.h>
#include <flipper_format/flipper_format_i.h>
#include "../meal_pager.h"
#include "../meal_pager_i.h"

#define MEAL_PAGER_SETTINGS_FILE_VERSION 1
#define CONFIG_FILE_DIRECTORY_PATH EXT_PATH("apps_data/meal_pager")
Expand Down
2 changes: 1 addition & 1 deletion helpers/retekess/meal_pager_retekess_t119.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#pragma once

#include "../../meal_pager.h"
#include "../../meal_pager_i.h"

char* encManchester(const char* bits, int mode);

Expand Down
88 changes: 1 addition & 87 deletions meal_pager.h
Original file line number Diff line number Diff line change
@@ -1,89 +1,3 @@
#pragma once
#include "meal_pager_i.h"

#include <furi.h>
#include <furi_hal.h>
#include <gui/gui.h>
#include <input/input.h>
#include <stdlib.h>
#include <assets_icons.h>
#include <dialogs/dialogs.h>
#include <notification/notification_messages.h>
#include <gui/view_dispatcher.h>
#include <gui/modules/submenu.h>
#include <gui/scene_manager.h>
#include <gui/modules/variable_item_list.h>
#include <gui/modules/button_menu.h>
#include <gui/modules/dialog_ex.h>
#include "scenes/meal_pager_scene.h"
#include "views/meal_pager_startscreen.h"
#include "views/meal_pager_transmit.h"
#include "helpers/meal_pager_storage.h"

#define TAG "Meal_Pager"

#define SUBGHZ_APP_EXTENSION ".sub"
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")

typedef struct {
Gui* gui;
NotificationApp* notification;
ViewDispatcher* view_dispatcher;
Submenu* submenu;
SceneManager* scene_manager;
VariableItemList* variable_item_list;
Meal_PagerStartscreen* meal_pager_startscreen;
Meal_PagerTransmit* meal_pager_transmit;
DialogsApp* dialogs; // File Browser
FuriString* file_path; // File Browser
uint32_t haptic;
uint32_t speaker;
uint32_t led;
uint32_t save_settings;
uint32_t pager_type;
uint32_t first_station;
char* first_station_char;
uint32_t last_station;
char* last_station_char;
uint32_t first_pager;
char* first_pager_char;
uint32_t last_pager;
char* last_pager_char;
uint32_t current_station;
uint32_t current_pager;
} Meal_Pager;

typedef enum {
Meal_PagerViewIdStartscreen,
Meal_PagerViewIdMenu,
Meal_PagerViewIdTransmit,
Meal_PagerViewIdSettings,
} Meal_PagerViewId;

typedef enum {
Meal_PagerPagerTypeT119,
Meal_PagerPagerTypeTD157,
Meal_PagerPagerTypeTD165,
Meal_PagerPagerTypeTD174,
} Meal_PagerPagerType;



typedef enum {
Meal_PagerHapticOff,
Meal_PagerHapticOn,
} Meal_PagerHapticState;

typedef enum {
Meal_PagerSpeakerOff,
Meal_PagerSpeakerOn,
} Meal_PagerSpeakerState;

typedef enum {
Meal_PagerLedOff,
Meal_PagerLedOn,
} Meal_PagerLedState;

typedef enum {
Meal_PagerSettingsOff,
Meal_PagerSettingsOn,
} Meal_PagerSettingsStoreState;
91 changes: 91 additions & 0 deletions meal_pager_i.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#pragma once

#include <furi.h>
#include <furi_hal.h>
#include <gui/gui.h>
#include <input/input.h>
#include <stdlib.h>
#include <assets_icons.h>
#include <dialogs/dialogs.h>
#include <notification/notification_messages.h>
#include <gui/view_dispatcher.h>
#include <gui/modules/submenu.h>
#include <gui/scene_manager.h>
#include <gui/modules/variable_item_list.h>
#include <gui/modules/button_menu.h>
#include <gui/modules/dialog_ex.h>
#include "scenes/meal_pager_scene.h"
#include "views/meal_pager_startscreen.h"
#include "views/meal_pager_transmit.h"
#include "helpers/meal_pager_storage.h"

#define TAG "Meal_Pager"

#define SUBGHZ_APP_EXTENSION ".sub"
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")

typedef struct Meal_PagerTransmit Meal_PagerTransmit;

typedef struct {
Gui* gui;
NotificationApp* notification;
ViewDispatcher* view_dispatcher;
Submenu* submenu;
SceneManager* scene_manager;
VariableItemList* variable_item_list;
Meal_PagerStartscreen* meal_pager_startscreen;
Meal_PagerTransmit* meal_pager_transmit;
DialogsApp* dialogs; // File Browser
FuriString* file_path; // File Browser
uint32_t haptic;
uint32_t speaker;
uint32_t led;
uint32_t save_settings;
uint32_t pager_type;
uint32_t first_station;
char* first_station_char;
uint32_t last_station;
char* last_station_char;
uint32_t first_pager;
char* first_pager_char;
uint32_t last_pager;
char* last_pager_char;
uint32_t current_station;
uint32_t current_pager;
} Meal_Pager;

typedef enum {
Meal_PagerViewIdStartscreen,
Meal_PagerViewIdMenu,
Meal_PagerViewIdTransmit,
Meal_PagerViewIdSettings,
} Meal_PagerViewId;

typedef enum {
Meal_PagerPagerTypeT119,
Meal_PagerPagerTypeTD157,
Meal_PagerPagerTypeTD165,
Meal_PagerPagerTypeTD174,
} Meal_PagerPagerType;



typedef enum {
Meal_PagerHapticOff,
Meal_PagerHapticOn,
} Meal_PagerHapticState;

typedef enum {
Meal_PagerSpeakerOff,
Meal_PagerSpeakerOn,
} Meal_PagerSpeakerState;

typedef enum {
Meal_PagerLedOff,
Meal_PagerLedOn,
} Meal_PagerLedState;

typedef enum {
Meal_PagerSettingsOff,
Meal_PagerSettingsOn,
} Meal_PagerSettingsStoreState;
2 changes: 1 addition & 1 deletion scenes/meal_pager_scene_menu.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../meal_pager.h"
#include "../meal_pager_i.h"

enum SubmenuIndex {
SubmenuIndexTransmit = 10,
Expand Down
2 changes: 1 addition & 1 deletion scenes/meal_pager_scene_settings.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../meal_pager.h"
#include "../meal_pager_i.h"
#include <lib/toolbox/value_index.h>

enum SettingsIndex {
Expand Down
2 changes: 1 addition & 1 deletion scenes/meal_pager_scene_startscreen.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../meal_pager.h"
#include "../meal_pager_i.h"
#include "../helpers/meal_pager_custom_event.h"
#include "../views/meal_pager_startscreen.h"

Expand Down
4 changes: 3 additions & 1 deletion scenes/meal_pager_scene_transmit.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../meal_pager.h"
#include "../meal_pager_i.h"
#include "../helpers/meal_pager_custom_event.h"
#include "../helpers/retekess/meal_pager_retekess_t119.h"
#include "../views/meal_pager_transmit.h"
Expand All @@ -20,6 +20,8 @@ void meal_pager_scene_transmit_on_enter(void* context) {
meal_pager_transmit_set_callback(app->meal_pager_transmit, meal_pager_transmit_callback, app);
view_dispatcher_switch_to_view(app->view_dispatcher, Meal_PagerViewIdTransmit);
meal_pager_retekess_t119_generate_all(app);
FURI_LOG_D(TAG, "Generated tmp.sub");

}

bool meal_pager_scene_transmit_on_event(void* context, SceneManagerEvent event) {
Expand Down
4 changes: 3 additions & 1 deletion views/meal_pager_startscreen.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "../meal_pager.h"
#include "meal_pager_startscreen.h"

#include "../meal_pager_i.h"
#include <furi.h>
#include <furi_hal.h>
#include <input/input.h>
Expand Down
2 changes: 1 addition & 1 deletion views/meal_pager_transmit.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../meal_pager.h"
#include "../meal_pager_i.h"
#include <furi.h>
#include <furi_hal.h>
#include <input/input.h>
Expand Down

0 comments on commit 41a408c

Please sign in to comment.