Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
card-access-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bc. Petr Elexa
card-access-system
Commits
a3e98fed
Commit
a3e98fed
authored
Nov 30, 2019
by
Bc. Petr Elexa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
panel: final open time
parent
1efbdc68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
26 deletions
+20
-26
terminal.c
cardreader/app/terminal.c
+9
-8
terminal_config.h
cardreader/app/terminal_config.h
+7
-14
reader.c
cardreader/bsp/reader.c
+3
-3
reader.h
cardreader/bsp/reader.h
+1
-1
No files found.
cardreader/app/terminal.c
View file @
a3e98fed
...
...
@@ -57,7 +57,7 @@ static TimerHandle_t _act_timer = NULL;
static
const
uint32_t
_act_timer_id
=
TERMINAL_TIMER_ID
;
// Last door open(true) / close(false) status
static
bool
_last_door_state
[
ACS_READER_COUNT
]
=
{
false
,
false
};
static
bool
_last_door_state
[
ACS_READER_
MAX
COUNT
]
=
{
false
,
false
};
// Signal request to clear cache.
static
bool
_cache_clear_req
=
false
;
...
...
@@ -170,7 +170,7 @@ void term_can_recv(uint8_t msg_obj_num)
else
return
;
// Stop processing if card reader not configured.
if
(
reader_idx
>=
ACS_READER_
COUNT
)
return
;
if
(
reader_idx
>=
ACS_READER_
MAXCOUNT
||
!
reader_conf
[
reader_idx
].
enabled
)
return
;
// Continue deducing action and execute it.
if
(
head
.
fc
==
FC_USER_AUTH_RESP
)
...
...
@@ -289,7 +289,7 @@ static void terminal_user_identified(uint32_t user_id, uint8_t reader_idx)
term_cache_item_t
user
=
{.
key
=
user_id
};
#endif
if
(
reader_idx
<
ACS_READER_
COUNT
)
if
(
reader_idx
<
ACS_READER_
MAXCOUNT
&&
reader_conf
[
reader_idx
].
enabled
)
{
#if CACHING_ENABLED
// Read from cache online if master is offline.
...
...
@@ -332,7 +332,7 @@ static void terminal_task(void *pvParameters)
uint8_t
reader_idx
=
reader_get_request_from_buffer
(
&
user_id
,
USER_REQUEST_WAIT_MS
);
if
(
reader_idx
<
ACS_READER_
COUNT
)
if
(
reader_idx
<
ACS_READER_
MAXCOUNT
&&
reader_conf
[
reader_idx
].
enabled
)
{
DEBUGSTR
(
"user req
\n
"
);
terminal_user_identified
(
user_id
,
reader_idx
);
...
...
@@ -361,9 +361,9 @@ static void terminal_task(void *pvParameters)
if
(
send_door_status
)
{
// Check if door open/close state changed
for
(
size_t
idx
=
0
;
idx
<
ACS_READER_COUNT
;
++
idx
)
for
(
size_t
idx
=
0
;
idx
<
ACS_READER_
MAX
COUNT
;
++
idx
)
{
if
(
reader_
is_door_open
(
idx
)
!=
_last_door_state
[
idx
]
)
if
(
reader_
conf
[
idx
].
enabled
&&
(
reader_is_door_open
(
idx
)
!=
_last_door_state
[
idx
])
)
{
DEBUGSTR
(
"new door state
\n
"
);
_last_door_state
[
idx
]
=
!
_last_door_state
[
idx
];
...
...
@@ -411,8 +411,9 @@ void terminal_init(void)
ACS_DST_ADDR_MASK
,
true
);
// Initialize card readers.
for
(
size_t
id
=
0
;
id
<
ACS_READER_COUNT
;
++
id
)
for
(
size_t
id
=
0
;
id
<
ACS_READER_
MAX
COUNT
;
++
id
)
{
// Config only present CR
if
(
reader_conf
[
id
].
enabled
)
terminal_reconfigure
(
NULL
,
id
);
}
...
...
@@ -427,7 +428,7 @@ void terminal_init(void)
void
terminal_reconfigure
(
reader_conf_t
*
reader_cfg
,
uint8_t
reader_idx
)
{
if
(
reader_idx
>=
ACS_READER_COUNT
)
return
;
if
(
reader_idx
>=
ACS_READER_
MAX
COUNT
)
return
;
portENTER_CRITICAL
();
// Effectively disables interrupts.
...
...
cardreader/app/terminal_config.h
View file @
a3e98fed
...
...
@@ -35,14 +35,11 @@
#define STORE_I2C_BUS_FREQ 400000 // 100kHz or 400kHz
#define STORE_I2C_SLAVE_ADDR 0x50 // 7bit address
// Internal index of card readers (can be swapped).
// Internal index of card readers (can be
only
swapped).
#define ACS_READER_A_IDX 0
#define ACS_READER_B_IDX 1
// Number of card readers present 1 or 2.
#define ACS_READER_COUNT 2
#define BEEP_ON_SUCCESS false
#define BEEP_ON_SUCCESS true
#define OK_LED_ON_SUCCESS true
// Door sensor types (reed switch).
...
...
@@ -117,8 +114,8 @@ void set_reader_addr(const uint16_t acs_addr);
#define ACS_READER_A_SENSOR_PORT 1 // Can be only 0 or 1.
#define ACS_READER_A_SENSOR_PIN 8
#define ACS_READER_A_OPEN_TIME_MS
8
000
#define ACS_READER_A_OK_GLED_TIME_MS
40
00
#define ACS_READER_A_OPEN_TIME_MS
5
000
#define ACS_READER_A_OK_GLED_TIME_MS
5
00
//---------------------------------------------------------------------------------------------------------------------
// Settings for RFID reader B
...
...
@@ -140,24 +137,20 @@ void set_reader_addr(const uint16_t acs_addr);
#define ACS_READER_B_SENSOR_PORT 1 // Can be only 0 or 1.
#define ACS_READER_B_SENSOR_PIN 5
#define ACS_READER_B_OPEN_TIME_MS
8
000
#define ACS_READER_B_OK_GLED_TIME_MS
40
00
#define ACS_READER_B_OPEN_TIME_MS
5
000
#define ACS_READER_B_OK_GLED_TIME_MS
5
00
//---------------------------------------------------------------------------------------------------------------------
// Internal setting
//---------------------------------------------------------------------------------------------------------------------
//
if following is changed it will need code modification
//
Not user modifiable.
#define WEIGAND_DEVICE_LIMIT 4
#define SERIAL_DEVICE_LIMIT 0
#define ACS_READER_MAXCOUNT 2
#define TERMINAL_TIMER_ID 15
#if ACS_READER_COUNT > ACS_READER_MAXCOUNT
#error "reader max count limit"
#endif
//---------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------
...
...
cardreader/bsp/reader.c
View file @
a3e98fed
...
...
@@ -87,7 +87,7 @@ static void _timer_open_callback(TimerHandle_t pxTimer)
// Which timer expired
uint32_t
id
=
(
uint32_t
)
pvTimerGetTimerID
(
pxTimer
);
if
(
id
<
ACS_READER_
COUNT
)
if
(
id
<
ACS_READER_
MAXCOUNT
&&
reader_conf
[
id
].
enabled
)
{
// Lock state
Chip_GPIO_SetPinState
(
LPC_GPIO
,
_reader_wiring
[
id
].
relay_port
,
_reader_wiring
[
id
].
relay_pin
,
LOG_HIGH
);
...
...
@@ -102,7 +102,7 @@ static void _timer_ok_callback(TimerHandle_t pxTimer)
// Which timer expired
uint32_t
id
=
(
uint32_t
)
pvTimerGetTimerID
(
pxTimer
);
if
(
id
<
ACS_READER_
COUNT
)
if
(
id
<
ACS_READER_
MAXCOUNT
&&
reader_conf
[
id
].
enabled
)
{
// Lock state
Chip_GPIO_SetPinState
(
LPC_GPIO
,
_reader_wiring
[
id
].
beep_port
,
_reader_wiring
[
id
].
beep_pin
,
LOG_LOW
);
...
...
@@ -117,7 +117,7 @@ void reader_init(uint8_t idx)
//Create stream buffer to receive idx from all card readers
if
(
_reader_buffer
==
NULL
)
{
_reader_buffer
=
xStreamBufferCreate
(
2
*
ACS_READER_COUNT
*
WEIGAND26_BUFF_ITEM_SIZE
,
WEIGAND26_BUFF_ITEM_SIZE
);
_reader_buffer
=
xStreamBufferCreate
(
2
*
ACS_READER_
MAX
COUNT
*
WEIGAND26_BUFF_ITEM_SIZE
,
WEIGAND26_BUFF_ITEM_SIZE
);
}
configASSERT
(
_reader_buffer
);
...
...
cardreader/bsp/reader.h
View file @
a3e98fed
...
...
@@ -55,7 +55,7 @@ typedef struct
/**
* @brief Configuration of readers
*/
extern
reader_conf_t
reader_conf
[
ACS_READER_COUNT
];
extern
reader_conf_t
reader_conf
[
ACS_READER_
MAX
COUNT
];
/**
* @brief Initialize reader driver.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment