Close

C Programming HOWTO Reference

A project log for 2018 Hackaday Superconference Badge

Based on the Hackaday Conference in Belgrade, this badge will be a stand-alone, battery powered vintage computer packed with features

mike-szczysMike Szczys 10/16/2018 at 16:190 Comments

This section is a concise reference guide for Superconference hackers short on time. It will continue growing through Supercon weekend to be a programming FAQ as needed.

HOWTO: Get an overview of badge code

HOWTO: Free up memory to make room for big projects.

HOWTO: Upload new badge firmware faster.

HOWTO: Manage memory at runtime.

HOWTO: Draw a bitmap to screen.

  1. tft_set_write_area(x,y,width,height); //Set the drawing area
    1. IMPORTANT: Drawing area is INCLUSIVE. This means to draw the entire screen width of 320 pixels, "x" would be zero, and "width" is 319. NOT 320.
  2. TFT_24_7789_Write_Command(0x2C); // Begin bitmap data transfer.
  3. TFT_24_7789_Write_Data3(red, green, blue); // RGB value for one pixel, repeat until drawing area is filled.

Example 1: disp.c: void tft_fill_area() fills an area with a single color.

Example 2: nyancat.c: nyancat() renders animation frame line-by-line.

HOWTO: Stop automatic redraw of text buffer on screen.

HOWTO: Read/write nonvolatile (flash) memory.

HOWTO: Generate sounds which aren't musical notes.

HOWTO: Read keyboard directly.

HOWTO: See under the hood of a BASIC command.

HOWTO: Add a new BASIC command.

HOWTO: I2C

(Added in version 1.21)

HOWTO: PWM

HOWTO: Solve the badge puzzle challenge


The following tasks have no direct support in default firmware. If someone steps up and write a piece of code to do it, please message Roger Cheng to add a link here.

HOWTO: SPI

Discussions