OpenChargeMicro/Software/src/openChargeMicro.h

83 lines
1.2 KiB
C
Raw Normal View History

2018-11-25 22:04:09 +01:00
2018-11-28 15:16:59 +01:00
//#define DEBUG
2018-11-25 22:04:09 +01:00
2018-11-21 23:45:26 +01:00
/* system header */
2018-11-21 23:17:31 +01:00
#include <avr/io.h>
#include <string.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <stdlib.h>
2018-11-22 11:50:11 +01:00
2018-11-21 23:45:26 +01:00
/* project header */
2018-11-24 14:55:51 +01:00
#include "ws2812/ws2812.h"
2018-11-21 23:17:31 +01:00
#include "ioController.h"
#include "multiplexer.h"
2018-11-25 16:58:13 +01:00
2018-11-22 11:50:11 +01:00
#include "clock.h"
2018-11-25 16:58:13 +01:00
#include "gui.h"
2018-11-22 22:40:46 +01:00
#include "charger.h"
2018-11-25 16:58:13 +01:00
2018-11-21 23:45:26 +01:00
/* Pins */
2018-11-21 23:17:31 +01:00
#define WS2812B PD2
#define ACTIVELED PB5
#define PROBE15V PC1
#define PROBE5V PC2
#define Z PC0
#define VTX PB3
#define VRX PB2
#define BUZZER PB1
#define POWERON PB0
#define S2 PD7
#define S1 PD6
#define S0 PD5
2018-11-25 22:04:09 +01:00
#ifdef DEBUG
2018-11-21 23:45:26 +01:00
/* Serial */
2018-11-21 23:17:31 +01:00
#define BUAD 9600
#define BUAD_RATE_CALC ((F_CPU/16/BUAD) - 1)
2018-11-25 22:04:09 +01:00
2018-11-21 23:17:31 +01:00
void serialSetup(void);
void serialSend(const char* sendString);
2018-11-25 22:04:09 +01:00
#endif
2018-11-22 20:43:21 +01:00
/* Charger Config */
#define CHARGER_SIZE 4
2018-11-26 21:42:12 +01:00
#define CONNECTION_TIMEOUT 3
2018-11-22 20:43:21 +01:00
// Charger 0
#define CH0_NR 0
#define CH0_U 0
#define CH0_I 4
// Charger 1
#define CH1_NR 1
#define CH1_U 1
#define CH1_I 5
// Charger 2
#define CH2_NR 2
#define CH2_U 2
#define CH2_I 6
// Charger 3
#define CH3_NR 3
#define CH3_U 3
#define CH3_I 7
2018-11-24 14:55:51 +01:00
/* ws2812 */
#define LED_C 1
2018-11-28 15:16:59 +01:00
#define BRIGHTNESS 255 //0 to 255
2018-11-22 20:43:21 +01:00
2018-11-25 16:58:13 +01:00
void updateChargers();
2018-11-25 22:04:09 +01:00
void updateGUI();
void checkForBattery();
2018-11-25 16:58:13 +01:00