mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
set local slot LED according to remote/local state.
The LED is illuminated as long as the slot is in local (physical SIM card) mode.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "board.h"
|
||||
#include "trace.h"
|
||||
#include "led.h"
|
||||
#include "sim_switch.h"
|
||||
|
||||
#ifdef PIN_SIM_SWITCH1
|
||||
@@ -16,6 +17,7 @@ static int initialized = 0;
|
||||
int sim_switch_use_physical(unsigned int nr, int physical)
|
||||
{
|
||||
const Pin *pin;
|
||||
enum led led;
|
||||
|
||||
if (!initialized) {
|
||||
TRACE_ERROR("Somebody forgot to call sim_switch_init()\r\n");
|
||||
@@ -29,11 +31,13 @@ int sim_switch_use_physical(unsigned int nr, int physical)
|
||||
#ifdef PIN_SIM_SWITCH1
|
||||
case 0:
|
||||
pin = &pin_conn_usim1;
|
||||
led = LED_USIM1;
|
||||
break;
|
||||
#endif
|
||||
#ifdef PIN_SIM_SWITCH2
|
||||
case 1:
|
||||
pin = &pin_conn_usim2;
|
||||
led = LED_USIM2;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -44,9 +48,11 @@ int sim_switch_use_physical(unsigned int nr, int physical)
|
||||
if (physical) {
|
||||
TRACE_INFO("%u: Use local/physical SIM\r\n", nr);
|
||||
PIO_Clear(pin);
|
||||
led_blink(led, BLINK_ALWAYS_ON);
|
||||
} else {
|
||||
TRACE_INFO("%u: Use remote/emulated SIM\r\n", nr);
|
||||
PIO_Set(pin);
|
||||
led_blink(led, BLINK_ALWAYS_OFF);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
#include "board_common.h"
|
||||
|
||||
#define LED_USIM1 LED_GREEN
|
||||
#define LED_USIM2 LED_RED
|
||||
|
||||
/** Name of the board */
|
||||
#define BOARD_NAME "QMOD"
|
||||
/** Board definition */
|
||||
|
||||
@@ -399,6 +399,7 @@ void mode_cardemu_init(void)
|
||||
PIO_EnableIt(&pin_usim1_vcc);
|
||||
#endif /* DETECT_VCC_BY_ADC */
|
||||
cardem_inst[0].ch = card_emu_init(0, 2, 0, PHONE_DATAIN, PHONE_INT);
|
||||
sim_switch_use_physical(0, 1);
|
||||
|
||||
#ifdef CARDEMU_SECOND_UART
|
||||
INIT_LLIST_HEAD(&cardem_inst[1].usb_out_queue);
|
||||
@@ -413,7 +414,9 @@ void mode_cardemu_init(void)
|
||||
PIO_EnableIt(&pin_usim2_vcc);
|
||||
#endif /* DETECT_VCC_BY_ADC */
|
||||
cardem_inst[1].ch = card_emu_init(1, 0, 1, CARDEM_USIM2_DATAIN, CARDEM_USIM2_INT);
|
||||
sim_switch_use_physical(1, 1);
|
||||
#endif /* CARDEMU_SECOND_UART */
|
||||
|
||||
}
|
||||
|
||||
/* called if config is deactivated */
|
||||
|
||||
Reference in New Issue
Block a user