|
STC15W408AS library 0.18.0
|
#include <bits.h>
Go to the source code of this file.
Macros | |
| #define | PCA_CPS0_BIT 1 |
| CMOD register CPS0 (counter pulse select) bit position. | |
| #define | PCA_CPS_MASK 0x0E |
| CMOD register CPS (counter pulse select) bits mask. | |
| #define | PCA_PWM_EBS0_BIT 6 |
| PCA_PWMn register EBS0 (PWM resolution select) bit position. | |
| #define | PCA_PWM_EBS_MASK 0xC0 |
| PCA_PWMn register EBS (PWM resolution select) bits mask. | |
| #define | PCA_CCP_S0_BIT 4 |
| P_SW1 register CCP_S0 (CCP pin group select) bit position. | |
| #define | PCA_CCP_S0_MSK 0x10 |
| P_SW1 register CCP_S0 (CCP pin group select) bit mask. | |
| #define | PCA_CCP_S1_MSK 0x20 |
| P_SW1 register CCP_S1 (CCP pin group select) bit mask. | |
| #define | PCA_CCP_SW_MASK (uint8_t)(PCA_CCP_S0_MSK | PCA_CCP_S1_MSK) |
| P_SW1 register CCP pin group select bits mask. | |
pin group | |
PCA pin mapping functions | |
| #define | pca_set_pin_group(group) |
| Set CCP/ECI pin group. | |
| #define | pca_get_pin_group() ((pca_pin_group_t)(bit_shift_right(get_reg(P_SW1, (PCA_CCP_S0_MSK | PCA_CCP_S1_MSK)), PCA_CCP_S0_BIT))) |
| Get CCP/ECI pin group. | |
counter | |
PCA counter functions | |
| #define | pca_set_clock_source(src) |
| Set PCA counter clock source. | |
| #define | pca_get_clock_source() ((pca_clock_source_t)(bit_shift_right(get_reg(CMOD, PCA_CPS_MASK), PCA_CPS0_BIT))) |
| Get PCA counter clock source. | |
| #define | pca_set_counter(value) |
| Set PCA counter value. | |
| #define | pca_get_counter() ((uint16_t)(bit_shift_left((uint16_t)CH, 8) | (uint16_t)CL)) |
| Get PCA counter value. | |
| #define | pca_start() (CR = 1) |
| Start PCA counter. | |
| #define | pca_stop() (CR = 0) |
| Stop PCA counter. | |
| #define | is_pca_running() (CR) |
| Get PCA counter run status. | |
| #define | pca_counter_run_in_idle() (bit_clr(CMOD,SBIT7)) |
| Let PCA counter run in MCU idle mode. | |
| #define | pca_counter_gate_off_in_idle() (bit_set(CMOD, SBIT7)) |
| Gate off PCA counter in MCU idle mode. | |
| #define | is_pca_counter_gated_off_in_idle() (test_if_bit_set(CMOD, SBIT7)) |
| Get PCA counter idle mode status. | |
overflow | |
PCA counter overflow flag and interrupt functions | |
| #define | pca_clear_overflow_flag() (CF = 0) |
| Clear PCA counter overflow flag. | |
| #define | is_pca_overflow() (CF) |
| Get PCA counter overflow flag status. | |
| #define | pca_enable_overflow_interrupt() (bit_set(CMOD, SBIT0)) |
| Enable PCA counter overflow interrupt. | |
| #define | pca_disable_overflow_interrupt() (bit_clr(CMOD, SBIT0)) |
| Disable PCA counter overflow interrupt. | |
| #define | is_pca_overflow_interrupt_enabled() (test_if_bit_set(CMOD, SBIT0)) |
| Get PCA counter overflow interrupt enable status. | |
module flags | |
PCA module compare/capture flag functions | |
| #define | pca_clear_module_flag(module) (CCF ## module = 0) |
| Clear PCA module compare/capture flag. | |
| #define | is_pca_module_flag_set(module) (CCF ## module) |
| Get PCA module compare/capture flag status. | |
| #define | pca_module_enable_interrupt(module) (bit_set(CCAPM ## module, SBIT0)) |
| Enable PCA module compare/capture interrupt. | |
| #define | pca_module_disable_interrupt(module) (bit_clr(CCAPM ## module, SBIT0)) |
| Disable PCA module compare/capture interrupt. | |
| #define | is_pca_module_interrupt_enabled(module) (test_if_bit_set(CCAPM ## module, SBIT0)) |
| Get PCA module compare/capture interrupt enable status. | |
compare/capture | |
PCA module compare and capture functions | |
| #define | pca_module_enable_comparator(module) (bit_set(CCAPM ## module, SBIT6)) |
| Enable PCA module comparator. | |
| #define | pca_module_disable_comparator(module) (bit_clr(CCAPM ## module, SBIT6)) |
| Disable PCA module comparator. | |
| #define | pca_module_enable_capture_positive(module) (bit_set(CCAPM ## module, SBIT5)) |
| Enable capture on positive edge. | |
| #define | pca_module_disable_capture_positive(module) (bit_clr(CCAPM ## module, SBIT5)) |
| Disable capture on positive edge. | |
| #define | pca_module_enable_capture_negative(module) (bit_set(CCAPM ## module, SBIT4)) |
| Enable capture on negative edge. | |
| #define | pca_module_disable_capture_negative(module) (bit_clr(CCAPM ## module, SBIT4)) |
| Disable capture on negative edge. | |
| #define | pca_module_enable_match(module) (bit_set(CCAPM ## module, SBIT3)) |
| Enable PCA module match. | |
| #define | pca_module_disable_match(module) (bit_clr(CCAPM ## module, SBIT3)) |
| Disable PCA module match. | |
| #define | pca_module_enable_toggle(module) (bit_set(CCAPM ## module, SBIT2)) |
| Enable PCA module toggle output. | |
| #define | pca_module_disable_toggle(module) (bit_clr(CCAPM ## module, SBIT2)) |
| Disable PCA module toggle output. | |
| #define | pca_module_set_compare(module, value) |
| Set PCA module compare/capture value. | |
| #define | pca_module_get_capture(module) ((uint16_t)(bit_shift_left((uint16_t)CCAP ## module ## H, 8) | (uint16_t)CCAP ## module ## L)) |
| Get PCA module capture value. | |
pwm | |
PCA module pulse width modulator functions | |
| #define | pca_module_pwm_init(module, resolution) |
| Init PCA module in PWM mode. | |
| #define | pca_module_pwm_disable(module) (bit_clr(CCAPM ## module, SBIT1)) |
| Disable PCA module PWM output. | |
| #define | is_pca_module_pwm_enabled(module) (test_if_bit_set(CCAPM ## module, SBIT1)) |
| Get PCA module PWM output enable status. | |
| #define | pca_module_pwm_set_duty(module, duty) |
| Set PCA module PWM duty. | |
| #define | pca_module_pwm_set_duty_on_overflow(module, duty) (CCAP ## module ## H = (uint8_t)(duty)) |
| Set PCA module PWM duty without immediate update. | |
Enumerations | |
| enum | pca_pin_group_t { PCA_PIN_GROUP_1 = 0 , PCA_PIN_GROUP_2 = 1 , PCA_PIN_GROUP_3 = 2 } |
| PCA pin group. More... | |
| enum | pca_clock_source_t { PCA_CLOCK_SYS_12 = 0 , PCA_CLOCK_SYS_2 = 1 , PCA_CLOCK_TIMER0 = 2 , PCA_CLOCK_ECI = 3 , PCA_CLOCK_SYS = 4 , PCA_CLOCK_SYS_4 = 5 , PCA_CLOCK_SYS_6 = 6 , PCA_CLOCK_SYS_8 = 7 } |
| PCA counter clock source. More... | |
| enum | pca_pwm_resolution_t { PCA_PWM_8BIT = 0 , PCA_PWM_7BIT = 1 , PCA_PWM_6BIT = 2 } |
| PCA module PWM output resolution. More... | |