Shop OBEX P1 Docs P2 Docs Learn Events
Mixing languages C + Spin + pasm - Page 2 — Parallax Forums

Mixing languages C + Spin + pasm

2»

Comments

  • Yeah, I fully understand. Error messages are always hard to get right for C because the location where the error is detected is often far away from the actual cause. If you forget to include an important definition then the compiler has no chance to guess what you mean.

    I try to completely avoid macros when programming on a "real computer" in C++. However that's hardly possible when programming in ANSI C on the "bare metal".

    What is a "pull request"? (english is not my native language, neither is C)
  • RaymanRayman Posts: 13,805
    That's a Git thing... I just started using GitHub. Haven't done a pull request yet myself. But, I think it lets you upload an edited file into the repository.
  • Ah, OK, found it here (step #8). I use GIT a lot but have never used GITHUB.
  • As a native English speaker, "pull request" is incorrect grammar. "Suggest change", or "submit change" would be a better description.

    Github doesn't care and won't change despite this poor choice of words limiting contributions, per their email response.
  • RaymanRayman Posts: 13,805
    I have to agree with you there... Took me a while to figure out the lingo...
  • A friend came up with a totally different and interesting idea. Theoretically it should be possible to configure an IDE like Code::Blocks or Eclipse to use fastspin as compiler. They are fully configurable and offer anything you can think of. Setting up the correct command line arguments also requires learning some scripting language for which I don't have the time and patience right now. But if I find somebody who is already familiar with it I'll give it a try.
  • whicker wrote: »
    As a native English speaker, "pull request" is incorrect grammar. "Suggest change", or "submit change" would be a better description.

    Github doesn't care and won't change despite this poor choice of words limiting contributions, per their email response.

    "Pull request" is perfectly correct grammar. It is a request to "git pull" a branch from a forked repository (and then potentially merge that branch's commits into some other branch). (GitHub's built-in pull request feature kindof obscures this, but when using standalone git servers, asking someone with write access to the upstream repo to pull your stuff constitutes a "pull request")
  • Wuerfel_21 wrote: »
    whicker wrote: »
    As a native English speaker, "pull request" is incorrect grammar. "Suggest change", or "submit change" would be a better description.

    Github doesn't care and won't change despite this poor choice of words limiting contributions, per their email response.

    "Pull request" is perfectly correct grammar. It is a request to "git pull" a branch from a forked repository (and then potentially merge that branch's commits into some other branch). (GitHub's built-in pull request feature kindof obscures this, but when using standalone git servers, asking someone with write access to the upstream repo to pull your stuff constitutes a "pull request")

    Nonsense.
    Pull means cancel in this usage.
  • whicker wrote: »
    Wuerfel_21 wrote: »
    whicker wrote: »
    As a native English speaker, "pull request" is incorrect grammar. "Suggest change", or "submit change" would be a better description.

    Github doesn't care and won't change despite this poor choice of words limiting contributions, per their email response.

    "Pull request" is perfectly correct grammar. It is a request to "git pull" a branch from a forked repository (and then potentially merge that branch's commits into some other branch). (GitHub's built-in pull request feature kindof obscures this, but when using standalone git servers, asking someone with write access to the upstream repo to pull your stuff constitutes a "pull request")

    Nonsense.
    Pull means cancel in this usage.

    Er, nope.
    https://stackoverflow.com/questions/292357/what-is-the-difference-between-git-pull-and-git-fetch
  • I meant, how would a normal person interpret the phrase "pull request"?

    {transitive verb} {direct object}
  • well you request somebody upstream to pull your changes from downstream into his upstream repo.

    makes sense to me.

    Mike
  • whicker wrote: »
    I meant, how would a normal person interpret the phrase "pull request"?

    {transitive verb} {direct object}

    I know I'm not a normal person, as there is no such thing, but I actually had to think for a while as to how you arrived at 'cancelling' for pull, especially in the context of git.

    If by a 'normal person', you mean a person with average native understanding of the English language, then probably by the most common meaning for pull. e.g. from Dictionary.com
    - 'to draw or haul toward oneself or itself, in a particular direction, or into a particular position'
    rather than a much less common meaning for pull e.g. tenth in the list from Dictionary.com
    - 'to withdraw or remove'
    Definition of Pull

    If it helps you come to terms with the actual meaning then simply mark it up as jargon and move on.
  • Caution! Big evil trap: operator precedence is different in C and Spin! (no bug, I just got cought by my own carelessness)
    DAT ' adc calibration state machine table
    adc_states	
      long	%00_11<<15 + %000000 ' swap channels, switch U1 to GIO
      long	%00_11<<15 + %001100 ' sample U0, average U1 GIO
      long	%01_11<<15 + %010000 ' switch U1 to VIO, calib GIO
      long	%01_11<<15 + %001100 ' sample U0, average U1 VIO
      long	%11_11<<15 + %110000 ' switch U1 to In, calib VIO
      long	%11_00<<15 + %000010 ' swap channels, switch U0 to GIO
      long	%11_00<<15 + %001010 ' sample U1, average U0 GIO
      long	%11_01<<15 + %010010 ' switch U0 to VIO, calib GIO
      long	%11_01<<15 + %001010 ' sample U1, average U0 VIO
      long	%11_11<<15 + %110011 ' switch U0 to In, calib VIO, rewind
    
    ... Spin translates to C...
    uint32_t adc_states[] = {
      (0b00_11<<15) + 0b000000, // swap channels, switch U1 to GIO
      (0b00_11<<15) + 0b001100, // sample U0, average U1 GIO
      (0b01_11<<15) + 0b010000, // switch U1 to VIO, calib GIO
      (0b01_11<<15) + 0b001100, // sample U0, average U1 VIO
      (0b11_11<<15) + 0b110000, // switch U1 to In, calib VIO
      (0b11_00<<15) + 0b000010, // swap channels, switch U0 to GIO
      (0b11_00<<15) + 0b001010, // sample U1, average U0 GIO
      (0b11_01<<15) + 0b010010, // switch U0 to VIO, calib GIO
      (0b11_01<<15) + 0b001010, // sample U1, average U0 VIO
      (0b11_11<<15) + 0b110011};// switch U0 to In, calib VIO, rewind
    
    The parantheses are important. Otherwise the compiler does 0b00_11<<(15 + 0b000000) which is luckily the same for the first case but not for the others. Took me several hours to debug. You don't look at code that you think has already worked before...
  • Yeah, the operator precedence in Spin has always bugged me. I never understood why it has something different than what every other language in existence (pretty much) uses.
Sign In or Register to comment.