summaryrefslogtreecommitdiffstats
path: root/src/target
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-12-23 11:09:35 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2016-09-25 08:11:45 +0200
commitc7f1ab629086c2d68b9e8c8f2483bf9acca25bd3 (patch)
tree6b6cd4292ce110b8bdbfb01137de5fc29fb45ab0 /src/target
parent57fbd7699751ad705d9658688b38cf6c9226f7f1 (diff)
Add ringer support to L1CTL interface and layer1
Diffstat (limited to 'src/target')
-rw-r--r--src/target/firmware/apps/layer1/main.c2
-rw-r--r--src/target/firmware/layer1/l23_api.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/src/target/firmware/apps/layer1/main.c b/src/target/firmware/apps/layer1/main.c
index 59ffe972..f122de6b 100644
--- a/src/target/firmware/apps/layer1/main.c
+++ b/src/target/firmware/apps/layer1/main.c
@@ -102,6 +102,8 @@ int main(void)
/* initialize SIM */
calypso_sim_init();
+ buzzer_mode_pwt(1);
+
puts("Power up simcard:\n");
memset(atr,0,sizeof(atr));
atrLength = calypso_sim_powerup(atr);
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index 11588032..230e382a 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -46,6 +46,7 @@
#include <rf/trf6151.h>
#include <calypso/sim.h>
#include <calypso/dsp.h>
+#include <calypso/buzzer.h>
#include <l1ctl_proto.h>
@@ -615,6 +616,17 @@ static void l1ctl_sim_req(struct msgb *msg)
sim_apdu(len, data);
}
+static void l1ctl_ringer_req(struct msgb *msg)
+{
+ struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
+ struct l1ctl_ringer_req *ring_req =
+ (struct l1ctl_ringer_req *) l1h->data;
+
+ printf("Ringtone Request: %u\n", ring_req->volume);
+ buzzer_volume(ring_req->volume);
+ buzzer_note(NOTE(NOTE_C, OCTAVE_4));
+}
+
static struct llist_head l23_rx_queue = LLIST_HEAD_INIT(l23_rx_queue);
/* callback from SERCOMM when L2 sends a message to L1 */
@@ -706,6 +718,9 @@ void l1a_l23_handler(void)
case L1CTL_SIM_REQ:
l1ctl_sim_req(msg);
break;
+ case L1CTL_RINGER_REQ:
+ l1ctl_ringer_req(msg);
+ break;
}
exit_msgbfree: