APM:Libraries
AP_Common.cpp
Go to the documentation of this file.
1 //
2 // Unit tests for the AP_Common code
3 //
4 
5 #include <AP_Common/AP_Common.h>
6 #include <AP_HAL/AP_HAL.h>
7 
8 void setup();
9 void loop();
10 void test_high_low_byte(void);
11 
13 
15 {
16 
17  // test each value from 0 to 300
18  for (uint16_t i = 0; i <= 300; i++) {
19  uint8_t high = HIGHBYTE(i);
20  uint8_t low = LOWBYTE(i);
21  hal.console->printf("\ni:%u high:%u low:%u", (unsigned int)i, (unsigned int)high, (unsigned int)low);
22  }
23 
24  // test values from 300 to 65400 at increments of 200
25  for (uint16_t i = 301; i <= 65400; i += 200) {
26  uint8_t high = HIGHBYTE(i);
27  uint8_t low = LOWBYTE(i);
28  hal.console->printf("\ni:%u high:%u low:%u", (unsigned int)i, (unsigned int)high, (unsigned int)low);
29  }
30 }
31 
32 /*
33  * euler angle tests
34  */
35 void setup(void)
36 {
37  hal.console->printf("AP_Common tests\n\n");
38 
40 }
41 
42 void loop(void)
43 {
44  // do nothing
45 }
46 
47 AP_HAL_MAIN();
AP_HAL::UARTDriver * console
Definition: HAL.h:110
void test_high_low_byte(void)
Definition: AP_Common.cpp:14
#define HIGHBYTE(i)
Definition: AP_Common.h:72
AP_HAL_MAIN()
virtual void printf(const char *,...) FMT_PRINTF(2
Definition: BetterStream.cpp:5
const AP_HAL::HAL & hal
Definition: AC_PID_test.cpp:14
void setup()
Definition: AP_Common.cpp:35
const HAL & get_HAL()
#define LOWBYTE(i)
Definition: AP_Common.h:71
Common definitions and utility routines for the ArduPilot libraries.
void loop()
Definition: AP_Common.cpp:42