Microchip® Advanced Software Framework

nav_automatic.h File Reference
#include "fs_com.h"
#include "fat.h"
#include "navigation.h"
#include "play_list.h"

Data Structures

union  Navauto_mov_bitfield_status
 
struct  Navauto_mov_state
 Structure to store the status from function navauto_mov() More...
 

Macros

Definition of the directory limitations of the file list
#define NAVAUTO_MODE_DISKS   0
 
#define NAVAUTO_MODE_DISK   1
 
#define NAVAUTO_MODE_DIRONLY   2
 
#define NAVAUTO_MODE_DIRSUB   3
 
#define NAVAUTO_MODE_NB   4
 
Definition of the random states
#define NAVAUTO_RAND_OFF   0
 
#define NAVAUTO_RAND_ON   1
 
Status list of function navauto_mov()
#define NAVAUTO_MOV_OK   0
 
#define NAVAUTO_MOV_OK_LOOP   1
 
#define NAVAUTO_MOV_EMPTY   2
 
#define NAVAUTO_MOV_DISKNOPRESENT   3
 
#define NAVAUTO_MOV_DISKERROR   4
 

Typedefs

typedef uint8_t Navauto_mode
 Structure to store the directory limitation of the file list. More...
 
typedef uint8_t Navauto_rand
 Structure to store the random state. More...
 

Enumerations

enum  navauto_mov_options_t {
  NAVAUTO_MOV_OPTS_NONE = 0,
  NAVAUTO_MOV_OPTS_STAY_CURRENT_DIR = 1
}
 

Functions

uint16_t navauto_close (void)
 This function closes the file list. More...
 
Navauto_mode navauto_getmode (void)
 This function returns the directory limitation of the file list. More...
 
uint16_t navauto_getnb (void)
 This function returns the file list size. More...
 
uint16_t navauto_getpos (void)
 This function returns the current position in the file list. More...
 
Navauto_rand navauto_getrand (void)
 This function returns the random state used. More...
 
void navauto_init (const FS_STRING sz_filterext)
 This function initializes the file extension filter used to create the file list. More...
 
Navauto_mov_state navauto_mov (bool b_direction, navauto_mov_options_t options)
 This function jumps to the next or previous file in file list. More...
 
bool navauto_open (bool b_playlist, uint16_t pos)
 This function opens a file list at the current position in navigator. More...
 
bool navauto_setmode (Navauto_mode exp_mode)
 This function sets the directory limitation of the file list. More...
 
bool navauto_setpos (uint16_t u16_pos)
 This function selects a new position in file list. More...
 
void navauto_setrand (Navauto_rand rand)
 This function changes the random state. More...
 

#define NAVAUTO_MODE_DIRONLY   2
#define NAVAUTO_MODE_DIRSUB   3
#define NAVAUTO_MODE_DISK   1
#define NAVAUTO_MODE_DISKS   0
#define NAVAUTO_MODE_NB   4
#define NAVAUTO_MOV_DISKERROR   4

Referenced by navauto_mov_playlist().

#define NAVAUTO_MOV_DISKNOPRESENT   3
#define NAVAUTO_MOV_EMPTY   2
#define NAVAUTO_RAND_OFF   0

Referenced by navauto_open().

#define NAVAUTO_RAND_ON   1

typedef uint8_t Navauto_mode

Structure to store the directory limitation of the file list.

typedef uint8_t Navauto_rand

Structure to store the random state.

Enumerator
NAVAUTO_MOV_OPTS_NONE 
NAVAUTO_MOV_OPTS_STAY_CURRENT_DIR 

uint16_t navauto_close ( void  )

This function closes the file list.

@return    If a play list file is open then it is the last position in the file list
           else it is the directory level corresponding at the last selected file
//! At the end of this routine, the selected file of current navigator is :
//! - the play list file (in case of a play list file has been opened)
//! - the last selected file (in other case)
//! 

References g_navauto_b_playlist, g_navauto_u16_dir_level, g_navauto_u16_pos, and pl_main_close().

Navauto_mode navauto_getmode ( void  )

This function returns the directory limitation of the file list.

@return Used navigation mode  (NAVAUTO_MODE_DISKS, NAVAUTO_MODE_DIRONLY, NAVAUTO_MODE_DIRSUB)
//! This parameter is ignored then a play list file is selected
//! 

References g_navauto_exp_mode.

uint16_t navauto_getnb ( void  )

This function returns the file list size.

References g_navauto_u16_nb.

uint16_t navauto_getpos ( void  )

This function returns the current position in the file list.

References g_navauto_u16_pos.

Navauto_rand navauto_getrand ( void  )

This function returns the random state used.

Returns
random used

References g_navauto_rand.

Referenced by navauto_open(), and navauto_setpos().

void navauto_init ( const FS_STRING  sz_filterext)

This function initializes the file extension filter used to create the file list.

@param sz_filterext    file extension filter
//! This parameter is ignored then a play list file is selected
//! 

References g_navauto_filter, g_navauto_u16_dir_level_root, and g_navauto_u16_nb.

Navauto_mov_state navauto_mov ( bool  b_direction,
navauto_mov_options_t  options 
)

This function jumps to the next or previous file in file list.

@param b_direction  jump direction (FS_FIND_NEXT or FS_FIND_PREV)
@param options  jump direction (FS_FIND_NEXT or FS_FIND_PREV)

@return    the status of the action
//! When the random is ON, the direction is ignored
//! 

References g_navauto_b_playlist, navauto_mov_explorer(), and navauto_mov_playlist().

Referenced by navauto_open(), and navauto_setpos().

bool navauto_open ( bool  b_playlist,
uint16_t  pos 
)

This function opens a file list at the current position in navigator.

Parameters
b_playlistif true then the current selected file is a play list file to open else create a file list with files included in a disk part
posIf b_playlist true, then position in the play list to start else folder level of the current position
Returns
false, in case of error or file list empty

References FS_FIND_NEXT, FS_FIND_PREV, g_navauto_b_playlist, g_navauto_filter, g_navauto_u16_dir_level, g_navauto_u16_dir_level_root, g_navauto_u16_nb, g_navauto_u16_pos, index, nav_dir_gotoparent(), nav_file_checkext(), nav_filelist_reset(), nav_filelist_set(), nav_filelist_validpos(), nav_getindex(), nav_gotoindex(), navauto_getrand(), navauto_mov(), navauto_mov_explorer(), navauto_mov_explorer_reset(), NAVAUTO_MOV_OK, NAVAUTO_MOV_OK_LOOP, NAVAUTO_MOV_OPTS_NONE, navauto_rand_init(), NAVAUTO_RAND_OFF, navauto_setrand(), pl_main_open(), pl_nav_getnbfile(), pl_nav_setpos(), state, status, Navauto_mov_state::status, Fs_index::u16_entry_pos_sel_file, Fs_index::u32_cluster_sel_dir, and Fs_index::u8_lun.

Referenced by navauto_setmode().

bool navauto_setmode ( Navauto_mode  exp_mode)

This function sets the directory limitation of the file list.

@param exp_mode    mode to select (NAVAUTO_MODE_DISKS, NAVAUTO_MODE_DIRONLY, NAVAUTO_MODE_DIRSUB)

@return true, mode changed
@return false, mode can't be changed (note: the selected file must be close)
//! This parameter is ignored then a play list file is selected
//! When the mode change, the folder level is reseted at the current position.
//! 

References g_navauto_b_playlist, g_navauto_exp_mode, and navauto_open().

bool navauto_setpos ( uint16_t  u16_pos)

This function selects a new position in file list.

Parameters
u16_posnew position to select
Returns
false in case of error

References FS_FIND_NEXT, FS_FIND_PREV, g_navauto_u16_pos, navauto_getrand(), navauto_mov(), NAVAUTO_MOV_OK, NAVAUTO_MOV_OPTS_NONE, navauto_setrand(), state, and Navauto_mov_state::status.

void navauto_setrand ( Navauto_rand  rand)

This function changes the random state.

Parameters
randrandom mode to use

References g_navauto_rand, g_navauto_rand_tab, g_navauto_u16_pos, and navauto_rand_init().

Referenced by navauto_open(), and navauto_setpos().