[Armadeus-commitlog] armadeus branch, master, updated. release-3.2-47-g3222c68
Brought to you by:
sszy
|
From: Fabien M <fa...@us...> - 2009-12-14 16:58:52
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 3222c687ac1d8372a978d2d4cf91e988dc07cedd (commit)
via 0e1358eea1a87a348e7cf0b88f7f0430b291cb14 (commit)
via 2410b65dbf88b8e48b766f279c46bdb7e3637153 (commit)
from 9468cdd845770e4a855d21fea674b6bf7e2be1f4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3222c687ac1d8372a978d2d4cf91e988dc07cedd
Merge: 0e1358eea1a87a348e7cf0b88f7f0430b291cb14 9468cdd845770e4a855d21fea674b6bf7e2be1f4
Author: Fabien Marteau <fab...@ar...>
Date: Mon Dec 14 17:58:18 2009 +0100
Merge branch 'master' of ssh://fabm@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 0e1358eea1a87a348e7cf0b88f7f0430b291cb14
Author: Fabien Marteau <fab...@ar...>
Date: Mon Dec 14 09:27:43 2009 +0100
[TOOL] little bug in ad5258 to be fixed
commit 2410b65dbf88b8e48b766f279c46bdb7e3637153
Author: Fabien Marteau <fab...@ar...>
Date: Fri Dec 11 18:51:23 2009 +0100
[TOOL] AsDevice refactoring and bug correction in ad5258
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/as_i2c.h | 7 +--
target/packages/as_devices/cpp/as_ad5258.cpp | 10 ++--
target/packages/as_devices/test_c.h | 67 ++++++++++++++++++++++----
3 files changed, 66 insertions(+), 18 deletions(-)
diff --git a/target/packages/as_devices/c/as_i2c.h b/target/packages/as_devices/c/as_i2c.h
index f0ec945..e6ea0cb 100644
--- a/target/packages/as_devices/c/as_i2c.h
+++ b/target/packages/as_devices/c/as_i2c.h
@@ -18,7 +18,6 @@
*
*/
-
#ifndef AS_I2C_H_
#define AS_I2C_H_
@@ -37,16 +36,14 @@
#ifdef __cplusplus
extern "C" {
-#endif // __cplusplus
+#endif /* __cplusplus */
#include <inttypes.h>
#include <sys/types.h>
-
-/// Number of I2C busses on system
+/* Number of I2C busses on system */
#define AS_I2C_DEV_COUNT 2
-
/** @brief Open an I2C bus.
*
* \e i2c_id is the ID of the I2C bus to open, it should strictly lower than
diff --git a/target/packages/as_devices/cpp/as_ad5258.cpp b/target/packages/as_devices/cpp/as_ad5258.cpp
index 8933075..f8d24b3 100644
--- a/target/packages/as_devices/cpp/as_ad5258.cpp
+++ b/target/packages/as_devices/cpp/as_ad5258.cpp
@@ -60,7 +60,7 @@ AsAd5258::getRdac(void)
void
AsAd5258::setEeprom(int aValue)
{
- mI2c->writeByteData(mI2cAd5258Addr,0x02,aValue);
+ mI2c->writeByteData(mI2cAd5258Addr,0x20,aValue);
}
/*------------------------------------------------------------------------------*/
@@ -71,7 +71,7 @@ int
AsAd5258::getEeprom(void)
{
unsigned char value;
- mI2c->readByteData(mI2cAd5258Addr,0x02,&value);
+ mI2c->readByteData(mI2cAd5258Addr,0x20,&value);
return value;
}
@@ -81,7 +81,8 @@ AsAd5258::getEeprom(void)
void
AsAd5258::store(void)
{
- mI2c->writeByte(mI2cAd5258Addr,0x0c);
+ mI2c->writeByte(mI2cAd5258Addr,0xc0);
+ /* wait for 26ms */
}
/*------------------------------------------------------------------------------*/
@@ -90,7 +91,8 @@ AsAd5258::store(void)
void
AsAd5258::restore(void)
{
- mI2c->writeByte(mI2cAd5258Addr,0x0a);
+ mI2c->writeByte(mI2cAd5258Addr,0xa0);
+ /* wait for 300µs */
}
diff --git a/target/packages/as_devices/test_c.h b/target/packages/as_devices/test_c.h
index e38a14c..9d18f9f 100644
--- a/target/packages/as_devices/test_c.h
+++ b/target/packages/as_devices/test_c.h
@@ -25,6 +25,7 @@
#include "as_apf27_pwm.h"
#include "as_93lcxx.h"
+#include "as_i2c.h"
#define PWM_NUM 0
@@ -35,6 +36,7 @@ void pressEnterToContinue(void)
while( getc(stdin) != '\n') ;
}
+/* pwm test */
void test_pwm(void)
{
int ret;
@@ -130,32 +132,80 @@ void test_pwm(void)
}
}
+/* i2c bus test */
void test_i2c(void)
{
char buffer[20];
+ int value;
+ int initialized = 0;
+
+ int i2c_id = 0;
+ int i2c_bus = -1;
while(buffer[0] != 'q')
{
system("clear");
printf("*********************************\n");
- printf("* Testing i2c menu *\n");
+ printf("* Testing i2c menu *\n");
printf("*********************************\n");
printf("Choose ('q' to quit):\n");
- printf(" 1) read mac address \n");
+ if (initialized == 0)
+ {
+ printf(" 1) Open i2c bus \n");
+ printf(" 2) Change bus number (%d)\n",i2c_id);
+ } else {
+ printf(" 1) Close i2c bus \n");
+ }
printf("> ");
scanf("%s",buffer);
- switch(buffer[0])
+ if (initialized == 0)
{
- case '1' : printf("TODO\n");
- pressEnterToContinue();
- break;
- default : break;
+ switch(buffer[0])
+ {
+ case '1' : printf("Open i2c bus\n");
+ i2c_bus = as_i2c_open( i2c_id);
+ if (i2c_bus < 0)
+ {
+ printf("Error can't open i2c bus\n");
+ } else {
+ printf("Bus %d opened\n", i2c_id);
+ initialized = 1;
+ }
+ pressEnterToContinue();
+ break;
+ case '2' : printf("Give bus number (max %d): ", AS_I2C_DEV_COUNT-1);
+ scanf("%d",&value);
+ if ((value >= AS_I2C_DEV_COUNT) || (value < 0))
+ {
+ printf(" Wrong value\n");
+ } else {
+ i2c_id = value;
+ }
+ pressEnterToContinue();
+ default : break;
+ }
+ } else {
+ switch(buffer[0])
+ {
+ case '1' : printf("Close i2c bus\n");
+ value = as_i2c_close(i2c_bus);
+ if (value < 0)
+ {
+ printf(" Error, can't close i2c bus num %d\n", i2c_id);
+ } else {
+ initialized = 0;
+ }
+ pressEnterToContinue();
+ printf("plop\n");
+ break;
+ default : break;
+ }
}
}
-
}
+/* spi bus test */
void test_spi(void)
{
printf("TODO\n");
@@ -164,7 +214,6 @@ void test_spi(void)
/* 93LCxx eepromm test */
-
int address_size(int aType, int aWordSize)
{
return (((aType-46)/10) + 6 + 2 - (aWordSize/8));
hooks/post-receive
--
armadeus
|