]> oss.titaniummirror.com Git - rgblamp.git/log
rgblamp.git
12 years agoMake comment in tmr_init() more clear
R. Steve McKown [Sat, 10 Dec 2011 09:03:04 +0000 (02:03 -0700)]
Make comment in tmr_init() more clear

12 years agoThese changes save 685 code words
R. Steve McKown [Sat, 10 Dec 2011 08:31:35 +0000 (01:31 -0700)]
These changes save 685 code words

12 years agoRemove debug auto off/on and fade/incolor options
R. Steve McKown [Sat, 10 Dec 2011 07:59:26 +0000 (00:59 -0700)]
Remove debug auto off/on and fade/incolor options

Both sets of functions are working correctly.

12 years agoFixes to pushbutton handling in main.
R. Steve McKown [Sat, 10 Dec 2011 07:58:55 +0000 (00:58 -0700)]
Fixes to pushbutton handling in main.

12 years agoDebounce for 64 ms instead of 32 ms
R. Steve McKown [Sat, 10 Dec 2011 07:58:26 +0000 (00:58 -0700)]
Debounce for 64 ms instead of 32 ms

12 years agoDon't use % to rotate _task_bitno; too slow.
R. Steve McKown [Sat, 10 Dec 2011 07:57:50 +0000 (00:57 -0700)]
Don't use % to rotate _task_bitno; too slow.

12 years agoTask id 0 was never being cleared in task_get()
R. Steve McKown [Sat, 10 Dec 2011 07:57:26 +0000 (00:57 -0700)]
Task id 0 was never being cleared in task_get()

12 years agoFix behavior on pushbutton
R. Steve McKown [Sat, 10 Dec 2011 07:18:14 +0000 (00:18 -0700)]
Fix behavior on pushbutton

12 years agomplabx files update
R. Steve McKown [Sat, 10 Dec 2011 06:58:41 +0000 (23:58 -0700)]
mplabx files update

12 years agoMisc fixes; close now
R. Steve McKown [Sat, 10 Dec 2011 06:58:00 +0000 (23:58 -0700)]
Misc fixes; close now

Code seems to be working, except transitions after the first don't seem
to fade.

12 years agoFix timer conditional
R. Steve McKown [Sat, 10 Dec 2011 06:57:47 +0000 (23:57 -0700)]
Fix timer conditional

12 years agoFix task_get() return check in main()
R. Steve McKown [Sat, 10 Dec 2011 06:32:54 +0000 (23:32 -0700)]
Fix task_get() return check in main()

12 years agoFixes from picbtnisr work
R. Steve McKown [Sat, 10 Dec 2011 06:24:41 +0000 (23:24 -0700)]
Fixes from picbtnisr work

12 years agomplabx file updates
R. Steve McKown [Sat, 10 Dec 2011 02:26:33 +0000 (19:26 -0700)]
mplabx file updates

12 years agoConvert to task form
R. Steve McKown [Sat, 10 Dec 2011 02:26:02 +0000 (19:26 -0700)]
Convert to task form

Barely working.  Will drive the lamp the wrong way if started with the
rocker in an on position.

12 years agomplabx update files
R. Steve McKown [Thu, 8 Dec 2011 22:38:44 +0000 (15:38 -0700)]
mplabx update files

12 years agoMaking changes...
R. Steve McKown [Thu, 8 Dec 2011 22:38:32 +0000 (15:38 -0700)]
Making changes...

12 years agoUses tmr, runs if already on, stops, will not wake
R. Steve McKown [Thu, 8 Dec 2011 21:50:01 +0000 (14:50 -0700)]
Uses tmr, runs if already on, stops, will not wake

12 years agomplabx file updates
R. Steve McKown [Thu, 8 Dec 2011 21:34:16 +0000 (14:34 -0700)]
mplabx file updates

12 years agoIncorporate new tmr and isr code
R. Steve McKown [Thu, 8 Dec 2011 21:34:04 +0000 (14:34 -0700)]
Incorporate new tmr and isr code

12 years agoUse bit defs and some aesthetic cleanup
R. Steve McKown [Thu, 8 Dec 2011 03:49:00 +0000 (20:49 -0700)]
Use bit defs and some aesthetic cleanup

12 years agoUse bit definitions to simplify adc_random()
R. Steve McKown [Thu, 8 Dec 2011 03:48:24 +0000 (20:48 -0700)]
Use bit definitions to simplify adc_random()

12 years agoEnsure proper behavior in timer_cwait
R. Steve McKown [Thu, 8 Dec 2011 03:05:19 +0000 (20:05 -0700)]
Ensure proper behavior in timer_cwait

Ah, the Hi-Tech compiler's lovely interpretation of promotions.  See
3.6.1, Integral Promotion.  This may affect the conditional in
timer_cwait(), so force a cast of the result to be sure it is correct.

12 years agochar defaults to unsigned
R. Steve McKown [Thu, 8 Dec 2011 02:45:02 +0000 (19:45 -0700)]
char defaults to unsigned

Signed char variables must be marked as such, per the Hi-Tech C manual,
section 3.3.4:

If the signed or unsigned keyword is absent from the
(char) variable's definition, the default type is unsigned char.

12 years agomplabx file updates
R. Steve McKown [Thu, 8 Dec 2011 01:12:39 +0000 (18:12 -0700)]
mplabx file updates

12 years agoCorrectly set unused PORTA pins to output high.
R. Steve McKown [Thu, 8 Dec 2011 01:11:47 +0000 (18:11 -0700)]
Correctly set unused PORTA pins to output high.

One of these is overridden by the dbgpin() macros in main.c, but that
code is likely to go away at some point.

12 years agoGenerate entropy with ADC reading floating pin
R. Steve McKown [Thu, 8 Dec 2011 01:10:19 +0000 (18:10 -0700)]
Generate entropy with ADC reading floating pin

This entropy is then used in a call to srand() so that the color
sequence on power-up isn't the same each time.

12 years agoAlways fade between colors
R. Steve McKown [Wed, 7 Dec 2011 02:52:55 +0000 (19:52 -0700)]
Always fade between colors

The A and B positions now act exactly the same, except B engages auto-off.

12 years agoImplement auto-off
R. Steve McKown [Wed, 7 Dec 2011 02:09:17 +0000 (19:09 -0700)]
Implement auto-off

After 5 hours, approximately, the lamp will automatically turn off.
Toggle the rocker to wake it back up.  An auto-wake feature will
be added later.

12 years agoUpdate buttons_sleep() for auto-off restart case
R. Steve McKown [Wed, 7 Dec 2011 02:07:47 +0000 (19:07 -0700)]
Update buttons_sleep() for auto-off restart case

buttons_sleep() now first sleeps until the rocker switch is turned off
before then sleeping until it is turned on.  This allows the function to
be used for the auto-off case, where the lamp must stay in auto-off when
the rocker switch is still in position B.  To wake from auto-off manually,
one simply turns the rocker off then back to either position A or B.

12 years agoAdd timer.h to timer.c
R. Steve McKown [Wed, 7 Dec 2011 02:07:10 +0000 (19:07 -0700)]
Add timer.h to timer.c

timer_xxx() functions need access to timer_cwait() inline macro.

12 years agoDon't use the white LED in random mode
R. Steve McKown [Wed, 7 Dec 2011 00:23:25 +0000 (17:23 -0700)]
Don't use the white LED in random mode

The white LED tends to wash out other colors, so don't use it.  The
CREE MC-E LED assembly makes a pretty good white using R+G+B.

12 years agoUpdate mplabx files
R. Steve McKown [Wed, 7 Dec 2011 00:17:50 +0000 (17:17 -0700)]
Update mplabx files

12 years agoClock loop start to loop start using Timer 0
R. Steve McKown [Wed, 7 Dec 2011 00:16:33 +0000 (17:16 -0700)]
Clock loop start to loop start using Timer 0

Timer 0 is configured to overflow every 32 msec, which is the period we
wait when driving the main control loop.  Once a loop iteration has
completed its processing, it calls timer_owait() to wait on the next
overflow.

12 years agoRun at 2 MHz
R. Steve McKown [Tue, 6 Dec 2011 18:43:40 +0000 (11:43 -0700)]
Run at 2 MHz

* PWM at 1.95 kHz
* 25 ms max loop processing time, out of a desired 32 ms.

12 years agomplabx file updates
R. Steve McKown [Tue, 6 Dec 2011 18:40:25 +0000 (11:40 -0700)]
mplabx file updates

12 years agoAdd debug pin
R. Steve McKown [Tue, 6 Dec 2011 18:38:34 +0000 (11:38 -0700)]
Add debug pin

* Debug on pin 1 of DIP18 package, RA2.
* Set pin high when processing in the loop.  Low during wait or sleep.

At 4 MHz, we see that processing within the loop is at most 12 ms, and
we have a loop period constraint of 32 ms.  We could run at 2 MHz too...

12 years agoRun at Fosc = 4MHz
R. Steve McKown [Tue, 6 Dec 2011 18:36:13 +0000 (11:36 -0700)]
Run at Fosc = 4MHz

* Run on internal oscillator at 4 MHz
* Get rid of the RUNAT32MHz definition
* Adjust PWM for ~ 1 kHz frequency, at Fosc = 4 MHz
* Loop processing <= 12 ms, out of a period of 32 ms

12 years agounused_init() properly configures unused pins
R. Steve McKown [Tue, 6 Dec 2011 16:34:52 +0000 (09:34 -0700)]
unused_init() properly configures unused pins

PortA unused pins are set as output high.
PortB can have unused pins as input with weak pull-ups enabled.

12 years agoUse internal uc pull-ups for IO pins.
R. Steve McKown [Tue, 6 Dec 2011 16:30:47 +0000 (09:30 -0700)]
Use internal uc pull-ups for IO pins.

This allows removal of the three external pull-up resistors in the circuit.

12 years agoHave 4 speed modes
R. Steve McKown [Tue, 6 Dec 2011 02:50:27 +0000 (19:50 -0700)]
Have 4 speed modes

12 years agoUse pushbutton rising edge for state change
R. Steve McKown [Tue, 6 Dec 2011 02:39:16 +0000 (19:39 -0700)]
Use pushbutton rising edge for state change

12 years agoTiming as const arrays
R. Steve McKown [Tue, 6 Dec 2011 02:18:15 +0000 (19:18 -0700)]
Timing as const arrays

For some reason, holding the pushbutton goofs up things...

12 years agoFix fading
R. Steve McKown [Tue, 6 Dec 2011 01:48:06 +0000 (18:48 -0700)]
Fix fading

12 years agofade is working
R. Steve McKown [Tue, 6 Dec 2011 00:09:22 +0000 (17:09 -0700)]
fade is working

12 years agoFading isn't working
R. Steve McKown [Mon, 5 Dec 2011 00:03:47 +0000 (17:03 -0700)]
Fading isn't working

12 years agoMinor changes on startup
R. Steve McKown [Sun, 4 Dec 2011 23:41:28 +0000 (16:41 -0700)]
Minor changes on startup

12 years agoCloser to a full featured setup
R. Steve McKown [Sun, 4 Dec 2011 22:57:55 +0000 (15:57 -0700)]
Closer to a full featured setup

Rocker switch is power switch.

* Off: lamp is off, PWM off, CPU in sleep
* On (right): Random time to fade between colors, with a random time
  staying in each color.
* Off (left): No fade between colors, with a random time in each color.

The push button speeds up fade and incolor times by a factor of 8.

12 years ago4 channel PWM with sample color changing
R. Steve McKown [Sat, 3 Dec 2011 02:55:50 +0000 (19:55 -0700)]
4 channel PWM with sample color changing

12 years agoFix comments about port assignments
R. Steve McKown [Thu, 1 Dec 2011 19:04:40 +0000 (12:04 -0700)]
Fix comments about port assignments

12 years agoAlter PWM in small increments
R. Steve McKown [Wed, 30 Nov 2011 23:49:33 +0000 (16:49 -0700)]
Alter PWM in small increments

* Use unsigned char, as unsigned short is a 16-bit value
* Increment and decrement PWM value by 1 instead of 16
* Alternate fixed LED state based on increasing/decreasing PWM duty
* Ignore /funclist file

12 years agoInitial commit
R. Steve McKown [Wed, 30 Nov 2011 23:37:12 +0000 (16:37 -0700)]
Initial commit