FreeCalypso > hg > freecalypso-tools
comparison target-utils/c139explore/dac.c @ 39:280826b807e3
c139explore: dac and dacon commands added for exercising the vibrator
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 26 Oct 2016 01:53:12 +0000 |
parents | |
children | 7ecb70b0ac36 |
comparison
equal
deleted
inserted
replaced
38:c90b1fff224a | 39:280826b807e3 |
---|---|
1 /* | |
2 * Code for exercising Motorola's vibrator, which is driven | |
3 * via the Iota auxiliary DAC on this phone. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include "types.h" | |
8 #include "abbdefs.h" | |
9 | |
10 void | |
11 cmd_dacon() | |
12 { | |
13 abb_reg_write(TOGBR1, 0x20); | |
14 } | |
15 | |
16 void | |
17 cmd_dac(argbulk) | |
18 char *argbulk; | |
19 { | |
20 char *argv[2]; | |
21 u32 val; | |
22 | |
23 if (parse_args(argbulk, 1, 1, argv, 0) < 0) | |
24 return; | |
25 val = strtoul(argv[0], 0, 0); | |
26 if (val > 0x3FF) { | |
27 printf("ERROR: argument out of range\n"); | |
28 return; | |
29 } | |
30 abb_reg_write(AUXDAC, val); | |
31 } |