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.
Dependents: mbed_AM2320 Fungi Fungi Nucleo_SSD1306_DS1302_ESP8266_AM2320_BME280 ... more
Revision 1:766868b34d56, committed 2015-07-10
- Comitter:
- yasuyuki
- Date:
- Fri Jul 10 14:56:41 2015 +0000
- Parent:
- 0:2cb35c995095
- Commit message:
- minus
Changed in this revision
diff -r 2cb35c995095 -r 766868b34d56 AM2320.cpp
--- a/AM2320.cpp Sat Mar 14 17:21:25 2015 +0000
+++ b/AM2320.cpp Fri Jul 10 14:56:41 2015 +0000
@@ -37,7 +37,7 @@
}
-int AM2320::humidity()
+unsigned short AM2320::humidity()
{
// get hum
@@ -48,14 +48,19 @@
}
-int AM2320::temperature()
+signed short AM2320::temperature()
{
// get temp
get();
temp.byte.HB=buf[4];
temp.byte.LB=buf[5];
- return temp.Val;
+ if(temp.Val&0x8000){
+ temp.Val&=0x7FFF;
+ temp.Val=0xFFFF-temp.Val+1;
+ }
+ return temp.S;
}
+
diff -r 2cb35c995095 -r 766868b34d56 AM2320.h
--- a/AM2320.h Sat Mar 14 17:21:25 2015 +0000
+++ b/AM2320.h Fri Jul 10 14:56:41 2015 +0000
@@ -22,8 +22,8 @@
AM2320 (I2C& p_i2c);
void get();
- int humidity();
- int temperature();
+ unsigned short humidity();
+ signed short temperature();
protected:
@@ -38,3 +38,4 @@
#endif /* AM2320_H_ */
+
diff -r 2cb35c995095 -r 766868b34d56 typedef.h
--- a/typedef.h Sat Mar 14 17:21:25 2015 +0000
+++ b/typedef.h Fri Jul 10 14:56:41 2015 +0000
@@ -19,6 +19,7 @@
{
WORD Val;
BYTE v[2];
+ signed short S;
struct
{
BYTE LB;