Portier Wireless Le portier sans fil est un système bidirectionnel basé sur un microcontrôleur PIC32MX130F064B-I/SS et un module radio 868 MHz, permettant à un visiteur d’envoyer une requête depuis l’extérieur via un bouton alimenté par piles, et à l’occupant du bureau de répondre par des signaux lumineux et sonores grâce à une unité intérieure alimentée en USB, le tout avec appairage sécurisé et gestion autonome de l’énergie.
Chargement...
Recherche...
Aucune correspondance
app.h
Aller à la documentation de ce fichier.
1/*******************************************************************************
2 MPLAB Harmony Application Header File
3
4 Company:
5 Microchip Technology Inc.
6
7 File Name:
8 app.h
9
10 Summary:
11 This header file provides prototypes and definitions for the application.
12
13 Description:
14 This header file provides function prototypes and data type definitions for
15 the application. Some of these are required by the system (such as the
16 "APP_Initialize" and "APP_Tasks" prototypes) and some of them are only used
17 internally by the application (such as the "APP_STATES" definition). Both
18 are defined here for convenience.
19*******************************************************************************/
20
21//DOM-IGNORE-BEGIN
22/*******************************************************************************
23Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.
24
25Microchip licenses to you the right to use, modify, copy and distribute
26Software only when embedded on a Microchip microcontroller or digital signal
27controller that is integrated into your product or third party product
28(pursuant to the sublicense terms in the accompanying license agreement).
29
30You should refer to the license agreement accompanying this Software for
31additional information regarding your rights and obligations.
32
33SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
34EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
35MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
36IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
37CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
38OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
39INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
40CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
41SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
42(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
43 *******************************************************************************/
44//DOM-IGNORE-END
45
46#ifndef _APP_H
47#define _APP_H
48
49// *****************************************************************************
50// Section : Fichiers inclus
51// *****************************************************************************
52
53#include <stdint.h> // Types entiers standards
54#include <stdbool.h> // Type booléen
55#include <stddef.h> // Définitions de taille
56#include <stdlib.h> // Fonctions utilitaires générales
57#include "system_config.h" // Configuration système
58#include "system_definitions.h" // Définitions système
59#include "Mc32Debounce.h" // Gestion anti-rebond pour boutons
60
61// DOM-IGNORE-BEGIN
62#ifdef __cplusplus // Pour compatibilité C++
63extern "C" {
64#endif
65// DOM-IGNORE-END
66
67// *****************************************************************************
68// Section : Définitions de types
69// *****************************************************************************
70
71// *****************************************************************************
72// Enumération des états de l'application
73// *****************************************************************************
74typedef enum
75{
76 APP_STATE_INIT = 0, // État initial de l'application
77 APP_STATE_WAIT, // Attente d'un événement
78 APP_STATE_SERVICE_TASKS // Exécution des tâches de service
80
81// *****************************************************************************
82// Structure des données de l'application
83// *****************************************************************************
84#define LOWBAT_THRESHOLD 2400 // Seuil de batterie faible (2.4V)
85
86typedef struct
87{
88 APP_STATES state; // État courant de l'application
89 bool isDoor; // Indique si la porte est détectée
90 uint16_t batVoltage; // Tension de la batterie
91 bool isLowBat; // Indique si la batterie est faible
92} APP_DATA;
93
94// *****************************************************************************
95// Déclarations externes des descripteurs de boutons
96// *****************************************************************************
97extern S_SwitchDescriptor swRing; // Descripteur du bouton de sonnette
98extern S_SwitchDescriptor swEnter; // Descripteur du bouton d'entrée
99extern S_SwitchDescriptor swWait; // Descripteur du bouton d'attente
100extern S_SwitchDescriptor swBusy; // Descripteur du bouton d'occupation
101
102// *****************************************************************************
103// Section : Prototypes des fonctions de l'application
104// *****************************************************************************
105
106/*******************************************************************************
107 Fonction : void APP_Initialize(void)
108 Initialise l'application Harmony, place dans l'état initial.
109*******************************************************************************/
110void APP_Initialize(void); // Initialise l'application
111
112/*******************************************************************************
113 Fonction : void APP_Tasks(void)
114 Machine à états principale de l'application Harmony.
115*******************************************************************************/
116void APP_Tasks(void); // Exécute les tâches de l'application
117
118/*******************************************************************************
119 Fonction : void APP_UpdateState(APP_STATES newState)
120 Met à jour l'état de l'application.
121*******************************************************************************/
122void APP_UpdateState(APP_STATES newState); // Met à jour l'état
123
124/*******************************************************************************
125 Fonction : bool APP_GetIsDoor(void)
126 Retourne l'état de détection de la porte.
127*******************************************************************************/
128bool APP_GetIsDoor(void); // Retourne si la porte est détectée
129
130// *****************************************************************************
131// Fin des définitions externes et compatibilité C++
132// *****************************************************************************
133#ifdef __cplusplus
134}
135#endif
136
137/*******************************************************************************
138 Fin du fichier
139*******************************************************************************/
S_SwitchDescriptor swRing
Definition app.c:86
S_SwitchDescriptor swBusy
Definition app.c:83
S_SwitchDescriptor swEnter
Definition app.c:80
S_SwitchDescriptor swWait
Definition app.c:89
bool APP_GetIsDoor(void)
Vérifie si l'entité courante est une porte.
Definition app.c:172
void APP_Initialize(void)
Initialise l'application.
Definition app.c:191
void APP_Tasks(void)
Tâche principale de l'application.
Definition app.c:222
APP_STATES
Definition app.h:75
@ APP_STATE_WAIT
Definition app.h:77
@ APP_STATE_SERVICE_TASKS
Definition app.h:78
@ APP_STATE_INIT
Definition app.h:76
void APP_UpdateState(APP_STATES newState)
Met à jour l'état de l'application.
Definition app.c:162
Definition app.h:87
bool isLowBat
Definition app.h:91
bool isDoor
Definition app.h:89
APP_STATES state
Definition app.h:88
uint16_t batVoltage
Definition app.h:90
Definition Mc32Debounce.h:48