uint8_t BillReqManufacturerID(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(BILL,0,MASTER,CCTALK_REQ_MANU_ID,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ cctalk.BillManufacturerID[0]=cctalk.BufferInput[9]; cctalk.BillManufacturerID[1]=cctalk.BufferInput[10]; cctalk.BillManufacturerID[2]=cctalk.BufferInput[11]; err=1; } CleanBufferInput(); return err; }
uint8_t BillReqBillTypeID(uint8_t id,uint8_t *string){ uint8_t err=0; uint16_t time=0; cctalk.FlagReceiveData=0; time=0; cctalk.BufferOutput[0]=id; SendDataccTalk(BILL,1,MASTER,CCTALK_REQ_BILL_ID,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ return 0; }else{ err=1; } string[0]=cctalk.BufferInput[9]; string[1]=cctalk.BufferInput[10]; string[2]=cctalk.BufferInput[11]; string[3]=cctalk.BufferInput[12]; string[4]=cctalk.BufferInput[13]; string[5]=cctalk.BufferInput[14]; string[6]=cctalk.BufferInput[15]; CleanBufferInput(); return err; }
uint8_t HopperDispenseCoin(uint8_t id,uint8_t numbercoins,uint8_t *serialnumber){ uint8_t err=0; uint16_t time=0; cctalk.BufferOutput[2]=serialnumber[0]; cctalk.BufferOutput[1]=serialnumber[1]; cctalk.BufferOutput[0]=serialnumber[2]; cctalk.BufferOutput[3]=numbercoins; SendDataccTalk(id,4,MASTER,CCTALK_DISP_HOPP_COIN,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<300){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=300){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t CoinAcceptorReqProductCode(void){ uint8_t err=0; uint16_t time=0; uint8_t size=0; SendDataccTalk(COIN_ACCEPTOR,0,MASTER,CCTALK_REQ_PROD_CODE,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ size=cctalk.BufferInput[6]; MoveStringtoString(cctalk.CoinProductCode,cctalk.BufferInput,0,9,size); err=1; } CleanBufferInput(); return err; }
uint8_t BillPoll(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(BILL,0,MASTER,CCTALK_SIMPLE_POLL,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t CoinAcceptorReqMasterInhibitStatus(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(COIN_ACCEPTOR,0,MASTER,CCTALK_REQ_MAST_INH_STA,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t BillModBillOperatingMode(uint8_t data){ uint8_t err=0; uint16_t time=0; cctalk.BufferOutput[0]=data; SendDataccTalk(BILL,1,MASTER,CCTALK_MOD_BILL_OPE_MO,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t DeviceResetSoftware(uint8_t id){ uint8_t err=0; uint16_t time=0; SendDataccTalk(id,0,MASTER,CCTALK_RESET_DEVICE,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t BillRouteBill(uint8_t data,uint8_t *response){ uint8_t err=0; uint16_t time=0; cctalk.BufferOutput[0]=data; SendDataccTalk(BILL,1,MASTER,CCTALK_ROUTE_BILL,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; *response = cctalk.BufferInput[9]; } CleanBufferInput(); return err; }
uint8_t BillModMasterInhibitStatus(uint8_t action){ uint8_t err=0; uint16_t time=0; cctalk.BufferOutput[0]=action; SendDataccTalk(BILL,1,MASTER,CCTALK_MOD_MAST_INH_STA,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t DeviceChangeAddress(uint8_t address_old, uint8_t address_new){ uint8_t err=0; uint16_t time=0; cctalk.BufferOutput[0]=address_new; SendDataccTalk(address_old,1,MASTER,CCTALK_ADDRESS_CHANGE,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t BillReadBufferedBillEvents(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(BILL,0,MASTER,CCTALK_BUF_BILL_EV,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ MoveStringtoString(cctalk.BillBufferEvents,cctalk.BufferInput,0,9,11); err=1; } CleanBufferInput(); return err; }
uint8_t CoinAcceptorReqOptionFlags(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(COIN_ACCEPTOR,0,MASTER,CCTALK_REQ_OPT_FLAGS,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ cctalk.CoinOptionFlags=cctalk.BufferInput[9]; err=1; } CleanBufferInput(); return err; }
uint8_t CoinAcceptorReadBufferedCreditErrorCodes(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(COIN_ACCEPTOR,0,MASTER,CCTALK_READ_BUFF_CRED,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ MoveStringtoString(cctalk.CoinBufferErrorCredit,cctalk.BufferInput,0,9,11); err=1; } CleanBufferInput(); return err; }
uint8_t HopperEnable(uint8_t id,uint8_t action){ uint8_t err=0; uint16_t time=0; cctalk.BufferOutput[0]=action; SendDataccTalk(id,1,MASTER,CCTALK_ENABLE_HOPP,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t CoinAcceptorReqSoftwareVersion(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(COIN_ACCEPTOR,0,MASTER,CCTALK_REQ_SOFT_VER,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ MoveStringtoString(cctalk.CoinSoftwareVersion,cctalk.BufferInput,0,9,14); err=1; } CleanBufferInput(); return err; }
uint8_t HopperReqTestHopper(uint8_t id,uint8_t *data){ uint8_t err=0; uint16_t time=0; SendDataccTalk(id,0,MASTER,CCTALK_TEST_HOPP,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; *data=cctalk.BufferInput[4]; } CleanBufferInput(); return err; }
uint8_t HopperReqProductCode(uint8_t id, uint8_t *string){ uint8_t err=0; uint16_t time=0; SendDataccTalk(id,0,MASTER,CCTALK_REQ_PROD_CODE,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; MoveStringtoString(string,cctalk.BufferInput,0,9,6); } CleanBufferInput(); return err; }
uint8_t CoinAcceptorModInhibitStatus(uint16_t typecoin){ uint8_t err=0; uint16_t time=0; cctalk.BufferOutput[0]=(uint8_t)(typecoin&0x00ff); cctalk.BufferOutput[1]=(uint8_t)(typecoin>>8); SendDataccTalk(COIN_ACCEPTOR,2,MASTER,CCTALK_MODIFY_INH_STA,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; } CleanBufferInput(); return err; }
uint8_t BillReqBarcode(uint8_t *string){ uint8_t err=0; uint16_t time=0; cctalk.FlagReceiveData=0; time=0; SendDataccTalk(BILL,0,MASTER,CCTALK_READ_BARC_DATA,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ return 0; }else{ err=1; } MoveStringtoString(string,cctalk.BufferInput,0,9,cctalk.BufferInput[6]); CleanBufferInput(); return err; }
uint8_t BillReqSerialNumber(void){ uint8_t err=0; uint16_t time=0; SendDataccTalk(BILL,0,MASTER,CCTALK_REQ_SERIAL_NUM,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ cctalk.BillSerialNumber[0]=cctalk.BufferInput[11]; cctalk.BillSerialNumber[1]=cctalk.BufferInput[10]; cctalk.BillSerialNumber[2]=cctalk.BufferInput[9]; err=1; } CleanBufferInput(); return err; }
uint8_t HopperReqStatus(uint8_t id,uint8_t *counter,uint8_t *coinspendent,uint8_t *coinspayout,uint8_t *coinsunpay){ uint8_t err=0; uint16_t time=0; SendDataccTalk(id,0,MASTER,CCTALK_REQ_HOPP_STATUS,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; *counter=cctalk.BufferInput[9]; *coinspendent = cctalk.BufferInput[10]; *coinspayout = cctalk.BufferInput[11]; *coinsunpay = cctalk.BufferInput[12]; } CleanBufferInput(); return err; }
uint8_t HopperReqSerialNumber(uint8_t id, uint8_t *string){ uint8_t err=0; uint16_t time=0; SendDataccTalk(id,0,MASTER,CCTALK_REQ_SERIAL_NUM,cctalk.BufferOutput); (void)FC_CCTALK_Reset(); while(!cctalk.FlagReceiveData && time<100){ (void)FC_CCTALK_GetTimeMS(&time); (void)WDOG_Clear(); } if(!cctalk.FlagReceiveData && time>=100){ err=0; }else{ err=1; string[0]=cctalk.BufferInput[11]; string[1]=cctalk.BufferInput[10]; string[2]=cctalk.BufferInput[9]; } CleanBufferInput(); return err; }
static portTASK_FUNCTION(TaskMain, pvParameters ) { byte i; #if PL_HAS_HW_LED byte cntr; #endif /* The parameters are not used. */ (void)pvParameters; #if PL_HAS_WATCHDOG WDOG_Clear(); #endif #if PL_HAS_HW_TOUCHSCREEN TouchScreen_CheckTouchScreenCalibrationData(); #endif BUZ_Init(); #if PL_HAS_UI APP_Init(); #endif #if PL_HAS_HW_LED cntr = 0; LED3_On(); LED4_Off(); #endif for(;;) { #if PL_HAS_HW_TOUCHSCREEN TCHS1_Scan(); #endif #if PL_POLL_KEYS2 KEY2_ScanKeys(); /* poll keys */ #endif i = 10; /* to avoid stalling */ while (EVNT1_EventsPending() && i>0) { EVNT1_HandleEvent(); i--; } #if PL_HAS_HW_LED cntr++; if (cntr == 10) { /* change LED's */ LED3_Neg(); LED4_Neg(); cntr = 0; } #endif #if PL_HAS_AUTO_DEMO #if PL_HAS_FONT_DEMO FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS); APP_SetApplicationMode(APP_MODE_FONT_DEMO); FRTOS1_vTaskDelay((10*1000)/portTICK_RATE_MS); #endif #if PL_HAS_ACCEL_DEMO APP_SetApplicationMode(APP_MODE_ACCEL_DEMO); FRTOS1_vTaskDelay((15*1000)/portTICK_RATE_MS); ACCEL_StopAccelDemo(); FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS); #endif #if 0 && PL_HAS_TETRIS_DEMO APP_SetApplicationMode(APP_MODE_TETRIS); FRTOS1_vTaskDelay((5*1000)/portTICK_RATE_MS); TETRIS_KillTask(); FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS); #endif #if PL_HAS_CUBE_DEMO APP_SetApplicationMode(APP_MODE_3D_CUBE); FRTOS1_vTaskDelay((8*1000)/portTICK_RATE_MS); CUBE_CloseShipWindow(); FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS); CUBE_CloseCubeWindow(); FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS); #endif //APP_SetApplicationMode(APP_MODE_MAIN_MENU); //FRTOS1_vTaskDelay((5*1000)/portTICK_RATE_MS); heapSize = FRTOS1_xPortGetFreeHeapSize(); #endif FRTOS1_vTaskDelay(50/portTICK_RATE_MS); } /* for */ }