Files
BRNSystemsandClaude Opus 5.5 04297ed019 Finish the OOK remote sender, fix F+EXIT
OOK sender for 433 MHz remotes: PT2262, EV1527, rc-switch protocols 1-7,
Intertechno self-learning and raw Manchester. The carrier is keyed with the
PA enable line through a new fast BK4819 GPIO write (~25 us instead of
~300 us), and every edge is scheduled on an absolute SysTick clock.

F+EXIT never opened the OOK sender: APP_ProcessKey cancels the F state for
EXIT before the screen handler runs. Open it there instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:13:24 +01:00

52 lines
1.7 KiB
C

//
// Created by bruno on 3/30/25.
//
// OOK (on/off keyed carrier) sender for 433 MHz style remotes: the carrier is
// keyed with the PA enable line, pulse edges are timed against SysTick.
//
#ifndef BRNQUANFW_OOKSENDER_H
#define BRNQUANFW_OOKSENDER_H
#include <stdbool.h>
#include <stdint.h>
#include "../driver/keyboard.h"
typedef enum OOKSENDERSCREENSTATE {
OOKSENDER_PROTO_CHOOSE = 0,
OOKSENDER_DATA_INPUT,
OOKSENDER_SENDING
} OOKSENDERSCREENSTATE;
typedef enum OOKSENDERPROTO {
OOKSENDER_PROTO_PT2262 = 0, // tri-state code, 12 trits (0 / 1 / F)
OOKSENDER_PROTO_EV1527, // 20 bit ID + 4 bit key
OOKSENDER_PROTO_RCSWITCH, // rc-switch protocols 1..7, decimal code
OOKSENDER_PROTO_INTERTECHNO, // Intertechno / KlikAanKlikUit self learning
OOKSENDER_PROTO_MANCHESTER, // raw Manchester bits
OOKSENDER_PROTO_END,
} OOKSENDERPROTO;
// Editable fields, meaning per protocol (labels: OOKSENDER_FieldLabel)
enum {
OOK_FIELD_CODE = 0, // code / ID / trits (PT2262: 2 bits per trit)
OOK_FIELD_ARG, // bits / key / unit / trit count
OOK_FIELD_EXTRA, // rc-switch protocol, Intertechno on/off
OOK_FIELD_PULSE, // base pulse length in us
OOK_FIELD_REPEAT, // number of code repetitions
OOK_FIELD_COUNT
};
extern uint8_t gOOKSenderState;
extern uint8_t gOOKSenderProtocol;
extern uint8_t gOOKSenderField;
extern uint32_t gOOKSenderValue[OOK_FIELD_COUNT];
// NULL when the field is not used by the protocol
const char *OOKSENDER_FieldLabel(uint8_t protocol, uint8_t field);
void OOKSENDER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
void OOKSENDER_TimeSlice500ms(void);
#endif //BRNQUANFW_OOKSENDER_H