CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Porting C-Code from GCC Compiler to CCS help

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

Porting C-Code from GCC Compiler to CCS help
PostPosted: Tue Aug 25, 2015 6:56 pm     Reply with quote

HI,

I found a serial protocol C-code example from Circuit Cellar example and I wanted to try to port the code to run on the CCS C-compiler. The software is Arduino compatible.

The start of errors are in 2 structures. I do not know how to handle.

Both structures have a callback function (described in comments) below.

The error occurs at this point. The error is -> Unknown Type
Code:

void (*cback)(uint8_t, uint8_t, uint8_t); // callback function

void (*func)(uint8_t);                // callback for new stable state

Is there a way to handle this in CCS C-Compiler?

Thanks for any help.

Jerry


Code:

struct vtimer {                           // one per timer
  uint16_t rtics;                         // remaining clock tics
  uint16_t otics;                         // original tic count (for repeating events)
  struct vtimer *next;                    // next in list
  void (*cback)(uint8_t, uint8_t, uint8_t); // callback function
  uint8_t tid;                            // timer ID (1 - 127)
  uint8_t tstats;                         // timer status
  uint8_t remain;                         // timeouts remaining
  uint8_t uident;                         // user identification
};

struct dbounce {
  volatile uint8_t *input;              // which PIN the switch is on
  uint8_t pmask;                        // which bit (0 - 7) as a mask
  uint8_t nread;                        // number of consecutive reads that make it stable
  uint8_t trans;                        // which transitions we care about
  void (*func)(uint8_t);                // callback for new stable state

  uint8_t swstat;                       // switch status (callback pending, stable)
  uint8_t rcount;                       // number of consecutive reads we've done
  uint8_t last_rd;                      // last value read
  uint8_t last_ok;                      // last stable value
};

PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 25, 2015 9:10 pm     Reply with quote

I added this include file and it compiled with no errors or warnings:
Code:
#include <stdint.h>

This is with CCS vs. 5.048.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group