Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/ecos-init_project
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ echo_available_templates() {
echo "| rng | | | | √ |"
echo "| rtc | | | | √ |"
echo "| smoke_test | | | | √ |"
echo "| spi_st7735 | √* | | | √ |"
echo "| spi_st7735 | √* | | | √ |"
echo "| spi_st7735_clock | √* | | | √ |"
echo "| spi_st7735_donut | √ | | | √ |"
echo "| spi_st7735_donut | √ | | | √ |"
echo "| st7789 | | √ | | √ |"
echo "| timer | | | | √ |"
echo "| wdg | | | | √ |"
Expand Down
4 changes: 2 additions & 2 deletions templates/filesystem_test/c2/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "main.h"
#include "init.h"
#include "ffinit.h"


void main(void){
Expand All @@ -13,4 +13,4 @@ void main(void){
while(1){
// printf("ENDING\n");
}
}
}
14 changes: 11 additions & 3 deletions templates/i2c_scan/c2/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#include "main.h"
#include "board.h"


// I2C状态寄存器位定义
#define I2C_STATUS_RXACK ((uint8_t)0x80) // (1 << 7)
#define I2C_STATUS_BUSY ((uint8_t)0x40) // (1 << 6)
#define I2C_STATUS_TIP ((uint8_t)0x02) // (1 << 1)
#define I2C_START_WRITE ((uint8_t)0x90)
#define I2C_STOP ((uint8_t)0x40)

static bool i2c_probe_device_quiet(uint8_t addr) {
// 保存原来的stdout,临时重定向以抑制错误输出
// 由于这是嵌入式环境,我们直接通过寄存器操作来检测ACK
Expand Down Expand Up @@ -127,14 +135,14 @@ void i2c_print_scan_result(uint8_t start_addr, uint8_t end_addr) {

void main(void){

sys_uart_init();
hal_sys_uart_init();
printf("Hello, World!\n");

// 初始化I2C
i2c_config_t i2c_config = {
hal_i2c_config_t i2c_config = {
.pscr = 99,
};
i2c_init(&i2c_config);
hal_i2c_init(HAL_I2C_PORT_0,&i2c_config);

// 执行I2C设备扫描
printf("\n=== I2C Device Scanner ===\n");
Expand Down
7 changes: 4 additions & 3 deletions templates/i2c_scan/c2/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
// Components headers
// #include "timer.h"
// #include "qspi.h"
#include "gpio.h"
//#include "gpio.h"
// #include "pwm.h"
// #include "hp_uart.h"
#include "i2c.h"
#include "hal_i2c.h"
#include "hal_sys_uart.h"

// Device headers
// #include "st7735.h"
// #include "sgp30.h"

#define PSRAM_SCKL_FREQ_MHZ (CONFIG_CPU_FREQ_MHZ / CONFIG_PSRAM_NUM)
#define PSRAM_SCKL_FREQ_MHZ (CONFIG_CPU_FREQ_MHZ / CONFIG_PSRAM_NUM)
2 changes: 1 addition & 1 deletion templates/minesweeper/c2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ typedef enum state_t {NEW_GAME, IN_GAME, GAME_OVER} state_t;
#define MAX_BLOCKS 128u

int main(void) {
sys_uart_init();
hal_sys_uart_init();
state_t state = GAME_OVER;
state_t next_state;
// user input
Expand Down
14 changes: 7 additions & 7 deletions templates/minesweeper/c2/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
#include "generated/autoconf.h"

// Components headers
#include "timer.h"
#include "qspi.h"
#include "gpio.h"
#include "pwm.h"
#include "hp_uart.h"
#include "i2c.h"
#include "hal_timer.h"
#include "hal_qspi.h"
#include "hal_gpio.h"
#include "hal_pwm.h"
#include "hal_hp_uart.h"
#include "hal_i2c.h"

// Device headers
#include "st7735.h"
#include "sgp30.h"

#define PSRAM_SCKL_FREQ_MHZ (CONFIG_CPU_FREQ_MHZ / CONFIG_PSRAM_NUM)
#define PSRAM_SCKL_FREQ_MHZ (CONFIG_CPU_FREQ_MHZ / CONFIG_PSRAM_NUM)
17 changes: 11 additions & 6 deletions templates/st7789/c2/main.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#include "main.h"

void main(void){
sys_uart_init();
hal_sys_uart_init();
printf("ST7789 LCD TEST!\n");

qspi_config_t qspi_config = {

hal_qspi_config_t qspi_config = {
.clkdiv = 1,
};
qspi_init(&qspi_config);
hal_qspi_init(HAL_QSPI_PORT_0, &qspi_config);

st7789_device_t st7789 = {
.dc_pin = GPIO_NUM_0,
.rst_pin = GPIO_NUM_1,
.dc_gpio_port = 0,
.dc_gpio_pin = GPIO_NUM_0,
.rst_gpio_port = 0,
.rst_gpio_pin = GPIO_NUM_1,
.qspi_port = HAL_QSPI_PORT_0,
.qspi_cs = HAL_QSPI_CS_0,
.screen_width = 240,
.screen_height = 240,
.rotation = 2,
Expand All @@ -22,4 +27,4 @@ void main(void){
st7789_fill(&st7789, 0, 0, 240, 240, 0xFFFFFFFF);
st7789_fill(&st7789, 0, 0, 240, 240, 0x00000000);
st7789_fill(&st7789, 0, 0, 240, 240, 0xAAAAAAAA);
}
}
14 changes: 7 additions & 7 deletions templates/st7789/c2/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
#include "generated/autoconf.h"

// Components headers
#include "timer.h"
#include "qspi.h"
#include "gpio.h"
#include "pwm.h"
#include "hp_uart.h"
#include "i2c.h"
#include "hal_timer.h"
#include "hal_qspi.h"
#include "hal_gpio.h"
#include "hal_pwm.h"
#include "hal_hp_uart.h"
#include "hal_i2c.h"

// Device headers
#include "st7735.h"
#include "sgp30.h"
#include "st7789.h"

#define PSRAM_SCKL_FREQ_MHZ (CONFIG_CPU_FREQ_MHZ / CONFIG_PSRAM_NUM)
#define PSRAM_SCKL_FREQ_MHZ (CONFIG_CPU_FREQ_MHZ / CONFIG_PSRAM_NUM)