NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
beeper.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <platform.h>
#include "build_config.h"
#include "common/pt.h"
#include "utype/cbuf.h"
#include "config/config.h"
#include "config/feature.h"
#include "../drivers/system.h"
#include "../sensors/battery.h"
#include "io/statusindicator.h"
#include "io/beeper.h"
Include dependency graph for beeper.c:

Data Structures

struct  morse_letter
 

Macros

#define MORSE_DOT_LENGTH   50
 
#define MORSE_DASH_LENGTH   (3 * MORSE_DOT_LENGTH)
 
#define MORSE_PART_PAUSE   (MORSE_DOT_LENGTH)
 
#define MORSE_LETTER_PAUSE   (3 * MORSE_DOT_LENGTH)
 
#define MORSE_WORD_PAUSE   (7 * MORSE_DOT_LENGTH)
 
#define BEEPER_COMMAND_REPEAT   0xFE
 
#define BEEPER_COMMAND_STOP   0xFF
 
#define BEEPER_COMMAND_REPEAT   0xFE
 
#define BEEPER_COMMAND_STOP   0xFF
 
#define BEEPER_ENTRY(a, b, c, d)   a,b,c
 
#define BEEPER_TABLE_ENTRY_COUNT   (sizeof(beeperTable) / sizeof(beeperTable[0]))
 

Enumerations

enum  { MEND, MDA, MDI }
 

Functions

void beeper_init (struct beeper *self, const struct system_calls *system)
 Initializes defaults for beeper function. More...
 
bool beeper_start (struct beeper *self, beeper_command_t mode)
 Puts beeper into a new beep state. More...
 
void beeper_write (struct beeper *self, const char *text)
 Write any text to the beeper (will be sent as morse) More...
 
void beeper_stop (struct beeper *self)
 Aborts current beeper function. More...
 
void beeper_update (struct beeper *self)
 Updates beeper state. More...
 

Macro Definition Documentation

#define BEEPER_COMMAND_REPEAT   0xFE
#define BEEPER_COMMAND_REPEAT   0xFE
#define BEEPER_COMMAND_STOP   0xFF
#define BEEPER_COMMAND_STOP   0xFF
#define BEEPER_ENTRY (   a,
  b,
  c,
 
)    a,b,c
#define BEEPER_TABLE_ENTRY_COUNT   (sizeof(beeperTable) / sizeof(beeperTable[0]))
#define MORSE_DASH_LENGTH   (3 * MORSE_DOT_LENGTH)
#define MORSE_DOT_LENGTH   50
#define MORSE_LETTER_PAUSE   (3 * MORSE_DOT_LENGTH)
#define MORSE_PART_PAUSE   (MORSE_DOT_LENGTH)
#define MORSE_WORD_PAUSE   (7 * MORSE_DOT_LENGTH)

Enumeration Type Documentation

anonymous enum
Enumerator
MEND 
MDA 
MDI 

Function Documentation

void beeper_init ( struct beeper self,
const struct system_calls system 
)

Initializes defaults for beeper function.

bool beeper_start ( struct beeper self,
beeper_command_t  mode 
)

Puts beeper into a new beep state.

void beeper_stop ( struct beeper self)

Aborts current beeper function.

void beeper_update ( struct beeper self)

Updates beeper state.

Beeper handler function to be called periodically in loop. Updates beeper state via time schedule.

void beeper_write ( struct beeper self,
const char *  text 
)

Write any text to the beeper (will be sent as morse)