New LF-RFID app (#534)
* Hal lfrfid: add read timer pulse and period config fns * New debug application for lfrfid subsystem * New lfrfid: app, fix naming * App lfrfid: assets * Container view module * App ibutton: remove unused header * App lfrfid scenes * App notification, add yield to blocking operations, add speaker volume control * App lfrfid: reading key scene * Assets: placeholder icon * App lfrfid: reworked container view module * App lfrfid: new scenes * App lfrfid: write scene * App lfrfid: write hid * App lfrfid: emulate scene * App lfrfid: save name scene * App lfrfid: add missing file
This commit is contained in:
@@ -91,6 +91,20 @@ void api_hal_rfid_set_emulate_period(uint32_t period);
|
||||
*/
|
||||
void api_hal_rfid_set_emulate_pulse(uint32_t pulse);
|
||||
|
||||
/**
|
||||
* @brief set read timer period
|
||||
*
|
||||
* @param period overall duration
|
||||
*/
|
||||
void api_hal_rfid_set_read_period(uint32_t period);
|
||||
|
||||
/**
|
||||
* @brief set read timer pulse
|
||||
*
|
||||
* @param pulse duration of high level
|
||||
*/
|
||||
void api_hal_rfid_set_read_pulse(uint32_t pulse);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -231,4 +231,28 @@ void api_hal_rfid_set_emulate_pulse(uint32_t pulse) {
|
||||
furi_check(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void api_hal_rfid_set_read_period(uint32_t period) {
|
||||
LFRFID_TIM.Instance->ARR = period;
|
||||
}
|
||||
|
||||
void api_hal_rfid_set_read_pulse(uint32_t pulse) {
|
||||
switch(LFRFID_READ_CHANNEL) {
|
||||
case TIM_CHANNEL_1:
|
||||
LFRFID_TIM.Instance->CCR1 = pulse;
|
||||
break;
|
||||
case TIM_CHANNEL_2:
|
||||
LFRFID_TIM.Instance->CCR2 = pulse;
|
||||
break;
|
||||
case TIM_CHANNEL_3:
|
||||
LFRFID_TIM.Instance->CCR3 = pulse;
|
||||
break;
|
||||
case TIM_CHANNEL_4:
|
||||
LFRFID_TIM.Instance->CCR4 = pulse;
|
||||
break;
|
||||
default:
|
||||
furi_check(0);
|
||||
break;
|
||||
}
|
||||
}
|
@@ -197,6 +197,14 @@ void api_hal_rfid_tim_emulate(float freq) {
|
||||
}
|
||||
|
||||
void api_hal_rfid_tim_emulate_start() {
|
||||
// TODO make api for interrupts priority
|
||||
for(size_t i = WWDG_IRQn; i <= DMAMUX1_OVR_IRQn; i++) {
|
||||
HAL_NVIC_SetPriority(i, 15, 0);
|
||||
}
|
||||
|
||||
HAL_NVIC_SetPriority(TIM2_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(TIM2_IRQn);
|
||||
|
||||
HAL_TIM_PWM_Start_IT(&LFRFID_EMULATE_TIM, LFRFID_EMULATE_CHANNEL);
|
||||
HAL_TIM_Base_Start_IT(&LFRFID_EMULATE_TIM);
|
||||
}
|
||||
@@ -207,6 +215,8 @@ void api_hal_rfid_tim_emulate_stop() {
|
||||
}
|
||||
|
||||
void api_hal_rfid_tim_reset() {
|
||||
HAL_TIM_Base_DeInit(&LFRFID_READ_TIM);
|
||||
HAL_TIM_Base_DeInit(&LFRFID_EMULATE_TIM);
|
||||
}
|
||||
|
||||
bool api_hal_rfid_is_tim_emulate(TIM_HandleTypeDef* hw) {
|
||||
@@ -235,4 +245,28 @@ void api_hal_rfid_set_emulate_pulse(uint32_t pulse) {
|
||||
furi_check(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void api_hal_rfid_set_read_period(uint32_t period) {
|
||||
LFRFID_TIM.Instance->ARR = period;
|
||||
}
|
||||
|
||||
void api_hal_rfid_set_read_pulse(uint32_t pulse) {
|
||||
switch(LFRFID_READ_CHANNEL) {
|
||||
case TIM_CHANNEL_1:
|
||||
LFRFID_TIM.Instance->CCR1 = pulse;
|
||||
break;
|
||||
case TIM_CHANNEL_2:
|
||||
LFRFID_TIM.Instance->CCR2 = pulse;
|
||||
break;
|
||||
case TIM_CHANNEL_3:
|
||||
LFRFID_TIM.Instance->CCR3 = pulse;
|
||||
break;
|
||||
case TIM_CHANNEL_4:
|
||||
LFRFID_TIM.Instance->CCR4 = pulse;
|
||||
break;
|
||||
default:
|
||||
furi_check(0);
|
||||
break;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user