Code for the project of LELEC2811 2017
Dependencies: FreescaleIAP MMA8491Q_PG mbed
Fork of LELEC_2811_Accelerometer by
Diff: main.cpp
- Revision:
- 2:f146ae6546b5
- Parent:
- 1:1406d318a3b7
- Child:
- 3:d03eae745223
--- a/main.cpp Wed Nov 23 15:52:48 2016 +0000 +++ b/main.cpp Mon Nov 27 15:14:24 2017 +0000 @@ -1,9 +1,7 @@ -/* LELEC_2811 Accelerometer Project - UCL 2014 - P. Gérard -*/ +/* LELEC 2811 - BadmintonLogger - Group G */ #include "mbed.h" #include "FreescaleIAP.h" // Library for Flash Access -#include "MMA8491Q_PG.h" // Accelerometer +#include "MMA8491Q_PG.h" // Accelerometer #define MMA8491_I2C_ADDRESS (0x55<<1) @@ -31,7 +29,7 @@ #define SECTOR_SIZE 1024 #define RESERVED_SECTOR 32 -#define ACQ_TIMER_PERIOD 0.01 // Time between 2 acquisitions (here 10 mSec) +#define ACQ_TIMER_PERIOD 0.01 // Time between 2 acquisitions (here 10 mSec) typedef struct{ int16_t X; @@ -43,22 +41,21 @@ MMA8491Q my8491(PTE0, PTE1, MMA8491_I2C_ADDRESS); // --- Set Serial Port -Serial Host_Comm(USBTX, USBRX); // tx, rxSerial pc(USBTX, USBRX); // tx, rx +Serial Host_Comm(USBTX, USBRX); // tx, rxSerial pc(USBTX, USBRX); // tx, rx -Ticker myTick_Acq; // Periodical timer for Acquisition +Ticker myTick_Acq; // Periodical timer for Acquisition -DigitalOut Led_Red(LED1); // Define I/O for Leds +DigitalOut Led_Red(LED1); // Define I/O for Leds DigitalOut Led_Green(LED2); DigitalOut Led_Blue(LED3); DigitalOut Accel_Enable(PTA13); -DigitalOut Start_Pulse_Out(PTC9); // Used to enter/exit Acquisition mode -DigitalIn Start_Pulse_In(PTC11); // ShortPin J1_15 and J1_16 to enter in Acq_Mode - +DigitalOut Start_Pulse_Out(PTC9); // Used to enter/exit Acquisition mode +DigitalIn Start_Pulse_In(PTC11); // ShortPin J1_15 and J1_16 to enter in Acq_Mode // Globale variable -volatile bool bTimer; // 1 means a Timer tick is done +volatile bool bTimer; // 1 means a Timer tick is done int Flash_Base_Address = RESERVED_SECTOR * SECTOR_SIZE ; // Store Flash Base Adresse with 32K reserved for Application Code int Nb_Sector; @@ -83,7 +80,7 @@ Start_Pulse_In.mode(PullNone); // Input Pin is programmed as floating Accel_Enable = DISABLE_STATE; // Turn Accel Enable to disabled state -// --- Baud rate setting + // --- Baud rate setting Host_Comm.baud(115200); Clear_Led(); @@ -93,7 +90,7 @@ myTick_Acq.attach(&myTimer_Acq_Task, ACQ_TIMER_PERIOD); - Host_Comm.printf("\n\rLELEC2811 Accelerometer Logger V1.0 UCL 2014\n\r"); + Host_Comm.printf("\n\rLELEC2811 Badminton Logger V1.0 Nov2017 Group G\n\r"); for (;;) { @@ -393,4 +390,3 @@ { bTimer = 1; } -