blob: 3cef8845bb8c78adb7d806ea89b26dddcffe9207 [file] [log] [blame]
Armando Montanez196b0cd2020-11-06 11:43:27 -08001// Copyright 2020 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14
15#include "pw_board_led/led.h"
16
17#include <cinttypes>
18
19#include "pw_log/log.h"
20
Anthony DiGirolamo1682d532024-05-14 17:45:29 +000021// pw::board_led API implementation for the a host machine using log statements
22// to simulate blinking an LED.
Armando Montanez196b0cd2020-11-06 11:43:27 -080023namespace pw::board_led {
24namespace {
25
26bool led_on = false;
27
28} // namespace
29
30void Init() { TurnOff(); }
31
32void TurnOff() {
33 PW_LOG_INFO("[ ]");
34 led_on = false;
35}
36
37void TurnOn() {
38 PW_LOG_INFO("[*]");
39 led_on = true;
40}
41
42void Toggle() {
43 // Check if the LED is on. If so, turn it off.
44 if (led_on) {
45 TurnOff();
46 } else {
47 TurnOn();
48 }
49}
50
51} // namespace pw::board_led