180622 HJM : 10 Count sensing data RF send

Dependencies:   1_cubebite_ev-cog-ad3029lz_433MHz_1nd_certTest stm-spirit1-rf-driver_for_cubebite2

Committer:
jmhong
Date:
Wed Mar 21 05:06:15 2018 +0000
Revision:
0:c2a57b2f934e
Child:
1:04f46755f8af
Test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmhong 0:c2a57b2f934e 1 #pragma once
jmhong 0:c2a57b2f934e 2
jmhong 0:c2a57b2f934e 3 #ifndef __MBED_H__
jmhong 0:c2a57b2f934e 4 #define __MBED_H__
jmhong 0:c2a57b2f934e 5 #include "mbed.h"
jmhong 0:c2a57b2f934e 6 #endif //__MBED_H__
jmhong 0:c2a57b2f934e 7
jmhong 0:c2a57b2f934e 8 #ifndef __SIMPLESPIRIT1_H__
jmhong 0:c2a57b2f934e 9 #define __SIMPLESPIRIT1_H__
jmhong 0:c2a57b2f934e 10 #include "SimpleSpirit1.h"
jmhong 0:c2a57b2f934e 11 #endif //__SIMPLESPIRIT1_H__
jmhong 0:c2a57b2f934e 12
jmhong 0:c2a57b2f934e 13
jmhong 0:c2a57b2f934e 14
jmhong 0:c2a57b2f934e 15
jmhong 0:c2a57b2f934e 16
jmhong 0:c2a57b2f934e 17
jmhong 0:c2a57b2f934e 18 //*************************************************************************************
jmhong 0:c2a57b2f934e 19 //Global variable : LEDs and user buttons by board
jmhong 0:c2a57b2f934e 20 //*************************************************************************************
jmhong 0:c2a57b2f934e 21 #ifdef CUBEBITE_BOARD_F401RE
jmhong 0:c2a57b2f934e 22 static DigitalOut TestLED(D5); /* LED of IDS01A4/5 */
jmhong 0:c2a57b2f934e 23 #endif
jmhong 0:c2a57b2f934e 24
jmhong 0:c2a57b2f934e 25 #ifdef CUBEBITE_BOARD_F746ZG
jmhong 0:c2a57b2f934e 26 static DigitalOut TestLED(PB_0); /* LED of IDS01A4/5 */
jmhong 0:c2a57b2f934e 27 static DigitalOut TestLED2(PB_7); /* LED of IDS01A4/5 */
jmhong 0:c2a57b2f934e 28 static DigitalOut TestLED3(PB_14); /* LED of IDS01A4/5 */
jmhong 0:c2a57b2f934e 29 #endif
jmhong 0:c2a57b2f934e 30
jmhong 0:c2a57b2f934e 31 #ifdef CUBEBITE_RF_USER_BUTTON_SEND_TEST
jmhong 0:c2a57b2f934e 32 static InterruptIn event(USER_BUTTON); /* Interrupt event to give userinterface to send pkt. */
jmhong 0:c2a57b2f934e 33 #endif
jmhong 0:c2a57b2f934e 34 //*************************************************************************************
jmhong 0:c2a57b2f934e 35
jmhong 0:c2a57b2f934e 36
jmhong 0:c2a57b2f934e 37
jmhong 0:c2a57b2f934e 38
jmhong 0:c2a57b2f934e 39
jmhong 0:c2a57b2f934e 40 //*************************************************************************************
jmhong 0:c2a57b2f934e 41 //Global variable : Rf Send, read Buffer
jmhong 0:c2a57b2f934e 42 //*************************************************************************************
jmhong 0:c2a57b2f934e 43 /* 180108 cubebite HJM : send testing, orignal code */
jmhong 0:c2a57b2f934e 44 #define TEST_STR_LEN (32)
jmhong 0:c2a57b2f934e 45 static uint8_t uiSendBuf[TEST_STR_LEN] ={'S','P','I','R','I','T','1',' ','H','E','L','L','O',' ','W','O','R','L','D',' ','P','2','P',' ','D','E','M','O'};
jmhong 0:c2a57b2f934e 46 static uint8_t uiRendBuf[TEST_STR_LEN] ={'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
jmhong 0:c2a57b2f934e 47 //*************************************************************************************
jmhong 0:c2a57b2f934e 48
jmhong 0:c2a57b2f934e 49
jmhong 0:c2a57b2f934e 50
jmhong 0:c2a57b2f934e 51 //*************************************************************************************
jmhong 0:c2a57b2f934e 52 //Global variable : tx, rx Flag
jmhong 0:c2a57b2f934e 53 //*************************************************************************************
jmhong 0:c2a57b2f934e 54 static volatile bool bRxDoneFlag = false;
jmhong 0:c2a57b2f934e 55 static volatile bool bTxDoneFlag = false;
jmhong 0:c2a57b2f934e 56 static volatile bool bSendDataFlag = false;
jmhong 0:c2a57b2f934e 57 //*************************************************************************************
jmhong 0:c2a57b2f934e 58
jmhong 0:c2a57b2f934e 59
jmhong 0:c2a57b2f934e 60
jmhong 0:c2a57b2f934e 61
jmhong 0:c2a57b2f934e 62 //*************************************************************************************
jmhong 0:c2a57b2f934e 63 //Global variable : Testing
jmhong 0:c2a57b2f934e 64 //*************************************************************************************
jmhong 0:c2a57b2f934e 65
jmhong 0:c2a57b2f934e 66 /* Test : RF Speed Test */
jmhong 0:c2a57b2f934e 67 #ifdef CUBEBITE_RF_SPEED_TEST_SEND_ON
jmhong 0:c2a57b2f934e 68 static clock_t clocktimeRFSpeedTestStart, clocktimeRFSpeedTestEnd;
jmhong 0:c2a57b2f934e 69 static float fRfSpeedTestResultTime;
jmhong 0:c2a57b2f934e 70
jmhong 0:c2a57b2f934e 71 static bool bIsSendFirstClockFunctionStarted = false;
jmhong 0:c2a57b2f934e 72 static bool bIsSetSendFlag = false;
jmhong 0:c2a57b2f934e 73 #endif
jmhong 0:c2a57b2f934e 74
jmhong 0:c2a57b2f934e 75
jmhong 0:c2a57b2f934e 76 #ifdef CUBEBITE_RF_SPEED_TEST_RECV_ON
jmhong 0:c2a57b2f934e 77 #define TEST_ACK_STR_LEN (6)
jmhong 0:c2a57b2f934e 78 static uint8_t uiSendAckBuf[TEST_ACK_STR_LEN] ={'O','K'};
jmhong 0:c2a57b2f934e 79 size_t sizetCurrAckBufLen = strlen((const char*)uiSendAckBuf) + 1;
jmhong 0:c2a57b2f934e 80
jmhong 0:c2a57b2f934e 81 static bool bIsAckSended = false;
jmhong 0:c2a57b2f934e 82 #endif
jmhong 0:c2a57b2f934e 83 //*************************************************************************************
jmhong 0:c2a57b2f934e 84
jmhong 0:c2a57b2f934e 85
jmhong 0:c2a57b2f934e 86
jmhong 0:c2a57b2f934e 87
jmhong 0:c2a57b2f934e 88
jmhong 0:c2a57b2f934e 89
jmhong 0:c2a57b2f934e 90
jmhong 0:c2a57b2f934e 91
jmhong 0:c2a57b2f934e 92
jmhong 0:c2a57b2f934e 93
jmhong 0:c2a57b2f934e 94
jmhong 0:c2a57b2f934e 95
jmhong 0:c2a57b2f934e 96
jmhong 0:c2a57b2f934e 97
jmhong 0:c2a57b2f934e 98