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: L3GD20 LIS3DH TextLCD mbed-rtos mbed
Revision 6:f14cce59e7fe, committed 2015-01-10
- Comitter:
- kenjiArai
- Date:
- Sat Jan 10 04:57:33 2015 +0000
- Parent:
- 5:dccdaaa1e57b
- Child:
- 7:3f763de12768
- Commit message:
- more simple but problem is there (delete SPI LCD control)
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mon.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jan 08 13:03:16 2015 +0000
+++ b/main.cpp Sat Jan 10 04:57:33 2015 +0000
@@ -6,7 +6,7 @@
* http://www.page.sannet.ne.jp/kenjia/index.html
* http://mbed.org/users/kenjiArai/
* Created: November 29th, 2014
- * Revised: January 7th, 2015
+ * Revised: January 10th, 2015
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -21,7 +21,6 @@
#include "L3GD20.h"
#include "LIS3DH.h"
#include "TextLCD.h"
-#include "ST7565_SPI_LCD.h"
// Definition ------------------------------------------------------------------------------------
#define USE_COM // use Communication with PC(UART)
@@ -61,7 +60,7 @@
DigitalIn USER_SWITCH[2] = {
#if defined(TARGET_RZ_A1H)
DigitalIn(P6_0), DigitalIn(P6_1)
-#elif defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F401RE)
+#elif defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE)
DigitalIn(PC_13), DigitalIn(A0)
#endif
};
@@ -70,7 +69,7 @@
#if defined(TARGET_RZ_A1H)
DigitalOut task0(P1_8);
DigitalOut task1(P1_9);
-#elif defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F401RE)
+#elif defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE)
DigitalOut task0(A0);
DigitalOut task1(A1);
#endif
@@ -88,9 +87,6 @@
// LCD
TextLCD_I2C_N lcd0(&i2c, 0x7c, TextLCD::LCD16x2); // LCD(Akizuki AQM0802A)
#endif
-// SPI LCD
-SPI spi_lcd(D11, D12, D13); // mosi, miso, sck
-ST7565 lcd1(spi_lcd, D8, D9, D7, ST7565::AQM1248A); // spi,reset,a0,ncs, LCD(Akizuki AQM1248A)
// Mutex
Mutex i2c_mutex;
@@ -188,20 +184,15 @@
void display(void const *args){
uint32_t n = 0;
- lcd1.cls();
while (true) {
#ifdef USE_I2C_LCD
i2c_mutex.lock();
lcd0.locate(0, 0); // 1st line top
- lcd0.printf("G=%7.1f ", sqrt(fa[0]*fa[0] + fa[1]*fa[1] + fa[2]*fa[2]));
+ lcd0.printf(" G=%4.1f ", sqrt(fa[0]*fa[0] + fa[1]*fa[1] + fa[2]*fa[2]));
lcd0.locate(0, 1); // 2nd line top
- lcd0.printf("%8d",n);
+ lcd0.printf("%8d",n++);
i2c_mutex.unlock();
#endif
- lcd1.locate(0,0);
- lcd1.printf("G:%+6.1f,%+6.1f,%+6.1f \r\n", fg[0], fg[1], fg[2]);
- lcd1.printf("A:%+6.1f,%+6.1f,%+6.1f \r\n", fa[0], fa[1], fa[2]);
- lcd1.printf("%d\r\n", n++);
Thread::wait(500);
// debug
task1 = !task1;
@@ -213,7 +204,7 @@
osThreadDef(update_angle, osPriorityNormal, 2048);
osThreadDef(monitor, osPriorityNormal, 2048);
osThreadDef(display, osPriorityAboveNormal, 2048);
-#elif defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F401RE)
+#elif defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE)
osThreadDef(update_angle, osPriorityNormal, 1024);
osThreadDef(monitor, osPriorityNormal, 1024);
osThreadDef(display, osPriorityAboveNormal, 1024);
@@ -254,18 +245,6 @@
if (osThreadCreate(osThread(update_angle), NULL) == NULL){
PRINTF("ERROR1\r\n");
}
-
- // SPI LCD
- spi_lcd.frequency(100000);
- lcd1.cls();
- lcd1.set_contrast(0x2a);
- lcd1.printf("test\r\n" );
- lcd1.printf("Kenji Arai / JH1PJL\r\n" );
- lcd1.printf("ABCDEFG 1234567890\r\n" );
- lcd1.rect(5,30,120,62,1);
- lcd1.circle(5,35,5,1);
- lcd1.fillcircle(60,55,5,1);
- lcd1.line(0,30,127,63,1);
// I2C LCD
#ifdef USE_I2C_LCD
// ---->lock
--- a/mon.cpp Thu Jan 08 13:03:16 2015 +0000
+++ b/mon.cpp Sat Jan 10 04:57:33 2015 +0000
@@ -7,7 +7,7 @@
* Created: May 15th, 2010
* Spareted: June 25th, 2014 mon() & mon_hw()
* Ported: July 12th, 2014 from L152RE
- * Revised: December 14th, 2014
+ * Revised: January 10th, 2015
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -16,7 +16,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-
// Include ---------------------------------------------------------------------------------------
#include "mbed.h"
#include "rtos.h"
@@ -33,7 +32,6 @@
// RAM -------------------------------------------------------------------------------------------
static char linebuf[64];
-static int buf_size = sizeof(linebuf);
extern float fa[3]; // Acc 0:X, 1:Y, 2:Z
extern float fg[3]; // Gyro 0:X, 1:Y, 2:Z
@@ -49,20 +47,6 @@
//-------------------------------------------------------------------------------------------------
// Control Program
//-------------------------------------------------------------------------------------------------
-#if 0
-// Put \r\n
-extern void put_rn ( void );
-// Put \r
-extern void put_r ( void );
-// Put ", "
-extern void put_lin ( void );
-// Put space n
-extern void put_spc( uint8_t n);
-// Change string -> integer
-//int xatoi (char **str, unsigned long *res){
-extern int xatoi (char **str, int32_t *res);
-
-#else
// Put \r\n
static void put_rn ( void ){
Thread::yield(); // change thread
@@ -77,20 +61,6 @@
PUTC('\r');
}
-// Put ", "
-static void put_lin ( void ){
- Thread::yield(); // change thread
- PRINTF(", ");
-}
-
-// Put space n
-static void put_spc( uint8_t n){
- for(;n > 0; n--){
- PUTC(' ');
- Thread::yield(); // change thread
- }
-}
-
// Change string -> integer
//int xatoi (char **str, unsigned long *res){
static int xatoi (char **str, int32_t *res){
@@ -137,7 +107,6 @@
*res = val;
return 1;
}
-#endif
//-------------------------------------------------------------------------------------------------
// Monitor
@@ -153,13 +122,6 @@
PRINTF("q - Return to main"); put_rn();
}
-#if 0
-extern void get_line (char *buff, int len);
-
-// RTC related subroutines
-extern void chk_and_set_time(char *ptr);
-
-#else
// Get key input data
static void get_line (char *buff, int len){
char c;
@@ -222,7 +184,6 @@
strftime(buf, 40, "%B %d,'%y, %H:%M:%S", localtime(&seconds));
PRINTF("Date: %s\r\n", buf);
}
-#endif
// ---------- Program starts here! ---------------------------------------------------------------
int mon(void) {