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: SDFileSystem mbed-rtos mbed
Fork of CDMS_BAE by
Diff: rtsc.cpp
- Revision:
- 4:374c51671a69
- Parent:
- 3:6cde88f8c50f
- Child:
- 5:3979ca24777a
--- a/rtsc.cpp Mon Dec 22 10:10:38 2014 +0000
+++ b/rtsc.cpp Mon Dec 22 14:33:30 2014 +0000
@@ -2,6 +2,8 @@
SPI spi(PTD6, PTD7, PTD5);
DigitalOut cs(PTD2);
+SDFileSystem sd(PTD6, PTD7, PTD5, D10,"sd");
+
void spiwrite(int a)
{
cs=1;
@@ -34,7 +36,7 @@
char mi[3]=getstr(minutes);
char s[3]=getstr(seconds);*/
char time[15];
- sprintf(time,"%2d%2d%2d%2d%2d%2d%2d",year1,month1,date1,day1,hours1,minutes1,seconds1);
+ sprintf(time,"%02d%02d%02d%02d%02d%02d%02d",year1,month1,date1,day1,hours1,minutes1,seconds1);
return(time);
}
@@ -69,5 +71,39 @@
wait(1);
printf("Seconds register = %2X : %2X : %2X : %2X : %2X : %2X : %2X \n\r",year,month,date,day, hours,minutes,seconds);
printf("b4 returning tmpstmp is : %s\n",getname(year,month,date,day,hours,minutes,seconds));
+ printf("Hello World!\n");
+ SensorData Sensor;
+
+ printf("Writing dummy values\n");
+ strcpy( Sensor.Voltage, "49");
+ strcpy( Sensor.Current, "83");
+ strcpy( Sensor.Temperature, "53");
+ strcpy( Sensor.PanelTemperature, "43");
+ Sensor.Vcell_soc='9';
+ Sensor.alerts= '4';
+ Sensor.crate='7';
+ Sensor.BatteryTemperature='6';
+ Sensor.faultpoll='4';
+ Sensor.faultir='g';
+ Sensor.power_mode='k';
+ strcpy( Sensor.AngularSpeed, "49");
+ strcpy(Sensor.Bnewvalue,"76");
+ SensorData* Sensor1= &Sensor;
+ printf("Done writing dummy values\n");
+ mkdir("/sd/hk", 0777);
+ char date2[100]="/sd/hk/";
+ strcat(date2,getname(year,month,date,day,hours,minutes,seconds));
+ strcat(date2,".txt");
+ FILE *fp ;
+ fp= fopen(date2, "w");
+ if(fp == NULL) {
+ error("Could not open file for write\n");
}
- }
\ No newline at end of file
+ else
+ {
+ fwrite(Sensor1, sizeof(*Sensor1), 1, fp);
+ fclose(fp);
+ printf("Mission Accomplished\n");
+ printf("Goodbye World!\n");
+ }
+ }}
\ No newline at end of file
