kind of work with zephyr with pca10056 with cmake -DBUILD_ZEPHYR

This commit is contained in:
hathach
2025-01-23 17:10:01 +07:00
parent 6080f89f3d
commit 31071ccf0e
17 changed files with 122 additions and 104 deletions

View File

@@ -62,15 +62,13 @@
#include "bsp/board_api.h"
#include "tusb.h"
#include "msc_app.h"
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF PROTYPES
//--------------------------------------------------------------------+
void led_blinking_task(void);
// from msc_app.c
extern bool msc_app_init(void);
extern void msc_app_task(void);
/*------------- MAIN -------------*/
int main(void) {
board_init();

View File

@@ -67,7 +67,9 @@ bool cli_init(void);
bool msc_app_init(void)
{
for(size_t i=0; i<CFG_TUH_DEVICE_MAX; i++) _disk_busy[i] = false;
for(size_t i=0; i<CFG_TUH_DEVICE_MAX; i++) {
_disk_busy[i] = false;
}
// disable stdout buffered for echoing typing command
#ifndef __ICCARM__ // TODO IAR doesn't support stream control ?
@@ -81,7 +83,9 @@ bool msc_app_init(void)
void msc_app_task(void)
{
if (!_cli) return;
if (!_cli) {
return;
}
int ch = board_getchar();
if ( ch > 0 )
@@ -99,8 +103,7 @@ void msc_app_task(void)
//
//--------------------------------------------------------------------+
bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data)
{
static bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data) {
msc_cbw_t const* cbw = cb_data->cbw;
msc_csw_t const* csw = cb_data->csw;
@@ -294,18 +297,11 @@ void cli_cmd_mkdir(EmbeddedCli *cli, char *args, void *context);
void cli_cmd_mv(EmbeddedCli *cli, char *args, void *context);
void cli_cmd_rm(EmbeddedCli *cli, char *args, void *context);
void cli_write_char(EmbeddedCli *cli, char c)
{
static void cli_write_char(EmbeddedCli *cli, char c) {
(void) cli;
putchar((int) c);
}
void cli_cmd_unknown(EmbeddedCli *cli, CliCommand *command)
{
(void) cli;
printf("%s: command not found\r\n", command->name);
}
bool cli_init(void)
{
EmbeddedCliConfig *config = embeddedCliDefaultConfig();

View File

@@ -0,0 +1,35 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2025 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.
*/
#ifndef MSC_APP_H
#define MSC_APP_H
#include <stdbool.h>
bool msc_app_init(void);
void msc_app_task(void);
#endif