Initial HW PWM (Delta-Sigma) (#609)
This commit is contained in:
parent
10f361c8ca
commit
4dc7d825bc
6 changed files with 238 additions and 11 deletions
36
extras/dsm/dsm.h
Normal file
36
extras/dsm/dsm.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* Implementation of Delta-Sigma modulator support.
|
||||
*
|
||||
* Part of esp-open-rtos
|
||||
* Copyright (C) 2018 ourairquality (https://github.com/ourairquality)
|
||||
* Copyright (C) 2018 Zaltora (https://github.com/Zaltora)
|
||||
* BSD Licensed as described in the file LICENSE
|
||||
*/
|
||||
#ifndef EXTRAS_DSM_H_
|
||||
#define EXTRAS_DSM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_DSM_PINS (8)
|
||||
#define DSM_DEBUG (0)
|
||||
|
||||
/*
|
||||
* Freq = (80,000,000/prescale) * (target / 256) HZ (0 < target < 128)
|
||||
* Freq = (80,000,000/prescale) * ((256 - target) / 256) HZ (128 < target < 256)
|
||||
*/
|
||||
|
||||
void dsm_init(uint8_t npins, const uint8_t* pins);
|
||||
void dsm_set_prescale(uint8_t prescale);
|
||||
void dsm_set_target(uint8_t target);
|
||||
|
||||
void dsm_start();
|
||||
void dsm_stop();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* EXTRAS_DSM_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue