rename interface component, update docs, added cleanup of old beacons

This commit is contained in:
Lurkars
2020-07-27 16:54:51 +02:00
parent 7dacb93369
commit 4e696f2fb4
30 changed files with 484 additions and 333 deletions
@@ -0,0 +1,37 @@
// Copyright 2020 Lukas Haubaum
//
// Licensed under the GNU Affero General Public License, Version 3;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.gnu.org/licenses/agpl-3.0.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file
*
* @brief interface for changing current date and time
*
*/
#ifndef _interface__DATETIME_H_
#define _interface__DATETIME_H_
typedef enum
{
INTERFACE_DATETIME_STATE_YEAR = 0,
INTERFACE_DATETIME_STATE_MONTH,
INTERFACE_DATETIME_STATE_DAY,
INTERFACE_DATETIME_STATE_HOUR,
INTERFACE_DATETIME_STATE_MINUTE,
INTERFACE_DATETIME_STATE_SECONDS,
} interface_datetime_state_t;
void interface_datetime_start(void);
int interface_datetime_state(void);
#endif
@@ -0,0 +1,35 @@
// Copyright 2020 Lukas Haubaum
//
// Licensed under the GNU Affero General Public License, Version 3;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.gnu.org/licenses/agpl-3.0.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file
*
* @brief interface menu to navigate through interface
*
*/
#ifndef _interface__MENU_H_
#define _interface__MENU_H_
typedef enum
{
INTERFACE_MENU_STATE_IDLE = 0,
INTERFACE_MENU_STATE_SELECT_TIME,
INTERFACE_MENU_STATE_SELECT_DEBUG,
INTERFACE_MENU_STATE_SELECT_STATUS,
} interface_menu_state_t;
void interface_menu_start(void);
int interface_menu_get_state(void);
#endif
@@ -0,0 +1,25 @@
// Copyright 2020 Lukas Haubaum
//
// Licensed under the GNU Affero General Public License, Version 3;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.gnu.org/licenses/agpl-3.0.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file
*
* @brief interface to show current ENA status (infection risk etc.)
*
*/
#ifndef _interface__STATUS_H_
#define _interface__STATUS_H_
void interface_status_start(void);
#endif
+79
View File
@@ -0,0 +1,79 @@
// Copyright 2020 Lukas Haubaum
//
// Licensed under the GNU Affero General Public License, Version 3;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.gnu.org/licenses/agpl-3.0.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file
*
* @brief interface functionality via touch pads for control and setup
*
*/
#ifndef _interface__H_
#define _interface__H_
#define INTERFACE_LOG "INTERFACE" // TAG for Logging
#define TOUCHPAD_FILTER_TOUCH_PERIOD (10)
#define TOUCH_PAD_COUNT (4)
#define TOUCH_PAD_ESC (TOUCH_PAD_NUM0)
#define TOUCH_PAD_OK (TOUCH_PAD_NUM6)
#define TOUCH_PAD_UP (TOUCH_PAD_NUM4)
#define TOUCH_PAD_DOWN (TOUCH_PAD_NUM3)
/**
* @brief different interface states
*/
typedef enum
{
INTERFACE_STATE_IDLE = 0, // ilde state, do nothing
INTERFACE_STATE_MENU, // main menu
INTERFACE_STATE_SET_DATETIME, // set current date and time
INTERFACE_STATE_STATUS, // current status
} interface_state_t;
/**
* @brief callback function on touch event
*/
typedef void (*interface_touch_callback)(void);
/**
* @brief register a callback function for touch event
*
* @param[in] touch_pad id of the touchpad to listen touch
* @param[in] callback callback function
*/
void interface_register_touch_callback(int touch_pad, interface_touch_callback callback);
/**
* @brief get current interface state
*
* @return
* current state the interface is in
*/
int interface_get_state(void);
/**
* @brief set current interface state
*
* @param[in] state new state to set
*/
void interface_set_state(interface_state_t state);
/**
* @brief start interface logic
*
* This will initialize the touch controls and start a task to listen to touch
* inputs and calling the callbacks
*/
void interface_start(void);
#endif