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.
Fork of TRP105F_Spline by
Diff: TRP105FS_SPIWrapper.cpp
- Revision:
- 23:772a9736ee59
- Parent:
- 22:eaaaa42a0ccb
- Child:
- 24:4e12e2fd088f
- Child:
- 25:1dba430435cf
--- a/TRP105FS_SPIWrapper.cpp Thu Jun 30 17:41:14 2016 +0000
+++ b/TRP105FS_SPIWrapper.cpp Thu Sep 01 09:37:34 2016 +0000
@@ -4,10 +4,10 @@
// Make instance of static member
//
SPI
-SPI_TRP105FS::spi(p5, p6, p7); // mosi(out), miso(in), sclk(clock)
+SPI_TRP105FS::spi(p5,p6,p7); // mosi(out), miso(in), sclk(clock)
DigitalOut
-SPI_TRP105FS::cs(p8); // cs (the chip select signal)
+SPI_TRP105FS::cs(p9); // cs (the chip select signal)
//
// For SPI, Define static method
@@ -15,14 +15,13 @@
int
SPI_TRP105FS::ADread(int channel)
{
- int command_high=0x06|((channel&0x04)>>2);
- int command_low=(channel&0x03)<<14;
- __disable_irq(); // 割り込み禁止
- cs = 0;
- spi.write(command_high);
- int resultbyte=spi.write(command_low) & 0xfff;
- cs = 1;
- __enable_irq(); // 割り込み許可
+
+ int command = (13|(ch<<1))<<11;
+ __disable_irq(); // 割り込み禁止
+ cs=0;
+ int resultbyte=spi.write(command) & 0x3ff;
+ cs=1;
+ __enable_irq(); // 割り込み許可
return(resultbyte);
}
@@ -101,7 +100,7 @@
{
char lfilename[13];
- sprintf(lfilename, "ADLOG%2d.TXT", channel);
+ sprintf(lfilename, "ADLOG%02d.TXT", channel);
trp.printOutData(lfilename);
}
#endif
\ No newline at end of file
