Giter Club home page Giter Club logo

stm32_12864_test's Introduction

STM32_12864_Test

特点 | Features

1,能驱动SSD1306控制下的 OLED 12864。

2,实现了ARM环境中的std重定向,具体实现方法见docs。

3,使用 STM32CubeMx + VScode + Makefile + arm-none-eabi-gcc,完全免费的生态链!

##注意 | Patient

如果你使用STM32CubeMx并且想重定向std,请修改软件自动生成的Makefile,具体操作为

1,CFLAGS参数后添加 --specs=nano.specs -u _printf_float

2,LIBS后的参数至少要有 -lc -lm -lnosys -lgcc -lrdimon

3,重定向函数与某些工具链中的函数如fputc()等不同,应该为 (以UART为例,仅初始化printf)

caddr_t _sbrk ( int incr ) {

static unsigned char *heap = NULL;

unsigned char *prev_heap;

if (heap == NULL) {

heap = (unsigned char *)&_end;

}

prev_heap = heap;

heap += incr;

return (caddr_t) prev_heap;

}

int link(char *old, char *new) {

return -1; }

int _close(int file) {

return -1; }

int _fstat(int file, struct stat *st) {

st->st_mode = S_IFCHR;

return 0;

}

int _isatty(int file) {

return 1; }

int _lseek(int file, int ptr, int dir) {

return 0; }

int _read(int file, char *ptr, int len) {

return 0; }

void abort(void) { /* Abort called */

while(1);

}

int _write(int file, char *ptr, int len) { HAL_UART_Transmit(&std_uart,(uint8_t *)ptr,len,UART_Defult_Wait_Time);

while(HAL_UART_GetState(&std_uart) != HAL_UART_STATE_READY);

return len;

}

stm32_12864_test's People

Contributors

jasonlrh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.