Skip to content

Commit

Permalink
update t3
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingcys committed Oct 21, 2024
1 parent a3e3c8a commit c44416a
Show file tree
Hide file tree
Showing 1,030 changed files with 251,361 additions and 1,815 deletions.
13 changes: 13 additions & 0 deletions build_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ for i in `find ${APP_OBJ_PATH}/$APP_BIN_NAME/src -type d`; do
done
fi

TOP_DIR=$(pwd)
if [ -f ${TOP_DIR}/.app ]; then
OLD_APP_BIN_NAME=$(cat ${TOP_DIR}/.app)
echo OLD_APP_BIN_NAME: ${OLD_APP_BIN_NAME}
fi

echo ${APP_BIN_NAME} > ${TOP_DIR}/.app
if [ "$OLD_APP_BIN_NAME" != "$APP_BIN_NAME" ]; then
make clean -C ./t3_os/armino/
rm -rf ./t3_os/tuya_build
echo "AUTO CLEAN SUCCESS"
fi

if [ x$USER_CMD = "xclean" ];then
make clean -C ./t3_os/armino/
rm -rf ./t3_os/tuya_build
Expand Down
18 changes: 0 additions & 18 deletions t3_os/armino/components/at_server/at_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,24 +645,6 @@ static void atsvr_rx_wakeup(int gpio_id)
}
}

static uint32_t uart_id_to_pm_uart_id(uint32_t uart_id)
{
switch (uart_id)
{
case UART_ID_0:
return PM_DEV_ID_UART1;

case UART_ID_1:
return PM_DEV_ID_UART2;

case UART_ID_2:
return PM_DEV_ID_UART3;

default:
return PM_DEV_ID_UART1;
}
}

static void atsvr_task_init(void)
{
//u16 i;
Expand Down
2 changes: 1 addition & 1 deletion t3_os/armino/components/bk_cli/cli_fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ uint32 data_comp[] = {
0xffb00000, 0xff7a0000, 0xff4a0000, 0xff250000, 0xff0c0000, 0xff000000, 0xff03ffff, 0xff13ffff,
} ;

extern void delay(int num);//TODO fix me
extern void bk_delay(int num);//TODO fix me

static void cli_fft_help(void)
{
Expand Down
2 changes: 1 addition & 1 deletion t3_os/armino/components/bk_cli/cli_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <driver/aud_dac.h>
#endif

//extern void delay(int num);//TODO fix me
//extern void bk_delay(int num);//TODO fix me
static RingBufferContext *ch1_tx_rb;
static RingBufferContext *ch1_rx_rb;
static RingBufferContext *ch2_tx_rb;
Expand Down
44 changes: 44 additions & 0 deletions t3_os/armino/components/bk_cli/cli_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#if CONFIG_PWM

static void pwm_self_test(pwm_chan_t chan);

static void cli_pwm_help(void)
{
CLI_LOGI("pwm_driver init\n");
Expand Down Expand Up @@ -113,6 +115,8 @@ static void cli_pwm_cmd(char *pcWriteBuffer, int xWriteBufferLen, int argc, char
BK_LOG_ON_ERR(bk_pwm_set_period_duty(chan, &config));
CLI_LOGI("pwm duty, chan=%d period=%x t1=%x t2=%x t3=%x\n", chan, config.period_cycle,
config.duty_cycle, config.duty2_cycle, config.duty3_cycle);
} else if (os_strcmp(argv[2], "selftest") == 0) {
pwm_self_test(chan);
} else {
cli_pwm_help();
return;
Expand Down Expand Up @@ -369,6 +373,46 @@ static void cli_pwm_idle_test_cmd(char *pcWriteBuffer, int xWriteBufferLen, int
}
}

typedef struct {
uint32_t freq_hz;
float duty_ratio;
} pwm_test_param_t;

static pwm_test_param_t test_param[] = {
{20000, 1.0f},
{20000, 0.1f},
{20000, 0.01f},
{20000, 0.0f},
{10000, 0.5f},
{1000, 0.25f},
};

static void pwm_self_test(pwm_chan_t chan)
{
pwm_init_config_t init_config = {0};
pwm_period_duty_config_t duty_config = {0};

for (uint32_t i = 0; i < sizeof(test_param)/sizeof(test_param[0]); i++) {
os_memset(&init_config, 0, sizeof(init_config));
os_memset(&duty_config, 0, sizeof(duty_config));

init_config.period_cycle = 26000000 / test_param[i].freq_hz;
init_config.duty_cycle = init_config.period_cycle * test_param[i].duty_ratio;

BK_LOG_ON_ERR(bk_pwm_init(chan, &init_config));
BK_LOG_ON_ERR(bk_pwm_start(chan));

duty_config.period_cycle = 26000000 / test_param[i].freq_hz;
duty_config.duty_cycle = init_config.period_cycle * test_param[i].duty_ratio;
BK_LOG_ON_ERR(bk_pwm_set_period_duty(chan, &duty_config));

rtos_delay_milliseconds(1000);

BK_LOG_ON_ERR(bk_pwm_stop(chan));
BK_LOG_ON_ERR(bk_pwm_deinit(chan));
}
}

#define PWM_CMD_CNT (sizeof(s_pwm_commands) / sizeof(struct cli_command))
static const struct cli_command s_pwm_commands[] = {
{"pwm_driver", "{init|deinit}}", cli_pwm_driver_cmd},
Expand Down
8 changes: 4 additions & 4 deletions t3_os/armino/components/bk_cli/cli_scr.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef struct {
uint8_t len;
} scr_data_t;

extern void delay(int num);
extern void bk_delay(int num);

static gpio_scr_map_group_t g_scr_chan = 0;

Expand All @@ -52,9 +52,9 @@ static void scr_fast_active(void)
bk_scr_gpio_config(g_scr_chan, BK_SCR_GPIO_PAUSE);

sys_hal_module_power_ctrl(POWER_MODULE_NAME_AHBP, POWER_MODULE_STATE_OFF);
delay(5000);
bk_delay(5000);
sys_hal_module_power_ctrl(POWER_MODULE_NAME_AHBP, POWER_MODULE_STATE_ON);
delay(1000);
bk_delay(1000);

bk_scr_soft_reset();

Expand All @@ -74,7 +74,7 @@ static void scr_fast_active(void)
bk_scr_set_control(BK_SCR_CTRL_ATR_START_FLUSH_FIFO, 1);
bk_scr_set_control(BK_SCR_CTRL_GLOBAL_INTR_EN, 1);

delay(1000);
bk_delay(1000);

bk_scr_set_control(BK_SCR_CTRL_VCC, 1);
bk_scr_set_control(BK_SCR_CTRL_ACT_FAST, 1);
Expand Down
11 changes: 11 additions & 0 deletions t3_os/armino/components/bk_cli/cli_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,14 @@ static void cli_spi_flash_cmd(char *pcWriteBuffer, int xWriteBufferLen, int argc
return;
}

#if CONFIG_SPI_ETH
static void cli_spi_eth_cmd(char *pcWriteBuffer, int xWriteBufferLen, int argc, char **argv)
{
extern void spi_eth_status_dump(void);
spi_eth_status_dump();
}
#endif /* CONFIG_SPI_ETH */

#define SPI_CMD_CNT (sizeof(s_spi_commands) / sizeof(struct cli_command))
static const struct cli_command s_spi_commands[] = {
{"spi_driver", "spi_driver {init|deinit}", cli_spi_driver_cmd},
Expand All @@ -759,6 +767,9 @@ static const struct cli_command s_spi_commands[] = {
{"spi_int", "spi_int {id} {reg} {tx|rx}", cli_spi_int_cmd},
{"spi_data_test", "spi_data_test {id} {master|slave} {baud_rate|send}[...]", cli_spi_data_txrx_test_cmd},
{"spi_flash", "spi_flash {id} {readid|read|write|erase} {addr} {len}[...]", cli_spi_flash_cmd},
#if CONFIG_SPI_ETH
{"spi_eth_dump", "spi_eth_dump {dump}", cli_spi_eth_cmd},
#endif /* CONFIG_SPI_ETH */
};

int cli_spi_init(void)
Expand Down
Loading

0 comments on commit c44416a

Please sign in to comment.