Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93744803
pwm.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 1, 03:41
Size
682 B
Mime Type
text/x-c
Expires
Tue, Dec 3, 03:41 (2 d)
Engine
blob
Format
Raw Data
Handle
22626871
Attached To
R6619 Oncilla Motordriver Firmware
pwm.h
View Options
/*
* File: pwm.h
* Author: tuleu
*
* Created on September 13, 2012, 2:24 PM
*/
#ifndef PWM_H
#define PWM_H
#include <p33Fxxxx.h>
enum pwm_device_t {
PWM_1_1,
PWM_1_2,
PWM_1_3,
PWM_2_1
};
typedef enum pwm_device_t pwm_device_t;
struct pwm_t {
volatile unsigned int * DC;
volatile unsigned int * TCON;
volatile unsigned int * CON1;
volatile unsigned int * TPER;
unsigned char pin;
};
typedef struct pwm_t pwm_t;
void pwm_init(pwm_t * pwm, pwm_device_t device);
#define pwm_set_cycle(pwm,value) \
do{ \
*(pwm.TPER) = value; \
}while(0)
#define pwm_set_value(pwm,value) \
do{ \
*(pwm.DC) = value; \
}while(0)
#endif /* PWM_H */
Event Timeline
Log In to Comment