infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 2 of 2

Thread: Spektrum Satteliten Auslesen

  1. #1
    New Member New Member Widnio is on a distinguished road
    Join Date
    Jul 2016
    Posts
    1
    Points
    15

    Spektrum Satteliten Auslesen

    Hallo,

    der Code von Infineon der den Satelliten ausliest ist sehr Statisch ...

    ich habe die Funktion RemoteControl_RX_ISR im Ordner "_Quad .../RCReceive" etwas adaptiert:
    void RemoteControl_RX_ISR(){
    int throttleRaw;
    int rudderRaw;
    int elevatorRaw;
    int aileronRaw;
    int AUX1Raw;
    int AUX2Raw;
    int start = 0; //Index of start byte (contains 0x30)
    int i = 0; //Index of start byte (contains 0x30)
    int j; // For index
    uint8_t ReadBufRC[32]; //Readbuffer
    uint8_t channels[32];
    int values[6];
    uint8_t WriteBufRC[32];

    for(j = 0; j < 32; j++){
    channels[j] = 254;
    }

    //Read data from UART buffer
    UART_ReadDataBytes(&RemoteControl_Handle, ReadBufRC, 32);



    //Search for start byte
    while (ReadBufRC[start] != 0x00 && ReadBufRC[start + 1] != 0xa2) //0x12 oder 0xa2 oder 0xb2 je nach verwendeter Funke!
    {
    start++;
    if (start > 16)
    {
    //Communication check bytes not in buffer
    return;
    }
    }

    //search for channel ID
    i = start + 2;
    while(i < 32){
    if(ReadBufRC[i] != 0x00 && ReadBufRC[i] != 0xa2){ //0x12 oder 0xa2 oder 0xb2 je nach verwendeter Funke!
    channels[i] = ((ReadBufRC[i] & 0x78) >> 3);
    }
    i = i + 2;
    }

    //write RAW values to Array
    for(j = 0; j < 32; j++){
    if (channels[j] != 254){
    values[channels[j]] = mergeBytes(ReadBufRC[j], ReadBufRC[j + 1]) & 0x07FF;
    }
    }



    //remap raw values to control values */
    PWMDuty = (uint32_t) map(values[0], 340, 1955, 0, 10000);



    PWM_CCU4_SetDutyCycle(&LED_PWM, PWMDuty);

    g_joystick_values.throttle = map(values[0], 0, 2048, 903, 2097);
    g_joystick_values.aileron = map(values[1], 0, 2048, 903, 2097);
    g_joystick_values.elevator = map(values[2], 0, 2048, 903, 2097);
    g_joystick_values.rudder = map(values[3], 0, 2048, 903, 2097);
    g_joystick_values.AUX1 = map(values[4], 0, 2048, 903, 2097);
    g_joystick_values.AUX2 = map(values[5], 0, 2048, 903, 2097);
    //Set values for RC Timeout check
    RCTimeOut = 0;
    connected = 1;
    RCCount++;
    }
    Last edited by Widnio; Oct 6th, 2016 at 10:16 AM.

  2. #2
    Beginner Beginner PhilippGuehring is on a distinguished road
    Join Date
    May 2016
    Posts
    16
    Points
    78.75
    Kannst du das auf GitHub als Pull-Request einreichen?

+ Reply to Thread
Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.