Permalink
Browse files

Cleanup of demos for dev kits

  • Loading branch information...
1 parent 185df6b commit a496355b4d8aea798dc6eded4b0a83f30d9d3cfc @zacinaction committed Jan 22, 2013
Showing with 163 additions and 1,900 deletions.
  1. +22 −0 DevelopmentKit/Energia/GyroDemo/GyroDemo.ino
  2. +0 −82 DevelopmentKit/Energia/GyroTest/GyroTest.ino
  3. +0 −98 DevelopmentKit/Energia/GyroTest/TI_USCI_I2C.ino
  4. +0 −53 DevelopmentKit/Energia/HMC5883L_Simple/HMC5883L_Simple.ino
  5. +0 −44 DevelopmentKit/Energia/HMC5883L_Test/HMC5883L_Test.ino
  6. +0 −77 DevelopmentKit/Energia/ITG3200_test/ITG3200_test.ino
  7. +34 −0 DevelopmentKit/Energia/MagGyroDemo/MagGyroDemo.ino
  8. +0 −66 DevelopmentKit/Energia/MagTest/MagTest.ino
  9. +0 −98 DevelopmentKit/Energia/MagTest/TI_USCI_I2C.ino
  10. +22 −0 DevelopmentKit/Energia/MagnetometerDemo/MagnetometerDemo.ino
  11. +29 −24 DevelopmentKit/Energia/RFTest/RFTest.ino
  12. 0 DevelopmentKit/Energia/{RFTest64kBits2/RFTest64kBits2.ino → RFTest2/RFTest2.ino}
  13. +0 −78 DevelopmentKit/Energia/RFTest437/RFTest437.ino
  14. +0 −78 DevelopmentKit/Energia/RFTest437PRN_0/RFTest437PRN_0.ino
  15. +0 −78 DevelopmentKit/Energia/RFTest437PRN_1/RFTest437PRN_1.ino
  16. +0 −78 DevelopmentKit/Energia/RFTest437PRN_2/RFTest437PRN_2.ino
  17. +0 −83 DevelopmentKit/Energia/RFTest64kBits/RFTest64kBits.ino
  18. +0 −80 DevelopmentKit/Energia/RFTest64kPRN_1/RFTest64kPRN_1.ino
  19. +0 −78 DevelopmentKit/Energia/RFTest64kPRN_2/RFTest64kPRN_2.ino
  20. +14 −0 DevelopmentKit/Energia/SerialDemo/SerialDemo.ino
  21. +0 −37 DevelopmentKit/Energia/SerialTest/SerialTest.ino
  22. +0 −15 DevelopmentKit/Energia/SerialTest2/SerialTest2.ino
  23. +38 −0 DevelopmentKit/Energia/SouvenirBlink/SouvenirBlink.ino
  24. +2 −24 DevelopmentKit/Energia/SpriteBlink/SpriteBlink.ino
  25. +0 −54 DevelopmentKit/HMC5883Llibrary/HMC5883L.c
  26. +0 −7 DevelopmentKit/HMC5883Llibrary/HMC5883L.h
  27. +0 −53 DevelopmentKit/HMC5883Llibrary/HMC5883L_Config.h
  28. +0 −43 DevelopmentKit/HMC5883Llibrary/main.c
  29. +0 −64 DevelopmentKit/ITG3200Library/ITG3200.c
  30. +0 −8 DevelopmentKit/ITG3200Library/ITG3200.h
  31. +0 −72 DevelopmentKit/ITG3200Library/ITG3200_Config.h
  32. +0 −44 DevelopmentKit/ITG3200Library/main.c
  33. +0 −53 DevelopmentKit/MAG3110Library/MAG3110.c
  34. +0 −10 DevelopmentKit/MAG3110Library/MAG3110.h
  35. +0 −88 DevelopmentKit/MAG3110Library/MAG3110_Config.h
  36. +0 −46 DevelopmentKit/MAG3110Library/main.c
  37. +0 −170 DevelopmentKit/TI_i2c_library/TI_USCI_I2C_master.c
  38. +0 −12 DevelopmentKit/TI_i2c_library/TI_USCI_I2C_master.h
  39. +2 −5 Sprite/EagleCAD/Sprite/Replica.brd
@@ -0,0 +1,22 @@
+#include <SpriteGyro.h>
+
+SpriteGyro gyro = SpriteGyro();
+
+void setup() {
+ gyro.init();
+ Serial.begin(9600);
+}
+
+void loop() {
+
+ AngularVelocity w = gyro.read();
+
+ Serial.print("x: ");
+ Serial.print(w.x);
+ Serial.print(" y:");
+ Serial.print(w.y);
+ Serial.print(" z: ");
+ Serial.println(w.z);
+
+ delay(250);
+}
@@ -1,82 +0,0 @@
-//This is a list of registers in the ITG-3200. Registers are parameters that determine how the sensor will behave, or they can hold data that represent the
-//sensors current status.
-//To learn more about the registers on the ITG-3200, download and read the datasheet.
-char WHO_AM_I = 0x00;
-char SMPLRT_DIV= 0x15;
-char DLPF_FS = 0x16;
-char GYRO_XOUT_H = 0x1D;
-char GYRO_XOUT_L = 0x1E;
-char GYRO_YOUT_H = 0x1F;
-char GYRO_YOUT_L = 0x20;
-char GYRO_ZOUT_H = 0x21;
-char GYRO_ZOUT_L = 0x22;
-
-//This is a list of settings that can be loaded into the registers.
-//DLPF, Full Scale Register Bits
-//FS_SEL must be set to 3 for proper operation
-//Set DLPF_CFG to 3 for 1kHz Fint and 42 Hz Low Pass Filter
-char DLPF_CFG_0 = 1<<0;
-char DLPF_CFG_1 = 1<<1;
-char DLPF_CFG_2 = 1<<2;
-char DLPF_FS_SEL_0 = 1<<3;
-char DLPF_FS_SEL_1 = 1<<4;
-
-//I2C devices each have an address. The address is defined in the datasheet for the device. The ITG-3200 breakout board can have different address depending on how
-//the jumper on top of the board is configured. By default, the jumper is connected to the VDD pin. When the jumper is connected to the VDD pin the I2C address
-//is 0x69.
-char GYRO_ADDRESS = 0x68;
-
-unsigned char sendGyro[2] = {0, 0};
-unsigned char RxBufferGyro[6];
-int gyroX=0, gyroY=0, gyroZ=0;
-
-void setup() {
-
- /* Port Mapping for I2C */
- UCB0CTL1 |= UCSWRST;
- PMAPPWD = 0x02D52; // Get write-access to port mapping regs
- PMAPCTL = PMAPRECFG; // Allow future runtime port mapping
- P2MAP0 = PM_UCB0SCL; // Map SCL input to P2.0
- P2MAP1 = PM_UCB0SDA; // Map SDA output to P2.1
- PMAPPWD = 0; // Lock port mapping registers
- P2SEL |= BIT0 | BIT1; //Set P2.0 and P2.1 to USCI Mode
-
- Serial.begin(9600);
-
- delay(1000);
-
- sendGyro[0] = SMPLRT_DIV;
- sendGyro[1] = 9;
- TI_USCI_I2C_transmitinit(GYRO_ADDRESS,12);
- TI_USCI_I2C_transmit(2,sendGyro);
-
- sendGyro[0] = DLPF_FS;
- sendGyro[1] = DLPF_FS_SEL_0|DLPF_FS_SEL_1|DLPF_CFG_0;
- TI_USCI_I2C_transmitinit(GYRO_ADDRESS,12);
- TI_USCI_I2C_transmit(2,sendGyro);
-
- delay(70);
-}
-
-void loop() {
-
- sendGyro[0] = GYRO_XOUT_H; //point to first gyro data register
- TI_USCI_I2C_transmitinit(GYRO_ADDRESS, 12);
- TI_USCI_I2C_transmit(1, sendGyro);
- TI_USCI_I2C_receiveinit(GYRO_ADDRESS, 12);
- TI_USCI_I2C_receive(6, RxBufferGyro);
-
- gyroX = ((int)RxBufferGyro[0]<<8) + (int)RxBufferGyro[1];
- gyroY = ((int)RxBufferGyro[2]<<8) + (int)RxBufferGyro[3];
- gyroZ = ((int)RxBufferGyro[4]<<8) + (int)RxBufferGyro[5];
-
- Serial.print("X: ");
- Serial.print(gyroX);
- Serial.print(" Y: ");
- Serial.print(gyroY);
- Serial.print(" Z: ");
- Serial.println(gyroZ);
-
- delay(100);
-
-}
@@ -1,98 +0,0 @@
-unsigned char *PTxData; // Pointer to TX data
-unsigned char TXByteCtr;
-
-unsigned char *PRxData; // Pointer to RX data
-unsigned char RXByteCtr;
-
-void TI_USCI_I2C_receiveinit(unsigned char slave_address,
- unsigned char prescale){
- UCB0CTL1 |= UCSWRST; // Enable SW reset
- UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
- UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset THESE TWO NEEDED TO RESET FOR READ
- UCB0BR0 = prescale; // fSCL = SMCLK/12 = ~100kHz
- UCB0BR1 = 0;
- UCB0I2CSA = slave_address; // Slave Address
- UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
- UCB0IE |= UCRXIE; // Enable RX interrupt
-}
-
-void TI_USCI_I2C_transmitinit(unsigned char slave_address,
- unsigned char prescale){
- UCB0CTL1 |= UCSWRST; // Enable SW reset
- UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
- UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
- UCB0BR0 = prescale; // fSCL = SMCLK/12 = ~100kHz
- UCB0BR1 = 0;
- UCB0I2CSA = slave_address; // Slave Address
- UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
- UCB0IE |= UCTXIE; // Enable TX interrupt
-}
-
-void TI_USCI_I2C_receive(unsigned char byte_count, unsigned char *field){
- PRxData = field; // Start of RX buffer
- RXByteCtr = byte_count; // Load RX byte counter
- while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent
- UCB0CTL1 |= UCTXSTT; // I2C start condition
-
- __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
- // Remain in LPM0 until all data
- // is RX'd
- __no_operation(); // Set breakpoint >>here<< and
- // read out the RxBuffer buffer
-}
-
-void TI_USCI_I2C_transmit(unsigned char byte_count, unsigned char *field){
- PTxData = field; // TX array start address
- // Place breakpoint here to see each
- // transmit operation.
- TXByteCtr = byte_count; // Load TX byte counter
-
- UCB0CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition
-
- __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
- __no_operation(); // Remain in LPM0 until all data
- // is TX'd
- while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent
-}
-
-__attribute__((interrupt(USCI_B0_VECTOR)))
-void USCI_B0_ISR(void)
-{
- //switch(__even_in_range(UCB0IV,12))
- switch(UCB0IV)
- {
- case 0: break; // Vector 0: No interrupts
- case 2: break; // Vector 2: ALIFG
- case 4: break; // Vector 4: NACKIFG
- case 6: break; // Vector 6: STTIFG
- case 8: break; // Vector 8: STPIFG
- case 10: // Vector 10: RXIFG
- RXByteCtr--; // Decrement RX byte counter
- if (RXByteCtr)
- {
- *PRxData++ = UCB0RXBUF; // Move RX data to address PRxData
- if (RXByteCtr == 1) // Only one byte left?
- UCB0CTL1 |= UCTXSTP; // Generate I2C stop condition
- }
- else
- {
- *PRxData = UCB0RXBUF; // Move final RX data to PRxData
- __bic_SR_register_on_exit(LPM0_bits); // Exit active CPU
- }
- break;
-
- case 12: // Vector 12: TXIFG
- if (TXByteCtr) // Check TX byte counter
- {
- UCB0TXBUF = *PTxData++; // Load TX buffer
- TXByteCtr--; // Decrement TX byte counter
- }
- else
- {
- UCB0CTL1 |= UCTXSTP; // I2C stop condition
- UCB0IFG &= ~UCTXIFG; // Clear USCI_B0 TX int flag
- __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
- }
- default: break;
- }
-}
@@ -1,53 +0,0 @@
-#include <Wire.h>
-#include <HMC5883L.h>
-
-HMC5883L compass;
-
-void setup() {
-
- /* Port Mapping for I2C */
- UCB0CTL1 |= UCSWRST;
- PMAPPWD = 0x02D52; // Get write-access to port mapping regs
- PMAPCTL = PMAPRECFG; // Allow future runtime port mapping
- P2MAP0 = PM_UCB0SCL; // Map SCL input to P2.0
- P2MAP1 = PM_UCB0SDA; // Map SDA output to P2.1
- PMAPPWD = 0; // Lock port mapping registers
- P2SEL |= BIT0 | BIT1; //Set P2.0 and P2.1 to USCI Mode
-
- Serial.begin(9600);
-
- Wire.begin();
-
- Serial.println("Hi");
- compass = HMC5883L(); //new instance of HMC5883L library
- setupHMC5883L(); //setup the HMC5883L
-}
-
-// Our main program loop.
-void loop(){
-
- float heading = getHeading();
- Serial.println(heading);
- delay(500);
-}
-
-void setupHMC5883L(){
- //Setup the HMC5883L, and check for errors
- int error = 0;
- error = compass.SetScale(1.3); //Set the scale of the compass.
- Serial.println(error);
- error = compass.SetMeasurementMode(Measurement_Continuous); // Set the measurement mode to Continuous
- Serial.println(error);
-}
-
-float getHeading(){
- //Get the reading from the HMC5883L and calculate the heading
- MagnetometerScaled scaled = compass.ReadScaledAxis(); //scaled values from compass.
- float heading = atan2(scaled.YAxis, scaled.XAxis);
-
- // Correct for when signs are reversed.
- if(heading < 0) heading += 2*PI;
- if(heading > 2*PI) heading -= 2*PI;
-
- return heading * RAD_TO_DEG; //radians to degrees
-}
@@ -1,44 +0,0 @@
- /*
- Magnetometer Test
- */
-
-void setup() {
-
- /* Port Mapping for I2C */
- UCB0CTL1 |= UCSWRST;
- PMAPPWD = 0x02D52; // Get write-access to port mapping regs
- PMAPCTL = PMAPRECFG;
- P2MAP0 = PM_UCB0SCL; // Map SCL input to P2.0
- P2MAP1 = PM_UCB0SDA; // Map SDA output to P2.1
- PMAPPWD = 0; // Lock port mapping registers
- P2SEL |= BIT0 | BIT1; //Set P1.1 and P1.2 to USCI Mode
-
- delay(10);
-}
-
-void loop() {
-
- delay(1000);
-}
-
-void txconfig() {
- UCB0CTL1 |= UCSWRST; // Enable SW reset
- UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
- UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
- UCB0BR0 = 80; // fSCL = SMCLK/80 = 100kHz
- UCB0BR1 = 0;
- UCB0I2CSA = 0x1E; // Slave Address
- UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
- UCB0IE |= UCTXIE; // Enable TX interrupt
-}
-
-void rxconfig() {
- UCB0CTL1 |= UCSWRST; // Enable SW reset
- UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
- UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset THESE TWO NEEDED TO RESET FOR READ
- UCB0BR0 = 80; // fSCL = SMCLK/80 = 100kHz
- UCB0BR1 = 0;
- UCB0I2CSA = 0x1E; // Slave Address
- UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
- UCB0IE |= UCRXIE; // Enable RX interrupt
-}
@@ -1,77 +0,0 @@
-// ITG-3200_test
-// Copyright 2010-2011 Filipe Vieira & various contributors.
-// http://code.google.com/p/itg-3200driver
-// Simple test of gyro sensors output using default settings.
-
-#include <Wire.h>
-#include <ITG3200.h>
-
-ITG3200 gyro = ITG3200();
-float x,y,z;
-int ix, iy, iz;
-
-void setup(void) {
-
- /* Port Mapping for I2C */
- UCB0CTL1 |= UCSWRST;
- PMAPPWD = 0x02D52; // Get write-access to port mapping regs
- PMAPCTL = PMAPRECFG; // Allow future runtime port mapping
- P2MAP0 = PM_UCB0SCL; // Map SCL input to P2.0
- P2MAP1 = PM_UCB0SDA; // Map SDA output to P2.1
- PMAPPWD = 0; // Lock port mapping registers
- P2SEL |= BIT0 | BIT1; //Set P1.1 and P1.2 to USCI Mode
-
- Wire.begin(); // if experiencing gyro problems/crashes while reading XYZ values
- // please read class constructor comments for further info.
-
- Serial.begin(9600);
-
- Serial.println("Serial port initialized");
-
- delay(1000);
- // Use ITG3200_ADDR_AD0_HIGH or ITG3200_ADDR_AD0_LOW as the ITG3200 address
- // depending on how AD0 is connected on your breakout board, check its schematics for details
- gyro.init(ITG3200_ADDR_AD0_HIGH);
-
- Serial.print("zeroCalibrating...");
- gyro.zeroCalibrate(2500, 2);
- Serial.println("done.");
-}
-
-void loop(void) {
- while (gyro.isRawDataReady()) {
- /*
- // Reads uncalibrated raw values from the sensor
- gyro.readGyroRaw(&ix,&iy,&iz);
- Serial.print("X1:");
- Serial.print(ix);
- Serial.print(" Y:");
- Serial.print(iy);
- Serial.print(" Z:");
- Serial.println(iz);
- */
-
- /*
- // Reads calibrated raw values from the sensor
- gyro.readGyroRawCal(&ix,&iy,&iz);
- Serial.print("X2:");
- Serial.print(ix);
- Serial.print(" Y:");
- Serial.print(iy);
- Serial.print(" Z:");
- Serial.println(iz);
- */
-
- // Reads calibrated values in deg/sec
- gyro.readGyro(&x,&y,&z);
- Serial.print("X3:");
- Serial.print(x);
- Serial.print(" Y:");
- Serial.print(y);
- Serial.print(" Z:");
- Serial.println(z);
- }
-}
-
-
-
Oops, something went wrong.

0 comments on commit a496355

Please sign in to comment.