2022-05-21 22:10:34 +08:00
|
|
|
/*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* This file is part of the TinyUSB stack.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \ingroup group_demo
|
|
|
|
* \defgroup group_board Boards Abstraction Layer
|
|
|
|
* @{ */
|
|
|
|
|
|
|
|
#ifndef _BSP_BOARD_H_
|
|
|
|
#define _BSP_BOARD_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2022-05-20 21:19:28 +08:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
2022-05-21 22:10:34 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-05-30 21:19:16 +08:00
|
|
|
#include "nrfx_timer.h"
|
2022-05-21 22:10:34 +08:00
|
|
|
|
|
|
|
#define CFG_BOARD_UART_BAUDRATE 115200
|
|
|
|
|
|
|
|
// Initialize on-board peripherals : led, button, uart and USB
|
|
|
|
void board_init(void);
|
|
|
|
|
2022-05-30 21:19:16 +08:00
|
|
|
// Write data to UART
|
2022-05-21 22:10:34 +08:00
|
|
|
int board_uart_write(void const *buf, int len);
|
|
|
|
|
2022-05-30 21:19:16 +08:00
|
|
|
// Ticks
|
|
|
|
extern volatile uint32_t system_ticks;
|
2022-05-21 22:10:34 +08:00
|
|
|
|
2022-05-30 21:19:16 +08:00
|
|
|
// Timers
|
|
|
|
extern nrfx_timer_t m_timer_touch;
|
|
|
|
extern nrfx_timer_t m_timer_timeout;
|
2022-05-21 22:10:34 +08:00
|
|
|
|
2022-05-30 21:19:16 +08:00
|
|
|
// Timer handlers
|
|
|
|
void timer_touch_handler(nrf_timer_event_t event_type, void * p_context);
|
|
|
|
void timer_timeout_handler(nrf_timer_event_t event_type, void * p_context);
|
2022-05-20 21:19:28 +08:00
|
|
|
|
2022-05-30 21:19:16 +08:00
|
|
|
// RNG event handler
|
2022-08-20 22:40:38 +08:00
|
|
|
extern volatile uint32_t rng_data_word, rng_count;
|
2022-05-30 21:19:16 +08:00
|
|
|
void rng_event_handler(uint8_t rng_data);
|
2022-05-20 21:19:28 +08:00
|
|
|
|
2022-05-21 22:10:34 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2022-05-20 21:19:28 +08:00
|
|
|
|
2022-05-21 22:10:34 +08:00
|
|
|
#endif /* _BSP_BOARD_H_ */
|
2022-05-20 21:19:28 +08:00
|
|
|
|
2022-05-21 22:10:34 +08:00
|
|
|
/** @} */
|