Merge pull request #5 from PlxEV/codex/refatorar-componente-rfid-para-auth
Rename RFID component to Auth
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
set(srcs "src/rc522_2.c" "src/wiegand.c" "src/main_wiegand.c")
|
set(srcs "src/auth.c" "src/rc522_2.c" "src/wiegand.c" "src/main_wiegand.c")
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
2
components/auth/idf_component.yml
Executable file
2
components/auth/idf_component.yml
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
version: "2.6.0"
|
||||||
|
description: Authentication component
|
||||||
9
components/auth/include/auth.h
Normal file
9
components/auth/include/auth.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef AUTH_H
|
||||||
|
#define AUTH_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
void auth_set_enable(bool value);
|
||||||
|
bool auth_get_enable(void);
|
||||||
|
|
||||||
|
#endif // AUTH_H
|
||||||
0
components/rfid/include/main_wiegand.h → components/auth/include/main_wiegand.h
Executable file → Normal file
0
components/rfid/include/main_wiegand.h → components/auth/include/main_wiegand.h
Executable file → Normal file
0
components/rfid/include/rc522_2.h → components/auth/include/rc522_2.h
Executable file → Normal file
0
components/rfid/include/rc522_2.h → components/auth/include/rc522_2.h
Executable file → Normal file
0
components/rfid/include/wiegand.h → components/auth/include/wiegand.h
Executable file → Normal file
0
components/rfid/include/wiegand.h → components/auth/include/wiegand.h
Executable file → Normal file
11
components/auth/src/auth.c
Normal file
11
components/auth/src/auth.c
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include "auth.h"
|
||||||
|
|
||||||
|
static bool enable = false;
|
||||||
|
|
||||||
|
void auth_set_enable(bool value) {
|
||||||
|
enable = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool auth_get_enable(void) {
|
||||||
|
return enable;
|
||||||
|
}
|
||||||
0
components/rfid/src/main_wiegand.c → components/auth/src/main_wiegand.c
Executable file → Normal file
0
components/rfid/src/main_wiegand.c → components/auth/src/main_wiegand.c
Executable file → Normal file
@@ -8,8 +8,9 @@
|
|||||||
#include "rc522_2.h"
|
#include "rc522_2.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "evse_api.h"
|
#include "evse_api.h"
|
||||||
|
#include "auth.h"
|
||||||
|
|
||||||
const static char *TAG = "RFID";
|
const static char *TAG = "AUTH";
|
||||||
|
|
||||||
spi_device_handle_t spi;
|
spi_device_handle_t spi;
|
||||||
// Member variables
|
// Member variables
|
||||||
@@ -2321,7 +2322,7 @@ void rc522_main(void *vParam)
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (evse_is_require_auth())
|
if (evse_is_require_auth() && auth_get_enable())
|
||||||
{
|
{
|
||||||
|
|
||||||
r = PICC_IsNewCardPresent();
|
r = PICC_IsNewCardPresent();
|
||||||
0
components/rfid/src/wiegand.c → components/auth/src/wiegand.c
Executable file → Normal file
0
components/rfid/src/wiegand.c → components/auth/src/wiegand.c
Executable file → Normal file
@@ -1,2 +0,0 @@
|
|||||||
version: "2.6.0"
|
|
||||||
description: MFRC522 driver
|
|
||||||
Reference in New Issue
Block a user