Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MMA8451Q mbed tsi_sensor
Fork of UTCSBootcamp by
KnockBaseAPI.h
00001 #ifndef KNOCK_BASE_API_046o73i4277823 00002 #define KNOCK_BASE_API_046o73i4277823 00003 00004 #include <stdarg.h> 00005 #include <MMA8451Q.h> // accelerometer 00006 #include "tsi_sensor.h" 00007 00008 Serial port(USBTX,USBRX); 00009 00010 #define MMA8451_I2C_ADDRESS (0x1d<<1) 00011 00012 //http://mbed.org/users/wd5gnr/code/frdm_tsi_slider_led_blend/rev/ (tsi example) 00013 MMA8451Q accelerometer(PTE25,PTE24, MMA8451_I2C_ADDRESS); 00014 00015 float turnOffset = 0.0;// the turn turnOffset 00016 float crashSensitivity = 0.5; // crash sensitivity 00017 float stopSensitivity = 0.2; // stop sensitivity 00018 bool debug = false; 00019 00020 DigitalOut bl(LED1); 00021 DigitalOut gl(LED2); 00022 DigitalOut rl(LED3); 00023 00024 void utrace(const char* msg, ...){ 00025 char buffer[256]; 00026 va_list args; 00027 va_start (args, msg); 00028 vsprintf (buffer,msg, args); 00029 va_end (args); 00030 port.printf(buffer); 00031 } 00032 00033 void flushSerialBuffer(void) { while (port.readable()) { port.getc(); } return; } 00034 00035 void _initialize(){ 00036 if(debug) utrace("initialize()\r\n"); 00037 /// set leds 00038 rl.write(1); 00039 gl.write(1); 00040 bl.write(1); 00041 // Initialize Baud Rate for PC Console 00042 // pc.baud(38400); 00043 } 00044 00045 void _finish(){ 00046 if(debug) utrace("finish()\r\n"); 00047 } 00048 00049 00050 #endif
Generated on Tue Jul 12 2022 20:26:16 by
1.7.2
