~toykeeper/flashlight-firmware/fsm

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/fsm-ramping.h

merged recent anduril2 branch updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
// auto-detect the data type for PWM tables
50
50
#ifndef PWM_BITS
51
 
#define PWM_BITS 8
52
 
#define PWM_TOP 255
 
51
    #define PWM_BITS 8
 
52
    #define PWM_TOP 255
53
53
#endif
54
54
#if PWM_BITS <= 8
55
 
#define PWM_DATATYPE uint8_t
56
 
#define PWM_DATATYPE2 uint16_t
57
 
#define PWM_TOP 255
58
 
#define PWM_GET(x,y) pgm_read_byte(x+y)
 
55
    #define PWM_DATATYPE uint8_t
 
56
    #define PWM_DATATYPE2 uint16_t
 
57
    #define PWM_TOP 255
 
58
    #define PWM_GET(x,y) pgm_read_byte(x+y)
59
59
#else
60
 
#define PWM_DATATYPE uint16_t
61
 
#ifndef PWM_DATATYPE2
62
 
#define PWM_DATATYPE2 uint32_t
63
 
#endif
64
 
#ifndef PWM_TOP
65
 
#define PWM_TOP 1023  // 10 bits by default
66
 
#endif
67
 
// pointer plus 2*y bytes
68
 
//#define PWM_GET(x,y) pgm_read_word(x+(2*y))
69
 
// nope, the compiler was already doing the math correctly
70
 
#define PWM_GET(x,y) pgm_read_word(x+y)
 
60
    #define PWM_DATATYPE uint16_t
 
61
    #ifndef PWM_DATATYPE2
 
62
        #define PWM_DATATYPE2 uint32_t
 
63
    #endif
 
64
    #ifndef PWM_TOP
 
65
        #define PWM_TOP 1023  // 10 bits by default
 
66
    #endif
 
67
    // pointer plus 2*y bytes
 
68
    //#define PWM_GET(x,y) pgm_read_word(x+(2*y))
 
69
    // nope, the compiler was already doing the math correctly
 
70
    #define PWM_GET(x,y) pgm_read_word(x+y)
71
71
#endif
72
72
 
73
73
// use UI-defined ramp tables if they exist