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: mbed
Diff: pat9125_mbed/pat9125_mbed.cpp
- Revision:
- 15:089f1d28d152
- Parent:
- 5:61318505e528
--- a/pat9125_mbed/pat9125_mbed.cpp Fri Oct 20 01:48:20 2017 +0000
+++ b/pat9125_mbed/pat9125_mbed.cpp Fri Oct 20 10:58:39 2017 +0000
@@ -36,13 +36,29 @@
#define attachInterrupt(pin,b,c) //pin->enable_irq()
#define digitalPinToInterrupt(pin) pin
#define detachInterrupt(pin) //pin->disable_irq()
-#define LCM_DisplayString_Reset gp_state->pLCM->LCM_DisplayString_Reset
-#define LCM_DisplayDecimal(a,b,c,d) gp_state->pLCM->LCM_DisplayDecimal(a,b,c,d)
-#define LCM_DisplayString(a,b,c) gp_state->pLCM->LCM_DisplayString(a,b,c)
+//#define LCM_DisplayString_Reset gp_state->pLCM->LCM_DisplayString_Reset
+//#define LCM_DisplayDecimal(a,b,c,d) gp_state->pLCM->LCM_DisplayDecimal(a,b,c,d)
+//#define LCM_DisplayString(a,b,c) gp_state->pLCM->LCM_DisplayString(a,b,c)
#define I2C_RESET gp_state->p_i2c = gp_state->p_i2c->reset(); //workaround for nRF51 mbed
+static void LCM_DisplayString(unsigned char line, unsigned char position, const char *ptr)
+{
+ if(gp_state->pLCM == NULL) return ;
+ gp_state->pLCM->LCM_DisplayString(line, position, ptr);
+}
+static void LCM_DisplayDecimal(unsigned char line, unsigned char position, unsigned int hex_word, unsigned char digits)
+{
+ if(gp_state->pLCM == NULL) return ;
+ gp_state->pLCM->LCM_DisplayDecimal(line, position, hex_word, digits) ;
+}
+static void LCM_DisplayString_Reset(void)
+{
+ if(gp_state->pLCM == NULL) return ;
+ gp_state->pLCM->LCM_DisplayString_Reset();
+}
+
unsigned char xy2uart_enh=0;
//for OTS
@@ -284,22 +300,26 @@
void println()
{
+ if(gp_state->p_pc == NULL) return ;
gp_state->p_pc->printf("\n");
}
void println(String str)
{
+ if(gp_state->p_pc == NULL) return ;
const char * c = str.c_str();
gp_state->p_pc->printf(c);
gp_state->p_pc->printf("\n");
}
void print(String str)
{
+ if(gp_state->p_pc == NULL) return ;
const char * c = str.c_str();
gp_state->p_pc->printf(c);
}
void print(signed int value)
{
+ if(gp_state->p_pc == NULL) return ;
gp_state->p_pc->printf("%d",value);
}
@@ -325,6 +345,7 @@
void serialEvent()
{
+ if(gp_state->p_pc == NULL) return ;
while (gp_state->p_pc->readable())
{
// get the new byte:
@@ -576,10 +597,9 @@
}
pat9125_mbed::pat9125_mbed(pat9125_mbed_state_s *state)
{
- gp_state = state ;
- //gp_state->p_pc->printf("PAT9125 ADDR0 %x\n", OTS_Read_Reg(0));
+ gp_state = state ;
gp_state->sen_status = OTS_Sensor_Init();
- gp_state->p_pc->printf("OTS_Sensor_Init\n");
+ print("OTS_Sensor_Init\n");
gp_state->pINT->fall(&OTS_MotionPin_ISR); //interrupt at low state
}
PAT9125EL - Miniature Optical Navigation for Surface Tracking