add example and fix makefile
This commit is contained in:
parent
a0a0cbf2da
commit
a02af3f279
5 changed files with 87 additions and 14 deletions
|
|
@ -1,9 +1,9 @@
|
|||
# Component makefile for private/dsm
|
||||
# Component makefile for extras/dsm
|
||||
|
||||
INC_DIRS += $(ROOT)private/dsm
|
||||
INC_DIRS += $(ROOT)extras/dsm
|
||||
|
||||
# args for passing into compile rule generation
|
||||
private/dsm_INC_DIR = $(ROOT)private/dsm
|
||||
private/dsm_SRC_DIR = $(ROOT)private/dsm
|
||||
extras/dsm_INC_DIR = $(ROOT)extras/dsm
|
||||
extras/dsm_SRC_DIR = $(ROOT)extras/dsm
|
||||
|
||||
$(eval $(call component_compile_rules,private/dsm))
|
||||
$(eval $(call component_compile_rules,extras/dsm))
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include <esp8266.h>
|
||||
|
||||
|
||||
#ifdef DSM_DEBUG
|
||||
#if (DSM_DEBUG)
|
||||
#define debug(fmt, ...) printf("%s: " fmt "\n", "DSM", ## __VA_ARGS__)
|
||||
#else
|
||||
#define debug(fmt, ...)
|
||||
|
|
@ -57,8 +57,6 @@ void dsm_init(uint8_t npins, const uint8_t* pins)
|
|||
dsmInfo.running = 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_set_prescale(uint8_t prescale)
|
||||
{
|
||||
//TODO: Add a freq/prescale converter
|
||||
|
|
@ -66,8 +64,6 @@ void dsm_set_prescale(uint8_t prescale)
|
|||
debug("Set Prescale: %u",dsmInfo.preScale);
|
||||
}
|
||||
|
||||
// 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_set_target(uint8_t target)
|
||||
{
|
||||
dsmInfo.target = target;
|
||||
|
|
|
|||
|
|
@ -8,14 +8,20 @@
|
|||
#ifndef EXTRAS_DSM_H_
|
||||
#define EXTRAS_DSM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_DSM_PINS 8
|
||||
|
||||
#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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue