


// Reset Code 50µs at 0=> 55µs.
// 55/0.4	
#define LED_RESET_DELAY ((uint32_t)(55.0f/0.4f))

// Mesuré sur LedTube 1 pour avoir au moins 4.5V sur toutes les led d'entrée de ligne
#define POWER_LIMIT 110


// TIM2,6,7 running APB1 @90Mhz
// 55us = 1/90e6*X
// X = 55e-6*90e6 = 90*55=4950
// 0.4us --> 36;
#define TIM6FREQ 90
#define WAIT55US (TIM6FREQ*55)
#define WAIT0DOT4US ((uint16_t)(TIM6FREQ*0.4f))
#define NB_DMA_WRITES ((uint32_t)((NB_LEDS_PER_STRIP*8*3*3)+LED_RESET_DELAY))


void initLedResetCodeInMemoryForDMA2(uint16_t *portbmem, uint16_t *portcmem);
void formatMemoryForDMA2(uint8_t *raw, uint16_t *portbmem, uint16_t *portcmem, uint8_t integer_offset);
void dmaLedDrive2(uint16_t *portbmem, uint16_t *portcmem);
void dmaPostLedDrive(void);
void dmaWait(void);
void dmaUrgentStop(void);

//void initLedResetCodeInMemoryForDMA(uint16_t *portbmem, uint8_t *portcmem);
//void formatMemoryForDMA(uint8_t *raw, uint16_t *portbmem, uint8_t *portcmem, uint8_t integer_offset);
//void manualLedDrive(uint16_t *portbmem, uint8_t *portcmem);
//void dmaLedDrive(uint16_t *portbmem, uint8_t *portcmem);
