Merge branch 'main' into offline-confirmation

This commit is contained in:
Nemanja Nedeljkovic
2023-08-22 20:44:51 +02:00
5 changed files with 38 additions and 0 deletions
+1
View File
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Added offline copy EM card uid for btnpress.(@nemanjan00)
- Added offline copy ic card uid for btnpress.(@xianglin1998)
- Added `hw settings btnpress` to get and set button press function.(@xianglin1998)
- Added `hw battery` to get battery informartion (@xianglin1998)
+28
View File
@@ -511,6 +511,34 @@ static void btn_fn_copy_ic_uid(void) {
nfc_tag_14a_coll_res_entity_t* antres;
if(tag_type[1] == TAG_TYPE_EM410X) {
uint8_t status;
bool is_reader_mode_now = get_device_mode() == DEVICE_MODE_READER;
// first, we need switch to reader mode.
if (!is_reader_mode_now) {
// enter reader mode
reader_mode_enter();
bsp_delay_ms(8);
NRF_LOG_INFO("Start reader mode to offline copy.")
}
uint8_t id_buffer[5] = { 0x00 };
status = PcdScanEM410X(id_buffer);
if(status == LF_TAG_OK) {
tag_data_buffer_t* buffer = get_buffer_by_tag_type(TAG_TYPE_EM410X);
memcpy(buffer->buffer, id_buffer, LF_EM410X_TAG_ID_SIZE);
tag_emulation_load_by_buffer(TAG_TYPE_EM410X, false);
// keep reader mode or exit reader mode.
}
if (!is_reader_mode_now) {
tag_mode_enter();
}
}
switch(tag_type[0]) {
case TAG_TYPE_MIFARE_Mini:
case TAG_TYPE_MIFARE_1024:
@@ -7,6 +7,7 @@
#include "fds_util.h"
#include "tag_emulation.h"
#include "tag_persistence.h"
#include "rgb_marquee.h"
#define NRF_LOG_MODULE_NAME tag_emu
@@ -458,6 +459,7 @@ uint8_t tag_emulation_get_slot(void) {
*/
void tag_emulation_set_slot(uint8_t index) {
slotConfig.config.activated = index; // 重设到新切换的卡槽上
rgb_marquee_reset(); // force animation color refresh according to new slot
}
/**
+6
View File
@@ -50,6 +50,12 @@ void rgb_marquee_stop(void){
ledblink1_step = 0;
}
// reset RGB state machines to force a refresh of the LED color
void rgb_marquee_reset(void){
ledblink6_step = 0;
ledblink1_step = 0;
}
// 亮度转PWM值
uint16_t get_pwmduty(uint8_t light_level){
return PWM_MAX-(PWM_MAX*pow(((double)light_level/LIGHT_LEVEL_MAX),2.2));
+1
View File
@@ -7,6 +7,7 @@
void rgb_marquee_init(void);
void rgb_marquee_stop(void);
void rgb_marquee_reset(void);
bool is_rgb_marquee_enable(void);
void ledblink1(uint8_t color,uint8_t dir);
void ledblink2(uint8_t color,uint8_t dir, uint8_t end);