Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gpio.h Source File

gpio.h

Go to the documentation of this file.
00001 /**
00002  * @file    gpio.h
00003  * @brief
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #ifndef GPIO_H
00023 #define GPIO_H
00024 
00025 #include <stdbool.h>
00026 #include "IO_Config.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 // wiring on PCB is unknown so implementations may vary
00033 typedef enum led_state {
00034     GPIO_LED_OFF = 0,
00035     GPIO_LED_ON
00036 } gpio_led_state_t;
00037 
00038 void gpio_init(void);
00039 void gpio_set_board_power(bool powerEnabled);
00040 void gpio_set_hid_led(gpio_led_state_t state);
00041 void gpio_set_cdc_led(gpio_led_state_t state);
00042 void gpio_set_msc_led(gpio_led_state_t state);
00043 uint8_t gpio_get_reset_btn_no_fwrd(void);
00044 uint8_t gpio_get_reset_btn_fwrd(void);
00045 #ifdef PBON_BUTTON
00046 uint8_t gpio_get_pbon_btn(void);
00047 #endif
00048 
00049 static inline uint8_t gpio_get_reset_btn(void)
00050 {
00051     return gpio_get_reset_btn_no_fwrd() || gpio_get_reset_btn_fwrd();
00052 }
00053 
00054 #ifdef __cplusplus
00055 }
00056 #endif
00057 
00058 #endif