Files
.github
docs
firmware
application
baseband
bootstrap
chibios
chibios-portapack
common
acars_packet.cpp
acars_packet.hpp
adc.hpp
adsb.cpp
adsb.hpp
adsb_frame.cpp
adsb_frame.hpp
ais_baseband.cpp
ais_baseband.hpp
ais_packet.cpp
ais_packet.hpp
ak4951.cpp
ak4951.hpp
backlight.cpp
backlight.hpp
baseband.hpp
baseband_cpld.cpp
baseband_cpld.hpp
baseband_packet.hpp
baseband_sgpio.cpp
baseband_sgpio.hpp
bch_code.cpp
bch_code.hpp
bit_pattern.hpp
bmp.hpp
buffer.cpp
buffer.hpp
buffer_exchange.cpp
buffer_exchange.hpp
chibios_cpp.cpp
chibios_cpp.hpp
complex.hpp
cpld_max5.cpp
cpld_max5.hpp
cpld_update.cpp
cpld_update.hpp
cpld_xilinx.cpp
cpld_xilinx.hpp
crc.hpp
debug.cpp
debug.hpp
dsp_fft.cpp
dsp_fft.hpp
dsp_fir_taps.cpp
dsp_fir_taps.hpp
dsp_iir.cpp
dsp_iir.hpp
dsp_iir_config.hpp
dsp_types.hpp
emu_cc1101.hpp
ert_packet.cpp
ert_packet.hpp
event.cpp
event.hpp
field_reader.hpp
fifo.hpp
gcc.cpp
gcc.hpp
gpdma.cpp
gpdma.hpp
gpio.hpp
hackrf_cpld_data.hpp
hackrf_gpio.hpp
hackrf_hal.cpp
hackrf_hal.hpp
i2c_pp.cpp
i2c_pp.hpp
i2s.hpp
jammer.cpp
jammer.hpp
jtag.cpp
jtag.hpp
jtag_tap.cpp
jtag_tap.hpp
jtag_target.hpp
jtag_target_gpio.hpp
lcd_ili9341.cpp
lcd_ili9341.hpp
led.hpp
lfsr_random.cpp
lfsr_random.hpp
lpc43xx_cpp.hpp
manchester.cpp
manchester.hpp
memory_map.hpp
message.hpp
message_queue.cpp
message_queue.hpp
modules.h
morse.cpp
morse.hpp
msgpack.cpp
msgpack.hpp
optional.hpp
pins.hpp
png_writer.cpp
png_writer.hpp
pocsag.cpp
pocsag.hpp
pocsag_packet.cpp
pocsag_packet.hpp
portapack_adc.hpp
portapack_cpld_data.hpp
portapack_dma.hpp
portapack_hal.hpp
portapack_io.cpp
portapack_io.hpp
portapack_persistent_memory.cpp
portapack_persistent_memory.hpp
portapack_shared_memory.cpp
portapack_shared_memory.hpp
simd.hpp
sine_table.hpp
sine_table_int8.hpp
sonde_packet.cpp
sonde_packet.hpp
spi_image.hpp
sstv.hpp
test_packet.cpp
test_packet.hpp
thread_base.hpp
thread_wait.cpp
thread_wait.hpp
tonesets.hpp
tpms_packet.cpp
tpms_packet.hpp
ui.cpp
ui.hpp
ui_focus.cpp
ui_focus.hpp
ui_painter.cpp
ui_painter.hpp
ui_text.cpp
ui_text.hpp
ui_widget.cpp
ui_widget.hpp
units.hpp
utility.cpp
utility.hpp
utility_m4.hpp
volume.hpp
wm8731.cpp
wm8731.hpp
graphics
tools
CMakeLists.txt
toolchain-arm-cortex-m.cmake
hackrf
hardware
sdcard
.gitignore
.gitmodules
.travis.yml
CMakeLists.txt
LICENSE
README.md
dockerfile
dockerfile-nogit
mayhem-firmware/firmware/common/led.hpp

59 lines
1.3 KiB
C++
Raw Normal View History

2015-07-08 08:39:24 -07:00
/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef __LED_H__
#define __LED_H__
#include "gpio.hpp"
struct LED {
constexpr LED(const GPIO gpio) :
_gpio { gpio } {
}
void setup() const {
_gpio.clear();
_gpio.output();
_gpio.configure();
}
void on() const {
_gpio.set();
}
void off() const {
_gpio.clear();
}
void toggle() const {
_gpio.toggle();
}
void write(const bool value) const {
_gpio.write(value);
}
private:
const GPIO _gpio;
};
#endif/*__LED_H__*/