Wiznet makers

Acorn_

Published January 02, 2024 ©

15 UCC

5 WCC

0 VAR

0 Contests

0 Followers

0 Following

Original Link

stm32h7-w5300-dac

Interfacing with a W5300 for network capabilities and a DAC for audio functionalities

COMPONENTS Hardware components

WIZnet - W5300

x 1


PROJECT DESCRIPTION

Summary

아래의 요약은 ChatGPT의 AskTheCode플러그인을 사용하여 Git저장소를 분석하여 요약한 내용을 재가공한 내용입니다. 

This project is a firmware project for the STM32H7 microcontroller and includes network functions using W5300 and audio functions using DAC. The project structure is extensive, including core firmware, drivers, middleware, USB device configuration, and application-specific code. It is mainly organized under the "firmware" directory, with subdirectories for the STM32Cube framework, hardware abstraction layers, various drivers, etc. It also includes libraries for DSP functions, file system, and Wiznet W5300 Internet offload chip.

 

Contents

ap.cpp

#include "ap.h"
#include "wiznet/wiznet.h"
#include "cmd/cmd_thread.h"
#include "osd/osd_thread.h"
#include "audio/usb_audio.h"


static void lcdUpdate(void);




void apInit(void)
{
  cliOpen(HW_UART_CH_CLI, 115200);
  logBoot(false);

  cmdThreadInit();
  osdThreadInit();
  usbAudioInit();
}

void apMain(void)
{
  uint32_t pre_time;
  uint8_t rot_i = 0;
  uint8_t rot_mode_tbl[2] = {4, 3};
  uint8_t cli_ch;


  pre_time = millis();
  while(1)
  {
    if (millis()-pre_time >= 500)
    {
      pre_time = millis();
      ledToggle(_DEF_LED1);
      ledToggle(_DEF_LED2);
    }    

    if (buttonGetPressed(_DEF_BUTTON3))
    {
      rot_i = (rot_i + 1) % 2;
      lcdSetRotation(rot_mode_tbl[rot_i]);
      lcdLogoOn();
      delay(50);
      while(buttonGetPressed(_DEF_BUTTON3));
    }
    

    if (usbIsOpen() && usbGetType() == USB_CON_CLI)
    {
      cli_ch = HW_UART_CH_USB;
    }
    else
    {
      cli_ch = HW_UART_CH_SWD;
    }
    if (cli_ch != cliGetPort())
    {
      cliOpen(cli_ch, 0);
    }


    cliMain();

    sdUpdate();
    cmdThreadUpdate();
    osdThreadUpdate();
    usbAudioUpdate();
    lcdUpdate();
  }
}

#include <time.h>

void lcdUpdate(void)
{
  static uint32_t pre_time = 0;
  bool is_busy = false;


  is_busy |= cmdAudioIsBusy();
  is_busy |= cmdBootIsBusy();
  is_busy |= usbAudioIsBusy();

  if (is_busy)
  {
    return;
  }

  if (lcdDrawAvailable() && millis()-pre_time >= 100)
  {
    pre_time = millis();

    lcdClearBuffer(black);  

    lcdLogoDraw(-1, -1);

    lcdRequestDraw();
  }
}
Documents
Comments Write