![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sampleProgram
Dependencies: QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo
Fork of 17robo_fuzi by
bit_test.h@0:bf96e953cdb8, 2017-06-26 (annotated)
- Committer:
- echo_piyo
- Date:
- Mon Jun 26 09:59:14 2017 +0000
- Revision:
- 0:bf96e953cdb8
????????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
echo_piyo | 0:bf96e953cdb8 | 1 | /* |
echo_piyo | 0:bf96e953cdb8 | 2 | int bit_test(int data, int bit_number); |
echo_piyo | 0:bf96e953cdb8 | 3 | データのビットが1なら1を返す |
echo_piyo | 0:bf96e953cdb8 | 4 | */ |
echo_piyo | 0:bf96e953cdb8 | 5 | |
echo_piyo | 0:bf96e953cdb8 | 6 | int bit_test(int data_byte, int bit_number) { |
echo_piyo | 0:bf96e953cdb8 | 7 | data_byte = data_byte >> bit_number; |
echo_piyo | 0:bf96e953cdb8 | 8 | data_byte = data_byte & 0b00000001; |
echo_piyo | 0:bf96e953cdb8 | 9 | return data_byte; |
echo_piyo | 0:bf96e953cdb8 | 10 | } |