]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Rename route_frame to route_incoming_frame
authorFred Sundvik <fsundvik@gmail.com>
Sun, 14 Feb 2016 19:34:40 +0000 (21:34 +0200)
committerFred Sundvik <fsundvik@gmail.com>
Sun, 14 Feb 2016 19:34:40 +0000 (21:34 +0200)
serial_link/protocol/frame_router.h
serial_link/protocol/frame_validator.c
serial_link/tests/frame_validator_tests.c

index b5beba13c3f692f235614d3342c7ff87204b44d4..dd1bfb12302dcbb78d726901abab8ea05eb0d689 100644 (file)
@@ -22,4 +22,4 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
-void route_frame(uint8_t* data, uint16_t size);
+void route_incoming_frame(uint8_t* data, uint16_t size);
index 0ffcda0473a18c24420377fad6344b68af843e3f..0a5f05068eb739bc5648ea2a55b829483dc28e7d 100644 (file)
@@ -107,7 +107,7 @@ void validator_recv_frame(uint8_t* data, uint16_t size) {
         uint32_t frame_crc = *(uint32_t*)(data + size - 4);
         uint32_t expected_crc = crc32_byte(data, size - 4);
         if (frame_crc == expected_crc) {
-            route_frame(data, size-4);
+            route_incoming_frame(data, size-4);
         }
     }
 }
index 3938f3eacac4b6b22a30235d63c73dc33fcbac0e..6f9b746f697c7a5dc0cdadfdaf9ca6234811ed7c 100644 (file)
@@ -26,7 +26,7 @@ SOFTWARE.
 #include <cgreen/mocks.h>
 #include "protocol/frame_validator.c"
 
-void route_frame(uint8_t* data, uint16_t size) {
+void route_incoming_frame(uint8_t* data, uint16_t size) {
     mock(data, size);
 }
 
@@ -39,7 +39,7 @@ BeforeEach(FrameValidator) {}
 AfterEach(FrameValidator) {}
 
 Ensure(FrameValidator, doesnt_validate_frames_under_5_bytes) {
-    never_expect(route_frame);
+    never_expect(route_incoming_frame);
     uint8_t data[] = {1, 2};
     validator_recv_frame(0, 1);
     validator_recv_frame(data, 2);
@@ -49,7 +49,7 @@ Ensure(FrameValidator, doesnt_validate_frames_under_5_bytes) {
 
 Ensure(FrameValidator, validates_one_byte_frame_with_correct_crc) {
     uint8_t data[] = {0x44, 0x04, 0x6A, 0xB3, 0xA3};
-    expect(route_frame,
+    expect(route_incoming_frame,
         when(size, is_equal_to(1)),
         when(data, is_equal_to_contents_of(data, 1))
     );
@@ -58,13 +58,13 @@ Ensure(FrameValidator, validates_one_byte_frame_with_correct_crc) {
 
 Ensure(FrameValidator, does_not_validate_one_byte_frame_with_incorrect_crc) {
     uint8_t data[] = {0x44, 0, 0, 0, 0};
-    never_expect(route_frame);
+    never_expect(route_incoming_frame);
     validator_recv_frame(data, 5);
 }
 
 Ensure(FrameValidator, validates_four_byte_frame_with_correct_crc) {
     uint8_t data[] = {0x44, 0x10, 0xFF, 0x00, 0x74, 0x4E, 0x30, 0xBA};
-    expect(route_frame,
+    expect(route_incoming_frame,
         when(size, is_equal_to(4)),
         when(data, is_equal_to_contents_of(data, 4))
     );
@@ -73,7 +73,7 @@ Ensure(FrameValidator, validates_four_byte_frame_with_correct_crc) {
 
 Ensure(FrameValidator, validates_five_byte_frame_with_correct_crc) {
     uint8_t data[] = {1, 2, 3, 4, 5, 0xF4, 0x99, 0x0B, 0x47};
-    expect(route_frame,
+    expect(route_incoming_frame,
         when(size, is_equal_to(5)),
         when(data, is_equal_to_contents_of(data, 5))
     );