Make it clear that the name of the constant being defined is a string.
When the value being defined is also a string, use a new
DECL_CONSTANT_STR() macro.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a command that can immediately set the value of a digital output
pin created with config_digital_out.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The gpio_out_toggle() function in the sam3x8e and stm32f1 code was
only valid if it was called with irqs disabled.
Commits 018c5daa and 9c52ad43 enabled the lcd code which called
gpio_out_toggle() with irqs enabled. This could cause corruption of
the gpio state.
Introduce a gpio_out_toggle_noirq() function that will only be invoked
with irqs disabled, and fix gpio_out_toggle() on sam3x8e and stm32f1
so that it safe to call even if irqs are enabled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Properly handle the (unlikely) case that a schedule_soft_pwm_out
command is received before a previous command is fully processed,
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the start value to be different from the default/shutdown value
for the pin. This will be useful for "heater fans" that should
startup in the off state, and transition to full on in a shutdown
state.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Avoid using linker magic to define the init, task, and shutdown
functions. Instead, use the compile_time_request system. This
simplifies the build and produces more efficient code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the range of values used for software PWM to avoid doing an
integer division in the main code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of assuming the maximum PWM value is 255, export a constant
from the firmware to the host with the maximum value.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move sched_is_before() from sched.c to timer_is_before() in the board
specific timer code. This allows the board code to provide its own
definition.
Also, remove the sched_from_us() and sched_read_time() wrapper
functions and change the callers to directly invoke timer_from_us() /
timer_read_time().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Consistently use an "oid_" prefix on the oid functions - this makes
them similar to other functions with a common prefix.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some architectures are faster passing regular integers than 8bit
integers. Use uint_fast8_t so that the architecture chooses the
appropriate type.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Task and command handlers always run with irqs enabled, so it is not
necessary to save/restore the irq state when disabling irqs in these
handlers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some boards may not support hardware based PWM. Update the build so
that those commands do not need to be compiled if they are not
available.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some boards may not support the ADC hardware. Update the build so
that those commands do not need to be compiled if they are not
available.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>