Close

Update: cleaned up USART code

A project log for Alarm Clock with Remote USB Interface

A device I designed to fuse 74-series logic with an ATmega328PB microcontroller

zachary-murtishiZachary Murtishi 12/12/2024 at 01:100 Comments

Bytes:

0x41 - Query current time. Returns 4 bytes representing current seconds, minutes, hours, and days
0x42 - Set current time. Send 3 bytes afterward containing minutes, hours, and seconds. It will always zero out seconds. Each byte must be sent within 10 ms of the last one to avoid a timeout. ERROR will be sent if the time is invalid. DONE will be sent if the time is valid.
0x43 - Will return "TEST", followed by a newline and carriage return.
0x44 - Will enable the alarm. If the alarm is already enabled, ERROR will be sent.
0x45 - Will disable the alarm. If the alarm is already disabled, ERROR will be sent.

0x46 - Set current alarm time. Send 2 bytes afterward containing minutes and hours. Each byte must be sent within 10 ms of the last one to avoid a timeout. ERROR will be sent if the received time is invalid. DONE will be sent if the time is valid.

0x47- Snooze the alarm if it is active. If the alarm is inactive, ERROR will be sent. If it is active, the alarm will be snoozed and DONE will be returned.

0x48- Stop the alarm if it is active. If the alarm is inactive, ERROR will be sent. If it is active, the alarm will be stopped  and DONE will be returned.

0x49- Dim all lights on the clock if the lights are not dimmed. If the lights are already dimmed, ERROR will be returned. Otherwise, DONE will be returned and all lights will be dimmed.

0x5- Turn on active lights on the clock if the lights are dimmed. If the lights are already on, ERROR will be returned. Otherwise, DONE will be returned and all active lights will be turned on.


Discussions