|
|
#define | SUBSCRIBE_TOPIC "/speakerReq" |
| | topic that the speaker controller subscribe to
|
| |
|
#define | PUBLISH_TOPIC "/speakerRes" |
| | topic that the speaker controller will publish replies to
|
| |
|
#define | SPKR_PWR_PIN 14 |
| | pins for controlling the power source to the speaker, probably controlling through a relay instead of directly to the speaker
|
| |
|
#define | SPKR_PWR_ON_STATE 1 |
| | the state of the power control pin if the speaker is powered on
|
| |
|
#define | SPKR_INC_PIN 5 |
| | pins that interact witht the INC pin of the digital pot, negative edge on this pin will move the digital pot wiper
|
| |
|
#define | SPKR_DIR_PIN 4 |
| | pins that controls the DIR pin of the digital pot, used for controlling whether the negative edge on the INC pin result in increase or decrease in resistance
|
| |
|
#define | SPKR_SELECT_PIN 12 |
| | pin that controls the CS line of the digital pot, the digital pot will only changes its resistance if the CS pin is active
|
| |
|
#define | VOLUME_UP_LIMIT 100 |
| | Max possible volume set by the user.
|
| |
|
#define | VOLUME_DOWN_LIMIT 0 |
| | Min possible volume set by the user.
|
| |
|
#define | SPKR_VOLUME_DELAY_MS 1 |
| | delay between toggling the INC pin to make sure the edge is registered by the digital pot
|
| |
|
#define | SPKR_INC_ACTIVATED_STATE 0 |
| | the state that the INC pin is activated, the pin triggers on negative edge so its activated state is low
|
| |
|
#define | SPKR_PIN_UP_STATE 1 |
| | the state of the pin that controls the DIR pin of the digital pot when the pot is in moving up resistance mode
|
| |
|
#define | SPKR_SELECT_ACTIVATED 0 |
| | the state of the pin that controls the CS pin of the digital pot when the pot is activated
|
| |
|
#define | SPKR_VOL_LEVEL_INPUT_PIN 0 |
| | pins for sensing analog voltage of the physical pot
|
| |
|
#define | SPKR_VOL_LEVEL_INPUT_THRESHOLD 15 |
| | minimum change in adc voltage before it's considered that the user moved the pot
|
| |
|
#define | SPKR_VOL_LEVEL_MAX_COUNT 1024 |
| | max value returned by the adc read function of mongoose
|
| |
|
#define | SPKR_PWR_INPUT_PIN 13 |
| | pins for sensing user turning on/off the speaker using the physical pot
|
| |
|
#define | SPKR_PWR_INPUT_OFF_STATE 1 |
| | the state the the input pin will be at if it's off, since it's pulled up so the off state will be one
|
| |
| #define | REGISTER_INTERRUPT() |
| | dummy function, interrupts are registered in the handler constructor for this device More...
|
| |
|
#define | TOTAL_HANDLER 1 |
| | device only needs to handle speaker type interface
|
| |
|
#define | SPKR_HANDLER_INDEX 0 |
| | index of the pointer to the speaker handler
|
| |
| #define | INITIALIZE_HANDLER() |
| | initialize list of handler More...
|
| |
|
| void | handlePolling (struct mg_connection *mgCon, ParentHandler *handlerList[], char *jsonBuf) |
| | poll the voltage on the potentiometer and change the volume if there is a change in voltage More...
|
| |
| static void | SpeakerCtrlHandler::pwrInputIntHandler (int pin, void *arg) |
| | handler function for when the user turn on/off the physical pot on the speaker This function will either turn on/off the speaker based on the user interaction with the physical potentiometer More...
|
| |
|
| SpeakerCtrlHandler::SpeakerCtrlHandler (void) |
| | Construct a new Speaker Ctrl Handler:: Speaker Ctrl Handler object create a new spekaer handler, intialize the namespace argument, prepare analog, and interrupt pins, set speaker to mute.
|
| |
| HandlerError | SpeakerCtrlHandler::handleRequest (struct mg_connection *mgCon, struct mg_str *message, char *commandName, char *response) |
| | function to handle request passed by aws mqtt Depending on the reques type, the handler will either mute the device, adjust volume or set new volume entirely More...
|
| |
| HandlerError | SpeakerCtrlHandler::handleReport (char *stateReport) |
| | handle preparing report for the speaker handler used when the handler needs to respond to the , will report whether the speaker is muted and what the volume is More...
|
| |
|
void | SpeakerCtrlHandler::checkPotVoltage (void) |
| | called by the main polling function to check and update the pot voltage if necessary read the adc voltage and if the voltage changes over a certain threshold, which indicates that the user has moved the pot, then the volume will be adjusted accordingly
|
| |