50 lines
1.4 KiB
C
50 lines
1.4 KiB
C
/*
|
|
* Stairs lighting
|
|
* Copyright 2017 (c) Mark van Renswoude
|
|
*
|
|
* https://git.x2software.net/pub/Stairs
|
|
*/
|
|
#ifndef __config
|
|
#define __config
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
// Baud rate for the RS485 communication
|
|
// At 16 Mhz we pick a baud rate with a very acceptable 0.2% error rate
|
|
// Source: http://www.robotroom.com/Asynchronous-Serial-Communication-2.html
|
|
const uint32_t CommBaudRate = 76800;
|
|
|
|
// Arduino pin number connected to the MAX485's Receiver and Driver Output Enable pins
|
|
const uint8_t CommWriteEnablePin = 2;
|
|
|
|
// How long since the last packet before the communication icon shows
|
|
// as 'off'. Note that if a module is not configured for sensors and
|
|
// the light doesn't change either there will be no communication,
|
|
// so no need to panic immediately.
|
|
const uint32_t CommIdleTimeout = 1000;
|
|
|
|
|
|
// How long the display should stay on once it's idle and showing the
|
|
// current step numbers.
|
|
const uint32_t DisplayIdleTimeout = 5000;
|
|
|
|
|
|
// I2C address of the PCA9685 PWM driver
|
|
const uint8_t PWMDriverAddress = 0x40;
|
|
|
|
// Frequency of the PCA9685 PWM driver
|
|
const uint16_t PWMDriverFrequency = 1600;
|
|
|
|
|
|
// Arduino analog pin number connected to the sensors
|
|
const uint8_t PinSensor1 = 1;
|
|
const uint8_t PinSensor2 = 2;
|
|
|
|
// Arduino digital pin number connected to the push button.
|
|
const uint8_t PinButton = 8;
|
|
|
|
// Debounce time for the push button. Since it is not used for fast operations, this can be relatively high.
|
|
const uint32_t ButtonDebounceTime = 500;
|
|
|
|
#endif |