Finished XROOT for complex numbers. Fixed bug in EXP w/infinities.

Updated rtc driver on ui project to match new API on fw.
This commit is contained in:
claudiol 2016-11-02 12:58:13 -04:00
parent a85dd9b5ab
commit c6d54f7c2d
3 changed files with 1432 additions and 90 deletions

View file

@ -11,7 +11,7 @@
#include <time.h>
int rtc_getday()
void rtc_getdatetime(struct date *dt, struct time *tm)
{
time_t now;
struct tm *timest;
@ -19,102 +19,122 @@ int rtc_getday()
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return timest->tm_mday;
if(timest==NULL) return;
if(dt) {
dt->mday=timest->tm_mday;
dt->mon=timest->tm_mon;
dt->wday=timest->tm_wday;
dt->year=timest->tm_year;
}
if(tm) {
tm->hour=timest->tm_hour;
tm->isdst=timest->tm_isdst;
tm->min=timest->tm_min;
tm->sec=timest->tm_sec;
}
return;
}
int rtc_getmon()
int rtc_setdatetime(struct date dt, struct time tm)
{
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return timest->tm_mon+1;
}
int rtc_getyear()
{
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return timest->tm_year+1900;
}
int rtc_getdow()
{
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return (timest->tm_wday==0)? 7:timest->tm_wday;
}
int rtc_getsec()
{
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return timest->tm_sec;
}
int rtc_getmin()
{
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return timest->tm_min;
}
int rtc_gethour()
{
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return timest->tm_hour;
}
int rtc_setdate(int day,int month,int year)
{
UNUSED_ARGUMENT(day);
UNUSED_ARGUMENT(month);
UNUSED_ARGUMENT(year);
// DO NOTHING, DON'T ALLOW TO CHANGE THE RTC ON A PC
UNUSED_ARGUMENT(dt);
UNUSED_ARGUMENT(tm);
// DO NOTHING, DON'T ALLOW TO CHANGE THE RTC ON A PC
return 0;
}
int rtc_settime(int hour,int min,int sec)
struct date rtc_getdate()
{
UNUSED_ARGUMENT(hour);
UNUSED_ARGUMENT(min);
UNUSED_ARGUMENT(sec);
struct date dt={0,0,0,0};
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return dt;
dt.mday=timest->tm_mday;
dt.mon=timest->tm_mon;
dt.wday=timest->tm_wday;
dt.year=timest->tm_year;
return dt;
}
int rtc_setdate(struct date dt)
{
UNUSED_ARGUMENT(dt);
// DO NOTHING, DON'T ALLOW TO CHANGE THE RTC ON A PC
return 0;
}
struct time rtc_gettime()
{
struct time tm={0,0,0,0};
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return tm;
tm.hour=timest->tm_hour;
tm.isdst=timest->tm_isdst;
tm.min=timest->tm_min;
tm.sec=timest->tm_sec;
return tm;
}
int rtc_settime(struct time tm)
{
UNUSED_ARGUMENT(tm);
// DO NOTHING, DON'T ALLOW TO CHANGE THE RTC ON A PC
return 0;
}
void rtc_getalarm(struct date *dt, struct time *tm, int *enabled)
{
UNUSED_ARGUMENT(dt);
UNUSED_ARGUMENT(tm);
if(enabled) *enabled=0;
return;
}
// SET ALARM INTERRUPT
int rtc_setalarm(struct date dt, struct time tm, int enabled)
{
UNUSED_ARGUMENT(dt);
UNUSED_ARGUMENT(tm);
UNUSED_ARGUMENT(enabled);
// DON'T ALLOW ALARMS IN THE SIMULATOR
return 0;
}
void rtc_gettick(int *freq, int *enabled)
{
UNUSED_ARGUMENT(freq);
// CAN'T GET RTC TICKS ON THE SIMULATOR
if(enabled) *enabled=0;
return;
}
// SET PERIODIC INTERRUPT
int rtc_settick(int freq, int enabled)
{
UNUSED_ARGUMENT(freq);
UNUSED_ARGUMENT(enabled);
// CAN'T SET RTC TICKS ON THE SIMULATOR
return 0;
}

File diff suppressed because it is too large Load diff

View file

@ -1761,8 +1761,53 @@ void LIB_HANDLER()
}
return;
}
case CPLX_INF|CPLX_MALFORMED:
case CPLX_INF|CPLX_POLAR:
{
REAL re,im;
BINT angmode;
rplReadCNumber(arg,&re,&im,&angmode);
REAL pi2;
switch(angmode) {
case ANGLEDEG:
case ANGLEDMS:
decconst_90(&pi2);
break;
case ANGLEGRAD:
decconst_100(&pi2);
break;
case ANGLERAD:
default:
decconst_PI_2(&pi2);
}
im.flags&=~F_NEGATIVE;
switch(cmpReal(&im,&pi2))
{
case 1: // ARG(Z)> PI/2
rplOverwriteData(1,(WORDPTR)zero_bint);
return;
case -1:
rplDropData(1);
rplUndInfinityToRReg(0);
rplNewRealFromRRegPush(0);
rplCheckResultAndError(&RReg[0]);
return;
default:
case 0: // ARG(Z)== PI/2
rplDropData(1);
rplNANToRReg(0);
rplNewRealFromRRegPush(0);
rplCheckResultAndError(&RReg[0]);
return;
}
}
case CPLX_INF|CPLX_MALFORMED:
case CPLX_UNDINF:
rplDropData(1);
rplNANToRReg(0);