12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #ifndef __TOOL_H__
- #define __TOOL_H__
- #include "SEGGER_RTT.h"
- #include "arm_math.h"
- /*
- (5)
- #pragma pack(push, 1)
- struct {
- signed int Sine1;
- signed int Sine2;
- signed int Sine3;
- } acValBuffer;
- #pragma pack(pop)
- 上面是你要发送的结构体,自己定义。
- (6)在你要发送的地方赋值并发送,例如中断:
- acValBuffer.Sine1 = Test_Counter1;
- acValBuffer.Sine2 = Test_Counter2;
- acValBuffer.Sine2 = Test_Counter3;
- SEGGER_RTT_Write(JS_RTT_Channel, &acValBuffer, sizeof(acValBuffer));
- (7)下面是重点!!!官方没有提到的。例如我想发四个数,两个int型,两个short型。
- #pragma pack(push, 1)
- struct {
- signed int Sine1;
- signed int Sine2;
- short Sine3;
- short Sine4;
- } acValBuffer;
- #pragma pack(pop)
- 那么对应的初始化要改为"JScope_I4I4I4"这个参数就要改成"JScope_I4I4I2I2“
- */
- #pragma pack(push, 1)
- typedef struct {
- signed int Sine1;
- signed int Sine2;
- signed int Sine3;
- signed int Sine4;
- signed int Sine5;
- signed int Sine6;
- }acValBuffer_t;
- #pragma pack(pop)
- #define CHECK_TIMECONSUMING_START uint32_t cnt1 = 0, cnt2 = 0; \
- static char string[100]; \
- cnt1 = NRF_RTC0->COUNTER
- #define CHECK_TIMECONSUMING_END cnt2 = NRF_RTC0->COUNTER; \
- sprintf(string,"=====>time consuming:%02f us\r\n",(cnt2-cnt1)/32.768 * 1000); \
- SEGGER_RTT_printf(0,"%s",string)
- void JS_RTT_Init(void);
- void JS_RTT_Print(signed int Sine1,signed int Sine2,signed int Sine3);
- void JS_RTT_Print_06(signed int Sine1,signed int Sine2,signed int Sine3,signed int Sine4,signed int Sine5,signed int Sine6);
- float32_t CoefficientVariation(double *p_array, uint32_t len);
- #endif
|