]> www.fi.muni.cz Git - bike-lights.git/log
bike-lights.git
10 years agopwmled: verify the input of pwmled_set_brightness
Jan "Yenya" Kasprzak [Wed, 26 Jun 2013 21:53:11 +0000 (23:53 +0200)]
pwmled: verify the input of pwmled_set_brightness

Also allow different number of current levels for each output

10 years agocontrol.c: test pattern for debugging pwmleds
Jan "Yenya" Kasprzak [Wed, 26 Jun 2013 21:48:54 +0000 (23:48 +0200)]
control.c: test pattern for debugging pwmleds

10 years agobraking is handled behind the patterns inside pattern.c
Jan "Yenya" Kasprzak [Wed, 26 Jun 2013 20:35:37 +0000 (22:35 +0200)]
braking is handled behind the patterns inside pattern.c

See the comment above pwmled_update_mode():

This is tricky: we use a single pattern for all three pwmleds,
but on some occasions, we want to be able to modify only a single
pwmled status without affecting other outputs. For example, during
braking, we want to modify only the rear pwmled status. We don't
use a separate "braking" pattern for every other pattern used, but instead
we change the pwmled0 status regardless of the original value when
braking. The rule is the following:
- if during braking the pwmled2 (front) is at mode 2, we switch it to
    mode 3 (which has the same target current) to avoid flicker.
- if pwmled0 (rear) is off, we set it to mode 2
    (if it is with mode 1, we keep it at mode 1)
TODO: something similar should be done for the "entering the dark area"
    condition, where we want to switch pwmled2 (front) on, to mode 2.

10 years agocontrol.c: new multi-pwmled panic pattern
Jan "Yenya" Kasprzak [Wed, 26 Jun 2013 20:06:20 +0000 (22:06 +0200)]
control.c: new multi-pwmled panic pattern

10 years agopattern.c: pwmled setting refactorization
Jan "Yenya" Kasprzak [Wed, 26 Jun 2013 19:52:33 +0000 (21:52 +0200)]
pattern.c: pwmled setting refactorization

10 years agoCommon patterns rewrite
Jan "Yenya" Kasprzak [Tue, 25 Jun 2013 21:41:04 +0000 (23:41 +0200)]
Common patterns rewrite

slowN_pattern, normalN_pattern, and onN_pattern for N=(1..4)
rewritten to be brightness-independent, and to avoid switching
multiple outputs on at once, if possible.
If not (such as when PWMLED 2 is continuously on), use mode 2 and 3
with the same target current to accomodate for different battery voltages
when more than one output is running.

TODO: actually set brightness based on various conditions, such as
ambient lights, user-requested dim mode, etc.

10 years agopwmled: do not probe pwmleds
Jan "Yenya" Kasprzak [Tue, 25 Jun 2013 20:20:04 +0000 (22:20 +0200)]
pwmled: do not probe pwmleds

... just wait for them to be used by pattern.c.
TODO: remove the probing code altogether.

10 years agopwmled: faster regulation
Jan "Yenya" Kasprzak [Tue, 25 Jun 2013 20:17:45 +0000 (22:17 +0200)]
pwmled: faster regulation

10 years agopwmled.c: reload ADC target data after setting the brightness
Jan "Yenya" Kasprzak [Tue, 25 Jun 2013 20:16:47 +0000 (22:16 +0200)]
pwmled.c: reload ADC target data after setting the brightness

10 years agoPWMLED: proof-of-concept brightness setting
Jan "Yenya" Kasprzak [Tue, 18 Jun 2013 15:36:41 +0000 (17:36 +0200)]
PWMLED: proof-of-concept brightness setting

In order to save space for patterns, we set the brightness
independently from pattern. Each brightness has only two levels
for PWMLED 0 and 2, and one for PWMLED 1. Patterns can then use
two-bit values for each PWMLED (one-bit for PWMLED 1), with the
following meaning:

0: off
1: level 1
2: level 2
3: also level 2, with a separate state stored. This can be used for
saving regulation value for a single current level with
and without other outputs running, or with different levels
of other output. This is in order to avoid flicker when one
PWMLED (usually the front one) is steady on, and the others
are blinking.

10 years agoPWM LEDs driven by a single pattern
Jan "Yenya" Kasprzak [Tue, 18 Jun 2013 14:34:33 +0000 (16:34 +0200)]
PWM LEDs driven by a single pattern

Pattern sources renumbered:

0 - all three PWM LEDs
1 - status led
2 - illumination LED
4 - laser LED

10 years agoDatasheets added
Jan "Yenya" Kasprzak [Wed, 26 Jun 2013 09:01:25 +0000 (11:01 +0200)]
Datasheets added

LEDs:
Cree XM-L2
Cree XP-G2

LED optics:
Ledil Leila for XP-G and XM-L
Fraen for Luxeons

10 years agoambient.c: zone adjustments
Jan "Yenya" Kasprzak [Tue, 25 Jun 2013 21:51:11 +0000 (23:51 +0200)]
ambient.c: zone adjustments

10 years agoInclude date and git revision in the eeprom variable
Jan "Yenya" Kasprzak [Tue, 25 Jun 2013 20:26:33 +0000 (22:26 +0200)]
Include date and git revision in the eeprom variable

... in order to be able to find out which firmware version is this MCU
running. This roughly corresponds to the commit
49420b56b31e113f4c40128c530f2e585a9f8061
of project Tinyboard.

10 years agoambient.c: log maximum and drop instead of min and drop
Jan "Yenya" Kasprzak [Thu, 13 Jun 2013 22:17:53 +0000 (00:17 +0200)]
ambient.c: log maximum and drop instead of min and drop

10 years agoambient zone adjustments
Jan "Yenya" Kasprzak [Thu, 13 Jun 2013 22:13:18 +0000 (00:13 +0200)]
ambient zone adjustments

The system switched to "darkness" mode too early.

10 years agomain.c: log the ambient light stats more often
Jan "Yenya" Kasprzak [Thu, 13 Jun 2013 19:19:10 +0000 (21:19 +0200)]
main.c: log the ambient light stats more often

10 years agologging.c: shorten the log buffer
Jan "Yenya" Kasprzak [Thu, 13 Jun 2013 19:16:51 +0000 (21:16 +0200)]
logging.c: shorten the log buffer

We are overflowing the stack, save the data segment space by
shortening the log double buffer in RAM.

10 years agoambient.c: detect drop of ambient light
Jan "Yenya" Kasprzak [Thu, 13 Jun 2013 19:14:30 +0000 (21:14 +0200)]
ambient.c: detect drop of ambient light

Measure also longer-term running average of ambient light values,
and log instead of minima and maxima of adc readings the diffrence
between this longer-term average and normal avereage (ambient_val).
This is so that we would be able to switch the front light on when
entering a darkish area from the bright sun.

10 years agoambient.c: adjustments for maximum zone
Jan "Yenya" Kasprzak [Thu, 13 Jun 2013 18:50:37 +0000 (20:50 +0200)]
ambient.c: adjustments for maximum zone

10 years agoDatasheet for lxhl-bd01 high-power red LED
Jan "Yenya" Kasprzak [Tue, 11 Jun 2013 10:54:24 +0000 (12:54 +0200)]
Datasheet for lxhl-bd01 high-power red LED

10 years agoTimer handling moved to the main thread
Jan "Yenya" Kasprzak [Fri, 7 Jun 2013 16:15:11 +0000 (18:15 +0200)]
Timer handling moved to the main thread

In order to mitigate the problem with watchdog reset, possibly caused
by timer IRQ handling taking too long, we only increment the jiffies
value in the WDT IRQ handler, and then read this value in the main
loop, compare with the previous one, and if those two are different,
we run the timer-induced operations. We can (probably) detect the
timer overrun (the difference in jiffies being greater than 1), and log
it.

The individual timer-induced operations are run in their own atomic
blocks for now, in order to be safe. The finer-grained locking is
in the TODO list :-).

10 years agomain.c: split up the main() function
Jan "Yenya" Kasprzak [Fri, 7 Jun 2013 16:00:31 +0000 (18:00 +0200)]
main.c: split up the main() function

- early HW setup, run once after reset, is moved to the first_boot()
  function
- main loop iteration is in a separate function main_loop_iteration()
- both functions (and hw_suspend() as well) are made inline

10 years agoDisable WDT as early as possible
Jan "Yenya" Kasprzak [Fri, 7 Jun 2013 15:42:10 +0000 (17:42 +0200)]
Disable WDT as early as possible

Apparently, after WDT reset, WDT is still running, and has to be
disabled. Otherwise it will kick in again during the initialization.

We want to indicate the WDT reset contition somehow. We use the GPIO
LED 0 - we set it to on if the reset source was WDT.

Also, we want to read and reset MCUSR as early as possible. We do it
from main(), and we then send the saved value where needed (init_log()
and power_down()).

10 years agopatterns: fibonacci-scaled step duration
Jan "Yenya" Kasprzak [Tue, 4 Jun 2013 16:04:35 +0000 (18:04 +0200)]
patterns: fibonacci-scaled step duration

We have only three bits for pattern duration now,
use Fibonacci-compressed values: instead of 0-7,
use 0, 1, 2, 3, 5, 8, 13, and 21.

10 years agopatterns: 3 bits for duration, 5 bits for mode
Jan "Yenya" Kasprzak [Tue, 4 Jun 2013 15:46:59 +0000 (17:46 +0200)]
patterns: 3 bits for duration, 5 bits for mode

I plan to use a single mode for encoding all three pwmleds:

2 bits for PWMLED 0
1 bit  for PWMLED 1
2 bits for PWMLED 2

10 years agoadc.c: fix uninitialized value
Jan "Yenya" Kasprzak [Mon, 3 Jun 2013 20:07:26 +0000 (22:07 +0200)]
adc.c: fix uninitialized value

10 years agobattery.c: don't report battery critical for now
Jan "Yenya" Kasprzak [Mon, 3 Jun 2013 20:05:09 +0000 (22:05 +0200)]
battery.c: don't report battery critical for now

10 years agopwmled.c: start probing with non-zero PWM value
Jan "Yenya" Kasprzak [Mon, 3 Jun 2013 20:04:33 +0000 (22:04 +0200)]
pwmled.c: start probing with non-zero PWM value

... in order to kick the ADCs on.

10 years agomain.c: on-demand sleep modes
Jan "Yenya" Kasprzak [Mon, 3 Jun 2013 15:56:06 +0000 (17:56 +0200)]
main.c: on-demand sleep modes

10 years agoadc: use only active pwmleds, on-demand switching of other channels
Jan "Yenya" Kasprzak [Mon, 3 Jun 2013 15:52:14 +0000 (17:52 +0200)]
adc: use only active pwmleds, on-demand switching of other channels

10 years agopwm.c: channels running - visible from the outside
Jan "Yenya" Kasprzak [Mon, 3 Jun 2013 15:11:26 +0000 (17:11 +0200)]
pwm.c: channels running - visible from the outside

Make the status of T/C1 visible from the outside, in order to
make the on-demand ADC channel selection possible, and also
to allow selecting the sleep modes in the main loop.

10 years agoadc.c: reorder ADC channels
Jan "Yenya" Kasprzak [Mon, 3 Jun 2013 12:11:23 +0000 (14:11 +0200)]
adc.c: reorder ADC channels

- those which need to be measured more frequently, put at the beginning.

10 years agoAmbient light zones adjustments
Jan "Yenya" Kasprzak [Tue, 28 May 2013 21:52:48 +0000 (23:52 +0200)]
Ambient light zones adjustments

10 years agopwm.c: disable when not needed
Jan "Yenya" Kasprzak [Tue, 28 May 2013 21:07:31 +0000 (23:07 +0200)]
pwm.c: disable when not needed

Timer/Counter 1 eats much power, especially with PLL clock. So let's
try to disable it when no PWM channel is active.

10 years agobuttons.c: handle brake sensor failure gracefully
Jan "Yenya" Kasprzak [Tue, 28 May 2013 20:45:56 +0000 (22:45 +0200)]
buttons.c: handle brake sensor failure gracefully

A common failure mode is that the magnet slips and does not provide
the signal, so it appears as if constantly braking. Avoid this situation
by allowing continuous braking of at most 16 seconds. After that, report
brake off, and wait for the real "brake off" signall from the Hall sensor.

10 years agotmr.c: combine watchdog IRQ and watchdog reset
Jan "Yenya" Kasprzak [Tue, 28 May 2013 20:29:06 +0000 (22:29 +0200)]
tmr.c: combine watchdog IRQ and watchdog reset

Fortunately, WDT reset can be combined with WDT interrupt. The procedure
is to reenable WDIE each time, or the next WDT timeout will be reset.

10 years agoWatchdog-based timing
Jan "Yenya" Kasprzak [Mon, 20 May 2013 22:34:06 +0000 (00:34 +0200)]
Watchdog-based timing

TODO: remove the sub-LSB PWM scaling, add deeper sleep states.

10 years agoambient: log minima and maxima
Jan "Yenya" Kasprzak [Mon, 20 May 2013 21:47:05 +0000 (23:47 +0200)]
ambient: log minima and maxima

In order to be able to tune the ambient light sensor better, I made
it to log the minimum and maximum values read for every three minutes
or so. When the log buffer fills, start over only after the next
off/on cycle.

11 years agoambient.c: adjust the day/dawn values
Jan "Yenya" Kasprzak [Thu, 11 Apr 2013 19:49:42 +0000 (21:49 +0200)]
ambient.c: adjust the day/dawn values

11 years agoambient.c: make the sensor react faster
Jan "Yenya" Kasprzak [Thu, 11 Apr 2013 19:49:12 +0000 (21:49 +0200)]
ambient.c: make the sensor react faster

11 years agopattern+current adjustments
Jan "Yenya" Kasprzak [Wed, 10 Apr 2013 21:48:27 +0000 (23:48 +0200)]
pattern+current adjustments

11 years agocontrol.c: braking pattern for pwmled0
Jan "Yenya" Kasprzak [Wed, 10 Apr 2013 21:16:45 +0000 (23:16 +0200)]
control.c: braking pattern for pwmled0

11 years agopwmled.c: slower response in order to gain stability
Jan "Yenya" Kasprzak [Thu, 28 Mar 2013 22:55:02 +0000 (23:55 +0100)]
pwmled.c: slower response in order to gain stability

11 years agopwmled.c: I only have one 350mA spot LED now in production mode
Jan "Yenya" Kasprzak [Thu, 28 Mar 2013 22:40:33 +0000 (23:40 +0100)]
pwmled.c: I only have one 350mA spot LED now in production mode

11 years agopwmleds: less measurements per run
Jan "Yenya" Kasprzak [Thu, 28 Mar 2013 22:36:26 +0000 (23:36 +0100)]
pwmleds: less measurements per run

With low-pass filters at the input of PWMLED ADC pins, it is now
relatively stable and noise-free, so we can lower the number of readings
to two. Hopefully this will not cause instability.

11 years agoslow ADC inputs
Jan "Yenya" Kasprzak [Thu, 28 Mar 2013 22:33:25 +0000 (23:33 +0100)]
slow ADC inputs

The fastest-repeated measurements are needed for PWM LEDs. OTOH,
things like buttons, battery voltage, ambient lights, etc. can be
read less frequently, and should be read in a deterministic time frame.
So we will measure PWMLED current in the free-running mode (as fast
as possible), and the other "slow" ADC inputs with each PATTERN_DIV-th
timer tick.

11 years agoambient light sensor: configurable # of readings
Jan "Yenya" Kasprzak [Thu, 28 Mar 2013 21:13:58 +0000 (22:13 +0100)]
ambient light sensor: configurable # of readings

Set the # of readings to 1, and decrease the shift value
for running average in order to get faster reaction.

11 years agoTimer-initiated ADC
Jan "Yenya" Kasprzak [Thu, 28 Mar 2013 18:48:01 +0000 (19:48 +0100)]
Timer-initiated ADC

Run ADC synchronously with timer IRQ. This partially reverts
commit 210916486d18b3dc976c65c7b01b44bca446d856 in order to
prepare for selectively enabling and disabling ADC channels.

11 years agoadc.c: configurable number of pre-readings
Jan "Yenya" Kasprzak [Sun, 17 Mar 2013 16:59:23 +0000 (17:59 +0100)]
adc.c: configurable number of pre-readings

When there is a supposed ADC noise problem, it is handful to drop
several first readings, and even discharge the ADC capacitor
by reading the single-ended wire connected to zero. This commit
rewrites the ADC handling to allow exactly this, for each ADC input.

11 years agobuttons.c: magnet for the Hall probe not present?
Jan "Yenya" Kasprzak [Thu, 14 Mar 2013 21:12:33 +0000 (22:12 +0100)]
buttons.c: magnet for the Hall probe not present?

Handle the case when the Hall probe magnet is not present.

11 years agocontrol.c: reset the braking variable
Jan "Yenya" Kasprzak [Thu, 14 Mar 2013 21:12:13 +0000 (22:12 +0100)]
control.c: reset the braking variable

11 years agoadc: fix the button adc number
Jan "Yenya" Kasprzak [Thu, 14 Mar 2013 19:20:48 +0000 (20:20 +0100)]
adc: fix the button adc number

... and use symbolic constants in the switch statement to avoid
this kind of bugs in the future.

11 years agoadc: missing break statement
Jan "Yenya" Kasprzak [Thu, 14 Mar 2013 18:07:02 +0000 (19:07 +0100)]
adc: missing break statement

oh well.

11 years agofirmware: buttons + hall probe via ADC
Jan "Yenya" Kasprzak [Fri, 8 Mar 2013 21:52:16 +0000 (22:52 +0100)]
firmware: buttons + hall probe via ADC

11 years agobattery.c: adjustment for 1.1V internal reference
Jan "Yenya" Kasprzak [Wed, 6 Mar 2013 23:19:43 +0000 (00:19 +0100)]
battery.c: adjustment for 1.1V internal reference

11 years agopattern.c: shorten the final delay
Jan "Yenya" Kasprzak [Wed, 6 Mar 2013 21:54:02 +0000 (22:54 +0100)]
pattern.c: shorten the final delay

Shorten tne final delay in number patterns and off_pattern.

11 years agopattern.c: synchronized patterns
Jan "Yenya" Kasprzak [Wed, 6 Mar 2013 21:51:55 +0000 (22:51 +0100)]
pattern.c: synchronized patterns

- status LEDs should not blink together
- PWM LEDs should start synchronized, in order to allow for compensation
of battery voltage variations when one output is on
compared to when more outputs are on

11 years agoRemove unused PATTERN_FOREVER
Jan "Yenya" Kasprzak [Wed, 6 Mar 2013 10:41:19 +0000 (11:41 +0100)]
Remove unused PATTERN_FOREVER

This is not used by any pattern anymore - remove it.

11 years agoMakefile: handlebar schematics for the web pages
Jan "Yenya" Kasprzak [Tue, 5 Mar 2013 13:09:49 +0000 (14:09 +0100)]
Makefile: handlebar schematics for the web pages

11 years agoambient zones adjusted
Jan "Yenya" Kasprzak [Wed, 6 Mar 2013 15:05:10 +0000 (16:05 +0100)]
ambient zones adjusted

11 years agoHandlebar switches
Jan "Yenya" Kasprzak [Tue, 5 Mar 2013 12:54:34 +0000 (13:54 +0100)]
Handlebar switches

I have decided to implement a brake light, which I want to trigger using
Hall-effect sensor mounted in the brake lever. Unfortunately I still
have only three wires for two switches and a Hall-effect sensor, so I
would have to change the digital switch readings (on/off) to ADC
readings (voltages selected using voltage split on resistors).

Here is the schematics for the whole handlebar electronics, and the
symbol file and datasheet for the Honeywell SS341RT Hall-effect sensor.

11 years agolights.h: fix prototype name
Jan "Yenya" Kasprzak [Thu, 28 Feb 2013 00:11:46 +0000 (01:11 +0100)]
lights.h: fix prototype name

11 years agocontrol.c: handle "battery critical" state
Jan "Yenya" Kasprzak [Thu, 28 Feb 2013 00:00:57 +0000 (01:00 +0100)]
control.c: handle "battery critical" state

11 years agocontrol.c: display battery status on status led by default
Jan "Yenya" Kasprzak [Wed, 27 Feb 2013 23:58:04 +0000 (00:58 +0100)]
control.c: display battery status on status led by default

11 years agopattern.c: num_pattern(10) is also allowed
Jan "Yenya" Kasprzak [Wed, 27 Feb 2013 23:57:35 +0000 (00:57 +0100)]
pattern.c: num_pattern(10) is also allowed

11 years agobattery.c: rework
Jan "Yenya" Kasprzak [Wed, 27 Feb 2013 23:56:55 +0000 (00:56 +0100)]
battery.c: rework

We can use values in mV instead of 100 mV. We can also provide
the battery level on scale from 1 to 10.

11 years agoadc.c: more measurements of ambient light
Jan "Yenya" Kasprzak [Wed, 27 Feb 2013 22:28:35 +0000 (23:28 +0100)]
adc.c: more measurements of ambient light

11 years agoambient.c: zone adjustments
Jan "Yenya" Kasprzak [Wed, 27 Feb 2013 22:28:16 +0000 (23:28 +0100)]
ambient.c: zone adjustments

11 years agobattery.c: priority of operations
Jan "Yenya" Kasprzak [Wed, 27 Feb 2013 22:27:46 +0000 (23:27 +0100)]
battery.c: priority of operations

... in order to fit to an 8-bit value.

11 years agoRevert "adc.c: make the ADC handlers non-atomic"
Jan "Yenya" Kasprzak [Wed, 27 Feb 2013 21:49:42 +0000 (22:49 +0100)]
Revert "adc.c: make the ADC handlers non-atomic"

This reverts commit eb2f91ea7806fd8f5b9a5597fcf5c13855911d71.

We will probably not need non-atomic handlers.

11 years agopattern: laser diodes as gpio 4
Jan "Yenya" Kasprzak [Wed, 20 Feb 2013 21:49:36 +0000 (22:49 +0100)]
pattern: laser diodes as gpio 4

11 years agopwmled.c: shut down the boost converter later
Jan "Yenya" Kasprzak [Wed, 20 Feb 2013 21:47:24 +0000 (22:47 +0100)]
pwmled.c: shut down the boost converter later

11 years agopins.txt: converter response times
Jan "Yenya" Kasprzak [Fri, 18 Jan 2013 21:52:35 +0000 (22:52 +0100)]
pins.txt: converter response times

11 years agoambient.c: zones adjusted for photoresistor
Jan "Yenya" Kasprzak [Fri, 18 Jan 2013 21:51:40 +0000 (22:51 +0100)]
ambient.c: zones adjusted for photoresistor

11 years agoMerge branch 'master' of ssh://anxur.fi.muni.cz/~kas/html/git/bike-lights
Jan "Yenya" Kasprzak [Fri, 18 Jan 2013 21:50:50 +0000 (22:50 +0100)]
Merge branch 'master' of ssh://anxur.fi.muni.cz/~kas/html/git/bike-lights

Conflicts:
firmware/adc.c

11 years agoadc.c: make the ADC handlers non-atomic
Jan "Yenya" Kasprzak [Fri, 4 Jan 2013 16:26:08 +0000 (17:26 +0100)]
adc.c: make the ADC handlers non-atomic

will it work?

11 years agoadc.c: routine for synchronous conversion
Jan "Yenya" Kasprzak [Fri, 4 Jan 2013 14:50:14 +0000 (15:50 +0100)]
adc.c: routine for synchronous conversion

11 years agocontrol.c: blinking modes update
Jan "Yenya" Kasprzak [Sun, 16 Dec 2012 16:32:32 +0000 (17:32 +0100)]
control.c: blinking modes update

11 years agocontrol.c: on_patterns should not last forever
Jan "Yenya" Kasprzak [Sun, 16 Dec 2012 16:31:18 +0000 (17:31 +0100)]
control.c: on_patterns should not last forever

11 years agoambient light: make three measurements
Jan "Yenya" Kasprzak [Sun, 16 Dec 2012 16:29:53 +0000 (17:29 +0100)]
ambient light: make three measurements

11 years agopwmled.c: do not regulate just after mode change
Jan "Yenya" Kasprzak [Sun, 16 Dec 2012 16:28:39 +0000 (17:28 +0100)]
pwmled.c: do not regulate just after mode change

11 years agopwmled.c: disable the disconnected step-up earlier
Jan "Yenya" Kasprzak [Sun, 16 Dec 2012 16:26:50 +0000 (17:26 +0100)]
pwmled.c: disable the disconnected step-up earlier

11 years agopattern.c: off_pattern should not last forever
Jan "Yenya" Kasprzak [Sun, 16 Dec 2012 16:22:26 +0000 (17:22 +0100)]
pattern.c: off_pattern should not last forever

11 years agobuttons.c: longer keypress
Jan "Yenya" Kasprzak [Sat, 15 Dec 2012 21:22:02 +0000 (22:22 +0100)]
buttons.c: longer keypress

... after we have increased the clock frequency

11 years agoambient.c: ambient light hysteresis
Jan "Yenya" Kasprzak [Sat, 15 Dec 2012 21:21:25 +0000 (22:21 +0100)]
ambient.c: ambient light hysteresis

11 years agoschematics: more low-pass filters, fuse removed
Jan "Yenya" Kasprzak [Sat, 15 Dec 2012 20:51:23 +0000 (21:51 +0100)]
schematics: more low-pass filters, fuse removed

11 years agoMerge branch 'master' of ssh://anxur.fi.muni.cz/~kas/html/git/bike-lights
Jan "Yenya" Kasprzak [Wed, 12 Dec 2012 04:03:59 +0000 (05:03 +0100)]
Merge branch 'master' of ssh://anxur.fi.muni.cz/~kas/html/git/bike-lights

11 years agoschematics: bug fixes
Jan "Yenya" Kasprzak [Tue, 11 Dec 2012 16:16:29 +0000 (17:16 +0100)]
schematics: bug fixes

- low-pass filters added to the ADC pins measuring LED current
- prog_ena jumper changed to disconnect pwm0 only, as this is what makes
problem during in-system programming
- labels for LED and battery connectors moved outside the footprint

11 years agopwm.c: maximum TOP value of T/C 1 is 0x3FF.
Jan "Yenya" Kasprzak [Mon, 10 Dec 2012 21:00:28 +0000 (22:00 +0100)]
pwm.c: maximum TOP value of T/C 1 is 0x3FF.

11 years agobuttons.c - the correct IRQ is PCIE1
Jan "Yenya" Kasprzak [Sat, 8 Dec 2012 21:32:40 +0000 (22:32 +0100)]
buttons.c - the correct IRQ is PCIE1

11 years agoAbility to quickly build testing firmware
Jan "Yenya" Kasprzak [Sat, 8 Dec 2012 19:36:27 +0000 (20:36 +0100)]
Ability to quickly build testing firmware

Testing is actually development,
and non-testing is "safe" for production use, even with some
features disabled. At least for now :-)

11 years agoADC measurements in mA
Jan "Yenya" Kasprzak [Sat, 8 Dec 2012 19:27:41 +0000 (20:27 +0100)]
ADC measurements in mA

11 years agopwm.c: publish only PWM_MAX as non-internal value
Jan "Yenya" Kasprzak [Fri, 7 Dec 2012 22:03:55 +0000 (23:03 +0100)]
pwm.c: publish only PWM_MAX as non-internal value

The TOP value of Timer/Counter 1 is computed inside pwm.c and it is
purely internal to this module.

11 years agopwmled.c: factored out probing to a separate function
Jan "Yenya" Kasprzak [Fri, 7 Dec 2012 21:51:20 +0000 (22:51 +0100)]
pwmled.c: factored out probing to a separate function

11 years agopwmled.c: save error sum between mode switches
Jan "Yenya" Kasprzak [Fri, 7 Dec 2012 21:03:49 +0000 (22:03 +0100)]
pwmled.c: save error sum between mode switches

otherwise it leads to instability when during short blink the error
sum does not manage to increase the stride.

Also, use 32-bit ints to simplify the code and save some branches.

11 years agopwm.c: make it usable from non-atomic blocks
Jan "Yenya" Kasprzak [Thu, 6 Dec 2012 23:10:20 +0000 (00:10 +0100)]
pwm.c: make it usable from non-atomic blocks

11 years agopwm.c - remove unused code
Jan "Yenya" Kasprzak [Thu, 6 Dec 2012 20:38:03 +0000 (21:38 +0100)]
pwm.c - remove unused code

11 years agopwm.c: PLL clock enabling code
Jan "Yenya" Kasprzak [Thu, 6 Dec 2012 20:34:00 +0000 (21:34 +0100)]
pwm.c: PLL clock enabling code

- factored out from init_pwm() in order to be able to suspend PLL also
during normal operation
- use _delay_us(100) instead of _delay_ms(1) as recommended by datasheet
- disable PLL in susp_pwm()

11 years agofirmware: control logic moved to a separate module
Jan "Yenya" Kasprzak [Fri, 30 Nov 2012 16:37:53 +0000 (17:37 +0100)]
firmware: control logic moved to a separate module

- buttons.c now controls status LEDs only when setting parameters
- pattern.c:
can use NULL instead of off_pattern
has number_pattern() than can also set up inverted patterns
contains only number and boot patterns as static variables
can reload all patterns if some state changes
- ambient.c resets all patterns when ambient zone changes
- control.c:
- now contains almost all pattern strings, only those needed by
other modules are exported
- status LED and illumination LED can be controlled by buttons.c
- separate _pattern_select() function for each LED