controller_bb_8_driver/tests/test_joystick.c
void testJoystick( void )
{
    debug_stream_init();

    sdStart( &SD6, &sdcfg );
    palSetPadMode( GPIOG, 14, PAL_MODE_ALTERNATE(8) );   // TX
    palSetPadMode( GPIOG, 9,  PAL_MODE_ALTERNATE(8) );   // RX

    float buf[3] = {0, 0, 0};

    systime_t   time = chVTGetSystemTimeX( );
    while( true )
    {
        sdReadTimeout( &SD3, (uint8_t*) &buf, 12, TIME_IMMEDIATE );

        chprintf( (BaseSequentialStream *)&SD6, "x: %d\ty: %d\tw: %d\n\r",
                  (int32_t)(buf[0] * 100),
                  (int32_t)(buf[1] * 100),
                  (int32_t)(buf[2] * 100)
                  );

        time = chThdSleepUntilWindowed( time, time + MS2ST( 100 ) );
    }
}
/*
 * @brief   Simple joystick test (without control system)
 */
@brief   Simple joystick test (without control system)
@brief Simple joystick test ( without control system )
void testJoystick( void )
{
    debug_stream_init();
    sdStart( &SD6, &sdcfg );
    palSetPadMode( GPIOG, 14, PAL_MODE_ALTERNATE(8) );   
    palSetPadMode( GPIOG, 9,  PAL_MODE_ALTERNATE(8) );   
    float buf[3] = {0, 0, 0};
    systime_t   time = chVTGetSystemTimeX( );
    while( true )
    {
        sdReadTimeout( &SD3, (uint8_t*) &buf, 12, TIME_IMMEDIATE );
        chprintf( (BaseSequentialStream *)&SD6, "x: %d\ty: %d\tw: %d\n\r",
                  (int32_t)(buf[0] * 100),
                  (int32_t)(buf[1] * 100),
                  (int32_t)(buf[2] * 100)
                  );
        time = chThdSleepUntilWindowed( time, time + MS2ST( 100 ) );
    }
}
void testJoystick ( void ) { debug_stream_init ( ) ; sdStart ( & SD6 , & sdcfg ) ; palSetPadMode ( GPIOG , 14 , PAL_MODE_ALTERNATE ( 8 ) ) ; palSetPadMode ( GPIOG , 9 , PAL_MODE_ALTERNATE ( 8 ) ) ; float buf [ 3 ] = { 0 , 0 , 0 } ; systime_t time = chVTGetSystemTimeX ( ) ; while ( true ) { sdReadTimeout ( & SD3 , ( uint8_t * ) & buf , 12 , TIME_IMMEDIATE ) ; chprintf ( ( BaseSequentialStream * ) & SD6 , " \t \t \n \r " , ( int32_t ) ( buf [ 0 ] * 100 ) , ( int32_t ) ( buf [ 1 ] * 100 ) , ( int32_t ) ( buf [ 2 ] * 100 ) ) ; time = chThdSleepUntilWindowed ( time , time + MS2ST ( 100 ) ) ; } }
@brief   Simple joystick test (without control system)
@brief Simple joystick test ( without control system )
// TX // RX