Skip to content

ktemkin-archive/JD-sample-libraries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JD-sample-libraries

Dirt-simple sample libraries for EECE 387. These libraries are intended to be minimalist samples-- they don't take advantage of more complex hardware features such as interrupt synchronization.

Libraries

Example

A simple TWI interface using Bus Pirate-like syntax, and stdio over serial. (Compatible with Arduino boards!)

#include "uart/stdio.h"
#include "twi/master.h"

int main() {

  uint8_t reading_low, reading_high;

  //Set up an I2c communication at 100kHz.
  set_up_twi_hardware(100000);

  //And take repeated light sensor readings.
  while(1) {
    perform_bus_pirate_twi_command("[ 0x72 0xAC [ 0x73 r s ]", &reading_low, &reading_high);
    printf("Sensor reading: %d\n", (reading_high << 8) | reading_low);
    _delay_ms(100);
  }
  
}

Samples

For more detailed examples, see the top-level code files. Annotated source:

About

Dirt-simple sample libraries for EECE 387. These libraries are intended to be minimalist samples-- they don't take advantage of more complex hardware features such as interrupt synchronization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors