MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / handle_command

Function handle_command

FluxEngine.cydsn/main.c:820–876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

818}
819
820static void handle_command(void)
821{
822 static uint8_t input_buffer[FRAME_SIZE];
823 (void) usb_read(FLUXENGINE_CMD_OUT_EP_NUM, input_buffer);
824
825 struct any_frame* f = (struct any_frame*) input_buffer;
826 print("command 0x%02x", f->f.type);
827 switch (f->f.type)
828 {
829 case F_FRAME_GET_VERSION_CMD:
830 cmd_get_version(f);
831 break;
832
833 case F_FRAME_SEEK_CMD:
834 cmd_seek((struct seek_frame*) f);
835 break;
836
837 case F_FRAME_MEASURE_SPEED_CMD:
838 cmd_measure_speed((struct measurespeed_frame*) f);
839 break;
840
841 case F_FRAME_BULK_WRITE_TEST_CMD:
842 cmd_bulk_write_test(f);
843 break;
844
845 case F_FRAME_BULK_READ_TEST_CMD:
846 cmd_bulk_read_test(f);
847 break;
848
849 case F_FRAME_READ_CMD:
850 cmd_read((struct read_frame*) f);
851 break;
852
853 case F_FRAME_WRITE_CMD:
854 cmd_write((struct write_frame*) f);
855 break;
856
857 case F_FRAME_ERASE_CMD:
858 cmd_erase((struct erase_frame*) f);
859 break;
860
861 case F_FRAME_RECALIBRATE_CMD:
862 cmd_recalibrate();
863 break;
864
865 case F_FRAME_SET_DRIVE_CMD:
866 cmd_set_drive((struct set_drive_frame*) f);
867 break;
868
869 case F_FRAME_MEASURE_VOLTAGES_CMD:
870 cmd_measure_voltages();
871 break;
872
873 default:
874 send_error(F_ERROR_BAD_COMMAND);
875 }
876}
877

Callers 1

mainFunction · 0.85

Calls 14

usb_readFunction · 0.85
printFunction · 0.85
cmd_get_versionFunction · 0.85
cmd_seekFunction · 0.85
cmd_measure_speedFunction · 0.85
cmd_bulk_write_testFunction · 0.85
cmd_bulk_read_testFunction · 0.85
cmd_readFunction · 0.85
cmd_writeFunction · 0.85
cmd_eraseFunction · 0.85
cmd_recalibrateFunction · 0.85
cmd_set_driveFunction · 0.85

Tested by

no test coverage detected