11 static const unsigned char Accl = 0b00110010;
12 static const unsigned char GYRO = 0b11010110;
13 static const unsigned char Magn = 0b00111100;
14 static const unsigned char BARO = 0b11101110;
15 static const unsigned char Fuel = 0b01101100;
25 static int RandomAddress() {
31 static void setUp(
void) {
36 static void tearDown(
void) {
44 static void test_L3GD20Ping(
void) {
45 TEST_ASSERT_TRUE(sut.
Ping(GYRO));
48 static void test_PingNonExistentDevice(
void) {
49 TEST_ASSERT_FALSE(sut.
Ping(0x38));
52 static void test_L3GD20ReadWhoAmIRegister(
void) {
53 TEST_ASSERT_EQUAL_INT(0b11010100, sut.
Get(GYRO, 0b00001111));
56 static void test_L3GD20WriteCtrlReg1(
void) {
58 TEST_ASSERT_TRUE(sut.
Put(GYRO, 0x20, 0b01111111));
59 TEST_ASSERT_EQUAL_HEX8(0b01111111, sut.
Get(GYRO, 0x20));
61 TEST_ASSERT_TRUE(sut.
Put(GYRO, 0x20, 0xFF));
62 TEST_ASSERT_EQUAL_HEX8(0xFF, sut.
Get(GYRO, 0x20));
65 static void test_L3GD20WriteMultipleBytes(
void) {
68 unsigned char data_address = 0x32 | 0x80;
69 char indata1[] = {0x0F, 0xFA, 0x0E, 0x80, 0x01, 0x22};
70 char indata2[] = {0x0E, 0xF9, 0x0D, 0x7F, 0x00, 0x21};
72 char outdata[data_size];
75 TEST_ASSERT_TRUE(sut.
Put(GYRO, data_address, indata1, data_size));
76 sut.
Get(GYRO, data_address, outdata, data_size);
77 TEST_ASSERT_EQUAL_MEMORY(indata1, outdata, data_size);
80 TEST_ASSERT_TRUE(sut.
Put(GYRO, data_address, indata2, data_size));
81 sut.
Get(GYRO, data_address, outdata, data_size);
82 TEST_ASSERT_EQUAL_MEMORY(indata2, outdata, data_size);
86 static void test_L3GD20WriteMultipleBytesButOnlyOne(
void) {
90 unsigned char data_address = 0x32 | 0x80;
91 char indata1[] = {0x0F};
92 char indata2[] = {0x0E};
94 char outdata[data_size];
98 TEST_ASSERT_TRUE(sut.
Put(GYRO, data_address, indata1, data_size));
99 sut.
Get(GYRO, data_address, outdata, data_size);
100 TEST_ASSERT_EQUAL_MEMORY(indata1, outdata, data_size);
103 TEST_ASSERT_TRUE(sut.
Put(GYRO, data_address, indata2, data_size));
104 sut.
Get(GYRO, data_address, outdata, data_size);
105 TEST_ASSERT_EQUAL_MEMORY(indata2, outdata, data_size);
112 static void test_MS5611PutSingleByteGetMultipleBytes(
void) {
113 TEST_IGNORE_MESSAGE(
"Must confirm function with Logic16");
115 TEST_ASSERT_TRUE(sut.
Put(BARO, 0b10100110));
118 char indata1[data_size];
119 TEST_ASSERT_TRUE(sut.
Get(BARO, indata1, data_size));