~toykeeper/flashlight-firmware/trunk

« back to all changes in this revision

Viewing changes to JonnyC/STAR/STAR_dual_switch/STAR_dual_switch.c

  • Committer: Selene Scriven
  • Date: 2014-11-10 21:44:25 UTC
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: ubuntu@toykeeper.net-20141110214425-h071pac1ulayazsf
JCapSolutions   2014-10-07 [merge]
git commit: fed8251a4b977f18c55acfbb1ed40c702008dde8
Merge branch 'dual_pwm'

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* STAR_dual_switch version 1.0
 
2
 *
 
3
 * Changelog
 
4
 *
 
5
 * 1.0 Initial version
 
6
 *
 
7
 */
 
8
 
1
9
/*
2
10
 * NANJG 105C Diagram
3
11
 *           ---
6
14
 *  Star 3 -|   |- PWM
7
15
 *     GND -|   |- Star 2
8
16
 *           ---
9
 
 
10
 
 * CPU speed is 4.8Mhz without the 8x divider when low fuse is 0x75
11
 
 *
12
 
 * define F_CPU 4800000  CPU: 4.8MHz  PWM: 9.4kHz       ####### use low fuse: 0x75  #######
13
 
 *                             /8     PWM: 1.176kHz     ####### use low fuse: 0x65  #######
14
 
 * define F_CPU 9600000  CPU: 9.6MHz  PWM: 19kHz        ####### use low fuse: 0x7a  #######
15
 
 *                             /8     PWM: 2.4kHz       ####### use low fuse: 0x6a  #######
16
 
 * 
17
 
 * Above PWM speeds are for phase-correct PWM.  This program uses Fast-PWM, which when the CPU is 4.8MHz will be 18.75 kHz
18
17
 *
19
18
 * FUSES
20
19
 *              I use these fuse settings
21
 
 *              Low:  0x75
 
20
 *              Low:  0x75      (4.8MHz CPU without 8x divider, 9.4kHz phase-correct PWM or 18.75kHz fast-PWM)
22
21
 *              High: 0xff
23
22
 *
 
23
 *      For more details on these settings, visit http://github.com/JCapSolutions/blf-firmware/wiki/PWM-Frequency
 
24
 *
24
25
 * STARS
25
26
 *              Star 2 = H-L if connected, L-H if not
26
27
 *              Star 3 = Memory if not connected
51
52
 *
52
53
 *              To find out what value to use, plug in the target voltage (V) to this equation
53
54
 *                      value = (V * 4700 * 255) / (23800 * 1.1)
54
 
 *
55
 
 *
56
 
 *  v1.0 - Initial try, there's bound to be bugs     
 
55
 *      
57
56
 */
58
57
#define F_CPU 4800000UL
59
58